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.80 2001/01/25 11:34:18 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.81 2001/04/19 13:39:54 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:314:    case '3':    case '4':    case '5':    case '6':    case '7':    case '8':    case '9':    case T_FLOAT:    case T_STRING:    case T_PROGRAM: +  case T_TYPE:    case T_MIXED:    case T_ZERO:    case T_VOID:    case PIKE_T_UNKNOWN:    break;       case T_OBJECT:    {    INT32 x;    addchar(EXTRACT_UCHAR(t++));
pike.git/src/encode.c:390:    * Gmp.mpz objects    */    code_entry(TAG_INT, val->u.integer,data);    break;       case T_STRING:    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"); -  Pike_error("Encoding of the type type not supported yet!\n"); +  code_entry(TAG_TYPE, 0, data); /* Type encoding #0 */ +  encode_type(val->u.string->str, 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);    }else{    INT64 x;
pike.git/src/encode.c:1155:    DECODE("float");       EDB(fprintf(stderr, "Exponent: %d\n", num));       push_float(LDEXP(res, num));    break;    }       case TAG_TYPE:    { -  Pike_error("Failed to decode string. " -  "(decode of the type type isn't supported yet).\n"); -  break; +  struct pike_string *t; +  +  decode_type(t, data); +  check_type_string(t); +  push_string(t); +  sp[-1].type = T_TYPE; +  +  tmp.type = T_INT; +  tmp = data->counter; +  data->counter.u.integer++;    } -  +  break;       case TAG_ARRAY:    {    struct array *a;    if(num < 0)    Pike_error("Failed to decode string. (array size is negative)\n");       /* Heruetical */    if(data->ptr + num > data->len)    Pike_error("Failed to decode array. (not enough data)\n");