pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: encode.c,v 1.155 2002/10/11 01:39:30 nilsson Exp $ + || $Id: encode.c,v 1.156 2002/11/22 14:13:20 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"
pike.git/src/encode.c:20:   #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"   #include "pikecode.h"    - RCSID("$Id: encode.c,v 1.155 2002/10/11 01:39:30 nilsson Exp $"); + RCSID("$Id: encode.c,v 1.156 2002/11/22 14:13:20 grubba Exp $");      /* #define ENCODE_DEBUG */      /* Use the old encoding method for programs. */   #define OLD_PIKE_ENCODE_PROGRAM      #ifdef ENCODE_DEBUG   /* Pass a nonzero integer as the third arg to encode_value,    * encode_value_canonic and decode_value to activate this debug. */   #define EDB(N,X) do { debug_malloc_touch(data); if (data->debug>=N) {X;} } while (0)
pike.git/src/encode.c:254:      /* NOTE: Take care to encode it exactly as the corresponing    * type string would have been encoded (cf TFUNCTION, T_MANY).    */   static void encode_type(struct pike_type *t, struct encode_data *data)   {    one_more_type:    if (t->type == T_MANY) {    addchar(T_FUNCTION);    addchar(T_MANY); -  } else if (t->type != PIKE_T_NAME) { +  } else {    addchar(t->type);    }    switch(t->type) {    default:    Pike_fatal("error in type tree: %d.\n", t->type);    /*NOTREACHED*/       break;       case PIKE_T_NAME: -  /* Strip the name. */ +  { +  struct svalue sval; +  sval.type = PIKE_T_STRING; +  sval.subtype = 0; +  sval.u.string = (void *)t->car; +  +  encode_value2(&sval, encode_data); +  }    t=t->cdr;    goto one_more_type;       case T_ASSIGN:    if (((ptrdiff_t)t->car < 0) || ((ptrdiff_t)t->car > 9)) {    Pike_fatal("Bad assign marker: %ld\n", (long)(ptrdiff_t)t->car);    }    addchar('0' + (ptrdiff_t)t->car);    t = t->cdr;    goto one_more_type;
pike.git/src/encode.c:1879:    case '9':    case T_FLOAT:    case T_STRING:    case T_MIXED:    case T_ZERO:    case T_VOID:    case PIKE_T_UNKNOWN:    push_type(tmp);    break;    +  case PIKE_T_NAME: +  decode_value2(data); +  +  if (Pike_sp[-1].type != PIKE_T_STRING) { +  Pike_error("decode_value(): Type name is not a string (%s)\n", +  get_name_of_type(Pike_sp[-1].type)); +  } +  low_decode_type(data); +  push_type_name(Pike_sp[-1].u.string); +  pop_stack(); +  break; +     case T_OBJECT:    {    int flag = GETC();       decode_value2(data);    switch(Pike_sp[-1].type)    {    case T_INT:    push_object_type_backwards(flag, Pike_sp[-1].u.integer );    break;