diff options
| author | Gerd Moellmann | 1999-07-21 21:43:52 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-07-21 21:43:52 +0000 |
| commit | 5010d3b8025ea541f0186deb68bdd629e4d5e963 (patch) | |
| tree | e6431f29e63e81cc76404fd4219b01688abf66b4 /src | |
| parent | 3dc9587ac1feec789a32c21a2ad8a009f7b30170 (diff) | |
| download | emacs-5010d3b8025ea541f0186deb68bdd629e4d5e963.tar.gz emacs-5010d3b8025ea541f0186deb68bdd629e4d5e963.zip | |
(P_): Moved to top of file.
(struct Lisp_Hash_Table): New.
(GC_HASH_TABLE_P): New.
(PVEC_HASH_TABLE): New.
(struct Lisp_Hash_Table): New.
(XHASH_TABLE): New.
(XSET_HASH_TABLE): New.
(HASH_TABLE_P): New.
(CHECK_HASH_TABLE): New.
(DEFAULT_HASH_SIZE): New.
(DEFAULT_REHASH_THRESHOLD): New.
(DEFAULT_REHASH_SIZE): New.
(HAVE_FACES): Removed.
(MAKE_GLYPH): Remove test for frame type.
(GLYPH_CHAR): Ditto.
(GLYPH_FACE): Ditto.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 171 |
1 files changed, 150 insertions, 21 deletions
diff --git a/src/lisp.h b/src/lisp.h index f8b8a76f1bb..5920245eb68 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -18,6 +18,13 @@ along with GNU Emacs; see the file COPYING. If not, write to | |||
| 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ | 19 | Boston, MA 02111-1307, USA. */ |
| 20 | 20 | ||
| 21 | /* Declare the prototype for a general external function. */ | ||
| 22 | #if defined (__STDC__) || defined (WINDOWSNT) | ||
| 23 | #define P_(proto) proto | ||
| 24 | #else | ||
| 25 | #define P_(proto) () | ||
| 26 | #endif | ||
| 27 | |||
| 21 | 28 | ||
| 22 | /* These are default choices for the types to use. */ | 29 | /* These are default choices for the types to use. */ |
| 23 | #ifndef EMACS_INT | 30 | #ifndef EMACS_INT |
| @@ -236,6 +243,7 @@ enum pvec_type | |||
| 236 | PVEC_CHAR_TABLE = 0x8000, | 243 | PVEC_CHAR_TABLE = 0x8000, |
| 237 | PVEC_BOOL_VECTOR = 0x10000, | 244 | PVEC_BOOL_VECTOR = 0x10000, |
| 238 | PVEC_BUFFER = 0x20000, | 245 | PVEC_BUFFER = 0x20000, |
| 246 | PVEC_HASH_TABLE = 0x40000, | ||
| 239 | PVEC_TYPE_MASK = 0x3fe00, | 247 | PVEC_TYPE_MASK = 0x3fe00, |
| 240 | PVEC_FLAG = PSEUDOVECTOR_FLAG | 248 | PVEC_FLAG = PSEUDOVECTOR_FLAG |
| 241 | }; | 249 | }; |
| @@ -728,6 +736,110 @@ struct Lisp_Subr | |||
| 728 | char *prompt; | 736 | char *prompt; |
| 729 | char *doc; | 737 | char *doc; |
| 730 | }; | 738 | }; |
| 739 | |||
| 740 | |||
| 741 | /*********************************************************************** | ||
| 742 | Hash Tables | ||
| 743 | ***********************************************************************/ | ||
| 744 | |||
| 745 | /* The structure of a Lisp hash table. */ | ||
| 746 | |||
| 747 | struct Lisp_Hash_Table | ||
| 748 | { | ||
| 749 | /* Vector fields. The hash table code doesn't refer to these. */ | ||
| 750 | EMACS_INT size; | ||
| 751 | struct Lisp_Vector *vec_next; | ||
| 752 | |||
| 753 | /* Function used to compare keys. */ | ||
| 754 | Lisp_Object test; | ||
| 755 | |||
| 756 | /* Nil if table is non-weak. Otherwise a symbol describing the | ||
| 757 | weakness of the table. */ | ||
| 758 | Lisp_Object weak; | ||
| 759 | |||
| 760 | /* When the table is resized, and this is an integer, compute the | ||
| 761 | new size by adding this to the old size. If a float, compute the | ||
| 762 | new size by multiplying the old size with this factor. */ | ||
| 763 | Lisp_Object rehash_size; | ||
| 764 | |||
| 765 | /* Resize hash table when number of entries/ table size is >= this | ||
| 766 | ratio, a float. */ | ||
| 767 | Lisp_Object rehash_threshold; | ||
| 768 | |||
| 769 | /* Number of key/value entries in the table. */ | ||
| 770 | Lisp_Object count; | ||
| 771 | |||
| 772 | /* Vector of keys and values. The key of item I is found at index | ||
| 773 | 2 * I, the value is found at index 2 * I + 1. */ | ||
| 774 | Lisp_Object key_and_value; | ||
| 775 | |||
| 776 | /* Vector of hash codes.. If hash[I] is nil, this means that that | ||
| 777 | entry I is unused. */ | ||
| 778 | Lisp_Object hash; | ||
| 779 | |||
| 780 | /* Vector used to chain entries. If entry I is free, next[I] is the | ||
| 781 | entry number of the next free item. If entry I is non-free, | ||
| 782 | next[I] is the index of the next entry in the collision chain. */ | ||
| 783 | Lisp_Object next; | ||
| 784 | |||
| 785 | /* Index of first free entry in free list. */ | ||
| 786 | Lisp_Object next_free; | ||
| 787 | |||
| 788 | /* Bucket vector. A non-nil entry is the index of the first item in | ||
| 789 | a collision chain. This vector's size can be larger than the | ||
| 790 | hash table size to reduce collisions. */ | ||
| 791 | Lisp_Object index; | ||
| 792 | |||
| 793 | /* Next weak hash table if this is a weak hash table. The head | ||
| 794 | of the list is in Vweak_hash_tables. */ | ||
| 795 | Lisp_Object next_weak; | ||
| 796 | |||
| 797 | /* User-supplied hash function, or nil. */ | ||
| 798 | Lisp_Object user_hash_function; | ||
| 799 | |||
| 800 | /* User-supplied key comparison function, or nil. */ | ||
| 801 | Lisp_Object user_cmp_function; | ||
| 802 | |||
| 803 | /* C function to compare two keys. */ | ||
| 804 | int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, | ||
| 805 | unsigned, Lisp_Object, unsigned)); | ||
| 806 | |||
| 807 | /* C function to compute hash code. */ | ||
| 808 | unsigned (* hashfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object)); | ||
| 809 | }; | ||
| 810 | |||
| 811 | |||
| 812 | #define XHASH_TABLE(OBJ) \ | ||
| 813 | ((struct Lisp_Hash_Table *) XPNTR (OBJ)) | ||
| 814 | |||
| 815 | #define XSET_HASH_TABLE(VAR, PTR) \ | ||
| 816 | (XSETPSEUDOVECTOR (VAR, PTR, PVEC_HASH_TABLE)) | ||
| 817 | |||
| 818 | #define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE) | ||
| 819 | #define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE) | ||
| 820 | |||
| 821 | #define CHECK_HASH_TABLE(x, i) \ | ||
| 822 | do \ | ||
| 823 | { \ | ||
| 824 | if (!HASH_TABLE_P ((x))) \ | ||
| 825 | x = wrong_type_argument (Qhash_table_p, (x)); \ | ||
| 826 | } \ | ||
| 827 | while (0) | ||
| 828 | |||
| 829 | /* Default size for hash tables if not specified. */ | ||
| 830 | |||
| 831 | #define DEFAULT_HASH_SIZE 65 | ||
| 832 | |||
| 833 | /* Default threshold specifying when to resize a hash table. The | ||
| 834 | value gives the ratio of current entries in the hash table and the | ||
| 835 | size of the hash table. */ | ||
| 836 | |||
| 837 | #define DEFAULT_REHASH_THRESHOLD 0.8 | ||
| 838 | |||
| 839 | /* Default factor by which to increase the size of a hash table. */ | ||
| 840 | |||
| 841 | #define DEFAULT_REHASH_SIZE 1.5 | ||
| 842 | |||
| 731 | 843 | ||
| 732 | /* These structures are used for various misc types. */ | 844 | /* These structures are used for various misc types. */ |
| 733 | 845 | ||
| @@ -986,7 +1098,6 @@ typedef unsigned char UCHAR; | |||
| 986 | /* Mask bits for character code. */ | 1098 | /* Mask bits for character code. */ |
| 987 | #define GLYPH_MASK_CHAR 0x0007FFFF /* The lowest 19 bits */ | 1099 | #define GLYPH_MASK_CHAR 0x0007FFFF /* The lowest 19 bits */ |
| 988 | 1100 | ||
| 989 | #ifdef HAVE_FACES | ||
| 990 | /* The FAST macros assume that we already know we're in an X window. */ | 1101 | /* The FAST macros assume that we already know we're in an X window. */ |
| 991 | 1102 | ||
| 992 | /* Given a character code and a face ID, return the appropriate glyph. */ | 1103 | /* Given a character code and a face ID, return the appropriate glyph. */ |
| @@ -999,18 +1110,9 @@ typedef unsigned char UCHAR; | |||
| 999 | #define FAST_GLYPH_FACE(glyph) (((glyph) & GLYPH_MASK_FACE) >> CHARACTERBITS) | 1110 | #define FAST_GLYPH_FACE(glyph) (((glyph) & GLYPH_MASK_FACE) >> CHARACTERBITS) |
| 1000 | 1111 | ||
| 1001 | /* Slower versions that test the frame type first. */ | 1112 | /* Slower versions that test the frame type first. */ |
| 1002 | #define MAKE_GLYPH(f, char, face) (FRAME_TERMCAP_P (f) ? (char) \ | 1113 | #define MAKE_GLYPH(f, char, face) (FAST_MAKE_GLYPH (char, face)) |
| 1003 | : FAST_MAKE_GLYPH (char, face)) | 1114 | #define GLYPH_CHAR(f, g) (FAST_GLYPH_CHAR (g)) |
| 1004 | #define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g)) | 1115 | #define GLYPH_FACE(f, g) (FAST_GLYPH_FACE (g)) |
| 1005 | #define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g)) | ||
| 1006 | #else /* not HAVE_FACES */ | ||
| 1007 | #define MAKE_GLYPH(f, char, face) (char) | ||
| 1008 | #define FAST_MAKE_GLYPH(char, face) (char) | ||
| 1009 | #define GLYPH_CHAR(f, g) ((g) & GLYPH_MASK_CHAR) | ||
| 1010 | #define FAST_GLYPH_CHAR(g) ((g) & GLYPH_MASK_CHAR) | ||
| 1011 | #define GLYPH_FACE(f, g) ((g) & GLYPH_MASK_FACE) | ||
| 1012 | #define FAST_GLYPH_FACE(g) ((g) & GLYPH_MASK_FACE) | ||
| 1013 | #endif /* not HAVE_FACES */ | ||
| 1014 | 1116 | ||
| 1015 | /* Return 1 iff GLYPH contains valid character code. */ | 1117 | /* Return 1 iff GLYPH contains valid character code. */ |
| 1016 | #define GLYPH_CHAR_VALID_P(glyph) \ | 1118 | #define GLYPH_CHAR_VALID_P(glyph) \ |
| @@ -1268,13 +1370,6 @@ typedef unsigned char UCHAR; | |||
| 1268 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) | 1370 | Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) |
| 1269 | #endif | 1371 | #endif |
| 1270 | 1372 | ||
| 1271 | /* Declare the prototype for a general external function. */ | ||
| 1272 | #if defined (__STDC__) || defined (WINDOWSNT) | ||
| 1273 | #define P_(proto) proto | ||
| 1274 | #else | ||
| 1275 | #define P_(proto) () | ||
| 1276 | #endif | ||
| 1277 | |||
| 1278 | /* defsubr (Sname); | 1373 | /* defsubr (Sname); |
| 1279 | is how we define the symbol for function `name' at start-up time. */ | 1374 | is how we define the symbol for function `name' at start-up time. */ |
| 1280 | extern void defsubr P_ ((struct Lisp_Subr *)); | 1375 | extern void defsubr P_ ((struct Lisp_Subr *)); |
| @@ -1675,6 +1770,32 @@ extern void syms_of_syntax P_ ((void)); | |||
| 1675 | /* Defined in fns.c */ | 1770 | /* Defined in fns.c */ |
| 1676 | extern Lisp_Object Qstring_lessp; | 1771 | extern Lisp_Object Qstring_lessp; |
| 1677 | extern Lisp_Object Vfeatures; | 1772 | extern Lisp_Object Vfeatures; |
| 1773 | unsigned sxhash P_ ((Lisp_Object, int)); | ||
| 1774 | Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | ||
| 1775 | Lisp_Object, Lisp_Object, Lisp_Object, | ||
| 1776 | Lisp_Object)); | ||
| 1777 | int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *)); | ||
| 1778 | void hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, | ||
| 1779 | unsigned)); | ||
| 1780 | void hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object)); | ||
| 1781 | void hash_clear P_ ((struct Lisp_Hash_Table *)); | ||
| 1782 | void remove_hash_entry P_ ((struct Lisp_Hash_Table *, int)); | ||
| 1783 | EXFUN (Fsxhash, 1); | ||
| 1784 | EXFUN (Fmake_hash_table, MANY); | ||
| 1785 | EXFUN (Fhash_table_count, 1); | ||
| 1786 | EXFUN (Fhash_table_rehash_size, 1); | ||
| 1787 | EXFUN (Fhash_table_rehash_threshold, 1); | ||
| 1788 | EXFUN (Fhash_table_size, 1); | ||
| 1789 | EXFUN (Fhash_table_test, 1); | ||
| 1790 | EXFUN (Fhash_table_weak, 1); | ||
| 1791 | EXFUN (Fhash_table_p, 1); | ||
| 1792 | EXFUN (Fclrhash, 1); | ||
| 1793 | EXFUN (Fgethash, 3); | ||
| 1794 | EXFUN (Fputhash, 3); | ||
| 1795 | EXFUN (Fremhash, 2); | ||
| 1796 | EXFUN (Fmaphash, 2); | ||
| 1797 | EXFUN (Fdefine_hash_table_test, 3); | ||
| 1798 | |||
| 1678 | EXFUN (Fidentity, 1); | 1799 | EXFUN (Fidentity, 1); |
| 1679 | EXFUN (Frandom, 1); | 1800 | EXFUN (Frandom, 1); |
| 1680 | EXFUN (Flength, 1); | 1801 | EXFUN (Flength, 1); |
| @@ -1724,6 +1845,7 @@ extern Lisp_Object string_make_multibyte P_ ((Lisp_Object)); | |||
| 1724 | extern Lisp_Object string_make_unibyte P_ ((Lisp_Object)); | 1845 | extern Lisp_Object string_make_unibyte P_ ((Lisp_Object)); |
| 1725 | EXFUN (Fcopy_alist, 1); | 1846 | EXFUN (Fcopy_alist, 1); |
| 1726 | EXFUN (Fplist_get, 2); | 1847 | EXFUN (Fplist_get, 2); |
| 1848 | EXFUN (Fplist_put, 3); | ||
| 1727 | EXFUN (Fset_char_table_parent, 2); | 1849 | EXFUN (Fset_char_table_parent, 2); |
| 1728 | EXFUN (Fchar_table_extra_slot, 2); | 1850 | EXFUN (Fchar_table_extra_slot, 2); |
| 1729 | EXFUN (Fset_char_table_extra_slot, 3); | 1851 | EXFUN (Fset_char_table_extra_slot, 3); |
| @@ -1785,7 +1907,6 @@ EXFUN (Fredraw_display, 0); | |||
| 1785 | EXFUN (Fsleep_for, 2); | 1907 | EXFUN (Fsleep_for, 2); |
| 1786 | EXFUN (Fsit_for, 3); | 1908 | EXFUN (Fsit_for, 3); |
| 1787 | extern Lisp_Object sit_for P_ ((int, int, int, int, int)); | 1909 | extern Lisp_Object sit_for P_ ((int, int, int, int, int)); |
| 1788 | extern void quit_error_check P_ ((void)); | ||
| 1789 | extern void init_display P_ ((void)); | 1910 | extern void init_display P_ ((void)); |
| 1790 | extern void syms_of_display P_ ((void)); | 1911 | extern void syms_of_display P_ ((void)); |
| 1791 | 1912 | ||
| @@ -1799,6 +1920,8 @@ extern void message1 P_ ((char *)); | |||
| 1799 | extern void message1_nolog P_ ((char *)); | 1920 | extern void message1_nolog P_ ((char *)); |
| 1800 | extern void message2 P_ ((char *, int, int)); | 1921 | extern void message2 P_ ((char *, int, int)); |
| 1801 | extern void message2_nolog P_ ((char *, int, int)); | 1922 | extern void message2_nolog P_ ((char *, int, int)); |
| 1923 | extern void message3 P_ ((Lisp_Object, int, int)); | ||
| 1924 | extern void message3_nolog P_ ((Lisp_Object, int, int)); | ||
| 1802 | extern void message_dolog P_ ((char *, int, int, int)); | 1925 | extern void message_dolog P_ ((char *, int, int, int)); |
| 1803 | extern void message_with_string P_ ((char *, Lisp_Object, int)); | 1926 | extern void message_with_string P_ ((char *, Lisp_Object, int)); |
| 1804 | extern void message_log_maybe_newline P_ ((void)); | 1927 | extern void message_log_maybe_newline P_ ((void)); |
| @@ -1816,6 +1939,8 @@ extern void init_xdisp P_ ((void)); | |||
| 1816 | extern void malloc_warning P_ ((char *)); | 1939 | extern void malloc_warning P_ ((char *)); |
| 1817 | extern void memory_full P_ ((void)); | 1940 | extern void memory_full P_ ((void)); |
| 1818 | extern void buffer_memory_full P_ ((void)); | 1941 | extern void buffer_memory_full P_ ((void)); |
| 1942 | extern int survives_gc_p P_ ((Lisp_Object)); | ||
| 1943 | extern void mark_object P_ ((Lisp_Object *)); | ||
| 1819 | extern Lisp_Object Vpurify_flag; | 1944 | extern Lisp_Object Vpurify_flag; |
| 1820 | EXFUN (Fcons, 2); | 1945 | EXFUN (Fcons, 2); |
| 1821 | EXFUN (list2, 2); | 1946 | EXFUN (list2, 2); |
| @@ -2011,6 +2136,7 @@ EXFUN (Feobp, 0); | |||
| 2011 | EXFUN (Fbolp, 0); | 2136 | EXFUN (Fbolp, 0); |
| 2012 | EXFUN (Fbobp, 0); | 2137 | EXFUN (Fbobp, 0); |
| 2013 | EXFUN (Fformat, MANY); | 2138 | EXFUN (Fformat, MANY); |
| 2139 | EXFUN (Fmessage, MANY); | ||
| 2014 | extern Lisp_Object format1 P_ ((/* char *, ... */)); | 2140 | extern Lisp_Object format1 P_ ((/* char *, ... */)); |
| 2015 | extern Lisp_Object make_buffer_string P_ ((int, int, int)); | 2141 | extern Lisp_Object make_buffer_string P_ ((int, int, int)); |
| 2016 | EXFUN (Fbuffer_substring, 2); | 2142 | EXFUN (Fbuffer_substring, 2); |
| @@ -2189,6 +2315,7 @@ EXFUN (Frecursive_edit, 0); | |||
| 2189 | EXFUN (Fcommand_execute, 4); | 2315 | EXFUN (Fcommand_execute, 4); |
| 2190 | EXFUN (Finput_pending_p, 0); | 2316 | EXFUN (Finput_pending_p, 0); |
| 2191 | extern Lisp_Object menu_bar_items P_ ((Lisp_Object)); | 2317 | extern Lisp_Object menu_bar_items P_ ((Lisp_Object)); |
| 2318 | extern Lisp_Object toolbar_items P_ ((Lisp_Object, int *)); | ||
| 2192 | extern Lisp_Object Qvertical_scroll_bar; | 2319 | extern Lisp_Object Qvertical_scroll_bar; |
| 2193 | extern void discard_mouse_events (); | 2320 | extern void discard_mouse_events (); |
| 2194 | EXFUN (Fevent_convert_list, 1); | 2321 | EXFUN (Fevent_convert_list, 1); |
| @@ -2246,6 +2373,7 @@ extern void syms_of_indent P_ ((void)); | |||
| 2246 | 2373 | ||
| 2247 | /* defined in window.c */ | 2374 | /* defined in window.c */ |
| 2248 | extern Lisp_Object Qwindowp, Qwindow_live_p; | 2375 | extern Lisp_Object Qwindowp, Qwindow_live_p; |
| 2376 | EXFUN (Fwindow_end, 2); | ||
| 2249 | EXFUN (Fselected_window, 0); | 2377 | EXFUN (Fselected_window, 0); |
| 2250 | EXFUN (Fnext_window, 3); | 2378 | EXFUN (Fnext_window, 3); |
| 2251 | EXFUN (Fdelete_window, 1); | 2379 | EXFUN (Fdelete_window, 1); |
| @@ -2458,6 +2586,7 @@ extern void syms_of_term P_ ((void)); | |||
| 2458 | #ifdef HAVE_X_WINDOWS | 2586 | #ifdef HAVE_X_WINDOWS |
| 2459 | /* Defined in fontset.c */ | 2587 | /* Defined in fontset.c */ |
| 2460 | extern void syms_of_fontset P_ ((void)); | 2588 | extern void syms_of_fontset P_ ((void)); |
| 2589 | EXFUN (Fset_fontset_font, 4); | ||
| 2461 | #endif | 2590 | #endif |
| 2462 | 2591 | ||
| 2463 | /* Defined in xfaces.c */ | 2592 | /* Defined in xfaces.c */ |