pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:18:   #include "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.49 1999/12/11 00:02:14 grubba Exp $"); + RCSID("$Id: encode.c,v 1.50 1999/12/11 00:31:47 grubba Exp $");      /* #define ENCODE_DEBUG */      #ifdef ENCODE_DEBUG   #define EDB(X) X   #else   #define EDB(X)   #endif      #ifdef _AIX
pike.git/src/encode.c:325:    * then this must be fixed to encode numbers over 32 bits as    * Gmp.mpz objects    */    code_entry(T_INT, val->u.integer,data);    break;       case T_STRING:    adddata(val->u.string);    break;    +  case T_TYPE: +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */ +  error("Encoding of the type type not supported yet!"); +  break; +     case T_FLOAT:    {    if(val->u.float_number==0.0)    { -  /* Backward compatibility! */ +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */    code_entry(T_TYPE,0,data);    code_entry(T_TYPE,0,data);    }else{    INT32 x;    int y;    double tmp;       tmp=FREXP((double)val->u.float_number, &y);    x=(INT32)((1<<30)*tmp);    y-=30;   #if 0    while(x && y && !(x&1))    {    x>>=1;    y++;    }   #endif -  /* Backward compatibility! */ +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */    code_entry(T_TYPE,x,data);    code_entry(T_TYPE,y,data);    }    break;    }       case T_ARRAY:    code_entry(T_ARRAY, val->u.array->size, data);    for(i=0; i<val->u.array->size; i++)    encode_value2(ITEM(val->u.array)+i, data);
pike.git/src/encode.c:573:       for(d=0;d<NUM_LFUNS;d++)    code_number(p->lfuns[d], data);    }else{    code_entry(val->type, 0,data);    encode_value2(sp-1, data);    }    pop_stack();    break;    } -  case T_TYPE: -  error("Encoding of the type type not supported yet!"); -  break; +     }   }      static void free_encode_data(struct encode_data *data)   {    toss_buffer(& data->buf);    free_mapping(data->encoded);   }      void f_encode_value(INT32 args)
pike.git/src/encode.c:925:    {    struct pike_string *str;    tmp=data->counter;    data->counter.u.integer++;    get_string_data(str, num, data);    push_string(str);    break;    }       case T_TYPE: -  /* Used to be T_FLOAT at this code (7). */ -  /* FALL_THROUGH */ -  case T_FLOAT: +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */    {    INT32 num2=num;       tmp=data->counter;    data->counter.u.integer++;       DECODE("float");    push_float(LDEXP((double)num2, num));    break;    }    -  +  case T_FLOAT: +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */ +  { +  error("Failed to decode string. " +  "(decode of the type type isn't supported yet).\n"); +  break; +  } +     case T_ARRAY:    {    struct array *a;    if(num < 0)    error("Failed to decode string. (array size is negative)\n");       /* Heruetical */    if(data->ptr + num > data->len)    error("Failed to decode array. (not enough data)\n");   
pike.git/src/encode.c:1480:   {    INT32 t,i;       i=extract_int(v,l);    t=extract_int(v,l);    switch(i)    {    case T_INT: push_int(t); return;       case T_TYPE: -  /* Backward compatibility! */ -  /* FALL_THROUGH */ -  case T_FLOAT: +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */    if(sizeof(INT32) < sizeof(float)) /* FIXME FIXME FIXME FIXME */    error("Float architecture not supported.\n");    push_int(t); /* WARNING! */    sp[-1].type = T_FLOAT;    return;    -  +  case T_FLOAT: +  /* NOTE: Floats are encoded with the tag T_TYPE (7) +  * for backward compatibility. +  */ +  error("Format error:decoding of the type type not supported yet.\n"); +  return; +     case T_STRING:    if(t<0) error("Format error, length of string is negative.\n");    if(*l < t) error("Format error, string to short\n");    push_string(make_shared_binary_string(*v, t));    (*l)-= t; (*v)+= t;    return;       case T_ARRAY:    if(t<0) error("Format error, length of array is negative.\n");    check_stack(t);