aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h64
1 files changed, 27 insertions, 37 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 005d1e7c746..2a32db62326 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -310,7 +310,6 @@ error !;
310# define lisp_h_XLI(o) (o) 310# define lisp_h_XLI(o) (o)
311# define lisp_h_XIL(i) (i) 311# define lisp_h_XIL(i) (i)
312#endif 312#endif
313#define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (CONSP (x), Qlistp, y)
314#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x) 313#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x)
315#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x) 314#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x)
316#define lisp_h_CHECK_TYPE(ok, predicate, x) \ 315#define lisp_h_CHECK_TYPE(ok, predicate, x) \
@@ -367,7 +366,6 @@ error !;
367#if DEFINE_KEY_OPS_AS_MACROS 366#if DEFINE_KEY_OPS_AS_MACROS
368# define XLI(o) lisp_h_XLI (o) 367# define XLI(o) lisp_h_XLI (o)
369# define XIL(i) lisp_h_XIL (i) 368# define XIL(i) lisp_h_XIL (i)
370# define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_CONS (x, y)
371# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x) 369# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x)
372# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x) 370# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)
373# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x) 371# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x)
@@ -1997,6 +1995,10 @@ struct Lisp_Hash_Table
1997 hash table size to reduce collisions. */ 1995 hash table size to reduce collisions. */
1998 Lisp_Object index; 1996 Lisp_Object index;
1999 1997
1998 /* Non-nil if the table can be purecopied. The table cannot be
1999 changed afterwards. */
2000 Lisp_Object pure;
2001
2000 /* Only the fields above are traced normally by the GC. The ones below 2002 /* Only the fields above are traced normally by the GC. The ones below
2001 `count' are special and are either ignored by the GC or traced in 2003 `count' are special and are either ignored by the GC or traced in
2002 a special way (e.g. because of weakness). */ 2004 a special way (e.g. because of weakness). */
@@ -2751,9 +2753,9 @@ CHECK_LIST (Lisp_Object x)
2751} 2753}
2752 2754
2753INLINE void 2755INLINE void
2754(CHECK_LIST_CONS) (Lisp_Object x, Lisp_Object y) 2756CHECK_LIST_END (Lisp_Object x, Lisp_Object y)
2755{ 2757{
2756 lisp_h_CHECK_LIST_CONS (x, y); 2758 CHECK_TYPE (NILP (x), Qlistp, y);
2757} 2759}
2758 2760
2759INLINE void 2761INLINE void
@@ -3121,38 +3123,28 @@ struct handler
3121 3123
3122extern Lisp_Object memory_signal_data; 3124extern Lisp_Object memory_signal_data;
3123 3125
3124/* Check quit-flag and quit if it is non-nil. 3126extern void maybe_quit (void);
3125 Typing C-g does not directly cause a quit; it only sets Vquit_flag.
3126 So the program needs to do QUIT at times when it is safe to quit.
3127 Every loop that might run for a long time or might not exit
3128 ought to do QUIT at least once, at a safe place.
3129 Unless that is impossible, of course.
3130 But it is very desirable to avoid creating loops where QUIT is impossible.
3131
3132 Exception: if you set immediate_quit to true,
3133 then the handler that responds to the C-g does the quit itself.
3134 This is a good thing to do around a loop that has no side effects
3135 and (in particular) cannot call arbitrary Lisp code.
3136 3127
3137 If quit-flag is set to `kill-emacs' the SIGINT handler has received 3128/* True if ought to quit now. */
3138 a request to exit Emacs when it is safe to do. */
3139 3129
3140extern void process_pending_signals (void); 3130#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
3141extern bool volatile pending_signals;
3142 3131
3143extern void process_quit_flag (void); 3132/* Heuristic on how many iterations of a tight loop can be safely done
3144#define QUIT \ 3133 before it's time to do a quit. This must be a power of 2. It
3145 do { \ 3134 is nice but not necessary for it to equal USHRT_MAX + 1. */
3146 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
3147 process_quit_flag (); \
3148 else if (pending_signals) \
3149 process_pending_signals (); \
3150 } while (false)
3151 3135
3136enum { QUIT_COUNT_HEURISTIC = 1 << 16 };
3152 3137
3153/* True if ought to quit now. */ 3138/* Process a quit rarely, based on a counter COUNT, for efficiency.
3139 "Rarely" means once per QUIT_COUNT_HEURISTIC or per USHRT_MAX + 1
3140 times, whichever is smaller (somewhat arbitrary, but often faster). */
3154 3141
3155#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) 3142INLINE void
3143rarely_quit (unsigned short int count)
3144{
3145 if (! (count & (QUIT_COUNT_HEURISTIC - 1)))
3146 maybe_quit ();
3147}
3156 3148
3157extern Lisp_Object Vascii_downcase_table; 3149extern Lisp_Object Vascii_downcase_table;
3158extern Lisp_Object Vascii_canon_table; 3150extern Lisp_Object Vascii_canon_table;
@@ -3375,7 +3367,7 @@ extern void sweep_weak_hash_tables (void);
3375EMACS_UINT hash_string (char const *, ptrdiff_t); 3367EMACS_UINT hash_string (char const *, ptrdiff_t);
3376EMACS_UINT sxhash (Lisp_Object, int); 3368EMACS_UINT sxhash (Lisp_Object, int);
3377Lisp_Object make_hash_table (struct hash_table_test, Lisp_Object, Lisp_Object, 3369Lisp_Object make_hash_table (struct hash_table_test, Lisp_Object, Lisp_Object,
3378 Lisp_Object, Lisp_Object); 3370 Lisp_Object, Lisp_Object, Lisp_Object);
3379ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); 3371ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *);
3380ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, 3372ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
3381 EMACS_UINT); 3373 EMACS_UINT);
@@ -4233,8 +4225,10 @@ extern int emacs_open (const char *, int, int);
4233extern int emacs_pipe (int[2]); 4225extern int emacs_pipe (int[2]);
4234extern int emacs_close (int); 4226extern int emacs_close (int);
4235extern ptrdiff_t emacs_read (int, void *, ptrdiff_t); 4227extern ptrdiff_t emacs_read (int, void *, ptrdiff_t);
4228extern ptrdiff_t emacs_read_quit (int, void *, ptrdiff_t);
4236extern ptrdiff_t emacs_write (int, void const *, ptrdiff_t); 4229extern ptrdiff_t emacs_write (int, void const *, ptrdiff_t);
4237extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t); 4230extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t);
4231extern ptrdiff_t emacs_write_quit (int, void const *, ptrdiff_t);
4238extern void emacs_perror (char const *); 4232extern void emacs_perror (char const *);
4239 4233
4240extern void unlock_all_files (void); 4234extern void unlock_all_files (void);
@@ -4360,9 +4354,6 @@ extern char my_edata[];
4360extern char my_endbss[]; 4354extern char my_endbss[];
4361extern char *my_endbss_static; 4355extern char *my_endbss_static;
4362 4356
4363/* True means ^G can quit instantly. */
4364extern bool immediate_quit;
4365
4366extern void *xmalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1)); 4357extern void *xmalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
4367extern void *xzalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1)); 4358extern void *xzalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
4368extern void *xrealloc (void *, size_t) ATTRIBUTE_ALLOC_SIZE ((2)); 4359extern void *xrealloc (void *, size_t) ATTRIBUTE_ALLOC_SIZE ((2));
@@ -4549,7 +4540,7 @@ enum
4549 use these only in macros like AUTO_CONS that declare a local 4540 use these only in macros like AUTO_CONS that declare a local
4550 variable whose lifetime will be clear to the programmer. */ 4541 variable whose lifetime will be clear to the programmer. */
4551#define STACK_CONS(a, b) \ 4542#define STACK_CONS(a, b) \
4552 make_lisp_ptr (&(union Aligned_Cons) { { a, { b } } }.s, Lisp_Cons) 4543 make_lisp_ptr (&((union Aligned_Cons) { { a, { b } } }).s, Lisp_Cons)
4553#define AUTO_CONS_EXPR(a, b) \ 4544#define AUTO_CONS_EXPR(a, b) \
4554 (USE_STACK_CONS ? STACK_CONS (a, b) : Fcons (a, b)) 4545 (USE_STACK_CONS ? STACK_CONS (a, b) : Fcons (a, b))
4555 4546
@@ -4595,8 +4586,7 @@ enum
4595 Lisp_Object name = \ 4586 Lisp_Object name = \
4596 (USE_STACK_STRING \ 4587 (USE_STACK_STRING \
4597 ? (make_lisp_ptr \ 4588 ? (make_lisp_ptr \
4598 ((&(union Aligned_String) \ 4589 ((&((union Aligned_String) {{len, -1, 0, (unsigned char *) (str)}}).s), \
4599 {{len, -1, 0, (unsigned char *) (str)}}.s), \
4600 Lisp_String)) \ 4590 Lisp_String)) \
4601 : make_unibyte_string (str, len)) 4591 : make_unibyte_string (str, len))
4602 4592