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

2:   || 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: encode.c,v 1.262 2008/02/29 14:27:09 grubba Exp $ + || $Id: encode.c,v 1.263 2008/04/14 10:14:38 grubba Exp $   */      #include "global.h"
30:   #include "pike_types.h"   #include "opcodes.h"   #include "peep.h" + #include "pike_compiler.h"      /* #define ENCODE_DEBUG */   
2413:    compilation_depth = *orig_compilation_depth;   }    - static void set_lex_pragmas(ptrdiff_t old_pragmas) - { -  lex.pragmas = DO_NOT_WARN((INT32)old_pragmas); - } -  +    static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,    struct svalue *other,    char *msg, ...)
3648:    int entry_type;    INT16 id_flags;    INT16 p_flags; -  ptrdiff_t old_pragmas = lex.pragmas; +  ptrdiff_t old_pragmas; +  struct compilation *c;   #define FOO(NUMTYPE,Y,ARGTYPE,NAME) \    NUMTYPE PIKE_CONCAT(local_num_, NAME) = 0;   #include "program_areas.h"
3704:    else    p = NULL;    +  enter_compiler(NULL, 0); +  +  c = THIS_COMPILATION; +     /* We don't want to be affected by #pragma save_parent or    * __pragma_save_parent__.    */ -  lex.pragmas = (old_pragmas & ~ID_SAVE_PARENT)|ID_DONT_SAVE_PARENT; -  SET_ONERROR(err2, set_lex_pragmas, (ptrdiff_t) old_pragmas); +  old_pragmas = c->lex.pragmas; +  c->lex.pragmas = (old_pragmas & ~ID_SAVE_PARENT)|ID_DONT_SAVE_PARENT;       /* Start the new program. */    orig_compilation_depth = compilation_depth;
4400:    compilation_depth = orig_compilation_depth;    push_program(p);    -  /* Restore lex.pragmas. */ -  CALL_AND_UNSET_ONERROR(err2); +  exit_compiler();       EDB(5, dump_program_tables(p, data->depth));   #ifdef PIKE_DEBUG