Mercurial > hg > xemacs-beta
comparison src/backtrace.h @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 /* The lisp stack. | |
2 Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
10 | |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with XEmacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | |
21 /* Synched up with: FSF 19.30. Contained redundantly in various C files | |
22 in FSFmacs. */ | |
23 | |
24 /* Authorship: | |
25 | |
26 FSF: Original version; a long time ago. | |
27 XEmacs: split out of some C files. (For some obscure reason, a header | |
28 file couldn't be used in FSF Emacs, but XEmacs doesn't have | |
29 that problem.) | |
30 Mly (probably) or JWZ: Some changes. | |
31 */ | |
32 | |
33 #ifndef _XEMACS_BACKTRACE_H_ | |
34 #define _XEMACS_BACKTRACE_H_ | |
35 | |
36 #include <setjmp.h> | |
37 | |
38 /* These definitions are used in eval.c and alloc.c */ | |
39 | |
40 struct backtrace | |
41 { | |
42 struct backtrace *next; | |
43 Lisp_Object *function; | |
44 Lisp_Object *args; /* Points to vector of args. */ | |
45 int nargs; /* Length of vector. | |
46 If nargs is UNEVALLED, args points to | |
47 slot holding list of unevalled args */ | |
48 int pdlcount; /* specpdl_depth () when invoked */ | |
49 #ifdef EMACS_BTL | |
50 /* The value of a Lisp integer that specifies the symbol being | |
51 "invoked" by this node in the backtrace, or 0 if the backtrace | |
52 doesn't correspond to a such an invocation */ | |
53 int id_number; | |
54 #endif | |
55 char evalargs; | |
56 /* Nonzero means call value of debugger when done with this operation. */ | |
57 char debug_on_exit; | |
58 }; | |
59 | |
60 /* This structure helps implement the `catch' and `throw' control | |
61 structure. A struct catchtag contains all the information needed | |
62 to restore the state of the interpreter after a non-local jump. | |
63 | |
64 Handlers for error conditions (represented by `struct handler' | |
65 structures) just point to a catch tag to do the cleanup required | |
66 for their jumps. | |
67 | |
68 catchtag structures are chained together in the C calling stack; | |
69 the `next' member points to the next outer catchtag. | |
70 | |
71 A call like (throw TAG VAL) searches for a catchtag whose `tag' | |
72 member is TAG, and then unbinds to it. The `val' member is used to | |
73 hold VAL while the stack is unwound; `val' is returned as the value | |
74 of the catch form. | |
75 | |
76 All the other members are concerned with restoring the interpreter | |
77 state. */ | |
78 | |
79 struct catchtag | |
80 { | |
81 Lisp_Object tag; | |
82 Lisp_Object val; | |
83 struct catchtag *next; | |
84 struct gcpro *gcpro; | |
85 JMP_BUF jmp; | |
86 struct backtrace *backlist; | |
87 #if 0 /* FSFmacs */ | |
88 /* #### */ | |
89 struct handler *handlerlist; | |
90 #endif | |
91 int lisp_eval_depth; | |
92 int pdlcount; | |
93 #if 0 /* FSFmacs */ | |
94 /* This is the equivalent of async_timer_suppress_count. | |
95 We probably don't have to bother with this. */ | |
96 int poll_suppress_count; | |
97 #endif | |
98 }; | |
99 | |
100 /* Dynamic-binding-o-rama */ | |
101 | |
102 /* Structure for recording Lisp call stack for backtrace purposes. */ | |
103 | |
104 /* The special binding stack holds the outer values of variables while | |
105 they are bound by a function application or a let form, stores the | |
106 code to be executed for Lisp unwind-protect forms, and stores the C | |
107 functions to be called for record_unwind_protect. | |
108 | |
109 If func is non-zero, undoing this binding applies func to old_value; | |
110 This implements record_unwind_protect. | |
111 If func is zero and symbol is nil, undoing this binding evaluates | |
112 the list of forms in old_value; this implements Lisp's unwind-protect | |
113 form. | |
114 Otherwise, undoing this binding stores old_value as symbol's value; this | |
115 undoes the bindings made by a let form or function call. */ | |
116 | |
117 struct specbinding | |
118 { | |
119 Lisp_Object symbol, old_value; | |
120 Lisp_Object (*func) (Lisp_Object); /* for unwind-protect */ | |
121 }; | |
122 | |
123 #if 0 /* FSFmacs */ | |
124 /* #### */ | |
125 /* Everything needed to describe an active condition case. */ | |
126 struct handler | |
127 { | |
128 /* The handler clauses and variable from the condition-case form. */ | |
129 Lisp_Object handler; | |
130 Lisp_Object var; | |
131 /* Fsignal stores here the condition-case clause that applies, | |
132 and Fcondition_case thus knows which clause to run. */ | |
133 Lisp_Object chosen_clause; | |
134 | |
135 /* Used to effect the longjump out to the handler. */ | |
136 struct catchtag *tag; | |
137 | |
138 /* The next enclosing handler. */ | |
139 struct handler *next; | |
140 }; | |
141 | |
142 extern struct handler *handlerlist; | |
143 | |
144 #endif | |
145 | |
146 /* These are extern because GC needs to mark them */ | |
147 extern struct specbinding *specpdl; | |
148 extern struct specbinding *specpdl_ptr; | |
149 extern struct catchtag *catchlist; | |
150 extern struct backtrace *backtrace_list; | |
151 | |
152 #endif /* _XEMACS_BACKTRACE_H_ */ |