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.88 2001/02/24 22:41:11 grubba Exp $"); + RCSID("$Id: encode.c,v 1.89 2001/03/03 00:28:35 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:342: Inside #if defined(USE_PIKE_TYPE)
   case T_STRING:    case T_PROGRAM:    case T_MIXED:    case T_ZERO:    case T_VOID:    case PIKE_T_UNKNOWN:    break;       case T_OBJECT:    { -  INT32 x; +     addchar((ptrdiff_t)t->car);       if(t->cdr)    { -  struct program *p=id_to_program(x); +  struct program *p=id_to_program((ptrdiff_t)t->cdr);    if(p)    {    ref_push_program(p);    }else{    push_int(0);    }    }else{    push_int(0);    }    encode_value2(Pike_sp-1, data);
pike.git/src/encode.c:1082:    } \   }while(0)      #define decode_number(X,data) do { \    INT32 what, e, num, numh; \    DECODE("decode_number"); \    X=(what & TAG_MASK) | (num<<4); \    }while(0) \       - static void restore_type_stack(unsigned char *old_stackp) + static void restore_type_stack(struct pike_type **old_stackp)   {   #if 0    fprintf(stderr, "Restoring type-stack: %p => %p\n",    Pike_compiler->type_stackp, old_stackp);   #endif /* 0 */   #ifdef PIKE_DEBUG    if (old_stackp > Pike_compiler->type_stackp) {    fatal("type stack out of sync!\n");    }   #endif /* PIKE_DEBUG */    Pike_compiler->type_stackp = old_stackp;   }    - static void restore_type_mark(unsigned char **old_type_mark_stackp) + static void restore_type_mark(struct pike_type ***old_type_mark_stackp)   {   #if 0    fprintf(stderr, "Restoring type-mark: %p => %p\n",    Pike_compiler->pike_type_mark_stackp, old_type_mark_stackp);   #endif /* 0 */   #ifdef PIKE_DEBUG    if (old_type_mark_stackp > Pike_compiler->pike_type_mark_stackp) {    fatal("type Pike_interpreter.mark_stack out of sync!\n");    }   #endif /* PIKE_DEBUG */
pike.git/src/encode.c:1131:   one_more_type:    tmp = GETC();    switch(tmp)    {    default:    fatal("error in type string.\n");    /*NOTREACHED*/    break;       case T_ASSIGN: + #ifdef USE_PIKE_TYPE +  low_decode_type(data); +  push_assign_type(GETC()); +  break; + #else /* !USE_PIKE_TYPE */    push_type(tmp);    push_type(GETC());    goto one_more_type; -  + #endif /* USE_PIKE_TYPE */       case T_FUNCTION: -  + #ifdef USE_PIKE_TYPE +  { +  int narg = 0; +  +  while (GETC() != T_MANY) { +  data->ptr--; +  low_decode_type(data); +  narg++; +  } +  low_decode_type(data); /* Many */ +  low_decode_type(data); /* Return */ +  push_reverse_type(T_MANY); +  while(narg-- > 0) { +  push_reverse_type(T_FUNCTION); +  } +  } +  break; + #else /* !USE_PIKE_TYPE */    push_type(tmp);    while(GETC()!=T_MANY)    {    data->ptr--;    low_decode_type(data);    }    push_type(T_MANY);    low_decode_type(data);    goto one_more_type; -  + #endif /* USE_PIKE_TYPE */       case T_MAPPING:    case T_OR:    case T_AND: -  + #ifdef USE_PIKE_TYPE +  low_decode_type(data); +  low_decode_type(data); +  push_reverse_type(tmp); +  break; + #else /* !USE_PIKE_TYPE */    push_type(tmp);    low_decode_type(data);    goto one_more_type; -  + #endif /* USE_PIKE_TYPE */       case T_ARRAY:    case T_MULTISET:    case T_NOT: -  + #ifdef USE_PIKE_TYPE +  low_decode_type(data);    push_type(tmp); -  +  break; + #else /* !USE_PIKE_TYPE */ +  push_type(tmp);    goto one_more_type; -  + #endif /* USE_PIKE_TYPE */       case T_INT: -  + #ifdef USE_PIKE_TYPE    { -  +  INT32 min=0, max=0; +  min = GETC(); +  min = (min<<8)|GETC(); +  min = (min<<8)|GETC(); +  min = (min<<8)|GETC(); +  max = GETC(); +  max = (max<<8)|GETC(); +  max = (max<<8)|GETC(); +  max = (max<<8)|GETC(); +  push_int_type(min, max); +  } + #else /* !USE_PIKE_TYPE */ +  {    int i;    push_type(tmp);    /* FIXME: I assume the type is saved in network byte order. Is it?    * /grubba 1999-03-07    */    for(i = 0; i < (int)(2*sizeof(INT32)); i++) {    push_type(GETC());    }    } -  + #endif /* USE_PIKE_TYPE */    break;       case '0':    case '1':    case '2':    case '3':    case '4':    case '5':    case '6':    case '7':
pike.git/src/encode.c:1236:    get_name_of_type(Pike_sp[-1].type));    }    pop_stack();    }    }       UNSET_ONERROR(err2);    UNSET_ONERROR(err1);   }    + #ifdef USE_PIKE_TYPE   /* This really needs to disable threads.... */   #define decode_type(X,data) do { \    type_stack_mark(); \ -  +  low_decode_type(data); \ +  (X)=pop_unfinished_type(); \ + } while(0) + #else /* !USE_PIKE_TYPE */ + /* This really needs to disable threads.... */ + #define decode_type(X,data) do { \    type_stack_mark(); \ -  +  type_stack_mark(); \    low_decode_type(data); \    type_stack_reverse(); \    (X)=pop_unfinished_type(); \   } while(0) -  + #endif /* USE_PIKE_TYPE */      static void decode_value2(struct decode_data *data)      #ifdef PIKE_DEBUG   #undef decode_value2   #define decode_value2(X) do { struct svalue *_=Pike_sp; decode_value2_(X); if(Pike_sp!=_+1) fatal("decode_value2 failed!\n"); } while(0)   #endif         {