cb22561995-10-11Fredrik Hübinette (Hubbe) /*\
06983f1996-09-22Fredrik Hübinette (Hubbe) ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License)
cb22561995-10-11Fredrik Hübinette (Hubbe) ||| See the files COPYING and DISCLAIMER for more information. \*/
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "global.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) #include "module.h" #include "macros.h" #include "error.h"
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "builtin_functions.h" #include "main.h" #include "svalue.h" #include "interpret.h" #include "stralloc.h" #include "object.h" #include "mapping.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) 
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "modules/modlist_headers.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) 
db3e131997-02-06Fredrik Hübinette (Hubbe) typedef void (*modfun)(void);
5267b71995-08-09Fredrik Hübinette (Hubbe) 
db3e131997-02-06Fredrik Hübinette (Hubbe) struct static_module
5267b71995-08-09Fredrik Hübinette (Hubbe) {
db3e131997-02-06Fredrik Hübinette (Hubbe)  char *name; modfun init; modfun exit; };
5267b71995-08-09Fredrik Hübinette (Hubbe) 
db3e131997-02-06Fredrik Hübinette (Hubbe) static struct static_module module_list[] = {
3d83bf1997-02-11Fredrik Hübinette (Hubbe)  { "Builtin", init_main, exit_main }
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "modules/modlist.h" }; void init_modules(void)
5267b71995-08-09Fredrik Hübinette (Hubbe) { unsigned int e;
db3e131997-02-06Fredrik Hübinette (Hubbe)  struct mapping *m = allocate_mapping(10); m->refs++; push_text("_static_modules"); push_mapping(m); f_add_constant(2);
5267b71995-08-09Fredrik Hübinette (Hubbe)  for(e=0;e<NELEM(module_list);e++) {
db3e131997-02-06Fredrik Hübinette (Hubbe)  struct program *p; struct object *o; struct pike_string *s; start_new_program(); module_list[e].init(); p=end_program(); o=clone(p,0); free_program(p); push_text(module_list[e].name); push_object(o); mapping_insert(m, sp-2, sp-1); pop_n_elems(2);
5267b71995-08-09Fredrik Hübinette (Hubbe)  } }
db3e131997-02-06Fredrik Hübinette (Hubbe) void exit_modules(void)
5267b71995-08-09Fredrik Hübinette (Hubbe) { int e;
db3e131997-02-06Fredrik Hübinette (Hubbe)  for(e=NELEM(module_list)-1;e>=0;e--) module_list[e].exit();
5267b71995-08-09Fredrik Hübinette (Hubbe) }