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.214 2005/05/18 12:36:53 mast Exp $ + || $Id: encode.c,v 1.215 2005/05/31 15:33:38 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: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.214 2005/05/18 12:36:53 mast Exp $"); + RCSID("$Id: encode.c,v 1.215 2005/05/31 15:33:38 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:1811:    int pickyness;    int pass;    struct pike_string *raw;    struct decode_data *next;   #ifdef PIKE_THREADS    struct thread_state *thread_state;   #endif   #ifdef ENCODE_DEBUG    int debug, depth;   #endif -  struct Supporter supporter; +    };      static void decode_value2(struct decode_data *data);      static int my_extract_char(struct decode_data *data)   {    if(data->ptr >= data->len)    Pike_error("Format error, not enough data in string.\n");    return data->data [ data->ptr++ ];   }
pike.git/src/encode.c:2759:    data->depth, "", entry_id.u.integer);    print_svalue(stderr, &entry_id);    fputc('\n', stderr););       SETUP_DECODE_MEMOBJ(T_PROGRAM, program, p, low_allocate_program(),;);       SET_ONERROR(err3, zap_unfinished_program, p);       if(data->pass == 1)    { -  if(! data->supporter.prog) -  data->supporter.prog = p; -  +     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.git/src/encode.c:3163:       if(placeholder)    {    free_object(placeholder);    UNSET_ONERROR(err4);    }    UNSET_ONERROR(err3);       ref_push_program(p);    -  if(!(p->flags & PROGRAM_FINISHED) && -  !data->supporter.depends_on) +  if(!(p->flags & PROGRAM_FINISHED))    {    /* Logic for the PROGRAM_FINISHED flag:    * The purpose of this code is to make sure that the PROGRAM_FINISHED    * flag is not set on the program until all inherited programs also    * have that flag. -Hubbe    */    for(d=1;d<p->num_inherits;d++)    if(! (p->inherits[d].prog->flags & PROGRAM_FINISHED))    break;   
pike.git/src/encode.c:4139:    return 0;    }   }            static struct decode_data *current_decode = NULL;      static void free_decode_data(struct decode_data *data)   { -  int delay; -  +     debug_malloc_touch(data);       if (current_decode == data) {    current_decode = data->next;    } else {    struct decode_data *d;    for (d = current_decode; d; d=d->next) {    if (d->next == data) {    d->next = d->next->next;    break;    }    }   #ifdef PIKE_DEBUG    if (!d) {    Pike_fatal("Decode data fell off the stack!\n");    }   #endif /* PIKE_DEBUG */    }    -  -  delay=unlink_current_supporter(&data->supporter); -  call_dependants(& data->supporter, 1); -  -  if(delay) -  { -  debug_malloc_touch(data); -  /* We have been delayed */ -  return; -  } -  +     free_mapping(data->decoded);      #ifdef PIKE_DEBUG    if(data->unfinished_programs)    Pike_fatal("We have unfinished programs left in decode()!\n");    if(data->unfinished_objects)    Pike_fatal("We have unfinished objects left in decode()!\n");   #endif       while(data->unfinished_programs)
pike.git/src/encode.c:4230: Inside #if defined(PIKE_DEBUG)
   "Got unfinished program <%"PRINTPIKEINT"d> after decode: ",    k->ind.u.integer);    }    }   #endif       UNSET_ONERROR(err);    free_decode_data(data);   }    - /* Run pass2 */ - int re_decode(struct decode_data *data, int ignored) - { -  data->next = current_decode; -  low_do_decode (data); -  return 1; - } -  +    static INT32 my_decode(struct pike_string *tmp,    struct object *codec   #ifdef ENCODE_DEBUG    , int debug   #endif    )   {    struct decode_data *data;       /* Attempt to avoid infinite recursion on circular structures. */
pike.git/src/encode.c:4306:    GETC() != 'k' ||    GETC() != 'e' ||    GETC() != '0')    {    free( (char *) data);    return 0;    }       data->decoded=allocate_mapping(128);    -  init_supporter(& data->supporter, -  (supporter_callback *) re_decode, -  (void *)data); -  +     low_do_decode (data);       return 1;   }      /* Compatibilidy decoder */      static unsigned char extract_char(char **v, ptrdiff_t *l)   {    if(!*l) Pike_error("Format error, not enough place for char.\n");