00001
00050 #include <stdlib.h>
00051 #include <stdio.h>
00052 #include <errno.h>
00053 #include <math.h>
00054 #include "network.h"
00055
00056 #ifdef _DEBUG
00057 EXPORT int cmdargs(int argc, char *argv[])
00058 {
00059 int n=0;
00060 int i;
00061 for (i=0; i<argc; i++)
00062 {
00063 if (strncmp(argv[i],"--debug_node=",13)==0)
00064 {
00065 debug_node = atoi(argv[i]+13);
00066 n++;
00067 }
00068 else if (strncmp(argv[i],"--debug_link=",13)==0)
00069 {
00070 debug_link = atoi(argv[i]+13);
00071 n++;
00072 }
00073 }
00074 if (debug_node>0) gl_debug("network node debugging mode %d", debug_node);
00075 if (debug_link>0) gl_debug("network link debugging mode %d", debug_link);
00076 return n;
00077 }
00078 #endif // _DEBUG
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 EXPORT CLASS *init(CALLBACKS *fntable, MODULE *module, int argc, char *argv[])
00114 {
00115 #ifdef _DEBUG
00116 cmdargs(argc,argv);
00117 #endif // _DEBUG
00118
00119 if (set_callback(fntable)==NULL)
00120 {
00121 errno = EINVAL;
00122 return NULL;
00123 }
00124 CLASS *first = (new node(module))->oclass;
00125 new link(module);
00126 new capbank(module);
00127 new fuse(module);
00128 new relay(module);
00129 new regulator(module);
00130 new transformer(module);
00131 new meter(module);
00132 new generator(module);
00133
00134
00135 return first;
00136 }
00137
00138 CDECL int do_kill()
00139 {
00140
00141 return 0;
00142 }
00143
00144