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.195 2003/08/04 16:14:21 mast Exp $ + || $Id: encode.c,v 1.196 2003/08/05 14:32:15 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"   #include "array.h"   #include "multiset.h" -  + #include "language.h" + #include "lex.h"   #include "dynamic_buffer.h"   #include "pike_error.h"   #include "operators.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"   #include "pikecode.h"    - RCSID("$Id: encode.c,v 1.195 2003/08/04 16:14:21 mast Exp $"); + RCSID("$Id: encode.c,v 1.196 2003/08/05 14:32:15 grubba Exp $");      /* #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:2115:    low_decode_type(data); \    (X)=pop_unfinished_type(); \   } while(0)      static void cleanup_new_program_decode (int *orig_compilation_depth)   {    end_first_pass(0);    compilation_depth = *orig_compilation_depth;   }    + static void set_lex_pragmas(INT32 old_pragmas) + { +  lex.pragmas = 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:3209:    }   #endif       break;    }       case 4: /* New-style encoding. */    {    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; -  +  INT32 old_pragmas = lex.pragmas;   #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:3268:    "for delay encoded program <%d>: ", entry_id.u.integer);    }    /* 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;    }    else    p = NULL;    +  /* 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, old_pragmas); +     /* 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;       p->flags = p_flags;       /* Kludge to get end_first_pass() to free the program. */    Pike_compiler->num_parse_error++;
pike.git/src/encode.c:3791:    * 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); +     EDB(5, dump_program_tables(p, data->depth));   #ifdef PIKE_DEBUG    check_program (p);   #endif       /* Verify... */   #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \    if (PIKE_CONCAT(local_num_, NAME) != p->PIKE_CONCAT(num_,NAME)) { \    ref_push_program (p); \    decode_error(Pike_sp - 1, NULL, \