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.79 2000/12/05 21:08:17 per Exp $"); + RCSID("$Id: encode.c,v 1.80 2001/01/25 11:34:18 hubbe 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:787:    ptrdiff_t len;    ptrdiff_t ptr;    struct mapping *decoded;    struct svalue counter;    struct object *codec;    int pickyness;   };      static void decode_value2(struct decode_data *data);    + static void fallback_codec(void) + { +  size_t x; +  push_constant_text("."); +  f_divide(2); +  f_reverse(1); +  Pike_sp--; +  x=Pike_sp->u.array->size; +  push_array_items(Pike_sp->u.array); +  ref_push_mapping(get_builtin_constants()); +  while(x--) +  { +  stack_swap(); +  f_arrow(2); +  } + } +    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++ ];   }      #define GETC() my_extract_char(data)      #define DECODE(Z) do { \
pike.git/src/encode.c:1249:    data->counter.u.integer++;    decode_value2(data);       switch(num)    {    case 0:    if(data->codec)    {    apply(data->codec,"objectof", 1);    }else{ -  ref_push_mapping(get_builtin_constants()); -  stack_swap(); -  f_index(2); +  fallback_codec();    }    break;       case 1:    if(IS_ZERO(Pike_sp-1))    {    mapping_insert(data->decoded, &tmp, Pike_sp-1);    decode_value2(data);    pop_stack();    }else{
pike.git/src/encode.c:1315:    data->counter.u.integer++;    decode_value2(data);       switch(num)    {    case 0:    if(data->codec)    {    apply(data->codec,"functionof", 1);    }else{ -  ref_push_mapping(get_builtin_constants()); -  stack_swap(); -  f_index(2); +  fallback_codec();    }    break;       case 1:    decode_value2(data);    if(Pike_sp[-2].type==T_INT)    {    pop_stack();    }else{    f_arrow(2);
pike.git/src/encode.c:1359:    decode_value2(data);       /* Keep the value so that we can make a good error-message. */    prog_code = Pike_sp-1;    stack_dup();       if(data->codec)    {    apply(data->codec,"programof", 1);    }else{ -  ref_push_mapping(get_builtin_constants()); -  stack_swap(); -  f_index(2); +  fallback_codec();    }    if(data->pickyness && !program_from_svalue(Pike_sp-1)) {    if ((prog_code->type == T_STRING) &&    (prog_code->u.string->len < 128) &&    (!prog_code->u.string->size_shift)) {    Pike_error("Failed to decode program \"%s\".\n",    prog_code->u.string->str);    }    Pike_error("Failed to decode program.\n");    }