Branch: Tag:

2008-04-12

2008-04-12 14:04:09 by Henrik Grubbström (Grubba) <grubba@grubba.org>

ONERROR now keeps track of what frame it was called in, so that it can be restored when triggered.

Rev: src/error.c:1.154
Rev: src/pike_error.h:1.43

2:   || 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: error.c,v 1.153 2008/03/29 11:50:56 mast Exp $ + || $Id: error.c,v 1.154 2008/04/12 14:04:09 grubba Exp $   */      #define NO_PIKE_SHORTHAND
116:    {    while(Pike_interpreter.recoveries->onerror)    { +  while(Pike_fp != Pike_interpreter.recoveries->onerror->frame_pointer) +  { + #ifdef PIKE_DEBUG +  if(!Pike_fp) +  Pike_fatal("Popped out of stack frames.\n"); + #endif +  POP_PIKE_FRAME(); +  } +     (*Pike_interpreter.recoveries->onerror->func)(Pike_interpreter.recoveries->onerror->arg);    Pike_interpreter.recoveries->onerror=Pike_interpreter.recoveries->onerror->previous;    }
133:    if(!Pike_interpreter.recoveries)    Pike_fatal("No error recovery context.\n");    -  while(Pike_fp != Pike_interpreter.recoveries->frame_pointer) +  /* Don't pop the stack before the onerrors have run; they might need +  * items from the stack. +  */ +  +  while(Pike_interpreter.recoveries->onerror)    { -  +  while(Pike_fp != Pike_interpreter.recoveries->onerror->frame_pointer) +  {   #ifdef PIKE_DEBUG    if(!Pike_fp)    Pike_fatal("Popped out of stack frames.\n");   #endif    POP_PIKE_FRAME();    } -  -  /* Don't pop the stack before the onerrors have run; they might need -  * items from the stack. -  */ -  -  while(Pike_interpreter.recoveries->onerror) -  { +     (*Pike_interpreter.recoveries->onerror->func)(Pike_interpreter.recoveries->onerror->arg);    Pike_interpreter.recoveries->onerror=Pike_interpreter.recoveries->onerror->previous;    }    -  +  while(Pike_fp != Pike_interpreter.recoveries->frame_pointer) +  {   #ifdef PIKE_DEBUG -  +  if(!Pike_fp) +  Pike_fatal("Popped out of stack frames.\n"); + #endif +  POP_PIKE_FRAME(); +  } +  + #ifdef PIKE_DEBUG    if(Pike_sp - Pike_interpreter.evaluator_stack < Pike_interpreter.recoveries->stack_pointer)    Pike_fatal("Stack error in error.\n");   #endif