pike.git / src / program.c

version» Context lines:

pike.git/src/program.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: program.c,v 1.735 2008/07/14 11:49:10 grubba Exp $ + || $Id: program.c,v 1.736 2008/07/16 01:00:19 mast Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:3129:    line += get_small_number(&cnt);    fprintf(stderr, "%*s %8d:%8d\n", indent, "", off, line);    }    }       fprintf(stderr, "\n");   }      void check_program(struct program *p)   { -  INT32 size; -  unsigned INT32 checksum, e; +  unsigned INT32 e;    int variable_positions[1024];       if(p->flags & PROGRAM_AVOID_CHECK) return;       for(e=0;e<NELEM(variable_positions);e++)    variable_positions[e]=-1;       if(p->id > current_program_id)    Pike_fatal("Program id is out of sync! (p->id=%d, current_program_id=%d)\n",p->id,current_program_id);   
pike.git/src/program.c:3897:   #endif /* PIKE_DEBUG */    return num_id_refs; /* aka np->num_identifier_references - 1 */   }      int low_reference_inherited_identifier(struct program_state *q,    int e,    struct pike_string *name,    int flags)   {    struct program *np=(q?q:Pike_compiler)->new_program; -  struct reference funp; +     struct program *p; -  int i,d,refs; +  int i;       p=np->inherits[e].prog;    i=find_shared_string_identifier(name,p);    if(i==-1)    {    i=really_low_find_shared_string_identifier(name,p, flags);    if(i==-1) return -1;    }       if(p->identifier_references[i].id_flags & ID_HIDDEN)
pike.git/src/program.c:4520:    default:    resolv_class(n);    do_inherit(Pike_sp-1, flags, name);    pop_stack();    }   }      int call_handle_inherit(struct pike_string *s)   {    struct compilation *c = THIS_COMPILATION; -  int args; +        CHECK_COMPILER();       ref_push_string(s);    if (!TEST_COMPAT(7,6)) {    /* In Pike 7.7 and later filenames belonging to Pike are assumed    * to be encoded according to UTF-8.    */    f_string_to_utf8(1);    }
pike.git/src/program.c:5050: Inside #if 0
     #if 0    if (!c) {    c = &svalue_int_zero;    }   #endif      #ifdef PIKE_DEBUG    if(name!=debug_findstring(name))    Pike_fatal("define_constant on nonshared string.\n"); +  if (c) { +  check_svalue (c); +  if (c->type > MAX_TYPE) +  /* check_svalue allows some things like T_SVALUE_PTR. */ +  Pike_fatal ("Invalid type in svalue: %d\n", c->type); +  }   #endif       n = isidentifier(name);       if(   #if 1    c &&   #endif    c->type == T_FUNCTION &&    c->subtype != FUNCTION_BUILTIN &&
pike.git/src/program.c:5122:    {    yyerror("Pass2: Constant disappeared!");    }else{    struct identifier *id;    id=ID_FROM_INT(Pike_compiler->new_program,n);    if(id->func.offset>=0) {    /* Update the stored constant. */    assign_svalue (&PROG_FROM_INT(Pike_compiler->new_program,n)->    constants[id->func.offset].sval, c);    } else { -  id->run_time_type = c->type; +  id->run_time_type = (unsigned char) c->type;    id->func.offset = store_constant(c, 0, 0);    }    free_type(id->type);    if ((c->type == T_INT) && !(flags & ID_INLINE)) {    if (c->u.integer) {    copy_pike_type(id->type, int_type_string);    } else {    copy_pike_type(id->type, zero_type_string);    }    } else {
pike.git/src/program.c:5173:   #endif    if ((c->type == T_INT) && !(flags & ID_INLINE)) {    if (c->u.integer) {    copy_pike_type(dummy.type, int_type_string);    } else {    copy_pike_type(dummy.type, zero_type_string);    }    } else {    dummy.type = get_type_of_svalue(c);    } -  dummy.run_time_type=c->type; +  dummy.run_time_type = (unsigned char) c->type;    dummy.func.offset=store_constant(c, 0, 0);    dummy.opt_flags=OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND;    if(c->type == PIKE_T_PROGRAM && (c->u.program->flags & PROGRAM_CONSTANT))    dummy.opt_flags=0;   #if 1    }    else {    copy_pike_type(dummy.type, mixed_type_string);    dummy.run_time_type=T_MIXED;    dummy.func.offset=-1;
pike.git/src/program.c:5290:    free_string(id);    return ret;   }      PMOD_EXPORT int add_float_constant(const char *name,    FLOAT_ARG_TYPE f,    INT32 flags)   {    struct svalue tmp;    tmp.type=T_FLOAT; -  tmp.u.float_number = f; +  tmp.u.float_number = (FLOAT_TYPE) f;    tmp.subtype=0;    return simple_add_constant(name, &tmp, flags);   }      PMOD_EXPORT int quick_add_float_constant(const char *name,    int name_length,    FLOAT_ARG_TYPE f,    INT32 flags)   {    struct svalue tmp;    struct pike_string *id;    INT32 ret;    -  tmp.u.float_number=f; +  tmp.u.float_number = (FLOAT_TYPE) f;    tmp.type=T_FLOAT;    tmp.subtype=0;    id=make_shared_binary_string(name,name_length);    ret=add_constant(id, &tmp, flags);    free_string(id);    return ret;   }      PMOD_EXPORT int add_string_constant(const char *name,    const char *str,
pike.git/src/program.c:5935:    return i;    }    }    return id;   }      PMOD_EXPORT int low_find_lfun(struct program *p, ptrdiff_t lfun)   {    struct pike_string *lfun_name = lfun_strings[lfun];    unsigned int flags = 0; + #if 0    struct identifier *id; -  + #endif    int i =    really_low_find_shared_string_identifier(lfun_name,    dmalloc_touch(struct program *,    p),    SEE_PROTECTED);   #if 0    if (i < 0 || !(p->flags & PROGRAM_FIXED)) return i;    id = ID_FROM_INT(p, i);    if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags) &&    (id->func.offset == -1)) {
pike.git/src/program.c:6465: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if (prog->linenumbers)    Pike_fatal ("Program already got linenumber info.\n");    if (Pike_compiler->new_program == prog)    Pike_fatal ("Use store_linenumber instead when the program is compiled.\n");   #endif       ptr = prog->linenumbers = xalloc (1 + 5 + 1 + (file->len << file->size_shift) + 5 + 5);    *ptr++ = 127;    ext_insert_small_number (&ptr, file->len); -  *ptr++ = file->size_shift; +  *ptr++ = (char) file->size_shift;    MEMCPY (ptr, file->str, file->len << file->size_shift);    ptr += file->len << file->size_shift;    *ptr++ = 0; /* PC */    ext_insert_small_number (&ptr, line);    prog->num_linenumbers = ptr - prog->linenumbers;   }      void store_linenumber(INT32 current_line, struct pike_string *current_file)   {   /* if(!store_linenumbers) Pike_fatal("Fnord.\n"); */
pike.git/src/program.c:6893:    * string_builder_vsprintf() if the number of extra    * Pike stack arguments (args) is zero.    */   PMOD_EXPORT void va_yyreport(int severity_level,    struct pike_string *file, INT32 line,    struct pike_string *system, INT32 args,    const char *fmt, va_list vargs)   {    struct compilation *c = MAYBE_THIS_COMPILATION;    struct string_builder s; -  struct pike_string *msg; +        if (!c) {    /* No compiler context. */    pop_n_elems(args);    return;    }       STACK_LEVEL_START(args);      #ifdef PIKE_DEBUG
pike.git/src/program.c:7239: Inside #if 0
     #if 0    fprintf(stderr, "verify_supporters start\n");   #endif       mark_supporters(current_supporter);    low_verify_supporters(current_supporter);   #ifdef DO_PIKE_CLEANUP    {    size_t e=0; -  struct supporter_marker *h; +     for(e=0;e<supporter_marker_hash_table_size;e++)    while(supporter_marker_hash_table[e])    remove_supporter_marker(supporter_marker_hash_table[e]->data);    }   #endif    exit_supporter_marker_hash();      #if 0    fprintf(stderr, "verify_supporters end\n");   #endif
pike.git/src/program.c:8244:    *! @[CompilationHandler]    */   static void f_compilation_create(INT32 args)   {    struct pike_string *aprog = NULL;    struct object *ahandler = NULL;/* error handler */    int amajor = -1;    int aminor = -1;    struct program *atarget = NULL;    struct object *aplaceholder = NULL; -  int delay, dependants_ok = 1; -  struct program *ret; - #ifdef PIKE_DEBUG -  ONERROR tmp; - #endif +  int dependants_ok = 1;    struct compilation *c = THIS_COMPILATION;       if (c->flags & COMPILER_BUSY) {    Pike_error("PikeCompiler object is in use.\n");    }       STACK_LEVEL_START(args);       get_all_args("create", args, ".%W%O%d%d%P%O",    &aprog, &ahandler,
pike.git/src/program.c:9006:   /*! @endclass    */      /* Strap the compiler by creating the compilation program by hand. */   static void compile_compiler(void)   {    struct program *p = low_allocate_program();    struct program *p2 = compilation_program = low_allocate_program();    struct object *co;    struct inherit *inh; -  struct pike_string *pike_compiler_string; +        p->parent_info_storage = -1;    /* p->event_handler = compilation_env_event_handler; */    p->flags |= PROGRAM_HAS_C_METHODS;      #if 0    /* ADD_STORAGE(struct compilation_env); */    p->alignment_needed = ALIGNOF(struct compilation_env);    p->storage_needed = p->xstorage + sizeof(struct compilation_env);   #endif /* 0 */
pike.git/src/program.c:9202:    tFunc(tInt tInt, tObj), 0);       ADD_FUNCTION("get_default_module",    f_compilation_env_get_default_module,    tFunc(tNone, tOr(tMap(tStr, tMix), tObj)), 0);       ADD_FUNCTION("handle_inherit", f_compilation_env_handle_inherit,    tFunc(tStr tStr tOr(tObj, tVoid), tPrg(tObj)), 0);       { -  struct pike_string *type_name; +     struct svalue type_value;       /* enum SeverityLevel { NOTICE, WARNING, ERROR, FATAL } */    type_value.type = PIKE_T_TYPE;    type_value.subtype = 0;    type_value.u.type = CONSTTYPE(tName("SeverityLevel", tInt03));    simple_add_constant("SeverityLevel", &type_value, 0);    free_svalue(&type_value);       add_integer_constant("NOTICE", REPORT_NOTICE, 0);
pike.git/src/program.c:9944:    " as identifier type in a program");   #endif       } GC_LEAVE;   }      unsigned gc_touch_all_programs(void)   {    unsigned n = 0;    struct program *p; -  struct program_state *ps; +     if (first_program && first_program->prev)    Pike_fatal("Error in program link list.\n");    for (p = first_program; p; p = p->next) {    debug_gc_touch(p);    n++;    if (p->next && p->next->prev != p)    Pike_fatal("Error in program link list.\n");    }    return n;   }
pike.git/src/program.c:10277:   }      /* NOTE: Does not add references to the return value! */   PMOD_EXPORT struct program *program_from_svalue(const struct svalue *s)   {    switch(s->type)    {    case T_OBJECT:    {    struct program *p = s->u.object->prog; + #if 0    int call_fun; -  + #endif       if (!p) return 0;      #if 0    p = p->inherits[s->subtype].prog;    if ((call_fun = FIND_LFUN(p, LFUN_CALL)) >= 0) {    /* Get the program from the return type. */    struct identifier *id = ID_FROM_INT(p, call_fun);    /* FIXME: do it. */    return 0;