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.94 2002/04/17 16:27:30 grubba Exp $"); + RCSID("$Id: encode.c,v 1.95 2002/04/18 09:37:32 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 if (data->debug>=N) {X;} while (0)
pike.git/src/encode.c:259:   #endif /* 0 */    case 3: addchar(DO_NOT_WARN((char)((num >> 24)&0xff)));    case 2: addchar(DO_NOT_WARN((char)((num >> 16)&0xff)));    case 1: addchar(DO_NOT_WARN((char)((num >> 8)&0xff)));    case 0: addchar(DO_NOT_WARN((char)(num&0xff)));    }   }      static void code_number(ptrdiff_t num, struct encode_data *data)   { +  EDB(5, fprintf(stderr, "%*scode_number(%d)\n", +  data->depth, "", num));    code_entry(DO_NOT_WARN(num & 15),    num >> 4, data);   }      #ifdef _REENTRANT   static void do_enable_threads(void)   {    exit_threads_disable(NULL);   }   #endif
pike.git/src/encode.c:881:    /* strings */    for(d=0;d<p->num_strings;d++) {    str_sval.u.string = p->strings[d];    encode_value2(&str_sval, data);    }    }       EDB(5,    {    fprintf(stderr, +  "%*sencode: Program flags: 0x%04x\n\n", +  data->depth, "", p->flags); +  +  fprintf(stderr,    "%*sencode: Reference table:\n"    "%*s ####: Flags Inherit Identifier\n",    data->depth, "", data->depth, "");    for (d=0; d < p->num_identifier_references; d++) {    struct reference *ref = p->identifier_references + d;       fprintf(stderr, "%*s %4d: %5x %7d %7d\n",    data->depth, "",    d, ref->id_flags, ref->inherit_offset,    ref->identifier_offset);
pike.git/src/encode.c:1478:    default: \    Pike_error("Failed to decode string, tag is wrong: %d\n", \    what & TAG_MASK); \    } \   }while(0)      #define decode_number(X,data) do { \    INT32 what, e, num, numh; \    DECODE("decode_number"); \    X=(what & TAG_MASK) | (num<<4); \ +  EDB(5, fprintf(stderr, "%*s ==>%d\n", \ +  data->depth, "", X)); \    }while(0) \         static void restore_type_stack(unsigned char *old_stackp)   {   #if 0    fprintf(stderr, "Restoring type-stack: %p => %p\n",    Pike_compiler->type_stackp, old_stackp);   #endif /* 0 */   #ifdef PIKE_DEBUG
pike.git/src/encode.c:2852: Inside #if defined(ENCODE_DEBUG)
     #ifdef ENCODE_DEBUG    data->depth-=2;   #endif       UNSET_ONERROR(err);       /* De-kludge to get end_first_pass() to free the program. */    Pike_compiler->num_parse_error--;    +  p->flags |= PROGRAM_PASS_1_DONE; +     EDB(5,    {    int d;       fprintf(stderr, -  +  "%*sdecode: Program flags: 0x%04x\n\n", +  data->depth, "", p->flags); +  +  fprintf(stderr,    "%*sdecode: Reference table:\n"    "%*s ####: Flags Inherit Identifier\n",    data->depth, "", data->depth, "");    for (d=0; d < p->num_identifier_references; d++) {    struct reference *ref = p->identifier_references + d;       fprintf(stderr, "%*s %4d: %5x %7d %7d\n",    data->depth, "",    d, ref->id_flags, ref->inherit_offset,    ref->identifier_offset);
pike.git/src/encode.c:2955:    } else if ((Pike_sp[-1].type == T_INT) &&    !Pike_sp[-1].u.integer) {    constant->name = NULL;    } else {    Pike_error("Non strings in string table.\n");    }    constant->sval = Pike_sp[-2];    Pike_sp -= 2;    }    +  /* The program should be consistent now. */ +  p->flags &= ~PROGRAM_AVOID_CHECK; +  +  EDB(5, fprintf(stderr, "%*sProgram flags: 0x%04x\n", +  data->depth, "", p->flags)); +    #ifdef ENCODE_DEBUG    data->depth -= 2;   #endif    }    break;       default:    Pike_error("Cannot decode program encoding type %d\n",num);    }    break;