comparison src/casetab.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 376386a54a3c
children 131b0175ea99
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
50 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); 50 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse);
51 51
52 #define STRING256_P(obj) \ 52 #define STRING256_P(obj) \
53 (STRINGP (obj) && string_char_length (XSTRING (obj)) == 256) 53 (STRINGP (obj) && string_char_length (XSTRING (obj)) == 256)
54 54
55 DEFUN ("case-table-p", Fcase_table_p, Scase_table_p, 1, 1, 0 /* 55 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /*
56 Return t iff ARG is a case table. 56 Return t iff ARG is a case table.
57 See `set-case-table' for more information on these data structures. 57 See `set-case-table' for more information on these data structures.
58 */ ) 58 */
59 (table) 59 (table))
60 Lisp_Object table;
61 { 60 {
62 Lisp_Object down, up, canon, eqv; 61 Lisp_Object down, up, canon, eqv;
63 down = Fcar_safe (table); 62 down = Fcar_safe (table);
64 up = Fcar_safe (Fcdr_safe (table)); 63 up = Fcar_safe (Fcdr_safe (table));
65 canon = Fcar_safe (Fcdr_safe (Fcdr_safe (table))); 64 canon = Fcar_safe (Fcdr_safe (Fcdr_safe (table)));
81 while (tem = Fcase_table_p (obj), NILP (tem)) 80 while (tem = Fcase_table_p (obj), NILP (tem))
82 obj = wrong_type_argument (Qcase_table_p, obj); 81 obj = wrong_type_argument (Qcase_table_p, obj);
83 return (obj); 82 return (obj);
84 } 83 }
85 84
86 DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 85 DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /*
87 0, 1, 0 /*
88 Return the case table of BUFFER, which defaults to the current buffer. 86 Return the case table of BUFFER, which defaults to the current buffer.
89 */ ) 87 */
90 (buffer) 88 (buffer))
91 Lisp_Object buffer;
92 { 89 {
93 Lisp_Object down, up, canon, eqv; 90 Lisp_Object down, up, canon, eqv;
94 struct buffer *buf = decode_buffer (buffer, 0); 91 struct buffer *buf = decode_buffer (buffer, 0);
95 92
96 down = buf->downcase_table; 93 down = buf->downcase_table;
99 eqv = buf->case_eqv_table; 96 eqv = buf->case_eqv_table;
100 97
101 return Fcons (down, Fcons (up, Fcons (canon, Fcons (eqv, Qnil)))); 98 return Fcons (down, Fcons (up, Fcons (canon, Fcons (eqv, Qnil))));
102 } 99 }
103 100
104 DEFUN ("standard-case-table", Fstandard_case_table, 101 DEFUN ("standard-case-table", Fstandard_case_table, 0, 0, 0, /*
105 Sstandard_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 Fcons (Vascii_downcase_table,
112 Fcons (Vascii_upcase_table, 108 Fcons (Vascii_upcase_table,
113 Fcons (Vascii_canon_table, 109 Fcons (Vascii_canon_table,
114 Fcons (Vascii_eqv_table, 110 Fcons (Vascii_eqv_table,
116 } 112 }
117 113
118 static Lisp_Object set_case_table (Lisp_Object table, int standard); 114 static Lisp_Object set_case_table (Lisp_Object table, int standard);
119 115
120 116
121 DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0 /* 117 DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /*
122 Select a new case table for the current buffer. 118 Select a new case table for the current buffer.
123 A case table is a list (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES) 119 A case table is a list (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES)
124 where each element is either nil or a string of length 256. 120 where each element is either nil or a string of length 256.
125 DOWNCASE maps each character to its lower-case equivalent. 121 DOWNCASE maps each character to its lower-case equivalent.
126 UPCASE maps each character to its upper-case equivalent; 122 UPCASE maps each character to its upper-case equivalent;
131 canonical equivalent character; it may be nil, in which case it is 127 canonical equivalent character; it may be nil, in which case it is
132 deduced from DOWNCASE and UPCASE. 128 deduced from DOWNCASE and UPCASE.
133 EQUIVALENCES is a map that cyclicly permutes each equivalence class 129 EQUIVALENCES is a map that cyclicly permutes each equivalence class
134 (of characters with the same canonical equivalent); it may be nil, 130 (of characters with the same canonical equivalent); it may be nil,
135 in which case it is deduced from CANONICALIZE. 131 in which case it is deduced from CANONICALIZE.
136 */ ) 132 */
137 (table) 133 (table))
138 Lisp_Object table;
139 { 134 {
140 return set_case_table (table, 0); 135 return set_case_table (table, 0);
141 } 136 }
142 137
143 DEFUN ("set-standard-case-table", 138 DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /*
144 Fset_standard_case_table, Sset_standard_case_table, 1, 1, 0 /*
145 Select a new standard case table for new buffers. 139 Select a new standard case table for new buffers.
146 See `set-case-table' for more info on case tables. 140 See `set-case-table' for more info on case tables.
147 */ ) 141 */
148 (table) 142 (table))
149 Lisp_Object table;
150 { 143 {
151 return set_case_table (table, 1); 144 return set_case_table (table, 1);
152 } 145 }
153 146
154 static Lisp_Object 147 static Lisp_Object
243 syms_of_casetab (void) 236 syms_of_casetab (void)
244 { 237 {
245 defsymbol (&Qcase_table_p, "case-table-p"); 238 defsymbol (&Qcase_table_p, "case-table-p");
246 defsymbol (&Qtranslate_table, "translate-table"); 239 defsymbol (&Qtranslate_table, "translate-table");
247 240
248 defsubr (&Scase_table_p); 241 DEFSUBR (Fcase_table_p);
249 defsubr (&Scurrent_case_table); 242 DEFSUBR (Fcurrent_case_table);
250 defsubr (&Sstandard_case_table); 243 DEFSUBR (Fstandard_case_table);
251 defsubr (&Sset_case_table); 244 DEFSUBR (Fset_case_table);
252 defsubr (&Sset_standard_case_table); 245 DEFSUBR (Fset_standard_case_table);
253 } 246 }
254 247
255 void 248 void
256 complex_vars_of_casetab (void) 249 complex_vars_of_casetab (void)
257 { 250 {