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.86 2001/02/24 22:08:43 grubba Exp $"); + RCSID("$Id: encode.c,v 1.87 2001/02/24 22:14:53 grubba Exp $");      /* #define ENCODE_DEBUG */      #ifdef ENCODE_DEBUG   #define EDB(X) X   #else   #define EDB(X)   #endif      /* The sp macro conflicts with Solaris 2.5.1's <sys/conf.h>. */
pike.git/src/encode.c:256:    num >> 4, data);   }      #ifdef _REENTRANT   static void do_enable_threads(void)   {    exit_threads_disable(NULL);   }   #endif    - static ptrdiff_t encode_type(unsigned char *t, struct encode_data *data) + static ptrdiff_t low_encode_type(unsigned char *t, struct encode_data *data)   {    unsigned char *q = t;   one_more_type:    addchar(EXTRACT_UCHAR(t));    switch(EXTRACT_UCHAR(t++))    {    default:    fatal("error in type string.\n");    /*NOTREACHED*/       break;       case T_ASSIGN:    addchar(EXTRACT_UCHAR(t++));    goto one_more_type;       case T_FUNCTION:    while(EXTRACT_UCHAR(t)!=T_MANY) -  t+=encode_type(t, data); +  t += low_encode_type(t, data);    addchar(EXTRACT_UCHAR(t++));       case T_MAPPING:    case T_OR:    case T_AND: -  t+=encode_type(t, data); +  t += low_encode_type(t, data);       case T_ARRAY:    case T_MULTISET:    case T_NOT:    goto one_more_type;       case T_INT:    {    int i;    /* FIXME: I assume the type is saved in network byte order. Is it?
pike.git/src/encode.c:346:    push_int(0);    }    encode_value2(Pike_sp-1, data);    pop_stack();    break;    }    }    return t-q;   }    + static ptrdiff_t encode_type(struct pike_type *t, struct encode_data *data) + { +  return low_encode_type(t->str, data); + }      static void encode_value2(struct svalue *val, struct encode_data *data)      #ifdef PIKE_DEBUG   #undef encode_value2   #define encode_value2(X,Y) do { struct svalue *_=Pike_sp; encode_value2_(X,Y); if(Pike_sp!=_) fatal("encode_value2 failed!\n"); } while(0)   #endif      {    static struct svalue dested = { T_INT, NUMBER_DESTRUCTED };
pike.git/src/encode.c:396:    adddata(val->u.string);    break;       case T_TYPE:    /* NOTE: Types are added to the encoded mapping AFTER they have    * been encoded, to simplify decoding.    */    if (data->canonic)    Pike_error("Canonical encoding of the type type not supported.\n");    code_entry(TAG_TYPE, 0, data); /* Type encoding #0 */ -  encode_type(val->u.type->str, data); +  encode_type(val->u.type, data);    mapping_insert(data->encoded, val, &data->counter);    data->counter.u.integer++;    break;       case T_FLOAT:    {    if(val->u.float_number==0.0)    {    code_entry(TAG_FLOAT,0,data);    code_entry(TAG_FLOAT,0,data);
pike.git/src/encode.c:687:    }    encode_value2(Pike_sp-1,data);    pop_stack();       adddata3(p->inherits[d].name);    }       for(d=0;d<p->num_identifiers;d++)    {    adddata(p->identifiers[d].name); -  encode_type(p->identifiers[d].type->str, data); +  encode_type(p->identifiers[d].type, data);    code_number(p->identifiers[d].identifier_flags,data);    code_number(p->identifiers[d].run_time_type,data);    code_number(p->identifiers[d].opt_flags,data);    code_number(p->identifiers[d].func.offset,data);    }       for(d=0;d<p->num_constants;d++)    {    encode_value2(& p->constants[d].sval, data);    adddata3(p->constants[d].name);