示例#1
0
文件: _eh.C 项目: BillTheBest/k42
void
__sjpopnthrow()
{
    struct eh_context *eh = (*get_eh_context)();
    void ***dhc = &eh->dynamic_handler_chain;
    void (*func)(void *, int);
    void *arg;
    void ***cleanup = (void***)&(*dhc)[1];

    if (cleanup[0])
    {
	double store[200];
	void **buf = (void**)store;
	buf[1] = 0;
	buf[0] = (*dhc);
	if (! __builtin_setjmp(&buf[2]))
	{
	    *dhc = buf;
	    while (cleanup[0])
	    {
		func = (void(*)(void*, int))cleanup[0][1];
		arg = (void*)cleanup[0][2];
		cleanup[0] = (void **)cleanup[0][0];
		(*func)(arg, 2);
	    }
	    *dhc = (void **)buf[0];
	}
	else
	{
	    __terminate();
	}
    }
    *dhc = (void**)(*dhc)[0];
    __sjthrow();
}
示例#2
0
void
__sjpopnthrow ()
{
  struct eh_context *eh = (*get_eh_context) ();
  void ***dhc = &eh->dynamic_handler_chain;
  void (*func)(void *, int);
  void *arg;
  void ***cleanup;

  /* The cleanup chain is one word into the buffer.  Get the cleanup
     chain.  */
  cleanup = (void***)&(*dhc)[1];

  /* If there are any cleanups in the chain, run them now.  */
  if (cleanup[0])
    {
      double store[200];
      void **buf = (void**)store;
      buf[1] = 0;
      buf[0] = (*dhc);

      /* try { */
#ifdef DONT_USE_BUILTIN_SETJMP
      if (! setjmp (&buf[2]))
#else
      if (! __builtin_setjmp (&buf[2]))
#endif
	{
	  *dhc = buf;
	  while (cleanup[0])
	    {
	      func = (void(*)(void*, int))cleanup[0][1];
	      arg = (void*)cleanup[0][2];

	      /* Update this before running the cleanup.  */
	      cleanup[0] = (void **)cleanup[0][0];

	      (*func)(arg, 2);
	    }
	  *dhc = buf[0];
	}
      /* catch (...) */
      else
	{
	  __terminate ();
	}
    }

  /* Then we pop the top element off the dynamic handler chain.  */
  *dhc = (void**)(*dhc)[0];

  __sjthrow ();
}