Branch: Tag:

1998-11-22

1998-11-22 11:08:52 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

New module: Perl

Rev: src/ChangeLog:1.157
Rev: src/README:1.8
Rev: src/acconfig.h:1.35
Rev: src/array.c:1.42
Rev: src/array.h:1.14
Rev: src/backend.c:1.40
Rev: src/builtin_functions.c:1.140
Rev: src/callback.c:1.15
Rev: src/compilation.h:1.13
Rev: src/configure.in:1.254
Rev: src/cpp.c:1.30
Rev: src/docode.c:1.42
Rev: src/dynamic_buffer.c:1.9
Rev: src/encode.c:1.26
Rev: src/error.c:1.22
Rev: src/error.h:1.25
Rev: src/fd_control.c:1.22
Rev: src/fdlib.h:1.21
Rev: src/gc.c:1.39
Rev: src/gc.h:1.20
Rev: src/global.h:1.26
Rev: src/hashtable.c:1.5
Rev: src/interpret.c:1.111
Rev: src/interpret.h:1.24
Rev: src/language.yacc:1.108
Rev: src/las.c:1.71
Rev: src/las.h:1.17
Rev: src/lex.c:1.58
Rev: src/lex.h:1.12
Rev: src/main.c:1.60
Rev: src/mapping.c:1.37
Rev: src/modules/Odbc/odbc.c:1.12
Rev: src/modules/Perl/.cvsignore:1.1
Rev: src/modules/Perl/Makefile.in:1.1
Rev: src/modules/Perl/configure.in:1.1
Rev: src/modules/Perl/perlmod.c:1.1
Rev: src/modules/Perl/testsuite.in:1.1
Rev: src/modules/Postgres/postgres.c:1.10
Rev: src/modules/Regexp/pike_regexp.c:1.13
Rev: src/modules/call_out/call_out.c:1.23
Rev: src/modules/files/file.c:1.128
Rev: src/modules/files/socket.c:1.40
Rev: src/modules/spider/spider.c:1.76
Rev: src/modules/sprintf/sprintf.c:1.31
Rev: src/multiset.c:1.12
Rev: src/object.c:1.53
Rev: src/opcodes.c:1.32
Rev: src/operators.c:1.44
Rev: src/peep.c:1.25
Rev: src/pike_memory.c:1.28
Rev: src/pike_types.c:1.49
Rev: src/pike_types.h:1.16
Rev: src/port.c:1.18
Rev: src/port.h:1.20
Rev: src/program.c:1.105
Rev: src/program.h:1.46
Rev: src/signal_handler.c:1.89
Rev: src/stralloc.c:1.50
Rev: src/stralloc.h:1.26
Rev: src/svalue.c:1.39
Rev: src/svalue.h:1.19
Rev: src/threads.c:1.85
Rev: src/threads.h:1.60

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: program.c,v 1.104 1998/11/13 01:28:44 hubbe Exp $"); + RCSID("$Id: program.c,v 1.105 1998/11/22 11:03:14 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
113:      /* So what if we don't have templates? / Hubbe */    - #ifdef DEBUG + #ifdef PIKE_DEBUG   #define CHECK_FOO(NUMTYPE,TYPE,NAME) \    if(malloc_size_program-> PIKE_CONCAT(num_,NAME) < new_program-> PIKE_CONCAT(num_,NAME)) \    fatal("new_program->num_" #NAME " is out of order\n"); \
196:   void unuse_modules(INT32 howmany)   {    if(!howmany) return; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(howmany *sizeof(struct svalue) > used_modules.s.len)    fatal("Unusing too many modules.\n");   #endif
437:   {    INT32 i,e,t;    if(new_program->flags & PROGRAM_FIXED) return; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(new_program->flags & PROGRAM_OPTIMIZED)    fatal("Cannot fixate optimized program\n");   #endif
545:    }       malloc_size_program = ALLOC_STRUCT(program); - #ifdef DEBUG + #ifdef PIKE_DEBUG    fake_object=(struct object *)xalloc(sizeof(struct object) + 256*sizeof(struct svalue));    /* Stipple to find illegal accesses */    MEMSET(fake_object,0x55,sizeof(struct object) + 256*sizeof(struct svalue));
603:       push_compiler_frame();    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(lex.current_file)    store_linenumber(last_pc, lex.current_file);   #endif
681:    GC_FREE();   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void dump_program_desc(struct program *p)   {    int e,d,q;
781:    }   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void check_program(struct program *p)   {    INT32 size,e;
924:    prog=new_program;    add_ref(prog);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    check_program(prog);    if(l_flag)    dump_program_desc(prog);
980:    SIZE_T offset;    offset=DO_ALIGN(new_program->storage_needed, alignment);    new_program->storage_needed = offset + size; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(alignment <=0) fatal("Alignment must be at least 1\n");    if(new_program->storage_needed<0)    fatal("add_storage failed horribly!\n");
1076:    int e,i;    struct program *p=state?state->new_program:new_program;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(function_name!=debug_findstring(function_name))    fatal("reference_inherited_function on nonshared string.\n");   #endif
1174:    struct object *o;    for(o=fake_object->parent;o!=parent;o=o->parent)    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!o) fatal("low_inherit with odd fake_object as parent!\n");   #endif    inherit.parent_offset++;
1402:    struct identifier dummy;    struct reference ref;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))    fatal("Attempting to add variable to fixed program\n");   
1460:   {    int n, run_time_type;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(name!=debug_findstring(name))    fatal("define_variable on nonshared string.\n");   #endif
1478:    return n;    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))    fatal("Attempting to add variable to fixed program\n");   #endif
1545:    struct identifier dummy;    struct reference ref;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(name!=debug_findstring(name))    fatal("define_constant on nonshared string.\n");   #endif
1576:    }    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))    fatal("Attempting to add constant to fixed program\n");   
1816:    }    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(compiler_pass==2)    fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n");   #endif
1906:    {    unsigned short *funindex = prog->identifier_index;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!funindex)    fatal("No funindex in fixed program\n");   #endif
2252:      struct program *compile(struct pike_string *prog)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    JMP_BUF tmp;   #endif    struct program *p;
2263:    INT32 num_used_modules_save = num_used_modules;    void yyparse(void);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(SETJMP(tmp))    fatal("Compiler exited with longjump!\n");   #endif
2310:    p=end_program();    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (threads_disabled < saved_threads_disabled) {    fatal("compile(): threads_disabled:%d saved_threads_disabled:%d\n",    threads_disabled, saved_threads_disabled);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    threads_disabled = saved_threads_disabled + 1;    /* fprintf(stderr, "compile() Leave: threads_disabled:%d, compilation_depth:%d\n", threads_disabled, compilation_depth); */   
2325:    lex=save_lex;       unuse_modules(1); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(num_used_modules)    fatal("Failed to pop modules properly.\n");   #endif
2335:    used_modules = used_modules_save;    num_used_modules = num_used_modules_save ;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    UNSETJMP(tmp);   #endif   
2372:    return ret;   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void check_all_programs(void)   {    struct program *p;
2453: Inside #if defined(GC2)
   {    if(p->inherits[e].parent)    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(debug_gc_check(p->inherits[e].parent,T_PROGRAM,p)==-2)    fprintf(stderr,"(program at 0x%lx -> inherit[%d].parent)\n",    (long)p,
2470:    debug_gc_check(p->inherits[e].prog, T_PROGRAM, p);    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag)    {    int e;
2567:    struct compiler_frame *f;    int e;    f=compiler_frame; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!f)    fatal("Popping out of compiler frames\n");   #endif
2599:    pid=p->id;    hval=oid*9248339 + pid;    hval%=GET_STORAGE_CACHE_SIZE; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(hval>GET_STORAGE_CACHE_SIZE)    fatal("hval>GET_STORAGE_CACHE_SIZE");   #endif
2690:   {    unsigned INT32 h=(parent->id * 9248339 + child->id);    h= h % FIND_CHILD_HASHSIZE; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(h>=FIND_CHILD_HASHSIZE)    fatal("find_child failed to hash within boundaries.\n");   #endif
2771:       hval = a->id*9248339 + b->id;    hval %= IMPLEMENTS_CACHE_SIZE; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(hval >= IMPLEMENTS_CACHE_SIZE)    fatal("Implements_cache failed!\n");   #endif