comparison src/chartab.h @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
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
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 39
40 DECLARE_LRECORD (char_table_entry, struct Lisp_Char_Table_Entry); 40 struct Lisp_Char_Table_Entry
41 {
42 struct lcrecord_header header;
43
44 /* In the interests of simplicity, we just use a fixed 96-entry
45 table. If we felt like being smarter, we could make this
46 variable-size and add an offset value into this structure. */
47 Lisp_Object level2[96];
48 };
49 typedef struct Lisp_Char_Table_Entry Lisp_Char_Table_Entry;
50
51 DECLARE_LRECORD (char_table_entry, Lisp_Char_Table_Entry);
41 #define XCHAR_TABLE_ENTRY(x) \ 52 #define XCHAR_TABLE_ENTRY(x) \
42 XRECORD (x, char_table_entry, struct Lisp_Char_Table_Entry) 53 XRECORD (x, char_table_entry, Lisp_Char_Table_Entry)
43 #define XSETCHAR_TABLE_ENTRY(x, p) XSETRECORD (x, p, char_table_entry) 54 #define XSETCHAR_TABLE_ENTRY(x, p) XSETRECORD (x, p, char_table_entry)
44 #define CHAR_TABLE_ENTRYP(x) RECORDP (x, char_table_entry) 55 #define CHAR_TABLE_ENTRYP(x) RECORDP (x, char_table_entry)
45 /* #define CHECK_CHAR_TABLE_ENTRY(x) CHECK_RECORD (x, char_table_entry) 56 /* #define CHECK_CHAR_TABLE_ENTRY(x) CHECK_RECORD (x, char_table_entry)
46 char table entries should never escape to Lisp */ 57 char table entries should never escape to Lisp */
47 58
48 struct Lisp_Char_Table_Entry
49 {
50 struct lcrecord_header header;
51
52 /* In the interests of simplicity, we just use a fixed 96-entry
53 table. If we felt like being smarter, we could make this
54 variable-size and add an offset value into this structure. */
55 Lisp_Object level2[96];
56 };
57
58 #endif /* MULE */ 59 #endif /* MULE */
59
60 DECLARE_LRECORD (char_table, struct Lisp_Char_Table);
61 #define XCHAR_TABLE(x) \
62 XRECORD (x, char_table, struct Lisp_Char_Table)
63 #define XSETCHAR_TABLE(x, p) XSETRECORD (x, p, char_table)
64 #define CHAR_TABLEP(x) RECORDP (x, char_table)
65 #define CHECK_CHAR_TABLE(x) CHECK_RECORD (x, char_table)
66 #define CONCHECK_CHAR_TABLE(x) CONCHECK_RECORD (x, char_table)
67
68 #define CHAR_TABLE_TYPE(ct) ((ct)->type)
69 #define XCHAR_TABLE_TYPE(ct) CHAR_TABLE_TYPE (XCHAR_TABLE (ct))
70 60
71 enum char_table_type 61 enum char_table_type
72 { 62 {
73 CHAR_TABLE_TYPE_GENERIC, 63 CHAR_TABLE_TYPE_GENERIC,
74 #ifdef MULE 64 #ifdef MULE
125 115
126 /* stuff used for syntax tables */ 116 /* stuff used for syntax tables */
127 Lisp_Object mirror_table; 117 Lisp_Object mirror_table;
128 Lisp_Object next_table; /* DO NOT mark through this. */ 118 Lisp_Object next_table; /* DO NOT mark through this. */
129 }; 119 };
130 120 typedef struct Lisp_Char_Table Lisp_Char_Table;
131 #ifdef MULE 121
132 122 DECLARE_LRECORD (char_table, Lisp_Char_Table);
133 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)
134 int leading_byte, 124 #define XSETCHAR_TABLE(x, p) XSETRECORD (x, p, char_table)
135 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);
136 137
137 INLINE Lisp_Object 138 INLINE Lisp_Object
138 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);
139 INLINE Lisp_Object 140 INLINE Lisp_Object
140 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)
141 { 142 {
142 unsigned char lb = CHAR_LEADING_BYTE (ch); 143 unsigned char lb = CHAR_LEADING_BYTE (ch);
143 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE])) 144 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE]))
144 return (ct)->level1[lb - MIN_LEADING_BYTE]; 145 return (ct)->level1[lb - MIN_LEADING_BYTE];
145 else 146 else
173 Emchar ch; 174 Emchar ch;
174 Lisp_Object charset; 175 Lisp_Object charset;
175 int row; 176 int row;
176 }; 177 };
177 178
178 void fill_char_table (struct Lisp_Char_Table *ct, Lisp_Object value); 179 void fill_char_table (Lisp_Char_Table *ct, Lisp_Object value);
179 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,
180 Lisp_Object val); 181 Lisp_Object val);
181 Lisp_Object get_char_table (Emchar, struct Lisp_Char_Table *); 182 Lisp_Object get_char_table (Emchar, Lisp_Char_Table *);
182 int map_char_table (struct Lisp_Char_Table *ct, 183 int map_char_table (Lisp_Char_Table *ct,
183 struct chartab_range *range, 184 struct chartab_range *range,
184 int (*fn) (struct chartab_range *range, 185 int (*fn) (struct chartab_range *range,
185 Lisp_Object val, void *arg), 186 Lisp_Object val, void *arg),
186 void *arg); 187 void *arg);
187 void prune_syntax_tables (void); 188 void prune_syntax_tables (void);
227 x = wrong_type_argument (Qcategory_table_value_p, x); \ 228 x = wrong_type_argument (Qcategory_table_value_p, x); \
228 } while (0) 229 } while (0)
229 230
230 #endif /* MULE */ 231 #endif /* MULE */
231 232
232 #endif /* _MULE_CHARTAB_H */ 233 #endif /* INCLUDED_chartab_h_ */