diff options
| author | Grégoire Jadi | 2013-06-12 17:06:09 +0200 |
|---|---|---|
| committer | Grégoire Jadi | 2013-06-12 17:06:09 +0200 |
| commit | 32a590b04a10f6bbe92bc1519b9e5ba2d32cfabc (patch) | |
| tree | 578be4eb2757a0716f252a269adc49fa9406556d /src/lisp.h | |
| parent | 5c77269b59c8d8d88fa91ec2c949294db1bb2131 (diff) | |
| parent | e6fa6da6899bf1b4877b96c450eae3934085d560 (diff) | |
| download | emacs-32a590b04a10f6bbe92bc1519b9e5ba2d32cfabc.tar.gz emacs-32a590b04a10f6bbe92bc1519b9e5ba2d32cfabc.zip | |
Merge branch 'jave-xwidget' into xwidget
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 117 |
1 files changed, 92 insertions, 25 deletions
diff --git a/src/lisp.h b/src/lisp.h index d5f614881e4..15eb0306251 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -73,6 +73,7 @@ enum | |||
| 73 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), | 73 | BITS_PER_SHORT = CHAR_BIT * sizeof (short), |
| 74 | BITS_PER_INT = CHAR_BIT * sizeof (int), | 74 | BITS_PER_INT = CHAR_BIT * sizeof (int), |
| 75 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), | 75 | BITS_PER_LONG = CHAR_BIT * sizeof (long int), |
| 76 | BITS_PER_PTRDIFF_T = CHAR_BIT * sizeof (ptrdiff_t), | ||
| 76 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) | 77 | BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT) |
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| @@ -2181,12 +2182,24 @@ typedef jmp_buf sys_jmp_buf; | |||
| 2181 | #endif | 2182 | #endif |
| 2182 | 2183 | ||
| 2183 | 2184 | ||
| 2185 | /* Elisp uses several stacks: | ||
| 2186 | - the C stack. | ||
| 2187 | - the bytecode stack: used internally by the bytecode interpreter. | ||
| 2188 | Allocated from the C stack. | ||
| 2189 | - The specpdl stack: keeps track of active unwind-protect and | ||
| 2190 | dynamic-let-bindings. Allocated from the `specpdl' array, a manually | ||
| 2191 | managed stack. | ||
| 2192 | - The catch stack: keeps track of active catch tags. | ||
| 2193 | Allocated on the C stack. This is where the setmp data is kept. | ||
| 2194 | - The handler stack: keeps track of active condition-case handlers. | ||
| 2195 | Allocated on the C stack. Every entry there also uses an entry in | ||
| 2196 | the catch stack. */ | ||
| 2197 | |||
| 2184 | /* Structure for recording Lisp call stack for backtrace purposes. */ | 2198 | /* Structure for recording Lisp call stack for backtrace purposes. */ |
| 2185 | 2199 | ||
| 2186 | /* The special binding stack holds the outer values of variables while | 2200 | /* The special binding stack holds the outer values of variables while |
| 2187 | they are bound by a function application or a let form, stores the | 2201 | they are bound by a function application or a let form, stores the |
| 2188 | code to be executed for Lisp unwind-protect forms, and stores the C | 2202 | code to be executed for unwind-protect forms. |
| 2189 | functions to be called for record_unwind_protect. | ||
| 2190 | 2203 | ||
| 2191 | If func is non-zero, undoing this binding applies func to old_value; | 2204 | If func is non-zero, undoing this binding applies func to old_value; |
| 2192 | This implements record_unwind_protect. | 2205 | This implements record_unwind_protect. |
| @@ -2199,35 +2212,77 @@ typedef jmp_buf sys_jmp_buf; | |||
| 2199 | which means having bound a local value while CURRENT-BUFFER was active. | 2212 | which means having bound a local value while CURRENT-BUFFER was active. |
| 2200 | If WHERE is nil this means we saw the default value when binding SYMBOL. | 2213 | If WHERE is nil this means we saw the default value when binding SYMBOL. |
| 2201 | WHERE being a buffer or frame means we saw a buffer-local or frame-local | 2214 | WHERE being a buffer or frame means we saw a buffer-local or frame-local |
| 2202 | value. Other values of WHERE mean an internal error. */ | 2215 | value. Other values of WHERE mean an internal error. |
| 2216 | |||
| 2217 | NOTE: The specbinding struct is defined here, because SPECPDL_INDEX is | ||
| 2218 | used all over the place, needs to be fast, and needs to know the size of | ||
| 2219 | struct specbinding. But only eval.c should access it. */ | ||
| 2203 | 2220 | ||
| 2204 | typedef Lisp_Object (*specbinding_func) (Lisp_Object); | 2221 | typedef Lisp_Object (*specbinding_func) (Lisp_Object); |
| 2205 | 2222 | ||
| 2223 | enum specbind_tag { | ||
| 2224 | SPECPDL_UNWIND, /* An unwind_protect function. */ | ||
| 2225 | SPECPDL_BACKTRACE, /* An element of the backtrace. */ | ||
| 2226 | SPECPDL_LET, /* A plain and simple dynamic let-binding. */ | ||
| 2227 | /* Tags greater than SPECPDL_LET must be "subkinds" of LET. */ | ||
| 2228 | SPECPDL_LET_LOCAL, /* A buffer-local let-binding. */ | ||
| 2229 | SPECPDL_LET_DEFAULT /* A global binding for a localized var. */ | ||
| 2230 | }; | ||
| 2231 | |||
| 2206 | struct specbinding | 2232 | struct specbinding |
| 2207 | { | 2233 | { |
| 2208 | Lisp_Object symbol, old_value; | 2234 | enum specbind_tag kind; |
| 2209 | specbinding_func func; | 2235 | union { |
| 2210 | Lisp_Object unused; /* Dividing by 16 is faster than by 12. */ | 2236 | struct { |
| 2237 | Lisp_Object arg; | ||
| 2238 | specbinding_func func; | ||
| 2239 | } unwind; | ||
| 2240 | struct { | ||
| 2241 | /* `where' is not used in the case of SPECPDL_LET. */ | ||
| 2242 | Lisp_Object symbol, old_value, where; | ||
| 2243 | } let; | ||
| 2244 | struct { | ||
| 2245 | Lisp_Object function; | ||
| 2246 | Lisp_Object *args; | ||
| 2247 | ptrdiff_t nargs : BITS_PER_PTRDIFF_T - 1; | ||
| 2248 | bool debug_on_exit : 1; | ||
| 2249 | } bt; | ||
| 2250 | } v; | ||
| 2211 | }; | 2251 | }; |
| 2212 | 2252 | ||
| 2253 | LISP_INLINE Lisp_Object specpdl_symbol (struct specbinding *pdl) | ||
| 2254 | { eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.symbol; } | ||
| 2255 | |||
| 2256 | LISP_INLINE Lisp_Object specpdl_old_value (struct specbinding *pdl) | ||
| 2257 | { eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.old_value; } | ||
| 2258 | |||
| 2259 | LISP_INLINE Lisp_Object specpdl_where (struct specbinding *pdl) | ||
| 2260 | { eassert (pdl->kind > SPECPDL_LET); return pdl->v.let.where; } | ||
| 2261 | |||
| 2262 | LISP_INLINE Lisp_Object specpdl_arg (struct specbinding *pdl) | ||
| 2263 | { eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.arg; } | ||
| 2264 | |||
| 2265 | LISP_INLINE specbinding_func specpdl_func (struct specbinding *pdl) | ||
| 2266 | { eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.func; } | ||
| 2267 | |||
| 2268 | LISP_INLINE Lisp_Object backtrace_function (struct specbinding *pdl) | ||
| 2269 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.function; } | ||
| 2270 | |||
| 2271 | LISP_INLINE ptrdiff_t backtrace_nargs (struct specbinding *pdl) | ||
| 2272 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.nargs; } | ||
| 2273 | |||
| 2274 | LISP_INLINE Lisp_Object *backtrace_args (struct specbinding *pdl) | ||
| 2275 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.args; } | ||
| 2276 | |||
| 2277 | LISP_INLINE bool backtrace_debug_on_exit (struct specbinding *pdl) | ||
| 2278 | { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.debug_on_exit; } | ||
| 2279 | |||
| 2213 | extern struct specbinding *specpdl; | 2280 | extern struct specbinding *specpdl; |
| 2214 | extern struct specbinding *specpdl_ptr; | 2281 | extern struct specbinding *specpdl_ptr; |
| 2215 | extern ptrdiff_t specpdl_size; | 2282 | extern ptrdiff_t specpdl_size; |
| 2216 | 2283 | ||
| 2217 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) | 2284 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) |
| 2218 | 2285 | ||
| 2219 | struct backtrace | ||
| 2220 | { | ||
| 2221 | struct backtrace *next; | ||
| 2222 | Lisp_Object function; | ||
| 2223 | Lisp_Object *args; /* Points to vector of args. */ | ||
| 2224 | ptrdiff_t nargs; /* Length of vector. */ | ||
| 2225 | /* Nonzero means call value of debugger when done with this operation. */ | ||
| 2226 | unsigned int debug_on_exit : 1; | ||
| 2227 | }; | ||
| 2228 | |||
| 2229 | extern struct backtrace *backtrace_list; | ||
| 2230 | |||
| 2231 | /* Everything needed to describe an active condition case. | 2286 | /* Everything needed to describe an active condition case. |
| 2232 | 2287 | ||
| 2233 | Members are volatile if their values need to survive _longjmp when | 2288 | Members are volatile if their values need to survive _longjmp when |
| @@ -2282,9 +2337,10 @@ struct catchtag | |||
| 2282 | Lisp_Object tag; | 2337 | Lisp_Object tag; |
| 2283 | Lisp_Object volatile val; | 2338 | Lisp_Object volatile val; |
| 2284 | struct catchtag *volatile next; | 2339 | struct catchtag *volatile next; |
| 2340 | #if 1 /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but they're defined later. */ | ||
| 2285 | struct gcpro *gcpro; | 2341 | struct gcpro *gcpro; |
| 2342 | #endif | ||
| 2286 | sys_jmp_buf jmp; | 2343 | sys_jmp_buf jmp; |
| 2287 | struct backtrace *backlist; | ||
| 2288 | struct handler *handlerlist; | 2344 | struct handler *handlerlist; |
| 2289 | EMACS_INT lisp_eval_depth; | 2345 | EMACS_INT lisp_eval_depth; |
| 2290 | ptrdiff_t volatile pdlcount; | 2346 | ptrdiff_t volatile pdlcount; |
| @@ -3342,10 +3398,15 @@ extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); | |||
| 3342 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); | 3398 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); |
| 3343 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); | 3399 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); |
| 3344 | extern void init_eval (void); | 3400 | extern void init_eval (void); |
| 3345 | #if BYTE_MARK_STACK | ||
| 3346 | extern void mark_backtrace (void); | ||
| 3347 | #endif | ||
| 3348 | extern void syms_of_eval (void); | 3401 | extern void syms_of_eval (void); |
| 3402 | extern void record_in_backtrace (Lisp_Object function, | ||
| 3403 | Lisp_Object *args, ptrdiff_t nargs); | ||
| 3404 | extern void mark_specpdl (void); | ||
| 3405 | extern void get_backtrace (Lisp_Object array); | ||
| 3406 | Lisp_Object backtrace_top_function (void); | ||
| 3407 | extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol); | ||
| 3408 | extern bool let_shadows_global_binding_p (Lisp_Object symbol); | ||
| 3409 | |||
| 3349 | 3410 | ||
| 3350 | /* Defined in editfns.c. */ | 3411 | /* Defined in editfns.c. */ |
| 3351 | extern Lisp_Object Qfield; | 3412 | extern Lisp_Object Qfield; |
| @@ -3728,9 +3789,10 @@ extern void syms_of_fontset (void); | |||
| 3728 | extern Lisp_Object Qfont_param; | 3789 | extern Lisp_Object Qfont_param; |
| 3729 | #endif | 3790 | #endif |
| 3730 | 3791 | ||
| 3731 | #ifdef WINDOWSNT | 3792 | /* Defined in gfilenotify.c */ |
| 3732 | /* Defined on w32notify.c. */ | 3793 | #ifdef HAVE_GFILENOTIFY |
| 3733 | extern void syms_of_w32notify (void); | 3794 | extern void globals_of_gfilenotify (void); |
| 3795 | extern void syms_of_gfilenotify (void); | ||
| 3734 | #endif | 3796 | #endif |
| 3735 | 3797 | ||
| 3736 | /* Defined in inotify.c */ | 3798 | /* Defined in inotify.c */ |
| @@ -3738,6 +3800,11 @@ extern void syms_of_w32notify (void); | |||
| 3738 | extern void syms_of_inotify (void); | 3800 | extern void syms_of_inotify (void); |
| 3739 | #endif | 3801 | #endif |
| 3740 | 3802 | ||
| 3803 | #ifdef HAVE_W32NOTIFY | ||
| 3804 | /* Defined on w32notify.c. */ | ||
| 3805 | extern void syms_of_w32notify (void); | ||
| 3806 | #endif | ||
| 3807 | |||
| 3741 | /* Defined in xfaces.c. */ | 3808 | /* Defined in xfaces.c. */ |
| 3742 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; | 3809 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; |
| 3743 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; | 3810 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; |