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.180 2003/06/05 15:30:52 grubba Exp $ + || $Id: encode.c,v 1.181 2003/06/05 15:54:23 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.180 2003/06/05 15:30:52 grubba Exp $"); + RCSID("$Id: encode.c,v 1.181 2003/06/05 15:54:23 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:1600:    BIT_VOID | BIT_INT,   #endif    0);       initialize_buf(&data->buf);    data->canonic = 0;    data->encoded=allocate_mapping(128);    data->delayed = allocate_array (0);    data->counter.type=T_INT;    data->counter.u.integer=COUNTER_START; +  + #ifdef ENCODE_DEBUG +  data->debug = args > 2 ? Pike_sp[2-args].u.integer : 0; +  data->depth = -2; + #endif +     if(args > 1 && Pike_sp[1-args].type == T_OBJECT)    {    data->codec=Pike_sp[1-args].u.object;    }else{    data->codec=get_master(); -  +  if (!data->codec) { +  /* Use a dummy if there's no master around yet, to avoid checks. */ +  push_object (clone_object (null_program, 0)); +  args++; +  data->codec = Pike_sp[-1].u.object;    } - #ifdef ENCODE_DEBUG -  data->debug = args > 2 ? Pike_sp[2-args].u.integer : 0; -  data->depth = -2; - #endif +  }       SET_ONERROR(tmp, free_encode_data, data);    addstr("\266ke0", 4);       encode_value2(Pike_sp-args, data, 1);       for (i = 0; i < data->delayed->size; i++)    encode_value2 (ITEM(data->delayed) + i, data, 2);       UNSET_ONERROR(tmp);
pike.git/src/encode.c:1668:    BIT_VOID | BIT_INT,   #endif    0);       initialize_buf(&data->buf);    data->canonic = 1;    data->encoded=allocate_mapping(128);    data->delayed = allocate_array (0);    data->counter.type=T_INT;    data->counter.u.integer=COUNTER_START; +  + #ifdef ENCODE_DEBUG +  data->debug = args > 2 ? Pike_sp[2-args].u.integer : 0; +  data->depth = -2; + #endif +     if(args > 1)    {    data->codec=Pike_sp[1-args].u.object;    }else{    data->codec=get_master(); -  +  if (!data->codec) { +  /* Use a dummy if there's no master around yet, to avoid checks. */ +  push_object (clone_object (null_program, 0)); +  args++; +  data->codec = Pike_sp[-1].u.object;    } - #ifdef ENCODE_DEBUG -  data->debug = args > 2 ? Pike_sp[2-args].u.integer : 0; -  data->depth = -2; - #endif +  }       SET_ONERROR(tmp, free_encode_data, data);    addstr("\266ke0", 4);       encode_value2(Pike_sp-args, data, 1);       for (i = 0; i < data->delayed->size; i++)    encode_value2 (ITEM(data->delayed) + i, data, 2);       UNSET_ONERROR(tmp);
pike.git/src/encode.c:4352: Inside #if defined(ENCODE_DEBUG)
   /* Fall through. */    case 2:   #endif    if (Pike_sp[1-args].type == T_OBJECT) {    codec = Pike_sp[1-args].u.object;    break;    }    /* Fall through. */    case 1:    codec = get_master(); +  if (!codec) { +  /* Use a dummy if there's no master around yet, to avoid checks. */ +  push_object (clone_object (null_program, 0)); +  args++; +  codec = Pike_sp[-1].u.object;    } -  +  }       if(!my_decode(s, codec   #ifdef ENCODE_DEBUG    , debug   #endif    ))    {    char *v=s->str;    ptrdiff_t l=s->len;    rec_restore_value(&v, &l);    }    assign_svalue(Pike_sp-args-1, Pike_sp-1);    pop_n_elems(args);   }