pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:18:   #include "pike_error.h"   #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"    - RCSID("$Id: encode.c,v 1.110 2001/07/12 23:41:20 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.111 2001/07/15 21:16:04 hubbe Exp $");      /* #define ENCODE_DEBUG */      #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 if (data->debug>=N) {X;} while (0)   #else   #define EDB(N,X) do {} while (0)   #endif
pike.git/src/encode.c:738:    if (data->canonic)    Pike_error("Canonical encoding of objects not supported.\n");    push_svalue(val);    apply(data->codec, "nameof", 1);    switch(Pike_sp[-1].type)    {    case T_INT:    if(Pike_sp[-1].subtype == NUMBER_UNDEFINED)    {    int to_change = data->buf.s.len; -  pop_stack(); -  push_svalue(val); -  f_object_program(1); +  struct svalue tmp=data->counter; +  tmp.u.integer--;       /* We have to remove ourself from the cache */    map_delete(data->encoded, val);    -  +  pop_stack(); +  push_svalue(val); +  f_object_program(1); +     /* Code the program */    code_entry(TAG_OBJECT, 3,data);    encode_value2(Pike_sp-1, data);    pop_stack();       push_svalue(val);       /* If we do not exist in cache, use backwards-    * compatible method, otherwise use newfangled    * style=3. -Hubbe    */    if(!low_mapping_lookup(data->encoded, val))    { -  +  EDB(1,fprintf(stderr, "%*sZapping 3 -> 1 in TAG_OBJECT\n", +  data->depth, "")); +     /* This causes the code_entry above to    * become: code_entry(TAG_OBJECT, 1, data);    * -Hubbe    */    data->buf.s.str[to_change] = 99;    apply(data->codec,"encode_object",1); -  +  +  /* Put value back in cache for future reference -Hubbe */ +  mapping_insert(data->encoded, val, &tmp);    }    break;    }    /* FALL THROUGH */       default:    code_entry(TAG_OBJECT, 0,data);    break;    }    encode_value2(Pike_sp-1, data);