00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __ONSTARTUP_H
00019 #define __ONSTARTUP_H
00020
00021 #include "defs.h"
00022
00023
00033 #define EXECUTE_ON_STARTUP(NAME, CODE) \
00034 static void __##NAME##_code() {CODE;} \
00035 static ExecuteOnStartup __##NAME##_reg(__##NAME##_code);
00036
00037
00038
00039
00040
00041
00042
00048 class ExecuteOnStartup
00049 {
00050 private:
00051 void (*code_to_exec)();
00052 ExecuteOnStartup *next;
00053 static ExecuteOnStartup *head;
00054 public:
00055 ExecuteOnStartup(void (*code_to_exec)());
00056 ~ExecuteOnStartup();
00057 void execute();
00058 static void executeAll();
00059 };
00060
00061 #endif
00062