pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:8833:    */      /*! @decl inherit Reporter    *!    *! Implements the @[Reporter] API.    *!    *! @seealso    *! @[Reporter()->report()], @[Reporter()->SeverityLevel]    */    + /*! @class lock +  *! +  *! This class acts as a lock against other threads accessing the compiler. +  *! +  *! The lock is released when the object is destructed. +  */ +  + static void compiler_environment_lock_event_handler(int e) + { +  switch(e) { +  case PROG_EVENT_INIT: +  lock_pike_compiler(); +  break; +  case PROG_EVENT_EXIT: +  unlock_pike_compiler(); +  break; +  } + } +  + /*! @endclass +  */ +    /*! @decl program compile(string source, CompilationHandler|void handler, @    *! int|void major, int|void minor,@    *! program|void target, object|void placeholder)    *!    *! Compile a string to a program.    *!    *! This function takes a piece of Pike code as a string and    *! compiles it into a clonable program.    *!    *! The optional argument @[handler] is used to specify an alternative
pike.git/src/program.c:10716:    add_integer_constant("WARNING", REPORT_WARNING, 0);    add_integer_constant("ERROR", REPORT_ERROR, 0);    add_integer_constant("FATAL", REPORT_FATAL, 0);       reporter_program = end_program();    }    add_global_program("Reporter", reporter_program);       low_inherit(reporter_program, NULL, -1, 0, 0, 0);    +  start_new_program(); +  Pike_compiler->new_program->event_handler = +  compiler_environment_lock_event_handler; +  Pike_compiler->new_program->flags |= PROGRAM_DESTRUCT_IMMEDIATE; +  end_class("lock", 0); +     compilation_env_program = end_program();       add_global_program("CompilerEnvironment", compilation_env_program);       exit_compiler();       ref_push_object(compilation_environment);    low_add_constant("DefaultCompilerEnvironment", Pike_sp-1);    pop_stack();   }