Branch: Tag:

2003-08-05

2003-08-05 14:32:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>

decode_value() now sets #pragma dont_save_parent to ensure proper decoding of programs.

Rev: src/encode.c:1.196

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.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"
15:   #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"
27:   #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 */   
2122:    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, ...)
3216:    {    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"
3275:    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;
3798:    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);