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: interpret.c,v 1.110 1998/11/20 19:01:06 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.111 1998/11/22 11:02:53 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
83:   }   int pop_sp_mark(void)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(mark_sp < mark_stack)    fatal("Mark stack underflow!\n");   #endif
92:      struct frame *fp; /* frame pointer */    - #ifdef DEBUG + #ifdef PIKE_DEBUG   static void gc_check_stack_callback(struct callback *foo, void *bar, void *gazonk)   {    struct frame *f;
177:    mark_sp=mark_stack;    fp=0;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    {    static struct callback *spcb;    if(!spcb)
375:    }   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void print_return_value(void)   {    if(t_flag>3)
402:      struct callback_list evaluator_callbacks;    - #ifdef DEBUG + #ifdef PIKE_DEBUG   static char trace_buffer[200];   #define GET_ARG() (backlog[backlogp].arg=(\    instr=prefix,\
484:    pop_n_elems(sp - evaluator_stack);   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   #define BACKLOG 512   struct backlog   {
536:    fp->pc = pc;    instr=EXTRACT_UCHAR(pc++);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag)    {   #if defined(_REENTRANT) && !defined(__NT__)
690:    {    if(inherit->parent_offset)    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t_flag>4)    {    sprintf(trace_buffer,"- Following o->parent (accumulator+=%d)\n",inherit->parent_offset-1);
702:    o=o->parent;    accumulator+=inherit->parent_offset-1;    }else{ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t_flag>4)    {    sprintf(trace_buffer,"- Following inherit->parent (accumulator+=%d)\n",inherit->parent_offset-1);
1463:       CASE(F_RETURN);    do_return: - #if defined(DEBUG) && defined(GC2) + #if defined(PIKE_DEBUG) && defined(GC2)    if(d_flag>2) do_gc();    if(d_flag>3) do_debug();    check_threads_etc();
1863:    case T_FUNCTION:    if(s->subtype == FUNCTION_BUILTIN)    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t_flag>1)    {    init_buf();
1881:    break;       case T_ARRAY: - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t_flag>1)    {    init_buf();
1893:    break;       case T_PROGRAM: - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t_flag>1)    {    init_buf();
1913:    }       call_lfun: - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(fun < 0 || fun >= NUM_LFUNS)    fatal("Apply lfun on illegal value!\n");   #endif
1945:    check_mark_stack(256);    check_c_stack(8192);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag>2) do_debug();   #endif   
1953:    if(!p)    PIKE_ERROR("destructed object->function",    "Cannot call functions in destructed objects.\n", sp, args); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(fun>=(int)p->num_identifier_references)    {    fprintf(stderr,"Function index out of range. %d >= %d\n",fun,(int)p->num_identifier_references);
1966:   #endif       ref = p->identifier_references + fun; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(ref->inherit_offset>=p->num_inherits)    fatal("Inherit offset out of range in program.\n");   #endif
2089:       clear_svalues(sp, num_locals - args);    sp += num_locals - args; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(num_locals < num_args)    fatal("Wrong number of arguments or locals in function def.\n");   #endif
2101:    {    struct svalue **save_mark_sp=mark_sp;    tailrecurse=eval_instruction(pc); - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(mark_sp < save_mark_sp)    fatal("Popped below save_mark_sp!\n");   #endif    mark_sp=save_mark_sp;    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(sp<evaluator_stack)    fatal("Stack error (also simple).\n");   #endif
2123: Inside #if defined(PROFILING) and #if defined(HAVE_GETHRTIME)
   time_passed = gethrtime() - time_base - start_time;    self_time=time_passed - time_in_children;    accounted_time+=self_time; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(self_time < 0 || children_base <0 || accounted_time <0)    fatal("Time is negative\n self_time=%ld\n time_passed=%ld\n time_in_children=%ld\n children_base=%ld\n accounted_time=%ld!\n time_base=%ld\n start_time=%ld\n",    (long)(self_time/100000),
2146: Inside #if 0
   {    pop_n_elems(sp - new_frame.locals -1);    }else if(sp - new_frame.locals < 1){ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(sp - new_frame.locals<0) fatal("Frame underflow.\n");   #endif    sp->u.integer = 0;
2249:    int tmp=eval_instruction(o->prog->program + offset);    if(tmp!=-1) mega_apply(APPLY_STACK, tmp, 0,0);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(sp<evaluator_stack)    fatal("Stack error (simple).\n");   #endif
2307:      void safe_apply(struct object *o, char *fun ,INT32 args)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!o->prog) fatal("Apply safe on destructed object.\n");   #endif    safe_apply_low(o, find_identifier(fun, o->prog), args);
2315:      void apply_lfun(struct object *o, int fun, int args)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(fun < 0 || fun >= NUM_LFUNS)    fatal("Apply lfun on illegal value!\n");   #endif
2356:    {    push_int(0);    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(sp < (expected_stack + evaluator_stack))    fatal("Stack underflow!\n");   #endif    }   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void slow_check_stack(void)   {    struct svalue *s,**m;
2411:      void cleanup_interpret(void)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    int e;   #endif   
2423:    fp = fp->parent_frame;    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    for(e=0;e<BACKLOG;e++)    {    if(backlog[e].program)