1 // $XConsortium: Unwind_Stack.hh /main/5 1996/10/04 09:34:56 drk $
4 #define UNWIND_STACK_SIZE 512
9 Destructable *f_object;
10 unsigned short f_size;
11 void set (Destructable *object, unsigned int size)
12 { f_object = object; f_size = size; }
13 unsigned long object_start() const
14 { return ((unsigned long) f_object); }
15 unsigned long object_end() const
16 { return ((unsigned long) f_object + f_size); }
25 PRINTF (("+++ New TOS = %d\n", f_bottom)); }
29 PRINTF (("--- Reset TOS = %d\n", g_top)); }
31 void push (Destructable *object, unsigned int size);
35 PRINTF ((" Pop [ %d ]\n", g_top)); }
38 { return (g_top == f_bottom); }
40 const Unwind_Record &top() const
41 { return (g_stack[g_top-1]); }
44 unsigned short f_bottom;
46 static unsigned short g_top;
49 static Unwind_Record* g_stack;
51 friend void initialize_exception();
52 friend void quit_exception();
54 static Unwind_Record g_stack[UNWIND_STACK_SIZE];
60 Unwind_Stack::push (Destructable *object, unsigned int size)
63 if (g_top > UNWIND_STACK_SIZE)
65 Exceptions::error (Exceptions::f_msg_out_of_obj_stack_memory,
66 Exceptions::INTERNAL_ERROR);
69 PRINTF ((" Push [ %d ] = %p\n", g_top, object));
70 g_stack[g_top++].set (object, size);