comparison src/lisp.h @ 83162:dbcd0af66869

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410 Make sure image types are initialized for lookup too * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-412 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-413 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-414 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-415 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-418 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-202
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 24 Jun 2004 07:44:13 +0000
parents 9fb10038ca55 d79e58a67b48
children 8e4ea1e2c254
comparison
equal deleted inserted replaced
83161:8d62eda26760 83162:dbcd0af66869
1197 This type of object is used in the arg to record_unwind_protect. */ 1197 This type of object is used in the arg to record_unwind_protect. */
1198 struct Lisp_Save_Value 1198 struct Lisp_Save_Value
1199 { 1199 {
1200 int type : 16; /* = Lisp_Misc_Save_Value */ 1200 int type : 16; /* = Lisp_Misc_Save_Value */
1201 unsigned gcmarkbit : 1; 1201 unsigned gcmarkbit : 1;
1202 int spacer : 15; 1202 int spacer : 14;
1203 /* If DOGC is set, POINTER is the address of a memory
1204 area containing INTEGER potential Lisp_Objects. */
1205 unsigned int dogc : 1;
1203 void *pointer; 1206 void *pointer;
1204 int integer; 1207 int integer;
1205 }; 1208 };
1206 1209
1207 1210
3246 : (!NILP (Fmemq ((el), (check))) \ 3249 : (!NILP (Fmemq ((el), (check))) \
3247 ? Qnil \ 3250 ? Qnil \
3248 : Fcons ((el), (check))))) 3251 : Fcons ((el), (check)))))
3249 3252
3250 3253
3254 /* SAFE_ALLOCA normally allocates memory on the stack, but if size is
3255 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
3256
3257 #define MAX_ALLOCA 16*1024
3258
3259 extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3260
3261 #define USE_SAFE_ALLOCA \
3262 int sa_count = SPECPDL_INDEX ()
3263
3264 /* SAFE_ALLOCA allocates a simple buffer. */
3265
3266 #define SAFE_ALLOCA(buf, type, size) \
3267 do { \
3268 if ((size) < MAX_ALLOCA) \
3269 buf = (type) alloca (size); \
3270 else \
3271 { \
3272 buf = (type) xmalloc (size); \
3273 record_unwind_protect (safe_alloca_unwind, \
3274 make_save_value (buf, 0)); \
3275 } \
3276 } while (0)
3277
3278 /* SAFE_FREE frees xmalloced memory and enables GC as needed. */
3279
3280 #define SAFE_FREE(size) \
3281 do { \
3282 if ((size) >= MAX_ALLOCA) \
3283 unbind_to (sa_count, Qnil); \
3284 } while (0)
3285
3286
3287 /* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */
3288
3289 #define SAFE_ALLOCA_LISP(buf, nelt) \
3290 do { \
3291 int size_ = (nelt) * sizeof (Lisp_Object); \
3292 if (size_ < MAX_ALLOCA) \
3293 buf = (Lisp_Object *) alloca (size_); \
3294 else \
3295 { \
3296 Lisp_Object arg_; \
3297 buf = (Lisp_Object *) xmalloc (size_); \
3298 arg_ = make_save_value (buf, nelt); \
3299 XSAVE_VALUE (arg_)->dogc = 1; \
3300 record_unwind_protect (safe_alloca_unwind, arg_); \
3301 } \
3302 } while (0)
3303
3304 #define SAFE_FREE_LISP(nelt) \
3305 do { \
3306 if (((nelt) * sizeof (Lisp_Object)) >= MAX_ALLOCA) \
3307 unbind_to (sa_count, Qnil); \
3308 } while (0)
3309
3310
3311
3251 #endif /* EMACS_LISP_H */ 3312 #endif /* EMACS_LISP_H */
3252 3313
3253 /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e 3314 /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e
3254 (do not change this comment) */ 3315 (do not change this comment) */