comparison src/chartab.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 6719134a07c2
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
22 /* Synched up with: Mule 2.3. Not synched with FSF. 22 /* Synched up with: Mule 2.3. Not synched with FSF.
23 23
24 This file was written independently of the FSF implementation, 24 This file was written independently of the FSF implementation,
25 and is not compatible. */ 25 and is not compatible. */
26 26
27 #ifndef _MULE_CHARTAB_H 27 #ifndef INCLUDED_chartab_h_
28 #define _MULE_CHARTAB_H 28 #define INCLUDED_chartab_h_
29 29
30 /************************************************************************/ 30 /************************************************************************/
31 /* Char Tables */ 31 /* Char Tables */
32 /************************************************************************/ 32 /************************************************************************/
33 33
34 /* Under Mule, we use a complex representation (see below). 34 /* Under Mule, we use a complex representation (see below).
35 When not under Mule, there are only 256 possible characters 35 When not under Mule, there are only 256 possible characters
36 so we just represent them directly. */ 36 so we just represent them directly. */
37 37
38 #ifdef MULE 38 #ifdef MULE
39
40 DECLARE_LRECORD (char_table_entry, struct Lisp_Char_Table_Entry);
41 #define XCHAR_TABLE_ENTRY(x) \
42 XRECORD (x, char_table_entry, struct Lisp_Char_Table_Entry)
43 #define XSETCHAR_TABLE_ENTRY(x, p) XSETRECORD (x, p, char_table_entry)
44 #define CHAR_TABLE_ENTRYP(x) RECORDP (x, char_table_entry)
45 #define GC_CHAR_TABLE_ENTRYP(x) GC_RECORDP (x, char_table_entry)
46 /* #define CHECK_CHAR_TABLE_ENTRY(x) CHECK_RECORD (x, char_table_entry)
47 char table entries should never escape to Lisp */
48 39
49 struct Lisp_Char_Table_Entry 40 struct Lisp_Char_Table_Entry
50 { 41 {
51 struct lcrecord_header header; 42 struct lcrecord_header header;
52 43
53 /* In the interests of simplicity, we just use a fixed 96-entry 44 /* In the interests of simplicity, we just use a fixed 96-entry
54 table. If we felt like being smarter, we could make this 45 table. If we felt like being smarter, we could make this
55 variable-size and add an offset value into this structure. */ 46 variable-size and add an offset value into this structure. */
56 Lisp_Object level2[96]; 47 Lisp_Object level2[96];
57 }; 48 };
49 typedef struct Lisp_Char_Table_Entry Lisp_Char_Table_Entry;
50
51 DECLARE_LRECORD (char_table_entry, Lisp_Char_Table_Entry);
52 #define XCHAR_TABLE_ENTRY(x) \
53 XRECORD (x, char_table_entry, Lisp_Char_Table_Entry)
54 #define XSETCHAR_TABLE_ENTRY(x, p) XSETRECORD (x, p, char_table_entry)
55 #define CHAR_TABLE_ENTRYP(x) RECORDP (x, char_table_entry)
56 /* #define CHECK_CHAR_TABLE_ENTRY(x) CHECK_RECORD (x, char_table_entry)
57 char table entries should never escape to Lisp */
58 58
59 #endif /* MULE */ 59 #endif /* MULE */
60
61 DECLARE_LRECORD (char_table, struct Lisp_Char_Table);
62 #define XCHAR_TABLE(x) \
63 XRECORD (x, char_table, struct Lisp_Char_Table)
64 #define XSETCHAR_TABLE(x, p) XSETRECORD (x, p, char_table)
65 #define CHAR_TABLEP(x) RECORDP (x, char_table)
66 #define GC_CHAR_TABLEP(x) GC_RECORDP (x, char_table)
67 #define CHECK_CHAR_TABLE(x) CHECK_RECORD (x, char_table)
68 #define CONCHECK_CHAR_TABLE(x) CONCHECK_RECORD (x, char_table)
69
70 #define CHAR_TABLE_TYPE(ct) ((ct)->type)
71 #define XCHAR_TABLE_TYPE(ct) CHAR_TABLE_TYPE (XCHAR_TABLE (ct))
72 60
73 enum char_table_type 61 enum char_table_type
74 { 62 {
75 CHAR_TABLE_TYPE_GENERIC, 63 CHAR_TABLE_TYPE_GENERIC,
76 #ifdef MULE 64 #ifdef MULE
127 115
128 /* stuff used for syntax tables */ 116 /* stuff used for syntax tables */
129 Lisp_Object mirror_table; 117 Lisp_Object mirror_table;
130 Lisp_Object next_table; /* DO NOT mark through this. */ 118 Lisp_Object next_table; /* DO NOT mark through this. */
131 }; 119 };
132 120 typedef struct Lisp_Char_Table Lisp_Char_Table;
133 #ifdef MULE 121
134 122 DECLARE_LRECORD (char_table, Lisp_Char_Table);
135 Lisp_Object get_non_ascii_char_table_value (struct Lisp_Char_Table *ct, 123 #define XCHAR_TABLE(x) XRECORD (x, char_table, Lisp_Char_Table)
136 int leading_byte, 124 #define XSETCHAR_TABLE(x, p) XSETRECORD (x, p, char_table)
137 Emchar c); 125 #define CHAR_TABLEP(x) RECORDP (x, char_table)
126 #define CHECK_CHAR_TABLE(x) CHECK_RECORD (x, char_table)
127 #define CONCHECK_CHAR_TABLE(x) CONCHECK_RECORD (x, char_table)
128
129 #define CHAR_TABLE_TYPE(ct) ((ct)->type)
130 #define XCHAR_TABLE_TYPE(ct) CHAR_TABLE_TYPE (XCHAR_TABLE (ct))
131
132 #ifdef MULE
133
134 Lisp_Object get_non_ascii_char_table_value (Lisp_Char_Table *ct,
135 int leading_byte,
136 Emchar c);
138 137
139 INLINE Lisp_Object 138 INLINE Lisp_Object
140 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (struct Lisp_Char_Table *ct, Emchar ch); 139 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch);
141 INLINE Lisp_Object 140 INLINE Lisp_Object
142 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (struct Lisp_Char_Table *ct, Emchar ch) 141 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch)
143 { 142 {
144 unsigned char lb = CHAR_LEADING_BYTE (ch); 143 unsigned char lb = CHAR_LEADING_BYTE (ch);
145 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE])) 144 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE]))
146 return (ct)->level1[lb - MIN_LEADING_BYTE]; 145 return (ct)->level1[lb - MIN_LEADING_BYTE];
147 else 146 else
175 Emchar ch; 174 Emchar ch;
176 Lisp_Object charset; 175 Lisp_Object charset;
177 int row; 176 int row;
178 }; 177 };
179 178
180 void fill_char_table (struct Lisp_Char_Table *ct, Lisp_Object value); 179 void fill_char_table (Lisp_Char_Table *ct, Lisp_Object value);
181 void put_char_table (struct Lisp_Char_Table *ct, struct chartab_range *range, 180 void put_char_table (Lisp_Char_Table *ct, struct chartab_range *range,
182 Lisp_Object val); 181 Lisp_Object val);
183 Lisp_Object get_char_table (Emchar, struct Lisp_Char_Table *); 182 Lisp_Object get_char_table (Emchar, Lisp_Char_Table *);
184 int map_char_table (struct Lisp_Char_Table *ct, 183 int map_char_table (Lisp_Char_Table *ct,
185 struct chartab_range *range, 184 struct chartab_range *range,
186 int (*fn) (struct chartab_range *range, 185 int (*fn) (struct chartab_range *range,
187 Lisp_Object val, void *arg), 186 Lisp_Object val, void *arg),
188 void *arg); 187 void *arg);
189 void prune_syntax_tables (int (*obj_marked_p) (Lisp_Object)); 188 void prune_syntax_tables (void);
190 189
191 EXFUN (Fcopy_char_table, 1); 190 EXFUN (Fcopy_char_table, 1);
192 EXFUN (Fmake_char_table, 1); 191 EXFUN (Fmake_char_table, 1);
193 EXFUN (Fput_char_table, 3); 192 EXFUN (Fput_char_table, 3);
194 EXFUN (Fget_char_table, 2); 193 EXFUN (Fget_char_table, 2);
229 x = wrong_type_argument (Qcategory_table_value_p, x); \ 228 x = wrong_type_argument (Qcategory_table_value_p, x); \
230 } while (0) 229 } while (0)
231 230
232 #endif /* MULE */ 231 #endif /* MULE */
233 232
234 #endif /* _MULE_CHARTAB_H */ 233 #endif /* INCLUDED_chartab_h_ */