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.179 2004/05/11 14:16:07 grubba Exp $ + || $Id: encode.c,v 1.180 2004/05/11 14:50:30 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:25:   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"   #include "pikecode.h"   #include "pike_types.h"   #include "opcodes.h"   #include "peep.h"    - RCSID("$Id: encode.c,v 1.179 2004/05/11 14:16:07 grubba Exp $"); + RCSID("$Id: encode.c,v 1.180 2004/05/11 14:50:30 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:2120:    INT32 what, e, num, numh;    struct svalue entry_id, *tmp2;    struct svalue *delayed_enc_val;      #ifdef ENCODE_DEBUG    data->depth += 2;   #endif       DECODE("decode_value2");    - #ifdef ENCODE_DEBUG -  if(data->debug) -  { -  if((what & TAG_MASK ) == TAG_AGAIN) -  fprintf(stderr, "%*sDecoding TAG_AGAIN from <%d>\n", -  data->depth, "", num); -  -  else -  if(data->debug > 1) -  fprintf(stderr, "%*sDecoding to <%d>: TAG%d (%d)\n", -  data->depth, "", data->counter.u.integer , -  what & TAG_MASK, num); -  } - #endif -  +     check_stack(1);       switch(what & TAG_MASK)    {    case TAG_DELAYED:    EDB (2, fprintf(stderr, "%*sDecoding delay encoded from <%d>\n",    data->depth, "", num););    entry_id.type = T_INT;    entry_id.subtype = 0;    entry_id.u.integer = num;
pike.git/src/encode.c:2191:       switch(what & TAG_MASK)    {    case TAG_INT:    push_int(num);    break;       case TAG_STRING:    {    struct pike_string *str; -  entry_id.type = T_INT; -  entry_id=data->counter; -  data->counter.u.integer++; +     get_string_data(str, num, data);    push_string(str);    break;    }       case TAG_FLOAT:    {    double res;       EDB(2,fprintf(stderr, "Decoding float... numh:0x%08x, num:0x%08x\n",
pike.git/src/encode.c:2352:   #endif       types = 0;    for(e=0;e<num;e++)    {    decode_value2(data);    stack_pop_to_no_free (ITEM(a) + e);    types |= 1 << ITEM(a)[e].type;    }    a->type_field = types; -  array_fix_type_field(a); +    #ifdef PIKE_NEW_MULTISETS    {    struct multiset *l = mkmultiset (a);    free_array (a);    /* This special case is handled efficiently by merge_multisets. */    merge_multisets (m, l, PIKE_MERGE_DESTR_A | PIKE_ARRAY_OP_ADD);    free_multiset (l);    }   #else    order_multiset(m);
pike.git/src/encode.c:2556:    case 0:    {    struct program *p;       decode_value2(data);    apply(data->codec,"programof", 1);       p = program_from_svalue(Pike_sp-1);       if (!p) { -  if(data->pickyness) { +  if(data->pickyness)    decode_error(NULL, Pike_sp - 1,    "Failed to decode program. Got: "); -  } +     pop_stack();    push_undefined();    break;    }       add_ref(p);    pop_stack();    push_program(p);    break;    }
pike.git/src/encode.c:2615:       debug_malloc_touch(p);    ref_push_program(p);    apply(data->codec, "__register_new_program", 1);       /* return a placeholder */    if(Pike_sp[-1].type == T_OBJECT)    {    placeholder=Pike_sp[-1].u.object;    if(placeholder->prog != null_program) -  Pike_error("Placeholder object is not a null_program clone!\n"); -  Pike_sp--; +  Pike_error("Placeholder object is not a __null_program clone.\n"); +  dmalloc_touch_svalue(Pike_sp-1);    }    else if (Pike_sp[-1].type != T_INT ||    Pike_sp[-1].u.integer)    Pike_error ("Expected placeholder object or zero "    "from __register_new_program.\n");    else {    pop_stack();    }    }   
pike.git/src/encode.c:3126:    {    pop_stack();    }else{    f_arrow(2);    }    if(Pike_sp[-1].type != T_PROGRAM && data->pickyness)    decode_error(NULL, Pike_sp - 1, "Failed to decode program. Got: ");    break;       case 3: -  entry_id=data->counter; -  data->counter.u.integer++; +     decode_value2(data);    if ((Pike_sp[-1].type == T_INT) &&    (Pike_sp[-1].u.integer < PROG_DYNAMIC_ID_START) &&    (Pike_sp[-1].u.integer > 0)) {    struct program *p = id_to_program(Pike_sp[-1].u.integer);    if (!p) {    Pike_error("Failed to get program from ID %"PRINTPIKEINT"d\n",    Pike_sp[-1].u.integer);    }    pop_stack();