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.170 2003/03/28 23:54:24 mast Exp $ + || $Id: encode.c,v 1.171 2003/04/02 19:22:43 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.170 2003/03/28 23:54:24 mast Exp $"); + RCSID("$Id: encode.c,v 1.171 2003/04/02 19:22:43 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:972: Inside #if defined(OLD_PIKE_ENCODE_PROGRAM)
   code_number(p->timestamp.tv_sec,data);    code_number(p->timestamp.tv_usec,data);       if(p->parent)    ref_push_program(p->parent);    else    push_int(0);    encode_value2(Pike_sp-1,data); /**/    pop_stack();    - #define FOO(X,Y,Z) \ -  code_number( p->PIKE_CONCAT(num_,Z), data); + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \ +  code_number( p->PIKE_CONCAT(num_,NAME), data);   #include "program_areas.h"       code_number(PIKE_BYTECODE_METHOD, data);      #ifdef ENCODE_PROGRAM   #ifdef PIKE_DEBUG    {    ptrdiff_t bufpos = data->buf.s.len;   #endif /* PIKE_DEBUG */    ENCODE_PROGRAM(p, &(data->buf));
pike.git/src/encode.c:1105:    /* parent */    if (p->parent) {    ref_push_program(p->parent);    } else {    push_int(0);    }    encode_value2(Pike_sp-1, data);    pop_stack();       /* num_* */ - #define FOO(X,Y,Z) \ -  code_number( p->PIKE_CONCAT(num_,Z), data); + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \ +  code_number( p->PIKE_CONCAT(num_,NAME), data);   #include "program_areas.h"       /* Byte-code method    */    code_number(PIKE_BYTECODE_METHOD, data);       /* program */   #ifdef ENCODE_PROGRAM   #ifdef PIKE_DEBUG    {
pike.git/src/encode.c:2569:    default:    Pike_error("Program decode failed!\n");    }    if(p->parent) {    add_ref(p->parent);    }    pop_stack();       debug_malloc_touch(p);    - #define FOO(X,Y,Z) \ -  decode_number( p->num_##Z, data); + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \ +  decode_number( p->PIKE_CONCAT(num_,NAME), data);   #include "program_areas.h"          if(data->pass == 1)    { - #define FOO(NUMTYPE,TYPE,NAME) \ + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \    size=DO_ALIGN(size, ALIGNOF(TYPE)); \    size+=p->PIKE_CONCAT(num_,NAME)*sizeof(p->NAME[0]);   #include "program_areas.h"       dat=xalloc(size);    debug_malloc_touch(dat);    MEMSET(dat,0,size);    size=0; - #define FOO(NUMTYPE,TYPE,NAME) \ + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \    size=DO_ALIGN(size, ALIGNOF(TYPE)); \    p->NAME=(TYPE *)(dat+size); \    size+=p->PIKE_CONCAT(num_,NAME)*sizeof(p->NAME[0]);   #include "program_areas.h"       for(e=0;e<p->num_constants;e++)    p->constants[e].sval.type=T_INT;       debug_malloc_touch(dat);    debug_malloc_touch(p);
pike.git/src/encode.c:3029:    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) \ + #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:3114:    (!Pike_sp[-1].u.integer)) {    p->parent = NULL;    } else {    Pike_error("Bad type for parent program (%s)\n",    get_name_of_type(Pike_sp[-1].type));    }    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--;       /* Decode lengths. */ - #define FOO(X,Y,NAME) decode_number(PIKE_CONCAT(local_num_, NAME), data); + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \ +  decode_number(PIKE_CONCAT(local_num_, NAME), data);   #include "program_areas.h"       /* Byte-code method */    decode_number(bytecode_method, data);    if (bytecode_method != PIKE_BYTECODE_METHOD) {    Pike_error("Unsupported byte-code method: %d\n", bytecode_method);    }       /* Decode program */    if (data->ptr + (int)local_num_program >= data->len) {
pike.git/src/encode.c:3530:    *    * 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) \ + #define FOO(NUMTYPE,TYPE,ARGTYPE,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"       /* Decode the actual constants    *    * This must be done after the program has been ended.