diff options
| author | Richard M. Stallman | 1995-10-07 22:07:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-10-07 22:07:01 +0000 |
| commit | 608ff985d9133417180184a7a335ba0126166a34 (patch) | |
| tree | 22322cc5eb59cc0416c5759b8fe440f69695dff9 /src | |
| parent | 4d27698234834aa0c210b4f2f7cb196274abb7ee (diff) | |
| download | emacs-608ff985d9133417180184a7a335ba0126166a34.tar.gz emacs-608ff985d9133417180184a7a335ba0126166a34.zip | |
(struct Lisp_Boolvector): New data type.
(struct Lisp_Char_Table): New structure.
(CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_ORDINARY_SLOTS): New macros.
(CHAR_TABLE_EXTRA_SLOTS): New macro.
(CHECK_CHAR_TABLE): New macro.
(pvec_type): Add PVEC_CHARTABLE and PVEC_BOOLVECTOR.
Move PVEC_BUFFER to a higher bit.
(CHARTABLEP, GC_CHARTABLEP, XSETCHARTABLE, XCHARTABLE): New macros.
(XBOOLVECTOR, XSETBOOLVECTOR, BOOLVECTORP, GC_BOOLVECTORP): New macros.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h index fc5473d4636..cda91c2b441 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -226,19 +226,21 @@ Lisp_Object; | |||
| 226 | enum pvec_type | 226 | enum pvec_type |
| 227 | { | 227 | { |
| 228 | PVEC_NORMAL_VECTOR = 0, | 228 | PVEC_NORMAL_VECTOR = 0, |
| 229 | PVEC_BUFFER = 0x100, | ||
| 230 | PVEC_PROCESS = 0x200, | 229 | PVEC_PROCESS = 0x200, |
| 231 | PVEC_FRAME = 0x400, | 230 | PVEC_FRAME = 0x400, |
| 232 | PVEC_COMPILED = 0x800, | 231 | PVEC_COMPILED = 0x800, |
| 233 | PVEC_WINDOW = 0x1000, | 232 | PVEC_WINDOW = 0x1000, |
| 234 | PVEC_WINDOW_CONFIGURATION = 0x2000, | 233 | PVEC_WINDOW_CONFIGURATION = 0x2000, |
| 235 | PVEC_SUBR = 0x4000, | 234 | PVEC_SUBR = 0x4000, |
| 236 | PVEC_TYPE_MASK = 0x7f00, | 235 | PVEC_CHAR_TABLE = 0x8000, |
| 236 | PVEC_BOOL_VECTOR = 0x10000, | ||
| 237 | PVEC_BUFFER = 0x20000, | ||
| 238 | PVEC_TYPE_MASK = 0x3ff00, | ||
| 237 | PVEC_FLAG = PSEUDOVECTOR_FLAG | 239 | PVEC_FLAG = PSEUDOVECTOR_FLAG |
| 238 | }; | 240 | }; |
| 239 | 241 | ||
| 240 | /* For convenience, we also store the number of elements in these bits. */ | 242 | /* For convenience, we also store the number of elements in these bits. */ |
| 241 | #define PSEUDOVECTOR_SIZE_MASK 0xff | 243 | #define PSEUDOVECTOR_SIZE_MASK 0x1ff |
| 242 | 244 | ||
| 243 | #endif /* NO_UNION_TYPE */ | 245 | #endif /* NO_UNION_TYPE */ |
| 244 | 246 | ||
| @@ -402,6 +404,8 @@ extern int pure_size; | |||
| 402 | #define XWINDOW(a) ((struct window *) XPNTR(a)) | 404 | #define XWINDOW(a) ((struct window *) XPNTR(a)) |
| 403 | #define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a)) | 405 | #define XSUBR(a) ((struct Lisp_Subr *) XPNTR(a)) |
| 404 | #define XBUFFER(a) ((struct buffer *) XPNTR(a)) | 406 | #define XBUFFER(a) ((struct buffer *) XPNTR(a)) |
| 407 | #define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a)) | ||
| 408 | #define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a)) | ||
| 405 | 409 | ||
| 406 | 410 | ||
| 407 | /* Construct a Lisp_Object from a value or address. */ | 411 | /* Construct a Lisp_Object from a value or address. */ |
| @@ -427,6 +431,8 @@ extern int pure_size; | |||
| 427 | #define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) | 431 | #define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) |
| 428 | #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) | 432 | #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) |
| 429 | #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) | 433 | #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) |
| 434 | #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) | ||
| 435 | #define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR)) | ||
| 430 | 436 | ||
| 431 | #ifdef USE_TEXT_PROPERTIES | 437 | #ifdef USE_TEXT_PROPERTIES |
| 432 | /* Basic data type for use of intervals. See the macros in intervals.h. */ | 438 | /* Basic data type for use of intervals. See the macros in intervals.h. */ |
| @@ -535,6 +541,55 @@ struct Lisp_Vector | |||
| 535 | Lisp_Object contents[1]; | 541 | Lisp_Object contents[1]; |
| 536 | }; | 542 | }; |
| 537 | 543 | ||
| 544 | /* A char table is a kind of vectorlike, with contents are like a vector | ||
| 545 | but with a few other slots. For some purposes, it makes sense | ||
| 546 | to handle a chartable with type struct Lisp_Vector. */ | ||
| 547 | |||
| 548 | /* This is the number of slots that apply to characters | ||
| 549 | or character sets. */ | ||
| 550 | #define CHAR_TABLE_ORDINARY_SLOTS 256 | ||
| 551 | |||
| 552 | /* This is the number of slots that every char table must have. | ||
| 553 | This counts the ordinary slots and the parent and defalt slots. */ | ||
| 554 | #define CHAR_TABLE_STANDARD_SLOTS (256+2) | ||
| 555 | |||
| 556 | /* Return the number of "extra" slots in the char table CT. */ | ||
| 557 | |||
| 558 | #define CHAR_TABLE_EXTRA_SLOTS(CT) \ | ||
| 559 | (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) | ||
| 560 | |||
| 561 | struct Lisp_Char_Table | ||
| 562 | { | ||
| 563 | /* This is the vector's size field, which also holds the | ||
| 564 | pseudovector type information. It holds the size, too. | ||
| 565 | The size counts the defalt and parent slots. */ | ||
| 566 | EMACS_INT size; | ||
| 567 | struct Lisp_Vector *next; | ||
| 568 | Lisp_Object contents[CHAR_TABLE_ORDINARY_SLOTS]; | ||
| 569 | /* This holds a default value, | ||
| 570 | which is used whenever the value for a specific character is nil. */ | ||
| 571 | Lisp_Object defalt; | ||
| 572 | /* This points to another char table, which we inherit from | ||
| 573 | when the value for a specific character is nil. | ||
| 574 | The `defalt' slot takes precedence over this. */ | ||
| 575 | Lisp_Object parent; | ||
| 576 | /* These hold additional data. */ | ||
| 577 | Lisp_Object extras[1]; | ||
| 578 | }; | ||
| 579 | |||
| 580 | /* A boolvector is a kind of vectorlike, with contents are like a string. */ | ||
| 581 | struct Lisp_Bool_Vector | ||
| 582 | { | ||
| 583 | /* This is the vector's size field. It doesn't have the real size, | ||
| 584 | just the subtype information. */ | ||
| 585 | EMACS_INT vector_size; | ||
| 586 | struct Lisp_Vector *next; | ||
| 587 | /* This is the size in bits. */ | ||
| 588 | EMACS_INT size; | ||
| 589 | /* This contains the actual bits, packed into bytes. */ | ||
| 590 | unsigned char data[1]; | ||
| 591 | }; | ||
| 592 | |||
| 538 | /* In a symbol, the markbit of the plist is used as the gc mark bit */ | 593 | /* In a symbol, the markbit of the plist is used as the gc mark bit */ |
| 539 | 594 | ||
| 540 | struct Lisp_Symbol | 595 | struct Lisp_Symbol |
| @@ -899,6 +954,10 @@ typedef unsigned char UCHAR; | |||
| 899 | #define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED) | 954 | #define GC_COMPILEDP(x) GC_PSEUDOVECTORP (x, PVEC_COMPILED) |
| 900 | #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) | 955 | #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) |
| 901 | #define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER) | 956 | #define GC_BUFFERP(x) GC_PSEUDOVECTORP (x, PVEC_BUFFER) |
| 957 | #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) | ||
| 958 | #define GC_CHAR_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_CHAR_TABLE) | ||
| 959 | #define BOOL_VECTOR_P(x) PSEUDOVECTORP (x, PVEC_BOOL_VECTOR) | ||
| 960 | #define GC_BOOL_VECTOR_P(x) GC_PSEUDOVECTORP (x, PVEC_BOOL_VECTOR) | ||
| 902 | 961 | ||
| 903 | #ifdef MULTI_FRAME | 962 | #ifdef MULTI_FRAME |
| 904 | #define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME) | 963 | #define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME) |
| @@ -928,6 +987,10 @@ typedef unsigned char UCHAR; | |||
| 928 | #define CHECK_SYMBOL(x, i) \ | 987 | #define CHECK_SYMBOL(x, i) \ |
| 929 | do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0) | 988 | do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0) |
| 930 | 989 | ||
| 990 | #define CHECK_CHAR_TABLE(x, i) \ | ||
| 991 | do { if (!CHAR_TABLE_P ((x)) && !NILP (x)) \ | ||
| 992 | x = wrong_type_argument (Qchar_table_p, (x)); } while (0) | ||
| 993 | |||
| 931 | #define CHECK_VECTOR(x, i) \ | 994 | #define CHECK_VECTOR(x, i) \ |
| 932 | do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0) | 995 | do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0) |
| 933 | 996 | ||
| @@ -1288,6 +1351,7 @@ extern Lisp_Object Qsymbolp, Qlistp, Qconsp; | |||
| 1288 | extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp; | 1351 | extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp; |
| 1289 | extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qvectorp; | 1352 | extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qvectorp; |
| 1290 | extern Lisp_Object Qinteger_or_marker_p, Qnumber_or_marker_p; | 1353 | extern Lisp_Object Qinteger_or_marker_p, Qnumber_or_marker_p; |
| 1354 | extern Lisp_Object Qchar_table_p; | ||
| 1291 | extern Lisp_Object Qboundp, Qfboundp; | 1355 | extern Lisp_Object Qboundp, Qfboundp; |
| 1292 | extern Lisp_Object Qbuffer_or_string_p; | 1356 | extern Lisp_Object Qbuffer_or_string_p; |
| 1293 | extern Lisp_Object Qcdr; | 1357 | extern Lisp_Object Qcdr; |