Mercurial > hg > xemacs-beta
comparison src/casetab.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 677f6a0ee643 |
children | 6330739388db |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
51 #endif | 51 #endif |
52 Lisp_Object Qtranslate_table; | 52 Lisp_Object Qtranslate_table; |
53 | 53 |
54 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); | 54 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); |
55 | 55 |
56 #define STRING256_P(obj) \ | 56 #define STRING256_P(obj) (STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256) |
57 (STRINGP (obj) && string_char_length (XSTRING (obj)) == 256) | |
58 | 57 |
59 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /* | 58 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /* |
60 Return t iff ARG is a case table. | 59 Return t if ARG is a case table. |
61 See `set-case-table' for more information on these data structures. | 60 See `set-case-table' for more information on these data structures. |
62 */ | 61 */ |
63 (table)) | 62 (table)) |
64 { | 63 { |
65 Lisp_Object down, up, canon, eqv; | 64 Lisp_Object down, up, canon, eqv; |
66 down = Fcar_safe (table); | 65 if (!CONSP (table)) return Qnil; down = XCAR (table); table = XCDR (table); |
67 up = Fcar_safe (Fcdr_safe (table)); | 66 if (!CONSP (table)) return Qnil; up = XCAR (table); table = XCDR (table); |
68 canon = Fcar_safe (Fcdr_safe (Fcdr_safe (table))); | 67 if (!CONSP (table)) return Qnil; canon = XCAR (table); table = XCDR (table); |
69 eqv = Fcar_safe (Fcdr_safe (Fcdr_safe (Fcdr_safe (table)))); | 68 if (!CONSP (table)) return Qnil; eqv = XCAR (table); |
70 | 69 |
71 return (STRING256_P (down) | 70 return (STRING256_P (down) |
72 && (NILP (up) || STRING256_P (up)) | 71 && (NILP (up) || STRING256_P (up)) |
73 && ((NILP (canon) && NILP (eqv)) | 72 && ((NILP (canon) && NILP (eqv)) |
74 || (STRING256_P (canon) | 73 || (STRING256_P (canon) |
89 DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /* | 88 DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /* |
90 Return the case table of BUFFER, which defaults to the current buffer. | 89 Return the case table of BUFFER, which defaults to the current buffer. |
91 */ | 90 */ |
92 (buffer)) | 91 (buffer)) |
93 { | 92 { |
94 Lisp_Object down, up, canon, eqv; | |
95 struct buffer *buf = decode_buffer (buffer, 0); | 93 struct buffer *buf = decode_buffer (buffer, 0); |
96 | 94 |
97 down = buf->downcase_table; | 95 return list4 (buf->downcase_table, |
98 up = buf->upcase_table; | 96 buf->upcase_table, |
99 canon = buf->case_canon_table; | 97 buf->case_canon_table, |
100 eqv = buf->case_eqv_table; | 98 buf->case_eqv_table); |
101 | |
102 return Fcons (down, Fcons (up, Fcons (canon, Fcons (eqv, Qnil)))); | |
103 } | 99 } |
104 | 100 |
105 DEFUN ("standard-case-table", Fstandard_case_table, 0, 0, 0, /* | 101 DEFUN ("standard-case-table", Fstandard_case_table, 0, 0, 0, /* |
106 Return the standard case table. | 102 Return the standard case table. |
107 This is the one used for new buffers. | 103 This is the one used for new buffers. |
108 */ | 104 */ |
109 ()) | 105 ()) |
110 { | 106 { |
111 return Fcons (Vascii_downcase_table, | 107 return list4 (Vascii_downcase_table, |
112 Fcons (Vascii_upcase_table, | 108 Vascii_upcase_table, |
113 Fcons (Vascii_canon_table, | 109 Vascii_canon_table, |
114 Fcons (Vascii_eqv_table, | 110 Vascii_eqv_table); |
115 Qnil)))); | |
116 } | 111 } |
117 | 112 |
118 static Lisp_Object set_case_table (Lisp_Object table, int standard); | 113 static Lisp_Object set_case_table (Lisp_Object table, int standard); |
119 | 114 |
120 | 115 |
192 #endif /* MULE */ | 187 #endif /* MULE */ |
193 | 188 |
194 static Lisp_Object | 189 static Lisp_Object |
195 set_case_table (Lisp_Object table, int standard) | 190 set_case_table (Lisp_Object table, int standard) |
196 { | 191 { |
197 Lisp_Object down, up, canon, eqv; | 192 Lisp_Object down, up, canon, eqv, tail = table; |
198 struct buffer *buf = current_buffer; | 193 struct buffer *buf = current_buffer; |
199 | 194 |
200 check_case_table (table); | 195 check_case_table (table); |
201 | 196 |
202 down = Fcar_safe (table); | 197 down = XCAR (tail); tail = XCDR (tail); |
203 up = Fcar_safe (Fcdr_safe (table)); | 198 up = XCAR (tail); tail = XCDR (tail); |
204 canon = Fcar_safe (Fcdr_safe (Fcdr_safe (table))); | 199 canon = XCAR (tail); tail = XCDR (tail); |
205 eqv = Fcar_safe (Fcdr_safe (Fcdr_safe (Fcdr_safe (table)))); | 200 eqv = XCAR (tail); |
206 | 201 |
207 if (NILP (up)) | 202 if (NILP (up)) |
208 { | 203 { |
209 up = MAKE_TRT_TABLE (); | 204 up = MAKE_TRT_TABLE (); |
210 compute_trt_inverse (down, up); | 205 compute_trt_inverse (down, up); |