diff options
| author | Paul Eggert | 2012-07-29 22:41:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-29 22:41:10 -0700 |
| commit | 03a660a609328ce854721de7ba403f6725ab4ace (patch) | |
| tree | fdcec18ea935fc0fe9385b164736101bcd05cf24 /src | |
| parent | e499d0eebc7d8c12b42b2aa5392ce747ca3619ea (diff) | |
| download | emacs-03a660a609328ce854721de7ba403f6725ab4ace.tar.gz emacs-03a660a609328ce854721de7ba403f6725ab4ace.zip | |
Export to GDB most of lisp.h's remaining object-like macros.
* lisp.h (min, max): Move earlier, because they're used earlier now.
(INTMASK, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK)
(CHAR_TABLE_STANDARD_SLOTS, CHARTAB_SIZE_BITS_0)
(CHARTAB_SIZE_BITS_1, CHARTAB_SIZE_BITS_2, CHARTAB_SIZE_BITS_3)
(DEFAULT_HASH_SIZE, COMPILED_ARGLIST, COMPILED_BYTECODE)
(COMPILED_CONSTANTS, COMPILED_STACK_DEPTH, COMPILED_DOC_STRING)
(COMPILED_INTERACTIVE, CHAR_ALT, CHAR_SUPER, CHAR_HYPER, CHAR_SHIFT)
(CHAR_CTL, CHAR_META, CHAR_MODIFIER_MASK, CHARACTERBITS)
(MANY, UNEVALLED, FLOAT_TO_STRING_BUFSIZE, MAX_ALLOCA):
Now constants, for GDB. They need not be macros.
(MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM, STRING_BYTES_BOUND):
Now constants, for GDB, as well as macros, for static initializers.
(CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_EXTRA_SLOTS):
Move to after the definition of struct Lisp_Char_Table,
since the former now needs that type defined.
(enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS)
(enum DEFAULT_HASH_SIZE, enum Lisp_Compiled, enum char_bits)
(enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA):
New enums, for gdb_make_enums_visible.
(GLYPH_MODE_LINE_FACE): Remove; unused.
* alloc.c (STRING_BYTES_MAX): Now a constant, now a macro.
(gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum
CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE,
enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled,
enum maxargs, enum MAX_ALLOCA.
(ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): Remove.
(ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Remove;
no longer needed, now that they are done in lisp.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 32 | ||||
| -rw-r--r-- | src/alloc.c | 48 | ||||
| -rw-r--r-- | src/lisp.h | 134 |
3 files changed, 124 insertions, 90 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6f3c0fc0913..6825a22c08a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2012-07-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Export to GDB most of lisp.h's remaining object-like macros. | ||
| 4 | * lisp.h (min, max): Move earlier, because they're used earlier now. | ||
| 5 | (INTMASK, ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK) | ||
| 6 | (CHAR_TABLE_STANDARD_SLOTS, CHARTAB_SIZE_BITS_0) | ||
| 7 | (CHARTAB_SIZE_BITS_1, CHARTAB_SIZE_BITS_2, CHARTAB_SIZE_BITS_3) | ||
| 8 | (DEFAULT_HASH_SIZE, COMPILED_ARGLIST, COMPILED_BYTECODE) | ||
| 9 | (COMPILED_CONSTANTS, COMPILED_STACK_DEPTH, COMPILED_DOC_STRING) | ||
| 10 | (COMPILED_INTERACTIVE, CHAR_ALT, CHAR_SUPER, CHAR_HYPER, CHAR_SHIFT) | ||
| 11 | (CHAR_CTL, CHAR_META, CHAR_MODIFIER_MASK, CHARACTERBITS) | ||
| 12 | (MANY, UNEVALLED, FLOAT_TO_STRING_BUFSIZE, MAX_ALLOCA): | ||
| 13 | Now constants, for GDB. They need not be macros. | ||
| 14 | (MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM, STRING_BYTES_BOUND): | ||
| 15 | Now constants, for GDB, as well as macros, for static initializers. | ||
| 16 | (CHAR_TABLE_STANDARD_SLOTS, CHAR_TABLE_EXTRA_SLOTS): | ||
| 17 | Move to after the definition of struct Lisp_Char_Table, | ||
| 18 | since the former now needs that type defined. | ||
| 19 | (enum CHARTAB_SIZE_BITS, enum CHAR_TABLE_STANDARD_SLOTS) | ||
| 20 | (enum DEFAULT_HASH_SIZE, enum Lisp_Compiled, enum char_bits) | ||
| 21 | (enum maxargs, enum FLOAT_TO_STRING_BUFSIZE, enum MAX_ALLOCA): | ||
| 22 | New enums, for gdb_make_enums_visible. | ||
| 23 | (GLYPH_MODE_LINE_FACE): Remove; unused. | ||
| 24 | * alloc.c (STRING_BYTES_MAX): Now a constant, now a macro. | ||
| 25 | (gdb_make_enums_visible): Add enum CHARTAB_SIZE_BITS, enum | ||
| 26 | CHAR_TABLE_STANDARD_SLOTS, enum char_bits, enum DEFAULT_HASH_SIZE, | ||
| 27 | enum FLOAT_TO_STRING_BUFSIZE, enum Lisp_Bits, enum Lisp_Compiled, | ||
| 28 | enum maxargs, enum MAX_ALLOCA. | ||
| 29 | (ARRAY_MARK_FLAG_VAL, PSEUDOVECTOR_FLAG_VAL, VALMASK_VAL): Remove. | ||
| 30 | (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Remove; | ||
| 31 | no longer needed, now that they are done in lisp.h. | ||
| 32 | |||
| 1 | 2012-07-30 Dmitry Antipov <dmantipov@yandex.ru> | 33 | 2012-07-30 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 34 | ||
| 3 | Cleanup string bytes checking. | 35 | Cleanup string bytes checking. |
diff --git a/src/alloc.c b/src/alloc.c index cb375f5432d..c5ed1980d7c 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1774,13 +1774,13 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1774 | STRING_BYTES_BOUND, nor can it be so long that the size_t | 1774 | STRING_BYTES_BOUND, nor can it be so long that the size_t |
| 1775 | arithmetic in allocate_string_data would overflow while it is | 1775 | arithmetic in allocate_string_data would overflow while it is |
| 1776 | calculating a value to be passed to malloc. */ | 1776 | calculating a value to be passed to malloc. */ |
| 1777 | #define STRING_BYTES_MAX \ | 1777 | static ptrdiff_t const STRING_BYTES_MAX = |
| 1778 | min (STRING_BYTES_BOUND, \ | 1778 | min (STRING_BYTES_BOUND, |
| 1779 | ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD \ | 1779 | ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD |
| 1780 | - GC_STRING_EXTRA \ | 1780 | - GC_STRING_EXTRA |
| 1781 | - offsetof (struct sblock, first_data) \ | 1781 | - offsetof (struct sblock, first_data) |
| 1782 | - SDATA_DATA_OFFSET) \ | 1782 | - SDATA_DATA_OFFSET) |
| 1783 | & ~(sizeof (EMACS_INT) - 1))) | 1783 | & ~(sizeof (EMACS_INT) - 1))); |
| 1784 | 1784 | ||
| 1785 | /* Initialize string allocation. Called from init_alloc_once. */ | 1785 | /* Initialize string allocation. Called from init_alloc_once. */ |
| 1786 | 1786 | ||
| @@ -6863,41 +6863,23 @@ The time is in seconds as a floating point value. */); | |||
| 6863 | #endif | 6863 | #endif |
| 6864 | } | 6864 | } |
| 6865 | 6865 | ||
| 6866 | /* Make some symbols visible to GDB. This section is last, so that | ||
| 6867 | the #undef lines don't mess up later code. */ | ||
| 6868 | |||
| 6869 | /* When compiled with GCC, GDB might say "No enum type named | 6866 | /* When compiled with GCC, GDB might say "No enum type named |
| 6870 | pvec_type" if we don't have at least one symbol with that type, and | 6867 | pvec_type" if we don't have at least one symbol with that type, and |
| 6871 | then xbacktrace could fail. Similarly for the other enums and | 6868 | then xbacktrace could fail. Similarly for the other enums and |
| 6872 | their values. */ | 6869 | their values. */ |
| 6873 | union | 6870 | union |
| 6874 | { | 6871 | { |
| 6872 | enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; | ||
| 6873 | enum CHAR_TABLE_STANDARD_SLOTS CHAR_TABLE_STANDARD_SLOTS; | ||
| 6874 | enum char_bits char_bits; | ||
| 6875 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; | 6875 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; |
| 6876 | enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; | ||
| 6876 | enum enum_USE_LSB_TAG enum_USE_LSB_TAG; | 6877 | enum enum_USE_LSB_TAG enum_USE_LSB_TAG; |
| 6878 | enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE; | ||
| 6877 | enum Lisp_Bits Lisp_Bits; | 6879 | enum Lisp_Bits Lisp_Bits; |
| 6880 | enum Lisp_Compiled Lisp_Compiled; | ||
| 6881 | enum maxargs maxargs; | ||
| 6882 | enum MAX_ALLOCA MAX_ALLOCA; | ||
| 6878 | enum More_Lisp_Bits More_Lisp_Bits; | 6883 | enum More_Lisp_Bits More_Lisp_Bits; |
| 6879 | enum pvec_type pvec_type; | 6884 | enum pvec_type pvec_type; |
| 6880 | } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; | 6885 | } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0}; |
| 6881 | |||
| 6882 | /* These symbols cannot be done as enums, since values might not be | ||
| 6883 | in 'int' range. Each symbol X has a corresponding X_VAL symbol, | ||
| 6884 | verified to have the correct value. */ | ||
| 6885 | |||
| 6886 | #define ARRAY_MARK_FLAG_VAL PTRDIFF_MIN | ||
| 6887 | #define PSEUDOVECTOR_FLAG_VAL (PTRDIFF_MAX - PTRDIFF_MAX / 2) | ||
| 6888 | #define VALMASK_VAL (USE_LSB_TAG ? -1 << GCTYPEBITS : VAL_MAX) | ||
| 6889 | |||
| 6890 | verify (ARRAY_MARK_FLAG_VAL == ARRAY_MARK_FLAG); | ||
| 6891 | verify (PSEUDOVECTOR_FLAG_VAL == PSEUDOVECTOR_FLAG); | ||
| 6892 | verify (VALMASK_VAL == VALMASK); | ||
| 6893 | |||
| 6894 | #undef ARRAY_MARK_FLAG | ||
| 6895 | #undef PSEUDOVECTOR_FLAG | ||
| 6896 | #undef VALMASK | ||
| 6897 | |||
| 6898 | ptrdiff_t const EXTERNALLY_VISIBLE | ||
| 6899 | ARRAY_MARK_FLAG = ARRAY_MARK_FLAG_VAL, | ||
| 6900 | PSEUDOVECTOR_FLAG = PSEUDOVECTOR_FLAG_VAL; | ||
| 6901 | |||
| 6902 | EMACS_INT const EXTERNALLY_VISIBLE | ||
| 6903 | VALMASK = VALMASK_VAL; | ||
diff --git a/src/lisp.h b/src/lisp.h index a530148e4dd..cf5c70bf1e4 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -28,6 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | #include <intprops.h> | 29 | #include <intprops.h> |
| 30 | 30 | ||
| 31 | /* The ubiquitous max and min macros. */ | ||
| 32 | #undef min | ||
| 33 | #undef max | ||
| 34 | #define max(a, b) ((a) > (b) ? (a) : (b)) | ||
| 35 | #define min(a, b) ((a) < (b) ? (a) : (b)) | ||
| 36 | |||
| 31 | /* EMACS_INT - signed integer wide enough to hold an Emacs value | 37 | /* EMACS_INT - signed integer wide enough to hold an Emacs value |
| 32 | EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if | 38 | EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if |
| 33 | pI - printf length modifier for EMACS_INT | 39 | pI - printf length modifier for EMACS_INT |
| @@ -212,7 +218,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; | |||
| 212 | 218 | ||
| 213 | /* Lisp integers use 2 tags, to give them one extra bit, thus | 219 | /* Lisp integers use 2 tags, to give them one extra bit, thus |
| 214 | extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ | 220 | extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1. */ |
| 215 | #define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1)) | 221 | static EMACS_INT const INTMASK = EMACS_INT_MAX >> (INTTYPEBITS - 1); |
| 216 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 | 222 | #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 |
| 217 | #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) | 223 | #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) |
| 218 | 224 | ||
| @@ -320,11 +326,11 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; | |||
| 320 | 326 | ||
| 321 | /* In the size word of a vector, this bit means the vector has been marked. */ | 327 | /* In the size word of a vector, this bit means the vector has been marked. */ |
| 322 | 328 | ||
| 323 | #define ARRAY_MARK_FLAG PTRDIFF_MIN | 329 | static ptrdiff_t const ARRAY_MARK_FLAG = PTRDIFF_MIN; |
| 324 | 330 | ||
| 325 | /* In the size word of a struct Lisp_Vector, this bit means it's really | 331 | /* In the size word of a struct Lisp_Vector, this bit means it's really |
| 326 | some other vector-like object. */ | 332 | some other vector-like object. */ |
| 327 | #define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) | 333 | static ptrdiff_t const PSEUDOVECTOR_FLAG = PTRDIFF_MAX - PTRDIFF_MAX / 2; |
| 328 | 334 | ||
| 329 | /* In a pseudovector, the size field actually contains a word with one | 335 | /* In a pseudovector, the size field actually contains a word with one |
| 330 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to | 336 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to |
| @@ -392,7 +398,7 @@ enum More_Lisp_Bits | |||
| 392 | 398 | ||
| 393 | #if USE_LSB_TAG | 399 | #if USE_LSB_TAG |
| 394 | 400 | ||
| 395 | #define VALMASK (-1 << GCTYPEBITS) | 401 | static int const VALMASK = -1 << GCTYPEBITS; |
| 396 | #define TYPEMASK ((1 << GCTYPEBITS) - 1) | 402 | #define TYPEMASK ((1 << GCTYPEBITS) - 1) |
| 397 | #define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK)) | 403 | #define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK)) |
| 398 | #define XINT(a) (XLI (a) >> INTTYPEBITS) | 404 | #define XINT(a) (XLI (a) >> INTTYPEBITS) |
| @@ -407,7 +413,7 @@ enum More_Lisp_Bits | |||
| 407 | 413 | ||
| 408 | #else /* not USE_LSB_TAG */ | 414 | #else /* not USE_LSB_TAG */ |
| 409 | 415 | ||
| 410 | #define VALMASK VAL_MAX | 416 | static EMACS_INT const VALMASK = VAL_MAX; |
| 411 | 417 | ||
| 412 | #define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS)) | 418 | #define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS)) |
| 413 | 419 | ||
| @@ -455,9 +461,14 @@ enum More_Lisp_Bits | |||
| 455 | #define EQ(x, y) (XHASH (x) == XHASH (y)) | 461 | #define EQ(x, y) (XHASH (x) == XHASH (y)) |
| 456 | 462 | ||
| 457 | /* Largest and smallest representable fixnum values. These are the C | 463 | /* Largest and smallest representable fixnum values. These are the C |
| 458 | values. */ | 464 | values. They are macros for use in static initializers, and |
| 465 | constants for visibility to GDB. */ | ||
| 466 | static EMACS_INT const MOST_POSITIVE_FIXNUM = | ||
| 459 | #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) | 467 | #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) |
| 468 | MOST_POSITIVE_FIXNUM; | ||
| 469 | static EMACS_INT const MOST_NEGATIVE_FIXNUM = | ||
| 460 | #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) | 470 | #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) |
| 471 | MOST_NEGATIVE_FIXNUM; | ||
| 461 | 472 | ||
| 462 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is | 473 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is |
| 463 | written this way so that it also works if I is of unsigned | 474 | written this way so that it also works if I is of unsigned |
| @@ -702,10 +713,15 @@ extern ptrdiff_t string_bytes (struct Lisp_String *); | |||
| 702 | Although the actual size limit (see STRING_BYTES_MAX in alloc.c) | 713 | Although the actual size limit (see STRING_BYTES_MAX in alloc.c) |
| 703 | may be a bit smaller than STRING_BYTES_BOUND, calculating it here | 714 | may be a bit smaller than STRING_BYTES_BOUND, calculating it here |
| 704 | would expose alloc.c internal details that we'd rather keep | 715 | would expose alloc.c internal details that we'd rather keep |
| 705 | private. The cast to ptrdiff_t ensures that STRING_BYTES_BOUND is | 716 | private. |
| 706 | signed. */ | 717 | |
| 718 | This is a macros for use in static initializers, and a constant for | ||
| 719 | visibility to GDB. The cast to ptrdiff_t ensures that | ||
| 720 | STRING_BYTES_BOUND is signed. */ | ||
| 721 | static ptrdiff_t const STRING_BYTES_BOUND = | ||
| 707 | #define STRING_BYTES_BOUND \ | 722 | #define STRING_BYTES_BOUND \ |
| 708 | min (MOST_POSITIVE_FIXNUM, (ptrdiff_t) min (SIZE_MAX, PTRDIFF_MAX) - 1) | 723 | min (MOST_POSITIVE_FIXNUM, (ptrdiff_t) min (SIZE_MAX, PTRDIFF_MAX) - 1) |
| 724 | STRING_BYTES_BOUND; | ||
| 709 | 725 | ||
| 710 | /* Mark STR as a unibyte string. */ | 726 | /* Mark STR as a unibyte string. */ |
| 711 | #define STRING_SET_UNIBYTE(STR) \ | 727 | #define STRING_SET_UNIBYTE(STR) \ |
| @@ -814,16 +830,6 @@ struct Lisp_Vector | |||
| 814 | of a char-table, and there's no way to access it directly from | 830 | of a char-table, and there's no way to access it directly from |
| 815 | Emacs Lisp program. */ | 831 | Emacs Lisp program. */ |
| 816 | 832 | ||
| 817 | /* This is the number of slots that every char table must have. This | ||
| 818 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 819 | slots. */ | ||
| 820 | #define CHAR_TABLE_STANDARD_SLOTS (VECSIZE (struct Lisp_Char_Table) - 1) | ||
| 821 | |||
| 822 | /* Return the number of "extra" slots in the char table CT. */ | ||
| 823 | |||
| 824 | #define CHAR_TABLE_EXTRA_SLOTS(CT) \ | ||
| 825 | (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) | ||
| 826 | |||
| 827 | #ifdef __GNUC__ | 833 | #ifdef __GNUC__ |
| 828 | 834 | ||
| 829 | #define CHAR_TABLE_REF_ASCII(CT, IDX) \ | 835 | #define CHAR_TABLE_REF_ASCII(CT, IDX) \ |
| @@ -885,10 +891,13 @@ struct Lisp_Vector | |||
| 885 | ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ | 891 | ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ |
| 886 | : char_table_set (CT, IDX, VAL)) | 892 | : char_table_set (CT, IDX, VAL)) |
| 887 | 893 | ||
| 888 | #define CHARTAB_SIZE_BITS_0 6 | 894 | enum CHARTAB_SIZE_BITS |
| 889 | #define CHARTAB_SIZE_BITS_1 4 | 895 | { |
| 890 | #define CHARTAB_SIZE_BITS_2 5 | 896 | CHARTAB_SIZE_BITS_0 = 6, |
| 891 | #define CHARTAB_SIZE_BITS_3 7 | 897 | CHARTAB_SIZE_BITS_1 = 4, |
| 898 | CHARTAB_SIZE_BITS_2 = 5, | ||
| 899 | CHARTAB_SIZE_BITS_3 = 7 | ||
| 900 | }; | ||
| 892 | 901 | ||
| 893 | extern const int chartab_size[4]; | 902 | extern const int chartab_size[4]; |
| 894 | 903 | ||
| @@ -987,6 +996,19 @@ struct Lisp_Subr | |||
| 987 | const char *doc; | 996 | const char *doc; |
| 988 | }; | 997 | }; |
| 989 | 998 | ||
| 999 | /* This is the number of slots that every char table must have. This | ||
| 1000 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 1001 | slots. */ | ||
| 1002 | enum CHAR_TABLE_STANDARD_SLOTS | ||
| 1003 | { | ||
| 1004 | CHAR_TABLE_STANDARD_SLOTS = VECSIZE (struct Lisp_Char_Table) - 1 | ||
| 1005 | }; | ||
| 1006 | |||
| 1007 | /* Return the number of "extra" slots in the char table CT. */ | ||
| 1008 | |||
| 1009 | #define CHAR_TABLE_EXTRA_SLOTS(CT) \ | ||
| 1010 | (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS) | ||
| 1011 | |||
| 990 | 1012 | ||
| 991 | /*********************************************************************** | 1013 | /*********************************************************************** |
| 992 | Symbols | 1014 | Symbols |
| @@ -1214,7 +1236,7 @@ struct Lisp_Hash_Table | |||
| 1214 | 1236 | ||
| 1215 | /* Default size for hash tables if not specified. */ | 1237 | /* Default size for hash tables if not specified. */ |
| 1216 | 1238 | ||
| 1217 | #define DEFAULT_HASH_SIZE 65 | 1239 | enum DEFAULT_HASH_SIZE { DEFAULT_HASH_SIZE = 65 }; |
| 1218 | 1240 | ||
| 1219 | /* Default threshold specifying when to resize a hash table. The | 1241 | /* Default threshold specifying when to resize a hash table. The |
| 1220 | value gives the ratio of current entries in the hash table and the | 1242 | value gives the ratio of current entries in the hash table and the |
| @@ -1471,31 +1493,38 @@ typedef unsigned char UCHAR; | |||
| 1471 | 1493 | ||
| 1472 | /* Meanings of slots in a Lisp_Compiled: */ | 1494 | /* Meanings of slots in a Lisp_Compiled: */ |
| 1473 | 1495 | ||
| 1474 | #define COMPILED_ARGLIST 0 | 1496 | enum Lisp_Compiled |
| 1475 | #define COMPILED_BYTECODE 1 | 1497 | { |
| 1476 | #define COMPILED_CONSTANTS 2 | 1498 | COMPILED_ARGLIST = 0, |
| 1477 | #define COMPILED_STACK_DEPTH 3 | 1499 | COMPILED_BYTECODE = 1, |
| 1478 | #define COMPILED_DOC_STRING 4 | 1500 | COMPILED_CONSTANTS = 2, |
| 1479 | #define COMPILED_INTERACTIVE 5 | 1501 | COMPILED_STACK_DEPTH = 3, |
| 1502 | COMPILED_DOC_STRING = 4, | ||
| 1503 | COMPILED_INTERACTIVE = 5 | ||
| 1504 | }; | ||
| 1480 | 1505 | ||
| 1481 | /* Flag bits in a character. These also get used in termhooks.h. | 1506 | /* Flag bits in a character. These also get used in termhooks.h. |
| 1482 | Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE | 1507 | Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE |
| 1483 | (MUlti-Lingual Emacs) might need 22 bits for the character value | 1508 | (MUlti-Lingual Emacs) might need 22 bits for the character value |
| 1484 | itself, so we probably shouldn't use any bits lower than 0x0400000. */ | 1509 | itself, so we probably shouldn't use any bits lower than 0x0400000. */ |
| 1485 | #define CHAR_ALT (0x0400000) | 1510 | enum char_bits |
| 1486 | #define CHAR_SUPER (0x0800000) | 1511 | { |
| 1487 | #define CHAR_HYPER (0x1000000) | 1512 | CHAR_ALT = 0x0400000, |
| 1488 | #define CHAR_SHIFT (0x2000000) | 1513 | CHAR_SUPER = 0x0800000, |
| 1489 | #define CHAR_CTL (0x4000000) | 1514 | CHAR_HYPER = 0x1000000, |
| 1490 | #define CHAR_META (0x8000000) | 1515 | CHAR_SHIFT = 0x2000000, |
| 1491 | 1516 | CHAR_CTL = 0x4000000, | |
| 1492 | #define CHAR_MODIFIER_MASK \ | 1517 | CHAR_META = 0x8000000, |
| 1493 | (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META) | 1518 | |
| 1519 | CHAR_MODIFIER_MASK = | ||
| 1520 | (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META), | ||
| 1521 | |||
| 1522 | /* Actually, the current Emacs uses 22 bits for the character value | ||
| 1523 | itself. */ | ||
| 1524 | CHARACTERBITS = 22 | ||
| 1525 | }; | ||
| 1494 | 1526 | ||
| 1495 | 1527 | ||
| 1496 | /* Actually, the current Emacs uses 22 bits for the character value | ||
| 1497 | itself. */ | ||
| 1498 | #define CHARACTERBITS 22 | ||
| 1499 | 1528 | ||
| 1500 | 1529 | ||
| 1501 | /* The glyph datatype, used to represent characters on the display. | 1530 | /* The glyph datatype, used to represent characters on the display. |
| @@ -1552,9 +1581,6 @@ typedef struct { | |||
| 1552 | (XINT (gc) >> CHARACTERBITS)); \ | 1581 | (XINT (gc) >> CHARACTERBITS)); \ |
| 1553 | } \ | 1582 | } \ |
| 1554 | while (0) | 1583 | while (0) |
| 1555 | |||
| 1556 | /* The ID of the mode line highlighting face. */ | ||
| 1557 | #define GLYPH_MODE_LINE_FACE 1 | ||
| 1558 | 1584 | ||
| 1559 | /* Structure to hold mouse highlight data. This is here because other | 1585 | /* Structure to hold mouse highlight data. This is here because other |
| 1560 | header files need it for defining struct x_output etc. */ | 1586 | header files need it for defining struct x_output etc. */ |
| @@ -1874,8 +1900,11 @@ typedef struct { | |||
| 1874 | is how we define the symbol for function `name' at start-up time. */ | 1900 | is how we define the symbol for function `name' at start-up time. */ |
| 1875 | extern void defsubr (struct Lisp_Subr *); | 1901 | extern void defsubr (struct Lisp_Subr *); |
| 1876 | 1902 | ||
| 1877 | #define MANY -2 | 1903 | enum maxargs |
| 1878 | #define UNEVALLED -1 | 1904 | { |
| 1905 | MANY = -2, | ||
| 1906 | UNEVALLED = -1 | ||
| 1907 | }; | ||
| 1879 | 1908 | ||
| 1880 | extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); | 1909 | extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); |
| 1881 | extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); | 1910 | extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); |
| @@ -2708,7 +2737,7 @@ extern void print_error_message (Lisp_Object, Lisp_Object, const char *, | |||
| 2708 | Lisp_Object); | 2737 | Lisp_Object); |
| 2709 | extern Lisp_Object internal_with_output_to_temp_buffer | 2738 | extern Lisp_Object internal_with_output_to_temp_buffer |
| 2710 | (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); | 2739 | (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object); |
| 2711 | #define FLOAT_TO_STRING_BUFSIZE 350 | 2740 | enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 }; |
| 2712 | extern int float_to_string (char *, double); | 2741 | extern int float_to_string (char *, double); |
| 2713 | extern void syms_of_print (void); | 2742 | extern void syms_of_print (void); |
| 2714 | 2743 | ||
| @@ -3304,15 +3333,6 @@ extern void init_system_name (void); | |||
| 3304 | # define lint_assume(cond) ((void) (0 && (cond))) | 3333 | # define lint_assume(cond) ((void) (0 && (cond))) |
| 3305 | #endif | 3334 | #endif |
| 3306 | 3335 | ||
| 3307 | /* The ubiquitous min and max macros. */ | ||
| 3308 | |||
| 3309 | #ifdef max | ||
| 3310 | #undef max | ||
| 3311 | #undef min | ||
| 3312 | #endif | ||
| 3313 | #define min(a, b) ((a) < (b) ? (a) : (b)) | ||
| 3314 | #define max(a, b) ((a) > (b) ? (a) : (b)) | ||
| 3315 | |||
| 3316 | /* We used to use `abs', but that clashes with system headers on some | 3336 | /* We used to use `abs', but that clashes with system headers on some |
| 3317 | platforms, and using a name reserved by Standard C is a bad idea | 3337 | platforms, and using a name reserved by Standard C is a bad idea |
| 3318 | anyway. */ | 3338 | anyway. */ |
| @@ -3355,7 +3375,7 @@ extern void init_system_name (void); | |||
| 3355 | /* SAFE_ALLOCA normally allocates memory on the stack, but if size is | 3375 | /* SAFE_ALLOCA normally allocates memory on the stack, but if size is |
| 3356 | larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ | 3376 | larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ |
| 3357 | 3377 | ||
| 3358 | #define MAX_ALLOCA 16*1024 | 3378 | enum MAX_ALLOCA { MAX_ALLOCA = 16*1024 }; |
| 3359 | 3379 | ||
| 3360 | extern Lisp_Object safe_alloca_unwind (Lisp_Object); | 3380 | extern Lisp_Object safe_alloca_unwind (Lisp_Object); |
| 3361 | 3381 | ||