Branch: Tag:

2008-04-14

2008-04-14 10:14:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Pike compiler mega patch.
Added predef::CompilerEnvironment, which is a wrapper for struct compilation.
Moved the definition of struct compilation to the new header file "pike_compiler.h".
The compilation struct is now contained in the current context in the current_object during compilation.
The global variable lex is no more, it has moved into the compilation struct.
Added enter_compiler() and exit_compiler().
predef::compile() is now shorthand for predef::CompilerContext()->compile().

Rev: src/builtin_functions.c:1.652
Rev: src/compilation.h:1.35
Rev: src/docode.c:1.197
Rev: src/docode.h:1.20
Rev: src/dynamic_load.c:1.90
Rev: src/encode.c:1.263
Rev: src/language.yacc:1.411
Rev: src/las.c:1.406
Rev: src/lex.c:1.121
Rev: src/lex.h:1.36
Rev: src/lexer.h:1.66
Rev: src/module.c:1.52
Rev: src/object.c:1.284
Rev: src/operators.c:1.230
Rev: src/pike_compiler.h:1.1
Rev: src/pike_types.c:1.321
Rev: src/program.c:1.660
Rev: src/program.h:1.237

1: + /* + || This file is part of Pike. For copyright information see COPYRIGHT. + || Pike is distributed under GPL, LGPL and MPL. See the file COPYING + || for more information. + || $Id: pike_compiler.h,v 1.1 2008/04/14 10:14:41 grubba Exp $ + */    -  + #ifndef PIKE_COMPILER_H + #define PIKE_COMPILER_H +  + #include "lex.h" + #include "program.h" +  + struct compilation + { +  struct Supporter supporter; +  struct pike_string *prog; /* String to compile. */ +  struct object *handler; /* error_handler */ +  struct object *compat_handler; /* compat_handler */ +  int major, minor; /* compat version */ +  struct program *target; /* Program being compiled. */ +  struct object *placeholder; +  +  struct program *p; /* Compiled program or NULL. */ +  struct lex lex; +  int compilation_inherit; /* Inherit in supporter->self containing +  * compilation_program. */ +  int save_depth; +  int saved_threads_disabled; +  dynamic_buffer used_modules_save; +  INT32 num_used_modules_save; +  struct mapping *resolve_cache_save; +  +  struct svalue default_module; + }; +  + #ifdef PIKE_DEBUG + #define CHECK_COMPILER() do { \ +  if (!Pike_fp || !compilation_program || \ +  Pike_fp->context->prog != compilation_program) { \ +  Pike_fatal("Invalid compilation context!\n"); \ +  } \ +  } while(0) + #else + #define CHECK_COMPILER() + #endif + #define THIS_COMPILATION ((struct compilation *)(Pike_fp->current_storage)) + #define MAYBE_THIS_COMPILATION ((Pike_fp && compilation_program && (Pike_fp->context->prog == compilation_program))?THIS_COMPILATION:NULL) +  + /* Function numbers. */ + #define CE_REPORT_FUN_NUM 0 + #define CE_PIKE_COMPILER_FUN_NUM 1 + #define CE_COMPILE_FUN_NUM 2 +  + #endif /* !PIKE_COMPILER_H */   Newline at end of file added.