c5e7291999-03-31Mirar (Pontus Hagland) /*
cc56ad1999-05-07Fredrik Hübinette (Hubbe)  * $Id: math_module.c,v 1.2 1999/05/08 00:50:52 hubbe Exp $
c5e7291999-03-31Mirar (Pontus Hagland)  */ #include "global.h" #include "config.h" #include "program.h"
02eb461999-03-31Mirar (Pontus Hagland) #include "math_module.h"
c5e7291999-03-31Mirar (Pontus Hagland)  /*** module init & exit & stuff *****************************************/ /* add other parsers here */
6a33fa1999-03-31Mirar (Pontus Hagland) struct program *math_matrix_program;
c5e7291999-03-31Mirar (Pontus Hagland) static struct math_class { char *name; void (*func)(void);
6a33fa1999-03-31Mirar (Pontus Hagland)  struct program **pd;
c5e7291999-03-31Mirar (Pontus Hagland) } sub[] = {
6a33fa1999-03-31Mirar (Pontus Hagland)  {"Matrix",init_math_matrix,&math_matrix_program},
c5e7291999-03-31Mirar (Pontus Hagland) }; void pike_module_exit(void) {
6a33fa1999-03-31Mirar (Pontus Hagland)  int i; for (i=0; i<(int)(sizeof(sub)/sizeof(sub[0])); i++) if (sub[i].pd && sub[i].pd[0]) free_program(sub[i].pd[0]);
c5e7291999-03-31Mirar (Pontus Hagland) } void pike_module_init(void) { int i; for (i=0; i<(int)(sizeof(sub)/sizeof(sub[0])); i++) { struct program *p; start_new_program(); sub[i].func(); p=end_program(); add_program_constant(sub[i].name,p,0);
6a33fa1999-03-31Mirar (Pontus Hagland)  if (sub[i].pd) sub[i].pd[0]=p; else free_program(p);
c5e7291999-03-31Mirar (Pontus Hagland)  } }
cc56ad1999-05-07Fredrik Hübinette (Hubbe)