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.158 2002/11/23 20:05:14 mast Exp $ + || $Id: encode.c,v 1.159 2003/02/17 19:31:41 mast 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:20:   #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.158 2002/11/23 20:05:14 mast Exp $"); + RCSID("$Id: encode.c,v 1.159 2003/02/17 19:31:41 mast 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:1985:    data->counter.u.integer++; \   }while(0)      /* This really needs to disable threads.... */   #define decode_type(X,data) do { \    type_stack_mark(); \    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 decode_value2(struct decode_data *data)      #ifdef PIKE_DEBUG   #undef decode_value2   #define decode_value2(X) do { struct svalue *_=Pike_sp; decode_value2_(X); if(Pike_sp!=_+1) Pike_fatal("decode_value2 failed!\n"); } while(0)   #endif         {    INT32 what, e, num, numh;
pike.git/src/encode.c:2989:    ref_push_program(p);    } else {    Pike_error("Failed to decode program.\n");    }    break;       case 4:    {    struct program *p;    ONERROR err; +  int orig_compilation_depth;    int byteorder;    int bytecode_method;    int entry_type;    INT16 id_flags;    INT16 p_flags;   #define FOO(NUMTYPE,Y,NAME) \    NUMTYPE PIKE_CONCAT(local_num_, NAME) = 0;   #include "program_areas.h"      #ifdef ENCODE_DEBUG
pike.git/src/encode.c:3029:    PIKE_BYTEORDER, byteorder);    }       /* Decode flags. */    decode_number(p_flags,data);    p_flags &= ~(PROGRAM_FINISHED | PROGRAM_OPTIMIZED |    PROGRAM_FIXED | PROGRAM_PASS_1_DONE);    p_flags |= PROGRAM_AVOID_CHECK;       /* Start the new program. */ +  orig_compilation_depth = compilation_depth; +  compilation_depth = -1;    low_start_new_program(NULL, 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++;    -  SET_ONERROR(err, end_first_pass, 0); +  SET_ONERROR(err, cleanup_new_program_decode, &orig_compilation_depth);       debug_malloc_touch(p);       tmp.type=T_PROGRAM;    tmp.u.program=p;    EDB(2,fprintf(stderr, "%*sDecoding a program to <%d>: ",    data->depth, "", data->counter.u.integer);    print_svalue(stderr, &tmp);    fputc('\n', stderr););    mapping_insert(data->decoded, & data->counter, &tmp);
pike.git/src/encode.c:3485:       EDB(5, dump_program_tables(p, data->depth));       /* Fixate & optimize    *    * lfuns and identifier_index    */    if (!(p = end_first_pass(2))) {    Pike_error("Failed to decode program.\n");    } +  compilation_depth = orig_compilation_depth;    push_program(p);       /* Verify... */   #define FOO(NUMTYPE,Y,NAME) \    if (PIKE_CONCAT(local_num_, NAME) != p->PIKE_CONCAT(num_,NAME)) { \    Pike_error("Value mismatch for num_" TOSTR(NAME) ": %d != %d\n", \    PIKE_CONCAT(local_num_, NAME), \    p->PIKE_CONCAT(num_, NAME)); \    }   #include "program_areas.h"