aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h114
1 files changed, 63 insertions, 51 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 3312fbb6d97..98126d48356 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -26,16 +26,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
26#define EMACS_UINT unsigned int 26#define EMACS_UINT unsigned int
27#endif 27#endif
28 28
29/* Define the fundamental Lisp data structures */ 29/* Define the fundamental Lisp data structures. */
30 30
31/* This is the set of Lisp data types */ 31/* This is the set of Lisp data types. */
32 32
33enum Lisp_Type 33enum Lisp_Type
34 { 34 {
35 /* Integer. XINT(obj) is the integer value. */ 35 /* Integer. XINT (obj) is the integer value. */
36 Lisp_Int, 36 Lisp_Int,
37 37
38 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */ 38 /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */
39 Lisp_Symbol, 39 Lisp_Symbol,
40 40
41 /* Miscellaneous. XMISC (object) points to a union Lisp_Misc, 41 /* Miscellaneous. XMISC (object) points to a union Lisp_Misc,
@@ -43,7 +43,7 @@ enum Lisp_Type
43 Lisp_Misc, 43 Lisp_Misc,
44 44
45 /* String. XSTRING (object) points to a struct Lisp_String. 45 /* String. XSTRING (object) points to a struct Lisp_String.
46 The length of the string, and its contents, are stored therein. */ 46 The length of the string, and its contents, are stored therein. */
47 Lisp_String, 47 Lisp_String,
48 48
49 /* Vector of Lisp objects, or something resembling it. 49 /* Vector of Lisp objects, or something resembling it.
@@ -52,12 +52,9 @@ enum Lisp_Type
52 information, if it's not a real vector object. */ 52 information, if it's not a real vector object. */
53 Lisp_Vectorlike, 53 Lisp_Vectorlike,
54 54
55 /* Cons. XCONS (object) points to a struct Lisp_Cons. */ 55 /* Cons. XCONS (object) points to a struct Lisp_Cons. */
56 Lisp_Cons, 56 Lisp_Cons,
57 57
58 /* Editor buffer. XBUFFER (obj) points to a struct buffer. */
59 Lisp_Buffer,
60
61#ifdef LISP_FLOAT_TYPE 58#ifdef LISP_FLOAT_TYPE
62 Lisp_Float, 59 Lisp_Float,
63#endif /* LISP_FLOAT_TYPE */ 60#endif /* LISP_FLOAT_TYPE */
@@ -78,7 +75,12 @@ enum Lisp_Misc_Type
78 Lisp_Misc_Buffer_Objfwd, 75 Lisp_Misc_Buffer_Objfwd,
79 Lisp_Misc_Buffer_Local_Value, 76 Lisp_Misc_Buffer_Local_Value,
80 Lisp_Misc_Some_Buffer_Local_Value, 77 Lisp_Misc_Some_Buffer_Local_Value,
81 Lisp_Misc_Overlay 78 Lisp_Misc_Overlay,
79 /* Currently floats are not a misc type,
80 but let's define this in case we want to change that. */
81 Lisp_Misc_Float,
82 /* This is not a type code. It is for range checking. */
83 Lisp_Misc_Limit
82 }; 84 };
83 85
84#ifndef NO_UNION_TYPE 86#ifndef NO_UNION_TYPE
@@ -91,7 +93,7 @@ typedef
91union Lisp_Object 93union Lisp_Object
92 { 94 {
93 /* Used for comparing two Lisp_Objects; 95 /* Used for comparing two Lisp_Objects;
94 also, positive integers can be accessed fast this way. */ 96 also, positive integers can be accessed fast this way. */
95 int i; 97 int i;
96 98
97 struct 99 struct
@@ -121,7 +123,7 @@ typedef
121union Lisp_Object 123union Lisp_Object
122 { 124 {
123 /* Used for comparing two Lisp_Objects; 125 /* Used for comparing two Lisp_Objects;
124 also, positive integers can be accessed fast this way. */ 126 also, positive integers can be accessed fast this way. */
125 int i; 127 int i;
126 128
127 struct 129 struct
@@ -203,13 +205,19 @@ Lisp_Object;
203/* In a pseudo-vector, the size field actually contains a word with one 205/* In a pseudo-vector, the size field actually contains a word with one
204 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to 206 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
205 indicate the actual type. */ 207 indicate the actual type. */
206#define PVEC_BUFFER 0x100 208enum pvec_type
207#define PVEC_PROCESS 0x200 209{
208#define PVEC_FRAME 0x400 210 PVEC_NORMAL_VECTOR = 0,
209#define PVEC_COMPILED 0x800 211 PVEC_BUFFER = 0x100,
210#define PVEC_WINDOW 0x1000 212 PVEC_PROCESS = 0x200,
211#define PVEC_WINDOW_CONFIGURATION 0x2000 213 PVEC_FRAME = 0x400,
212#define PVEC_SUBR 0x4000 214 PVEC_COMPILED = 0x800,
215 PVEC_WINDOW = 0x1000,
216 PVEC_WINDOW_CONFIGURATION = 0x2000,
217 PVEC_SUBR = 0x4000,
218 PVEC_TYPE_MASK = 0x7f00,
219 PVEC_FLAG = PSEUDOVECTOR_FLAG,
220};
213 221
214/* For convenience, we also store the number of elements in these bits. */ 222/* For convenience, we also store the number of elements in these bits. */
215#define PSEUDOVECTOR_SIZE_MASK 0xff 223#define PSEUDOVECTOR_SIZE_MASK 0xff
@@ -222,7 +230,7 @@ you lose
222 230
223/* These macros extract various sorts of values from a Lisp_Object. 231/* These macros extract various sorts of values from a Lisp_Object.
224 For example, if tem is a Lisp_Object whose type is Lisp_Cons, 232 For example, if tem is a Lisp_Object whose type is Lisp_Cons,
225 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */ 233 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
226 234
227#ifdef NO_UNION_TYPE 235#ifdef NO_UNION_TYPE
228 236
@@ -355,9 +363,9 @@ extern int pure_size;
355 363
356#endif /* NO_UNION_TYPE */ 364#endif /* NO_UNION_TYPE */
357 365
366/* Extract a value or address from a Lisp_Object. */
358 367
359#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a)) 368#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a))
360#define XBUFFER(a) ((struct buffer *) XPNTR(a))
361#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a)) 369#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a))
362#define XSTRING(a) ((struct Lisp_String *) XPNTR(a)) 370#define XSTRING(a) ((struct Lisp_String *) XPNTR(a))
363#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a)) 371#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a))
@@ -377,10 +385,13 @@ extern int pure_size;
377#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a)) 385#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
378#define XWINDOW(a) ((struct window *) XPNTR(a)) 386#define XWINDOW(a) ((struct window *) XPNTR(a))
379#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a)) 387#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
388#define XBUFFER(a) ((struct buffer *) XPNTR(a))
389
390
391/* Construct a Lisp_Object from a value or address. */
380 392
381#define XSETINT(a, b) XSET (a, Lisp_Int, b) 393#define XSETINT(a, b) XSET (a, Lisp_Int, b)
382#define XSETCONS(a, b) XSET (a, Lisp_Cons, b) 394#define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
383#define XSETBUFFER(a, b) XSET (a, Lisp_Buffer, b)
384#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b) 395#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
385#define XSETSTRING(a, b) XSET (a, Lisp_String, b) 396#define XSETSTRING(a, b) XSET (a, Lisp_String, b)
386#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b) 397#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
@@ -399,18 +410,19 @@ extern int pure_size;
399#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) 410#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
400#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) 411#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
401#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) 412#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
413#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
402 414
403#ifdef USE_TEXT_PROPERTIES 415#ifdef USE_TEXT_PROPERTIES
404/* Basic data type for use of intervals. See the macros in intervals.h */ 416/* Basic data type for use of intervals. See the macros in intervals.h. */
405 417
406struct interval 418struct interval
407{ 419{
408 /* The first group of entries deal with the tree structure. */ 420 /* The first group of entries deal with the tree structure. */
409 421
410 unsigned int total_length; /* Length of myself and both children. */ 422 unsigned int total_length; /* Length of myself and both children. */
411 unsigned int position; /* Cache of interval's character position */ 423 unsigned int position; /* Cache of interval's character position. */
412 struct interval *left; /* Intervals which precede me. */ 424 struct interval *left; /* Intervals which precede me. */
413 struct interval *right; /* Intervals which succeed me. */ 425 struct interval *right; /* Intervals which succeed me. */
414 426
415 /* Parent in the tree, or the Lisp_Object containing this interval tree. 427 /* Parent in the tree, or the Lisp_Object containing this interval tree.
416 428
@@ -426,13 +438,13 @@ struct interval
426 438
427 /* The remaining components are `properties' of the interval. 439 /* The remaining components are `properties' of the interval.
428 The first four are duplicates for things which can be on the list, 440 The first four are duplicates for things which can be on the list,
429 for purposes of speed. */ 441 for purposes of speed. */
430 442
431 unsigned char write_protect; /* Non-zero means can't modify. */ 443 unsigned char write_protect; /* Non-zero means can't modify. */
432 unsigned char visible; /* Zero means don't display. */ 444 unsigned char visible; /* Zero means don't display. */
433 unsigned char front_sticky; /* Non-zero means text inserted just 445 unsigned char front_sticky; /* Non-zero means text inserted just
434 before this interval goes into it. */ 446 before this interval goes into it. */
435 unsigned char rear_sticky; /* Likewise for just after it. */ 447 unsigned char rear_sticky; /* Likewise for just after it. */
436 448
437 /* Properties of this interval. 449 /* Properties of this interval.
438 The mark bit on this field says whether this particular interval 450 The mark bit on this field says whether this particular interval
@@ -449,16 +461,16 @@ typedef struct interval *INTERVAL;
449 x = wrong_type_argument (Qbuffer_or_string_p, (x)); } 461 x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
450 462
451/* Macro used to conditionally compile intervals into certain data 463/* Macro used to conditionally compile intervals into certain data
452 structures. See, e.g., struct Lisp_String below. */ 464 structures. See, e.g., struct Lisp_String below. */
453#define DECLARE_INTERVALS INTERVAL intervals; 465#define DECLARE_INTERVALS INTERVAL intervals;
454 466
455/* Macro used to conditionally compile interval initialization into 467/* Macro used to conditionally compile interval initialization into
456 certain code. See, e.g., alloc.c. */ 468 certain code. See, e.g., alloc.c. */
457#define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val 469#define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val
458 470
459#else /* No text properties */ 471#else /* No text properties */
460 472
461/* If no intervals are used, make the above definitions go away. */ 473/* If no intervals are used, make the above definitions go away. */
462 474
463#define CHECK_STRING_OR_BUFFER(x, i) 475#define CHECK_STRING_OR_BUFFER(x, i)
464 476
@@ -490,7 +502,7 @@ struct Lisp_Buffer_Cons
490struct Lisp_String 502struct Lisp_String
491 { 503 {
492 EMACS_INT size; 504 EMACS_INT size;
493 DECLARE_INTERVALS /* `data' field must be last. */ 505 DECLARE_INTERVALS /* `data' field must be last. */
494 unsigned char data[1]; 506 unsigned char data[1];
495 }; 507 };
496 508
@@ -611,7 +623,7 @@ struct Lisp_Buffer_Objfwd
611 variable). 623 variable).
612 624
613 If we want to examine or set the value and BUFFER is current, 625 If we want to examine or set the value and BUFFER is current,
614 we just examine or set REALVALUE. If BUFFER is not current, we 626 we just examine or set REALVALUE. If BUFFER is not current, we
615 store the current REALVALUE value into CURRENT-ALIST-ELEMENT, 627 store the current REALVALUE value into CURRENT-ALIST-ELEMENT,
616 then find the appropriate alist element for the buffer now 628 then find the appropriate alist element for the buffer now
617 current and set up CURRENT-ALIST-ELEMENT. Then we set 629 current and set up CURRENT-ALIST-ELEMENT. Then we set
@@ -671,7 +683,7 @@ struct Lisp_Float
671#endif /* LISP_FLOAT_TYPE */ 683#endif /* LISP_FLOAT_TYPE */
672 684
673/* A character, declared with the following typedef, is a member 685/* A character, declared with the following typedef, is a member
674 of some character set associated with the current buffer. */ 686 of some character set associated with the current buffer. */
675#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ 687#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */
676#define _UCHAR_T 688#define _UCHAR_T
677typedef unsigned char UCHAR; 689typedef unsigned char UCHAR;
@@ -790,8 +802,6 @@ typedef unsigned char UCHAR;
790#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String) 802#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
791#define CONSP(x) (XTYPE ((x)) == Lisp_Cons) 803#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
792#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons) 804#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
793#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
794#define GC_BUFFERP(x) (XGCTYPE ((x)) == Lisp_Buffer)
795 805
796#ifdef LISP_FLOAT_TYPE 806#ifdef LISP_FLOAT_TYPE
797#define FLOATP(x) (XTYPE ((x)) == Lisp_Float) 807#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
@@ -844,6 +854,8 @@ typedef unsigned char UCHAR;
844#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR) 854#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
845#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED) 855#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
846#define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED) 856#define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED)
857#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
858#define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER)
847 859
848#ifdef MULTI_FRAME 860#ifdef MULTI_FRAME
849#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME) 861#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
@@ -983,7 +995,7 @@ typedef unsigned char UCHAR;
983#else 995#else
984 996
985/* This version of DEFUN declares a function prototype with the right 997/* This version of DEFUN declares a function prototype with the right
986 arguments, so we can catch errors with maxargs at compile-time. */ 998 arguments, so we can catch errors with maxargs at compile-time. */
987#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \ 999#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
988 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 1000 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
989 struct Lisp_Subr sname = \ 1001 struct Lisp_Subr sname = \
@@ -992,7 +1004,7 @@ typedef unsigned char UCHAR;
992 Lisp_Object fnname 1004 Lisp_Object fnname
993 1005
994/* Note that the weird token-substitution semantics of ANSI C makes 1006/* Note that the weird token-substitution semantics of ANSI C makes
995 this work for MANY and UNEVALLED. */ 1007 this work for MANY and UNEVALLED. */
996#define DEFUN_ARGS_MANY (int, Lisp_Object *) 1008#define DEFUN_ARGS_MANY (int, Lisp_Object *)
997#define DEFUN_ARGS_UNEVALLED (Lisp_Object) 1009#define DEFUN_ARGS_UNEVALLED (Lisp_Object)
998#define DEFUN_ARGS_0 (void) 1010#define DEFUN_ARGS_0 (void)
@@ -1009,7 +1021,7 @@ typedef unsigned char UCHAR;
1009#endif 1021#endif
1010 1022
1011/* defsubr (Sname); 1023/* defsubr (Sname);
1012 is how we define the symbol for function `name' at start-up time. */ 1024 is how we define the symbol for function `name' at start-up time. */
1013extern void defsubr (); 1025extern void defsubr ();
1014 1026
1015#define MANY -2 1027#define MANY -2
@@ -1082,7 +1094,7 @@ extern Lisp_Object memory_signal_data;
1082 Tells GC how to save a copy of the stack. */ 1094 Tells GC how to save a copy of the stack. */
1083extern char *stack_bottom; 1095extern char *stack_bottom;
1084 1096
1085/* Check quit-flag and quit if it is non-nil. */ 1097/* Check quit-flag and quit if it is non-nil. */
1086 1098
1087#define QUIT \ 1099#define QUIT \
1088 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \ 1100 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
@@ -1117,7 +1129,7 @@ extern char *stack_bottom;
1117 1129
1118#define UPCASE1(CH) (XSTRING (current_buffer->upcase_table)->data[CH]) 1130#define UPCASE1(CH) (XSTRING (current_buffer->upcase_table)->data[CH])
1119 1131
1120/* Downcase a character, or make no change if that cannot be done. */ 1132/* Downcase a character, or make no change if that cannot be done. */
1121 1133
1122#define DOWNCASE(CH) (XSTRING (current_buffer->downcase_table)->data[CH]) 1134#define DOWNCASE(CH) (XSTRING (current_buffer->downcase_table)->data[CH])
1123 1135
@@ -1132,15 +1144,15 @@ extern char *stack_bottom;
1132extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table; 1144extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
1133extern Lisp_Object Vascii_canon_table, Vascii_eqv_table; 1145extern Lisp_Object Vascii_canon_table, Vascii_eqv_table;
1134 1146
1135/* number of bytes of structure consed since last GC */ 1147/* Number of bytes of structure consed since last GC. */
1136 1148
1137extern int consing_since_gc; 1149extern int consing_since_gc;
1138 1150
1139/* threshold for doing another gc */ 1151/* Threshold for doing another gc. */
1140 1152
1141extern int gc_cons_threshold; 1153extern int gc_cons_threshold;
1142 1154
1143/* Structure for recording stack slots that need marking */ 1155/* Structure for recording stack slots that need marking. */
1144 1156
1145/* This is a chain of structures, each of which points at a Lisp_Object variable 1157/* This is a chain of structures, each of which points at a Lisp_Object variable
1146 whose value should be marked in garbage collection. 1158 whose value should be marked in garbage collection.
@@ -1151,7 +1163,7 @@ extern int gc_cons_threshold;
1151 link disappears. 1163 link disappears.
1152 1164
1153 Every function that can call Feval must protect in this fashion all 1165 Every function that can call Feval must protect in this fashion all
1154 Lisp_Object variables whose contents will be used again. */ 1166 Lisp_Object variables whose contents will be used again. */
1155 1167
1156extern struct gcpro *gcprolist; 1168extern struct gcpro *gcprolist;
1157 1169
@@ -1192,7 +1204,7 @@ struct gcpro
1192 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ 1204 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \
1193 gcprolist = &gcpro5; } 1205 gcprolist = &gcpro5; }
1194 1206
1195/* Call staticpro (&var) to protect static variable `var'. */ 1207/* Call staticpro (&var) to protect static variable `var'. */
1196 1208
1197void staticpro(); 1209void staticpro();
1198 1210
@@ -1517,7 +1529,7 @@ void shut_down_emacs ( /* int signal, int no_x, Lisp_Object stuff */ );
1517extern int noninteractive; 1529extern int noninteractive;
1518/* Nonzero means don't do use window-system-specific display code */ 1530/* Nonzero means don't do use window-system-specific display code */
1519extern int inhibit_window_system; 1531extern int inhibit_window_system;
1520/* Nonzero means that a filter or a sentinel is running. */ 1532/* Nonzero means that a filter or a sentinel is running. */
1521extern int running_asynch_code; 1533extern int running_asynch_code;
1522 1534
1523/* defined in process.c */ 1535/* defined in process.c */