Branch: Tag:

2003-08-03

2003-08-03 00:53:20 by Martin Stjernholm <mast@lysator.liu.se>

Fixed handling of IDREF_MAGIC_THIS. Minor cleanups wrt
identifier_flags.

Rev: src/encode.c:1.193

2:   || 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.192 2003/07/30 18:52:15 mast Exp $ + || $Id: encode.c,v 1.193 2003/08/03 00:53:20 mast Exp $   */      #include "global.h"
27:   #include "bignum.h"   #include "pikecode.h"    - RCSID("$Id: encode.c,v 1.192 2003/07/30 18:52:15 mast Exp $"); + RCSID("$Id: encode.c,v 1.193 2003/08/03 00:53:20 mast Exp $");      /* #define ENCODE_DEBUG */   
1124:    code_number(p->identifiers[d].identifier_flags,data);    code_number(p->identifiers[d].run_time_type,data);    code_number(p->identifiers[d].opt_flags,data); -  if (!(p->identifiers[d].identifier_flags & IDENTIFIER_C_FUNCTION)) { +  if (!IDENTIFIER_IS_C_FUNCTION(p->identifiers[d].identifier_flags)) {    code_number(p->identifiers[d].func.offset,data);    } else {    Pike_error("Cannot encode functions implemented in C "
1328:    }    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, ""));
1352:       /* 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, ""));
1379:       /* 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, ""));
1402:    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    }    }   
2954:    decode_number(p->identifiers[d].identifier_flags,data);    decode_number(p->identifiers[d].run_time_type,data);    decode_number(p->identifiers[d].opt_flags,data); -  if (!(p->identifiers[d].identifier_flags & IDENTIFIER_C_FUNCTION)) +  if (!IDENTIFIER_IS_C_FUNCTION(p->identifiers[d].identifier_flags))    {    decode_number(p->identifiers[d].func.offset,data);    } else {