comparison src/chartab.h @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 2f8bb876ab1d
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
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 INCLUDED_chartab_h_ 27 #ifndef _MULE_CHARTAB_H
28 #define INCLUDED_chartab_h_ 28 #define _MULE_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 */
39 48
40 struct Lisp_Char_Table_Entry 49 struct Lisp_Char_Table_Entry
41 { 50 {
42 struct lcrecord_header header; 51 struct lcrecord_header header;
43 52
44 /* In the interests of simplicity, we just use a fixed 96-entry 53 /* In the interests of simplicity, we just use a fixed 96-entry
45 table. If we felt like being smarter, we could make this 54 table. If we felt like being smarter, we could make this
46 variable-size and add an offset value into this structure. */ 55 variable-size and add an offset value into this structure. */
47 Lisp_Object level2[96]; 56 Lisp_Object level2[96];
48 }; 57 };
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))
60 72
61 enum char_table_type 73 enum char_table_type
62 { 74 {
63 CHAR_TABLE_TYPE_GENERIC, 75 CHAR_TABLE_TYPE_GENERIC,
64 #ifdef MULE 76 #ifdef MULE
115 127
116 /* stuff used for syntax tables */ 128 /* stuff used for syntax tables */
117 Lisp_Object mirror_table; 129 Lisp_Object mirror_table;
118 Lisp_Object next_table; /* DO NOT mark through this. */ 130 Lisp_Object next_table; /* DO NOT mark through this. */
119 }; 131 };
120 typedef struct Lisp_Char_Table Lisp_Char_Table; 132
121 133 #ifdef MULE
122 DECLARE_LRECORD (char_table, Lisp_Char_Table); 134
123 #define XCHAR_TABLE(x) XRECORD (x, char_table, Lisp_Char_Table) 135 Lisp_Object get_non_ascii_char_table_value (struct Lisp_Char_Table *ct,
124 #define XSETCHAR_TABLE(x, p) XSETRECORD (x, p, char_table) 136 int leading_byte,
125 #define CHAR_TABLEP(x) RECORDP (x, char_table) 137 Emchar c);
126 #define CHECK_CHAR_TABLE(x) CHECK_RECORD (x, char_table) 138
127 #define CONCHECK_CHAR_TABLE(x) CONCHECK_RECORD (x, char_table) 139 INLINE Lisp_Object
128 140 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (struct Lisp_Char_Table *ct, Emchar ch);
129 #define CHAR_TABLE_TYPE(ct) ((ct)->type) 141 INLINE Lisp_Object
130 #define XCHAR_TABLE_TYPE(ct) CHAR_TABLE_TYPE (XCHAR_TABLE (ct)) 142 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (struct Lisp_Char_Table *ct, Emchar ch)
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);
137
138 INLINE_HEADER Lisp_Object
139 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch);
140 INLINE_HEADER Lisp_Object
141 CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (Lisp_Char_Table *ct, Emchar ch)
142 { 143 {
143 unsigned char lb = CHAR_LEADING_BYTE (ch); 144 unsigned char lb = CHAR_LEADING_BYTE (ch);
144 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE])) 145 if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE]))
145 return (ct)->level1[lb - MIN_LEADING_BYTE]; 146 return (ct)->level1[lb - MIN_LEADING_BYTE];
146 else 147 else
156 157
157 #define CHAR_TABLE_VALUE_UNSAFE(ct, ch) ((ct)->ascii[(unsigned char) (ch)]) 158 #define CHAR_TABLE_VALUE_UNSAFE(ct, ch) ((ct)->ascii[(unsigned char) (ch)])
158 159
159 #endif /* not MULE */ 160 #endif /* not MULE */
160 161
161 #define XCHAR_TABLE_VALUE_UNSAFE(ct, ch) \
162 CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (ct), ch)
163
164 enum chartab_range_type 162 enum chartab_range_type
165 { 163 {
166 CHARTAB_RANGE_ALL, 164 CHARTAB_RANGE_ALL,
167 #ifdef MULE 165 #ifdef MULE
168 CHARTAB_RANGE_CHARSET, 166 CHARTAB_RANGE_CHARSET,
177 Emchar ch; 175 Emchar ch;
178 Lisp_Object charset; 176 Lisp_Object charset;
179 int row; 177 int row;
180 }; 178 };
181 179
182 void fill_char_table (Lisp_Char_Table *ct, Lisp_Object value); 180 void fill_char_table (struct Lisp_Char_Table *ct, Lisp_Object value);
183 void put_char_table (Lisp_Char_Table *ct, struct chartab_range *range, 181 void put_char_table (struct Lisp_Char_Table *ct, struct chartab_range *range,
184 Lisp_Object val); 182 Lisp_Object val);
185 Lisp_Object get_char_table (Emchar, Lisp_Char_Table *); 183 Lisp_Object get_char_table (Emchar, struct Lisp_Char_Table *);
186 int map_char_table (Lisp_Char_Table *ct, 184 int map_char_table (struct Lisp_Char_Table *ct,
187 struct chartab_range *range, 185 struct chartab_range *range,
188 int (*fn) (struct chartab_range *range, 186 int (*fn) (struct chartab_range *range,
189 Lisp_Object val, void *arg), 187 Lisp_Object val, void *arg),
190 void *arg); 188 void *arg);
191 void prune_syntax_tables (void); 189 void prune_syntax_tables (int (*obj_marked_p) (Lisp_Object));
192 190
193 EXFUN (Fcopy_char_table, 1); 191 EXFUN (Fcopy_char_table, 1);
194 EXFUN (Fmake_char_table, 1); 192 EXFUN (Fmake_char_table, 1);
195 EXFUN (Fput_char_table, 3); 193 EXFUN (Fput_char_table, 3);
196 EXFUN (Fget_char_table, 2); 194 EXFUN (Fget_char_table, 2);
231 x = wrong_type_argument (Qcategory_table_value_p, x); \ 229 x = wrong_type_argument (Qcategory_table_value_p, x); \
232 } while (0) 230 } while (0)
233 231
234 #endif /* MULE */ 232 #endif /* MULE */
235 233
236 #endif /* INCLUDED_chartab_h_ */ 234 #endif /* _MULE_CHARTAB_H */