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"
bb55f81997-03-16Fredrik Hübinette (Hubbe) #include "pike_macros.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) #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) 
24ddc71998-03-28Henrik Grubbström (Grubba) RCSID("$Id: module.c,v 1.8 1998/03/28 15:10:50 grubba Exp $");
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"
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) { unsigned int e;
db3e131997-02-06Fredrik Hübinette (Hubbe)  struct mapping *m = allocate_mapping(10); push_text("_static_modules");
61e9a01998-01-25Fredrik Hübinette (Hubbe)  ref_push_mapping(m);
db3e131997-02-06Fredrik Hübinette (Hubbe)  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 pike_string *s; start_new_program(); module_list[e].init(); p=end_program(); push_text(module_list[e].name);
1a8e141997-02-27Fredrik Hübinette (Hubbe)  push_program(p);
db3e131997-02-06Fredrik Hübinette (Hubbe)  mapping_insert(m, sp-2, sp-1); pop_n_elems(2);
5267b71995-08-09Fredrik Hübinette (Hubbe)  }
61e9a01998-01-25Fredrik Hübinette (Hubbe)  free_mapping(m);
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) }