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.182 2004/05/11 15:42:50 grubba Exp $ + || $Id: encode.c,v 1.183 2004/05/11 19:50: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.182 2004/05/11 15:42:50 grubba Exp $"); + RCSID("$Id: encode.c,v 1.183 2004/05/11 19:50: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:1124:    p->inherits[d].prog->id););    }       for(d=0;d<p->num_identifiers;d++)    {    adddata(p->identifiers[d].name);    encode_type(p->identifiers[d].type, data);    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 "    "(identifier='%s').\n",    p->identifiers[d].name->str);    }    }       for(d=0;d<NUM_LFUNS;d++)    code_number(p->lfuns[d], data);
pike.git/src/encode.c:3101:    SET_ONERROR(err2, restore_type_mark, Pike_compiler->pike_type_mark_stackp);       debug_malloc_touch(p);    for(d=0;d<p->num_identifiers;d++)    {    getdata(p->identifiers[d].name);    decode_type(p->identifiers[d].type,data);    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 {    ref_push_program (p);    ref_push_string (p->identifiers[d].name);    decode_error(Pike_sp - 1, Pike_sp - 2,    "Cannot decode function implemented in C: ");    }    }   
pike.git/src/encode.c:4023:    CALL_AND_UNSET_ONERROR(err2);       EDB(5, dump_program_tables(p, data->depth));   #ifdef PIKE_DEBUG    check_program (p);   #endif       if (bytecode_method == PIKE_BYTECODE_PORTABLE) {    /* We've regenerated p->program, so these may be off. */    local_num_program = p->num_program; +  local_num_relocations = p->num_relocations;    local_num_linenumbers = p->num_linenumbers;    }       /* Verify... */   #define FOO(NUMTYPE,TYPE,NAME) \    if (PIKE_CONCAT(local_num_, NAME) != p->PIKE_CONCAT(num_,NAME)) { \    ref_push_program (p); \    decode_error(Pike_sp - 1, NULL, \    "Value mismatch for num_" TOSTR(NAME) ": %d != %d\n", \    PIKE_CONCAT(local_num_, NAME), \
pike.git/src/encode.c:4416:    (*l) -= t; (*v) += t;    APPLY_MASTER("programof", 1);    return;       default:    Pike_error("Format error: Unknown type tag %ld:%ld\n",    PTRDIFF_T_TO_LONG(i), PTRDIFF_T_TO_LONG(t));    }   }    - /*! @decl mixed decode_value(string coded_value, object|void codec) + /*! @decl mixed decode_value(string coded_value, void|Codec codec)    *! -  *! Decode a value from a string. +  *! Decode a value from the string @[coded_value].    *!    *! This function takes a string created with @[encode_value()] or    *! @[encode_value_canonic()] and converts it back to the value that was    *! coded.    *! -  *! If no codec is specified, the current master object will be used as codec. +  *! If @[codec] is specified, it's used as the codec for the decode. +  *! If no codec is specified, the current master object will be used.    *!    *! @seealso    *! @[encode_value()], @[encode_value_canonic()]    */   void f_decode_value(INT32 args)   {    struct pike_string *s;    struct object *codec;      #ifdef ENCODE_DEBUG