aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-07-21 21:43:52 +0000
committerGerd Moellmann1999-07-21 21:43:52 +0000
commit5010d3b8025ea541f0186deb68bdd629e4d5e963 (patch)
treee6431f29e63e81cc76404fd4219b01688abf66b4 /src
parent3dc9587ac1feec789a32c21a2ad8a009f7b30170 (diff)
downloademacs-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.h171
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
18the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */ 19Boston, 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
747struct 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. */
1280extern void defsubr P_ ((struct Lisp_Subr *)); 1375extern 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 */
1676extern Lisp_Object Qstring_lessp; 1771extern Lisp_Object Qstring_lessp;
1677extern Lisp_Object Vfeatures; 1772extern Lisp_Object Vfeatures;
1773unsigned sxhash P_ ((Lisp_Object, int));
1774Lisp_Object make_hash_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
1775 Lisp_Object, Lisp_Object, Lisp_Object,
1776 Lisp_Object));
1777int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *));
1778void hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
1779 unsigned));
1780void hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object));
1781void hash_clear P_ ((struct Lisp_Hash_Table *));
1782void remove_hash_entry P_ ((struct Lisp_Hash_Table *, int));
1783EXFUN (Fsxhash, 1);
1784EXFUN (Fmake_hash_table, MANY);
1785EXFUN (Fhash_table_count, 1);
1786EXFUN (Fhash_table_rehash_size, 1);
1787EXFUN (Fhash_table_rehash_threshold, 1);
1788EXFUN (Fhash_table_size, 1);
1789EXFUN (Fhash_table_test, 1);
1790EXFUN (Fhash_table_weak, 1);
1791EXFUN (Fhash_table_p, 1);
1792EXFUN (Fclrhash, 1);
1793EXFUN (Fgethash, 3);
1794EXFUN (Fputhash, 3);
1795EXFUN (Fremhash, 2);
1796EXFUN (Fmaphash, 2);
1797EXFUN (Fdefine_hash_table_test, 3);
1798
1678EXFUN (Fidentity, 1); 1799EXFUN (Fidentity, 1);
1679EXFUN (Frandom, 1); 1800EXFUN (Frandom, 1);
1680EXFUN (Flength, 1); 1801EXFUN (Flength, 1);
@@ -1724,6 +1845,7 @@ extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
1724extern Lisp_Object string_make_unibyte P_ ((Lisp_Object)); 1845extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
1725EXFUN (Fcopy_alist, 1); 1846EXFUN (Fcopy_alist, 1);
1726EXFUN (Fplist_get, 2); 1847EXFUN (Fplist_get, 2);
1848EXFUN (Fplist_put, 3);
1727EXFUN (Fset_char_table_parent, 2); 1849EXFUN (Fset_char_table_parent, 2);
1728EXFUN (Fchar_table_extra_slot, 2); 1850EXFUN (Fchar_table_extra_slot, 2);
1729EXFUN (Fset_char_table_extra_slot, 3); 1851EXFUN (Fset_char_table_extra_slot, 3);
@@ -1785,7 +1907,6 @@ EXFUN (Fredraw_display, 0);
1785EXFUN (Fsleep_for, 2); 1907EXFUN (Fsleep_for, 2);
1786EXFUN (Fsit_for, 3); 1908EXFUN (Fsit_for, 3);
1787extern Lisp_Object sit_for P_ ((int, int, int, int, int)); 1909extern Lisp_Object sit_for P_ ((int, int, int, int, int));
1788extern void quit_error_check P_ ((void));
1789extern void init_display P_ ((void)); 1910extern void init_display P_ ((void));
1790extern void syms_of_display P_ ((void)); 1911extern void syms_of_display P_ ((void));
1791 1912
@@ -1799,6 +1920,8 @@ extern void message1 P_ ((char *));
1799extern void message1_nolog P_ ((char *)); 1920extern void message1_nolog P_ ((char *));
1800extern void message2 P_ ((char *, int, int)); 1921extern void message2 P_ ((char *, int, int));
1801extern void message2_nolog P_ ((char *, int, int)); 1922extern void message2_nolog P_ ((char *, int, int));
1923extern void message3 P_ ((Lisp_Object, int, int));
1924extern void message3_nolog P_ ((Lisp_Object, int, int));
1802extern void message_dolog P_ ((char *, int, int, int)); 1925extern void message_dolog P_ ((char *, int, int, int));
1803extern void message_with_string P_ ((char *, Lisp_Object, int)); 1926extern void message_with_string P_ ((char *, Lisp_Object, int));
1804extern void message_log_maybe_newline P_ ((void)); 1927extern void message_log_maybe_newline P_ ((void));
@@ -1816,6 +1939,8 @@ extern void init_xdisp P_ ((void));
1816extern void malloc_warning P_ ((char *)); 1939extern void malloc_warning P_ ((char *));
1817extern void memory_full P_ ((void)); 1940extern void memory_full P_ ((void));
1818extern void buffer_memory_full P_ ((void)); 1941extern void buffer_memory_full P_ ((void));
1942extern int survives_gc_p P_ ((Lisp_Object));
1943extern void mark_object P_ ((Lisp_Object *));
1819extern Lisp_Object Vpurify_flag; 1944extern Lisp_Object Vpurify_flag;
1820EXFUN (Fcons, 2); 1945EXFUN (Fcons, 2);
1821EXFUN (list2, 2); 1946EXFUN (list2, 2);
@@ -2011,6 +2136,7 @@ EXFUN (Feobp, 0);
2011EXFUN (Fbolp, 0); 2136EXFUN (Fbolp, 0);
2012EXFUN (Fbobp, 0); 2137EXFUN (Fbobp, 0);
2013EXFUN (Fformat, MANY); 2138EXFUN (Fformat, MANY);
2139EXFUN (Fmessage, MANY);
2014extern Lisp_Object format1 P_ ((/* char *, ... */)); 2140extern Lisp_Object format1 P_ ((/* char *, ... */));
2015extern Lisp_Object make_buffer_string P_ ((int, int, int)); 2141extern Lisp_Object make_buffer_string P_ ((int, int, int));
2016EXFUN (Fbuffer_substring, 2); 2142EXFUN (Fbuffer_substring, 2);
@@ -2189,6 +2315,7 @@ EXFUN (Frecursive_edit, 0);
2189EXFUN (Fcommand_execute, 4); 2315EXFUN (Fcommand_execute, 4);
2190EXFUN (Finput_pending_p, 0); 2316EXFUN (Finput_pending_p, 0);
2191extern Lisp_Object menu_bar_items P_ ((Lisp_Object)); 2317extern Lisp_Object menu_bar_items P_ ((Lisp_Object));
2318extern Lisp_Object toolbar_items P_ ((Lisp_Object, int *));
2192extern Lisp_Object Qvertical_scroll_bar; 2319extern Lisp_Object Qvertical_scroll_bar;
2193extern void discard_mouse_events (); 2320extern void discard_mouse_events ();
2194EXFUN (Fevent_convert_list, 1); 2321EXFUN (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 */
2248extern Lisp_Object Qwindowp, Qwindow_live_p; 2375extern Lisp_Object Qwindowp, Qwindow_live_p;
2376EXFUN (Fwindow_end, 2);
2249EXFUN (Fselected_window, 0); 2377EXFUN (Fselected_window, 0);
2250EXFUN (Fnext_window, 3); 2378EXFUN (Fnext_window, 3);
2251EXFUN (Fdelete_window, 1); 2379EXFUN (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 */
2460extern void syms_of_fontset P_ ((void)); 2588extern void syms_of_fontset P_ ((void));
2589EXFUN (Fset_fontset_font, 4);
2461#endif 2590#endif
2462 2591
2463/* Defined in xfaces.c */ 2592/* Defined in xfaces.c */