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. \*/
9893772001-08-20Henrik Grubbström (Grubba) /**/
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "global.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) #include "module.h"
bb55f81997-03-16Fredrik Hübinette (Hubbe) #include "pike_macros.h"
b2d3e42000-12-01Fredrik Hübinette (Hubbe) #include "pike_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"
992e662000-07-06Fredrik Hübinette (Hubbe) #include "program_id.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) 
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "modules/modlist_headers.h"
9893772001-08-20Henrik Grubbström (Grubba) #ifdef POST_MODULES #include "post_modules/modlist_headers.h" #else /* !POST_MODULES */ RCSID("$Id: module.c,v 1.13 2001/08/20 16:45:26 grubba Exp $"); #endif /* POST_MODULES */
24ddc71998-03-28Henrik Grubbström (Grubba) 
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[] = {
156fd51997-10-27Fredrik Hübinette (Hubbe)  { "Builtin", low_init_main, low_exit_main }
db3e131997-02-06Fredrik Hübinette (Hubbe) #include "modules/modlist.h"
9893772001-08-20Henrik Grubbström (Grubba) #ifdef POST_MODULES #include "post_modules/modlist.h" #endif /* POST_MODULES */
156fd51997-10-27Fredrik Hübinette (Hubbe)  ,{ "Builtin2", init_main, exit_main }
db3e131997-02-06Fredrik Hübinette (Hubbe) }; void init_modules(void)
5267b71995-08-09Fredrik Hübinette (Hubbe) {
c712e71998-04-23Fredrik Hübinette (Hubbe)  struct program *p;
5267b71995-08-09Fredrik Hübinette (Hubbe)  unsigned int e;
c712e71998-04-23Fredrik Hübinette (Hubbe)  start_new_program();
992e662000-07-06Fredrik Hübinette (Hubbe)  Pike_compiler->new_program->id=PROG___BUILTIN_ID;
db3e131997-02-06Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe)  for(e=0;e<NELEM(module_list);e++) {
db3e131997-02-06Fredrik Hübinette (Hubbe)  start_new_program(); module_list[e].init();
45ee5d1999-02-10Fredrik Hübinette (Hubbe)  debug_end_class(module_list[e].name,strlen(module_list[e].name),0);
5267b71995-08-09Fredrik Hübinette (Hubbe)  }
c712e71998-04-23Fredrik Hübinette (Hubbe)  push_text("_static_modules"); push_object(low_clone(p=end_program())); f_add_constant(2); free_program(p);
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) }