aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-30 01:54:16 +0000
committerRichard M. Stallman1994-12-30 01:54:16 +0000
commit7c06ac2bfaa05716f686104c58906c412958b463 (patch)
treeab278b21023a45b7c7904e56d4c27ea15badcb9c /src
parent169ee24357c55b3aded78bffdd618f8a036d6b55 (diff)
downloademacs-7c06ac2bfaa05716f686104c58906c412958b463.tar.gz
emacs-7c06ac2bfaa05716f686104c58906c412958b463.zip
(VALBITS): Default now 28.
(GCTYPEBITS): Default now 3. (enum Lisp_Type): Lisp_Process, Lisp_Window, Lisp_Frame, Lisp_Subr deleted. (PSEUDOVECTORP, GC_PSEUDOVECTORP): Add paren for proper nesting. (PROCESSP, GC_PROCESSP, XSETPROCESS): Rewrite to use pseudovectors. (WINDOWP, GC_WINDOWP, XSETWINDOW): Likewise. (FRAMEP, GC_FRAMEP): Likewise. (SUBRP, GC_SUBRP, XSETSUBR): Likewise. (PVEC_SUBR): New macro. (struct Lisp_Subr): Add a size field. (DEFUN (both definitions)): Store that size field.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h178
1 files changed, 96 insertions, 82 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 5517743cfdc..3312fbb6d97 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -47,7 +47,7 @@ enum Lisp_Type
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.
50 XVECTOR(object) points to a struct Lisp_Vector, which contains 50 XVECTOR (object) points to a struct Lisp_Vector, which contains
51 the size and contents. The size field also contains the type 51 the size and contents. The size field also contains the 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,
@@ -55,38 +55,9 @@ enum Lisp_Type
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 /* Byte-compiled function. A vector of 4 to 6 elements which are the 58 /* Editor buffer. XBUFFER (obj) points to a struct buffer. */
59 arglist, bytecode-string, constant vector, stack size,
60 (optional) doc string, and (optional) interactive spec. */
61 Lisp_Compiled,
62
63 /* Editor buffer. XBUFFER(obj) points to a struct buffer. */
64 Lisp_Buffer, 59 Lisp_Buffer,
65 60
66 /* Built-in function. XSUBR(obj) points to a struct Lisp_Subr
67 which describes how to call the function, and its documentation,
68 as well as pointing to the code. */
69 Lisp_Subr,
70
71 /* Object describing a connection to a subprocess.
72 It points to storage of type struct Lisp_Process */
73 Lisp_Process,
74
75#ifdef MULTI_FRAME
76 /* Pointer to a vector-like object describing a display frame
77 on which Emacs can display a window hierarchy. We don't define
78 this unless MULTI_FRAME is defined; this helps the compiler catch
79 code that won't work on a non-MULTI_FRAME configuration. */
80 Lisp_Frame,
81#endif
82
83 /* Window used for Emacs display.
84 Data inside looks like a Lisp_Vector. */
85 Lisp_Window,
86
87 /* Used by save,set,restore-window-configuration */
88 OBSOLETE_Lisp_Window_Configuration,
89
90#ifdef LISP_FLOAT_TYPE 61#ifdef LISP_FLOAT_TYPE
91 Lisp_Float, 62 Lisp_Float,
92#endif /* LISP_FLOAT_TYPE */ 63#endif /* LISP_FLOAT_TYPE */
@@ -188,11 +159,11 @@ Lisp_Object;
188 159
189/* These values are overridden by the m- file on some machines. */ 160/* These values are overridden by the m- file on some machines. */
190#ifndef VALBITS 161#ifndef VALBITS
191#define VALBITS 24 162#define VALBITS 28
192#endif 163#endif
193 164
194#ifndef GCTYPEBITS 165#ifndef GCTYPEBITS
195#define GCTYPEBITS 7 166#define GCTYPEBITS 3
196#endif 167#endif
197 168
198#ifndef VALMASK 169#ifndef VALMASK
@@ -238,6 +209,7 @@ Lisp_Object;
238#define PVEC_COMPILED 0x800 209#define PVEC_COMPILED 0x800
239#define PVEC_WINDOW 0x1000 210#define PVEC_WINDOW 0x1000
240#define PVEC_WINDOW_CONFIGURATION 0x2000 211#define PVEC_WINDOW_CONFIGURATION 0x2000
212#define PVEC_SUBR 0x4000
241 213
242/* For convenience, we also store the number of elements in these bits. */ 214/* For convenience, we also store the number of elements in these bits. */
243#define PSEUDOVECTOR_SIZE_MASK 0xff 215#define PSEUDOVECTOR_SIZE_MASK 0xff
@@ -387,13 +359,12 @@ extern int pure_size;
387#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a)) 359#define XCONS(a) ((struct Lisp_Cons *) XPNTR(a))
388#define XBUFFER(a) ((struct buffer *) XPNTR(a)) 360#define XBUFFER(a) ((struct buffer *) XPNTR(a))
389#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a)) 361#define XVECTOR(a) ((struct Lisp_Vector *) XPNTR(a))
390#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
391#define XSTRING(a) ((struct Lisp_String *) XPNTR(a)) 362#define XSTRING(a) ((struct Lisp_String *) XPNTR(a))
392#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a)) 363#define XSYMBOL(a) ((struct Lisp_Symbol *) XPNTR(a))
393#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
394#define XWINDOW(a) ((struct window *) XPNTR(a))
395#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
396#define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a)) 364#define XFLOAT(a) ((struct Lisp_Float *) XPNTR(a))
365
366/* Misc types. */
367#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
397#define XMARKER(a) (&(XMISC(a)->u_marker)) 368#define XMARKER(a) (&(XMISC(a)->u_marker))
398#define XINTFWD(a) (&(XMISC(a)->u_intfwd)) 369#define XINTFWD(a) (&(XMISC(a)->u_intfwd))
399#define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd)) 370#define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd))
@@ -402,21 +373,32 @@ extern int pure_size;
402#define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value)) 373#define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value))
403#define XOVERLAY(a) (&(XMISC(a)->u_overlay)) 374#define XOVERLAY(a) (&(XMISC(a)->u_overlay))
404 375
376/* Pseudovector types. */
377#define XPROCESS(a) ((struct Lisp_Process *) XPNTR(a))
378#define XWINDOW(a) ((struct window *) XPNTR(a))
379#define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a))
380
405#define XSETINT(a, b) XSET (a, Lisp_Int, b) 381#define XSETINT(a, b) XSET (a, Lisp_Int, b)
406#define XSETCONS(a, b) XSET (a, Lisp_Cons, b) 382#define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
407#define XSETBUFFER(a, b) XSET (a, Lisp_Buffer, b) 383#define XSETBUFFER(a, b) XSET (a, Lisp_Buffer, b)
408#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b) 384#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
409#define XSETSUBR(a, b) XSET (a, Lisp_Subr, b)
410#define XSETSTRING(a, b) XSET (a, Lisp_String, b) 385#define XSETSTRING(a, b) XSET (a, Lisp_String, b)
411#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b) 386#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
412#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
413#define XSETWINDOW(a, b) XSET (a, Lisp_Window, b)
414#define XSETPROCESS(a, b) XSET (a, Lisp_Process, b)
415#define XSETFLOAT(a, b) XSET (a, Lisp_Float, b) 387#define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
416#define XSETPSEUDOVECTOR(a, b, code) (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code)) 388
417#define XSETWINDOW_CONFIGURATION(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) 389/* Misc types. */
418#define XSETCOMPILED(a, b) XSET (a, Lisp_Compiled, b) 390#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
419#define XSETMARKER(a, b) (XSETMISC (a, b), XMISC (a)->type = Lisp_Misc_Marker) 391#define XSETMARKER(a, b) (XSETMISC (a, b), XMISC (a)->type = Lisp_Misc_Marker)
392
393/* Pseudovector types. */
394#define XSETPSEUDOVECTOR(a, b, code) \
395 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code))
396#define XSETWINDOW_CONFIGURATION(a, b) \
397 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
398#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
399#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
400#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
401#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
420 402
421#ifdef USE_TEXT_PROPERTIES 403#ifdef USE_TEXT_PROPERTIES
422/* Basic data type for use of intervals. See the macros in intervals.h */ 404/* Basic data type for use of intervals. See the macros in intervals.h */
@@ -536,8 +518,17 @@ struct Lisp_Symbol
536 struct Lisp_Symbol *next; /* -> next symbol in this obarray bucket */ 518 struct Lisp_Symbol *next; /* -> next symbol in this obarray bucket */
537 }; 519 };
538 520
521/* This structure describes a built-in function.
522 It is generated by the DEFUN macro only.
523 defsubr makes it into a Lisp object.
524
525 This type is treated in most respects as a pseudovector,
526 but since we never dynamically allocate or free them,
527 we don't need a next-vector field. */
528
539struct Lisp_Subr 529struct Lisp_Subr
540 { 530 {
531 EMACS_INT size;
541 Lisp_Object (*function) (); 532 Lisp_Object (*function) ();
542 short min_args, max_args; 533 short min_args, max_args;
543 char *symbol_name; 534 char *symbol_name;
@@ -545,6 +536,8 @@ struct Lisp_Subr
545 char *doc; 536 char *doc;
546 }; 537 };
547 538
539/* These structures are used for various misc types. */
540
548/* A miscellaneous object, when it's on the free list. */ 541/* A miscellaneous object, when it's on the free list. */
549struct Lisp_Free 542struct Lisp_Free
550 { 543 {
@@ -666,7 +659,7 @@ union Lisp_Misc
666 struct Lisp_Buffer_Local_Value u_buffer_local_value; 659 struct Lisp_Buffer_Local_Value u_buffer_local_value;
667 struct Lisp_Overlay u_overlay; 660 struct Lisp_Overlay u_overlay;
668 }; 661 };
669 662
670#ifdef LISP_FLOAT_TYPE 663#ifdef LISP_FLOAT_TYPE
671/* Optional Lisp floating point type */ 664/* Optional Lisp floating point type */
672struct Lisp_Float 665struct Lisp_Float
@@ -695,14 +688,14 @@ typedef unsigned char UCHAR;
695 688
696/* Flag bits in a character. These also get used in termhooks.h. 689/* Flag bits in a character. These also get used in termhooks.h.
697 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE 690 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
698 (MUlti-Lingual Emacs) might need 18 bits for the character value 691 (MUlti-Lingual Emacs) might need 22 bits for the character value
699 itself, so we probably shouldn't use any bits lower than 0x040000. */ 692 itself, so we probably shouldn't use any bits lower than 0x0400000. */
700#define CHAR_ALT (0x040000) 693#define CHAR_ALT (0x0400000)
701#define CHAR_SUPER (0x080000) 694#define CHAR_SUPER (0x0800000)
702#define CHAR_HYPER (0x100000) 695#define CHAR_HYPER (0x1000000)
703#define CHAR_SHIFT (0x200000) 696#define CHAR_SHIFT (0x2000000)
704#define CHAR_CTL (0x400000) 697#define CHAR_CTL (0x4000000)
705#define CHAR_META (0x800000) 698#define CHAR_META (0x8000000)
706 699
707#ifdef USE_X_TOOLKIT 700#ifdef USE_X_TOOLKIT
708#ifdef NO_UNION_TYPE 701#ifdef NO_UNION_TYPE
@@ -797,31 +790,9 @@ typedef unsigned char UCHAR;
797#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String) 790#define GC_STRINGP(x) (XGCTYPE ((x)) == Lisp_String)
798#define CONSP(x) (XTYPE ((x)) == Lisp_Cons) 791#define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
799#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons) 792#define GC_CONSP(x) (XGCTYPE ((x)) == Lisp_Cons)
800#define COMPILEDP(x) (XTYPE ((x)) == Lisp_Compiled)
801#define GC_COMPILEDP(x) (XGCTYPE ((x)) == Lisp_Compiled)
802#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer) 793#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
803#define GC_BUFFERP(x) (XGCTYPE ((x)) == Lisp_Buffer) 794#define GC_BUFFERP(x) (XGCTYPE ((x)) == Lisp_Buffer)
804#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr) 795
805#define GC_SUBRP(x) (XGCTYPE ((x)) == Lisp_Subr)
806#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
807#define GC_PROCESSP(x) (XGCTYPE ((x)) == Lisp_Process)
808#ifdef MULTI_FRAME
809#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
810#define GC_FRAMEP(x) (XGCTYPE ((x)) == Lisp_Frame)
811#else
812#ifdef HAVE_MOUSE
813/* We could use this in the !HAVE_MOUSE case also, but we prefer a compile-time
814 error message in case FRAMEP is used. */
815#define FRAMEP(x) (EQ (x, Fselected_frame ()))
816#define GC_FRAMEP(x) (GC_EQ (x, Fselected_frame ()))
817#endif
818#endif
819#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
820#define GC_WINDOWP(x) (XGCTYPE ((x)) == Lisp_Window)
821#define PSEUDOVECTORP(x, code) (VECTORLIKEP (x) && ((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) == PSEUDOVECTOR_FLAG | (code))
822#define GC_PSEUDOVECTORP(x, code) (GC_VECTORLIKEP (x) && ((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) == PSEUDOVECTOR_FLAG | (code))
823#define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
824#define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
825#ifdef LISP_FLOAT_TYPE 796#ifdef LISP_FLOAT_TYPE
826#define FLOATP(x) (XTYPE ((x)) == Lisp_Float) 797#define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
827#define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float) 798#define GC_FLOATP(x) (XGCTYPE ((x)) == Lisp_Float)
@@ -848,6 +819,45 @@ typedef unsigned char UCHAR;
848#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value) 819#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value)
849#define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value) 820#define GC_SOME_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISC (x)->type == Lisp_Misc_Some_Buffer_Local_Value)
850 821
822
823/* True if object X is a pseudo vector whose code is CODE. */
824#define PSEUDOVECTORP(x, code) \
825 (VECTORLIKEP (x) \
826 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
827 == (PSEUDOVECTOR_FLAG | (code))))
828
829/* True if object X is a pseudo vector whose code is CODE.
830 This one works during GC. */
831#define GC_PSEUDOVECTORP(x, code) \
832 (GC_VECTORLIKEP (x) \
833 && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code)))) \
834 == (PSEUDOVECTOR_FLAG | (code))))
835
836/* Test for specific pseudovector types. */
837#define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
838#define GC_WINDOW_CONFIGURATIONP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
839#define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
840#define GC_PROCESSP(x) GC_PSEUDOVECTORP (x, PVEC_PROCESS)
841#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
842#define GC_WINDOWP(x) GC_PSEUDOVECTORP (x, PVEC_WINDOW)
843#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
844#define GC_SUBRP(x) GC_PSEUDOVECTORP (x, PVEC_SUBR)
845#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
846#define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED)
847
848#ifdef MULTI_FRAME
849#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
850#define GC_FRAMEP(x) GC_PSEUDOVECTORP (x, PVEC_FRAME)
851#else
852#ifdef HAVE_MOUSE
853/* We could use this in the !HAVE_MOUSE case also, but we prefer a compile-time
854 error message in case FRAMEP is used. */
855#define FRAMEP(x) (EQ (x, Fselected_frame ()))
856#define GC_FRAMEP(x) (GC_EQ (x, Fselected_frame ()))
857#endif
858#endif
859
860
851#define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) 861#define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
852#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y)) 862#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
853 863
@@ -963,18 +973,22 @@ typedef unsigned char UCHAR;
963 `doc' is documentation for the user. */ 973 `doc' is documentation for the user. */
964 974
965#if !defined (__STDC__) || defined (USE_NONANSI_DEFUN) 975#if !defined (__STDC__) || defined (USE_NONANSI_DEFUN)
966#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \ 976#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
967 Lisp_Object fnname (); \ 977 Lisp_Object fnname (); \
968 struct Lisp_Subr sname = {fnname, minargs, maxargs, lname, prompt, 0}; \ 978 struct Lisp_Subr sname = \
979 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
980 fnname, minargs, maxargs, lname, prompt, 0}; \
969 Lisp_Object fnname 981 Lisp_Object fnname
970 982
971#else 983#else
972 984
973/* This version of DEFUN declares a function prototype with the right 985/* This version of DEFUN declares a function prototype with the right
974 arguments, so we can catch errors with maxargs at compile-time. */ 986 arguments, so we can catch errors with maxargs at compile-time. */
975#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \ 987#define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
976 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 988 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
977 struct Lisp_Subr sname = {fnname, minargs, maxargs, lname, prompt, 0}; \ 989 struct Lisp_Subr sname = \
990 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
991 fnname, minargs, maxargs, lname, prompt, 0}; \
978 Lisp_Object fnname 992 Lisp_Object fnname
979 993
980/* Note that the weird token-substitution semantics of ANSI C makes 994/* Note that the weird token-substitution semantics of ANSI C makes