pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.218 2001/07/09 14:19:15 grubba Exp $"); + RCSID("$Id: interpret.c,v 1.219 2001/07/13 11:26:38 grubba Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:669:    return;       e=backlogp;    do    {    e++;    if(e>=BACKLOG) e=0;       if(backlog[e].program)    { -  char *file; +  struct pike_string *file;    INT32 line;      #ifdef _REENTRANT    if(thread != backlog[e].thread_id)    {    fprintf(stderr,"[Thread swap, Pike_interpreter.thread_id=%p]\n",backlog[e].thread_id);    thread = backlog[e].thread_id;    }   #endif    -  file=get_line(backlog[e].pc-1,backlog[e].program, &line); +  file = get_line(backlog[e].pc-1,backlog[e].program, &line);   #ifdef HAVE_COMPUTED_GOTO    fprintf(stderr,"%s:%ld: %s", -  file, +  file->str,    (long)line,    get_opcode_name(backlog[e].instruction));   #else /* !HAVE_COMPUTED_GOTO */    if(backlog[e].instruction < 0 || backlog[e].instruction+F_OFFSET > F_MAX_OPCODE)    {    fprintf(stderr,"%s:%ld: ILLEGAL INSTRUCTION %d\n", -  file, +  file->str,    (long)line,    backlog[e].instruction + F_OFFSET); -  +  free_string(file);    continue;    }       fprintf(stderr,"%s:%ld: %s", -  file, +  file->str,    (long)line,    low_get_f_name(backlog[e].instruction + F_OFFSET, backlog[e].program));    if(instrs[backlog[e].instruction].flags & I_HASARG2)    {    fprintf(stderr,"(%ld,%ld)",    (long)backlog[e].arg,    (long)backlog[e].arg2);    }    else if(instrs[backlog[e].instruction].flags & I_JUMP)    {    fprintf(stderr,"(%+ld)", (long)backlog[e].arg);    }    else if(instrs[backlog[e].instruction].flags & I_HASARG)    {    fprintf(stderr,"(%ld)", (long)backlog[e].arg);    }    fprintf(stderr," %ld, %ld\n",    DO_NOT_WARN((long)backlog[e].stack),    DO_NOT_WARN((long)backlog[e].mark_stack));   #endif /* HAVE_COMPUTED_GOTO */ -  +  free_string(file);    }    }while(e!=backlogp);   }      #endif   static int o_catch(PIKE_OPCODE_T *pc);         #ifdef PIKE_DEBUG   #define EVAL_INSTR_RET_CHECK(x) \
pike.git/src/interpret.c:793:    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-2]='.';    }    fprintf(stderr,"%-*s%s\n",4,"-",s);    free(s);   }      static void do_trace_call(INT32 args)   { -  char *file,*s; +  struct pike_string *filep = NULL; +  char *file, *s;    INT32 linep,e;    my_strcat("(");    for(e=0;e<args;e++)    {    if(e) my_strcat(",");    describe_svalue(Pike_sp-args+e,0,0);    }    my_strcat(")");    s=simple_free_buf();    if((size_t)strlen(s) > (size_t)TRACE_LEN)    {    s[TRACE_LEN]=0;    s[TRACE_LEN-1]='.';    s[TRACE_LEN-2]='.';    s[TRACE_LEN-2]='.';    }    if(Pike_fp && Pike_fp->pc)    {    char *f; -  file=get_line(Pike_fp->pc,Pike_fp->context.prog,&linep); -  while((f=STRCHR(file,'/'))) file=f+1; +  filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep); +  file = filep->str; +  while((f=STRCHR(file,'/'))) +  file=f+1;    }else{    linep=0;    file="-";    }    fprintf(stderr,"- %s:%4ld: %s\n",file,(long)linep,s); -  +  if (filep) { +  free_string(filep); +  }    free(s);   }         #undef INIT_BLOCK   #define INIT_BLOCK(X) do { \    X->refs=1; \    X->flags=0; \    X->scope=0; \    DO_IF_SECURITY( if(CURRENT_CREDS) { \
pike.git/src/interpret.c:1798: Inside #if defined(PIKE_DEBUG) and #if defined(PIKE_THREADS)
   f = ts->state.frame_pointer;    else    f = Pike_fp;   #else    f = Pike_fp;   #endif       for (of = 0; f; f = (of = f)->next)    if (f->refs) {    int args, i; -  char *file = 0; +  struct pike_string *file = NULL;    INT32 line;       if (f->context.prog) {    if (f->pc)    file = get_line (f->pc, f->context.prog, &line);    else    file = get_program_line (f->context.prog, &line);    } -  if (file) -  fprintf (stderr, "%s:%d: ", file, line); -  else +  if (file) { +  fprintf (stderr, "%s:%d: ", file->str, line); +  free_string(file); +  } else    fputs ("unknown program: ", stderr);       if (f->current_object && f->current_object->prog) {    /* FIXME: Wide string identifiers. */    fputs (ID_FROM_INT (f->current_object->prog, f->fun)->name->str, stderr);    fputc ('(', stderr);    }    else    fputs ("unknown function(", stderr);   
pike.git/src/interpret.c:1927:    else if(arg->u.object->prog)    fputs (ID_FROM_INT(arg->u.object->prog,arg->subtype)->name->str, stderr);    else    fputc ('0', stderr);    break;       case T_OBJECT: {    struct program *p = arg->u.object->prog;    if (p && p->num_linenumbers) {    file = get_program_line (p, &line); -  fprintf (stderr, "object(%s:%d)", file, line); +  fprintf (stderr, "object(%s:%d)", file->str, line); +  free_string(file);    }    else    fputs ("object", stderr);    break;    }       case T_PROGRAM: {    struct program *p = arg->u.program;    if (p->num_linenumbers) {    file = get_program_line (p, &line); -  fprintf (stderr, "program(%s:%d)", file, line); +  fprintf (stderr, "program(%s:%d)", file->str, line); +  free_string(file);    }    else    fputs ("program", stderr);    break;    }       case T_FLOAT:    fprintf (stderr, "%f",(double) arg->u.float_number);    break;