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.96 2002/04/25 13:35:05 grubba Exp $"); + RCSID("$Id: encode.c,v 1.97 2002/05/02 14:48:01 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 if (data->debug>=N) {X;} while (0)
pike.git/src/encode.c:1244:    free_mapping(data->encoded);   }      void f_encode_value(INT32 args)   {    ONERROR tmp;    struct encode_data d, *data;    data=&d;       check_all_args("encode_value", args, BIT_MIXED, BIT_VOID | BIT_OBJECT, -  BIT_VOID | BIT_INT, 0); + #ifdef ENCODE_DEBUG +  /* This argument is only an internal debug helper. +  * It's intentionally not part of the function +  * prototype, to keep the argument position free for +  * other uses in the future. */ +  BIT_VOID | BIT_INT, + #endif +  0);       initialize_buf(&data->buf);    data->canonic = 0;    data->encoded=allocate_mapping(128);    data->counter.type=T_INT;    data->counter.u.integer=COUNTER_START;    if(args > 1)    {    data->codec=Pike_sp[1-args].u.object;    }else{
pike.git/src/encode.c:1280:    push_string(low_free_buf(&data->buf));   }      void f_encode_value_canonic(INT32 args)   {    ONERROR tmp;    struct encode_data d, *data;    data=&d;       check_all_args("encode_value_canonic", args, BIT_MIXED, BIT_VOID | BIT_OBJECT, -  BIT_VOID | BIT_INT, 0); + #ifdef ENCODE_DEBUG +  /* This argument is only an internal debug helper. +  * It's intentionally not part of the function +  * prototype, to keep the argument position free for +  * other uses in the future. */ +  BIT_VOID | BIT_INT, + #endif +  0);       initialize_buf(&data->buf);    data->canonic = 1;    data->encoded=allocate_mapping(128);    data->counter.type=T_INT;    data->counter.u.integer=COUNTER_START;    if(args > 1)    {    data->codec=Pike_sp[1-args].u.object;    }else{
pike.git/src/encode.c:1792: Inside #if defined(ENCODE_DEBUG)
  #ifdef ENCODE_DEBUG    data->depth -= 2;   #endif    return;    }       case TAG_MAPPING:    {    struct mapping *m;    if(num<0) -  Pike_error("Failed to decode string. (mapping size is negative)\n"); +  Pike_error("Failed to decode mapping. (mapping size is negative)\n");       /* Heruetical */    if(data->ptr + num > data->len)    Pike_error("Failed to decode mapping. (not enough data)\n");       m=allocate_mapping(num);    tmp.type=T_MAPPING;    tmp.u.mapping=m;    EDB(2,fprintf(stderr, "%*sDecoding mapping of size %d to <%d>\n",    data->depth, "", num, data->counter.u.integer));
pike.git/src/encode.c:1826:    data->depth -= 2;   #endif    return;    }       case TAG_MULTISET:    {    struct multiset *m;    struct array *a;    if(num<0) -  Pike_error("Failed to decode string. (multiset size is negative)\n"); +  Pike_error("Failed to decode multiset. (multiset size is negative)\n");       /* Heruetical */    if(data->ptr + num > data->len)    Pike_error("Failed to decode multiset. (not enough data)\n");       /* NOTE: This code knows stuff about the implementation of multisets...*/    a = low_allocate_array(num, 0);    m = allocate_multiset(a);    tmp.type = T_MULTISET;    tmp.u.multiset = m;
pike.git/src/encode.c:1920:    }       EDB(2,fprintf(stderr, "%*sDecoded an object to <%d>: ",    data->depth, "", tmp.u.integer);    print_svalue(stderr, Pike_sp-1);    fputc('\n', stderr););       ref_push_object(o);    decode_value2(data);    if(!data->codec) -  Pike_error("Failed to decode (no codec)\n"); +  Pike_error("Failed to decode object (no codec)\n");    apply(data->codec,"decode_object",2);    pop_stack();    }       break;      #ifdef AUTO_BIGNUM    /* It is possible that we should do this even without    * AUTO_BIGNUM /Hubbe    * However, that requires that some of the bignum functions
pike.git/src/encode.c:3236:   }      void f_decode_value(INT32 args)   {    struct pike_string *s;    struct object *codec;      #ifdef ENCODE_DEBUG    int debug;   #endif +     check_all_args("decode_value", args, -  BIT_STRING, BIT_VOID | BIT_OBJECT | BIT_INT, BIT_VOID | BIT_INT, 0); +  BIT_STRING, BIT_VOID | BIT_OBJECT | BIT_INT, + #ifdef ENCODE_DEBUG +  /* This argument is only an internal debug helper. +  * It's intentionally not part of the function +  * prototype, to keep the argument position free for +  * other uses in the future. */ +  BIT_VOID | BIT_INT, + #endif +  0);      #ifdef ENCODE_DEBUG    debug = args > 2 ? Pike_sp[2-args].u.integer : 0;   #endif       s = Pike_sp[-args].u.string;    if(args<2)    {    codec=get_master();    }