Branch: Tag:

2002-01-31

2002-01-31 17:52:15 by Marcus Comstedt <marcus@mc.pp.se>

Make it possible to inherit pike programs from C programs.

Rev: src/dynamic_load.c:1.59
Rev: src/module.c:1.16
Rev: src/program.c:1.401

16:   #include "object.h"   #include "mapping.h"   #include "program_id.h" + #include "language.h" + #include "lex.h"      #include "modules/modlist_headers.h"   #ifndef IN_TPIKE   #include "post_modules/modlist_headers.h"   #endif    - RCSID("$Id: module.c,v 1.15 2002/01/16 02:54:15 nilsson Exp $"); + RCSID("$Id: module.c,v 1.16 2002/01/31 17:52:15 marcus Exp $");      typedef void (*modfun)(void);   
46:   {    struct program *p;    unsigned int e; +  struct lex save_lex;    -  +  save_lex = lex; +  lex.current_line=1; +  lex.current_file=make_shared_string("-"); +     start_new_program();    Pike_compiler->new_program->id=PROG___BUILTIN_ID;       for(e=0;e<NELEM(module_list);e++)    { -  +  JMP_BUF recovery;    start_new_program(); -  +  if(SETJMP(recovery)) { +  free_program(end_program()); +  call_handle_error(); +  } else {    module_list[e].init();    debug_end_class(module_list[e].name,strlen(module_list[e].name),0);    } -  +  UNSETJMP(recovery); +  }    push_text("_static_modules");    push_object(low_clone(p=end_program()));    f_add_constant(2);    free_program(p); -  +  free_string(lex.current_file); +  lex = save_lex;   }      void exit_modules(void)   { -  +  JMP_BUF recovery;    int e;    for(e=NELEM(module_list)-1;e>=0;e--) -  +  { +  if(SETJMP(recovery)) +  call_handle_error(); +  else    module_list[e].exit(); -  +  UNSETJMP(recovery);    } -  + }