pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c: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: 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"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"
pike.git/src/encode.c:23:   #include "module_support.h"   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"   #include "pikecode.h"   #include "pike_types.h"   #include "opcodes.h"   #include "peep.h" + #include "pike_compiler.h"      /* #define ENCODE_DEBUG */      /* Use the old encoding method for programs. */   /* #define OLD_PIKE_ENCODE_PROGRAM */      #ifdef ENCODE_DEBUG   /* Pass a nonzero integer as the third arg to encode_value,    * encode_value_canonic and decode_value to activate this debug. */   #define EDB(N,X) do { debug_malloc_touch(data); if (data->debug>=N) {X;} } while (0)
pike.git/src/encode.c:2406:   static void cleanup_new_program_decode (int *orig_compilation_depth)   {    debug_malloc_touch(Pike_compiler->new_program);    debug_malloc_touch(Pike_compiler->new_program->parent);    /* The program is consistent enough to be freed... */    Pike_compiler->new_program->flags &= ~PROGRAM_AVOID_CHECK;    end_first_pass(0);    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, ...)    ATTRIBUTE((noreturn,format (printf, 3, 4)));      static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,    struct svalue *other,    char *msg, ...)   {    int n = 0;
pike.git/src/encode.c:3641:    {    struct program *p;    ONERROR err;    ONERROR err2;    int orig_compilation_depth;    int byteorder;    int bytecode_method;    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"      #ifdef ENCODE_DEBUG    data->depth += 2;   #endif       /* Decode byte-order. */    decode_number(byteorder, data);
pike.git/src/encode.c:3697:    }    /* No new ref here; low_start_new_program will add one for    * Pike_compiler->new_program and we want ride on that one    * just like when it's created there. */    p = delayed_enc_val->u.program;    debug_malloc_touch(p);    }    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;    compilation_depth = -1;    low_start_new_program(p, 1, NULL, 0, NULL);    p = Pike_compiler->new_program;   #if TWO_PASS_DECODE_WORKS    if(! data->supporter.prog)    data->supporter.prog = p;   #endif
pike.git/src/encode.c:4393:    * lfuns and identifier_index    */    ref_push_program (p);    if (!(p = end_first_pass(2))) {    decode_error(Pike_sp - 1, NULL, "Failed to decode program.\n");    }    pop_stack();    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    check_program (p);   #endif       if (bytecode_method == PIKE_BYTECODE_PORTABLE) {    /* We've regenerated p->program, so these may be off. */    local_num_program = p->num_program;    local_num_relocations = p->num_relocations;