diff options
author | Pixel <pixel@nobis-crew.org> | 2011-10-03 14:48:05 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-10-03 14:48:05 -0700 |
commit | 342b273234405ab76dc159d2e402bfb1ddfa1d8f (patch) | |
tree | f10d6857960313d6fc3b0aaa325ed46b8ad481fb /src/Main.cc |
First commit - very basic features.
Diffstat (limited to 'src/Main.cc')
-rw-r--r-- | src/Main.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Main.cc b/src/Main.cc new file mode 100644 index 0000000..04d867f --- /dev/null +++ b/src/Main.cc @@ -0,0 +1,34 @@ +#include "Main.h" + +Balau::AtStart * Balau::AtStart::s_head = 0; +Balau::AtExit * Balau::AtExit::s_head = 0; + +Balau::AtStart::AtStart(int priority) : m_priority(priority) { + if (priority < 0) + return; + + AtStart ** ptr = &s_head; + + m_next = 0; + + for (ptr = &s_head; *ptr && (priority > (*ptr)->m_priority); ptr = &((*ptr)->m_next)); + + m_next = *ptr; + *ptr = this; +} + +Balau::AtExit::AtExit(int priority) : m_priority(priority) { + if (priority < 0) + return; + + AtExit ** ptr = &s_head; + + m_next = 0; + + for (ptr = &s_head; *ptr && (priority > (*ptr)->m_priority); ptr = &((*ptr)->m_next)); + + m_next = *ptr; + *ptr = this; +} + +Balau::Main * Balau::Main::application = NULL; |