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.171 2004/05/11 11:28:52 grubba Exp $ + || $Id: encode.c,v 1.172 2004/05/11 11:36:40 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:25:   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"   #include "pikecode.h"   #include "pike_types.h"   #include "opcodes.h"   #include "peep.h"    - RCSID("$Id: encode.c,v 1.171 2004/05/11 11:28:52 grubba Exp $"); + RCSID("$Id: encode.c,v 1.172 2004/05/11 11:36:40 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:1294:    code_number(ref_no, data);    } else {    if (id_dumped[ref->identifier_offset]) {    EDB(3,    fprintf(stderr, "%*sencode: already encoded reference\n",    data->depth, ""));    goto next_identifier_ref;    }    id_dumped[ref->identifier_offset] = 1;    -  if (IDENTIFIER_IS_CONSTANT(id->identifier_flags)) { -  /* Constant */ -  +  switch (id->identifier_flags & IDENTIFIER_TYPE_MASK) { +  case IDENTIFIER_CONSTANT:    EDB(3,    fprintf(stderr, "%*sencode: encoding constant\n",    data->depth, ""));       code_number(ID_ENTRY_CONSTANT, data);    code_number(ref->id_flags, data);       /* name */    str_sval.u.string = id->name;    encode_value2(&str_sval, data, 0);
pike.git/src/encode.c:1318:    /* offset */    code_number(id->func.offset, data);       /* type */    ref_push_type_value(id->type);    encode_value2(Pike_sp-1, data, 0);    pop_stack();       /* run-time type */    code_number(id->run_time_type, data); -  } else if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags)) { -  /* Pike function */ +  break;    -  +  case IDENTIFIER_PIKE_FUNCTION:    EDB(3,    fprintf(stderr, "%*sencode: encoding function\n",    data->depth, ""));       code_number(ID_ENTRY_FUNCTION, data);    code_number(ref->id_flags, data);       /* name */    str_sval.u.string = id->name;    encode_value2(&str_sval, data, 0);
pike.git/src/encode.c:1345:    pop_stack();       /* func_flags (aka identifier_flags) */    code_number(id->identifier_flags, data);       /* func */    code_number(id->func.offset, data);       /* opt_flags */    code_number(id->opt_flags, data); -  } else if (id->identifier_flags & IDENTIFIER_C_FUNCTION) { -  /* C Function */ +  break; +  +  case IDENTIFIER_C_FUNCTION:    /* Not supported. */    Pike_error("Cannot encode functions implemented in C "    "(identifier='%s').\n",    p->identifiers[d].name->str); -  } else { -  /* Variable */ +  break; +  +  case IDENTIFIER_VARIABLE:    EDB(3,    fprintf(stderr, "%*sencode: encoding variable\n",    data->depth, ""));       code_number(ID_ENTRY_VARIABLE, data);    code_number(ref->id_flags, data);       /* name */    str_sval.u.string = id->name;    encode_value2(&str_sval, data, 0);       /* type */    ref_push_type_value(id->type);    encode_value2(Pike_sp-1, data, 0);    pop_stack(); -  +  break; +  +  default:; + #ifdef PIKE_DEBUG +  Pike_fatal ("Unknown identifier type.\n"); + #endif    }    }       /* Identifier reference number */    code_number(d, data);       next_identifier_ref:    ; /* C requires a statement after lables. */   #ifdef ENCODE_DEBUG    data->depth -= 2;