pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:1: + /*\ + ||| This file a part of uLPC, and is copyright by Fredrik Hubinette + ||| uLPC is distributed as GPL (General Public License) + ||| See the files COPYING and DISCLAIMER for more information. + \*/   #include <stdio.h>   #include "global.h"   #include "macros.h"   #include "error.h"   #include "interpret.h"   #include "stralloc.h"   #include "builtin_efuns.h"   #include "array.h"   #include "object.h"      char *automatic_fatal; - JMP_BUF *recoveries; + JMP_BUF *recoveries=0; + ONERROR *onerror_stack=0;      jmp_buf *init_recovery(JMP_BUF *r)   {    r->fp=fp;    r->sp=sp;    r->mark_sp=mark_sp;    r->previous=recoveries; -  +  r->onerror=onerror_stack;    recoveries=r;    return & r->recovery;   }      void throw()   {    if(!recoveries)    fatal("No error recovery context.\n");      #ifdef DEBUG
pike.git/src/error.c:39:   #endif    free_object(fp->current_object);    free_program(fp->context.prog);       fp = fp->parent_frame;    }       pop_n_elems(sp - recoveries->sp);    mark_sp = recoveries->mark_sp;    +  while(recoveries->onerror != onerror_stack) +  { + #ifdef DEBUG +  if(!onerror_stack) +  fatal("Popped out of onerror stack!\n"); + #endif +  (*onerror_stack->func)(onerror_stack->arg); +  onerror_stack=onerror_stack->previous; +  } +     longjmp(recoveries->recovery,1);   }      struct svalue throw_value = { T_INT };      void va_error(char *fmt, va_list args)   {    char buf[2000];    static int in_error;    if(in_error)