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.163 2003/08/05 14:32:45 grubba Exp $ + || $Id: encode.c,v 1.164 2003/11/18 14:22:52 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:22:   #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.163 2003/08/05 14:32:45 grubba Exp $"); + RCSID("$Id: encode.c,v 1.164 2003/11/18 14:22:52 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:1094:       /* num_* */   #define FOO(X,Y,Z) \    code_number( p->PIKE_CONCAT(num_,Z), data);   #include "program_areas.h"       /* Byte-code method    */    code_number(PIKE_BYTECODE_METHOD, data);    + #ifdef PIKE_USE_MACHINE_CODE +  /* Add the checksum of the instrs array. */ +  code_number(instrs_checksum, data); + #endif /* PIKE_USE_MACHINE_CODE */ +     /* program */   #ifdef ENCODE_PROGRAM   #ifdef PIKE_DEBUG    {    ptrdiff_t bufpos = data->buf.s.len;   #endif /* PIKE_DEBUG */    ENCODE_PROGRAM(p, &(data->buf));   #ifdef PIKE_DEBUG    if (p->num_program * sizeof(p->program[0]) !=    data->buf.s.len - bufpos) {
pike.git/src/encode.c:3118:    /* Decode lengths. */   #define FOO(X,Y,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);    }    + #ifdef PIKE_USE_MACHINE_CODE +  { +  size_t csum; +  /* Check the checksum of the instrs array. */ +  decode_number(csum, data); +  if (csum != instrs_checksum) { +  Pike_error("Bad instruction checksum: %d (expected %d)\n", +  csum, instrs_checksum); +  } +  } + #endif /* PIKE_USE_MACHINE_CODE */ +     /* Decode program */    if (data->ptr + (int)local_num_program >= data->len) {    Pike_error("Failed to decode program. (string too short)\n");    }    for (e=0; e<(int)local_num_program; e++) {    PIKE_OPCODE_T opcode;    MEMCPY(&opcode, data->data + data->ptr, sizeof(PIKE_OPCODE_T));    data->ptr += sizeof(PIKE_OPCODE_T);    add_to_program(opcode);    }