Mercurial > hg > xemacs-beta
comparison src/casetab.c @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
53 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); | 53 static void compute_trt_inverse (Lisp_Object trt, Lisp_Object inverse); |
54 | 54 |
55 #define STRING256_P(obj) (STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256) | 55 #define STRING256_P(obj) (STRINGP (obj) && XSTRING_CHAR_LENGTH (obj) == 256) |
56 | 56 |
57 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /* | 57 DEFUN ("case-table-p", Fcase_table_p, 1, 1, 0, /* |
58 Return t if ARG is a case table. | 58 Return t if OBJECT is a case table. |
59 See `set-case-table' for more information on these data structures. | 59 See `set-case-table' for more information on these data structures. |
60 */ | 60 */ |
61 (table)) | 61 (object)) |
62 { | 62 { |
63 Lisp_Object down, up, canon, eqv; | 63 Lisp_Object down, up, canon, eqv; |
64 if (!CONSP (table)) return Qnil; down = XCAR (table); table = XCDR (table); | 64 if (!CONSP (object)) return Qnil; down = XCAR (object); object = XCDR (object); |
65 if (!CONSP (table)) return Qnil; up = XCAR (table); table = XCDR (table); | 65 if (!CONSP (object)) return Qnil; up = XCAR (object); object = XCDR (object); |
66 if (!CONSP (table)) return Qnil; canon = XCAR (table); table = XCDR (table); | 66 if (!CONSP (object)) return Qnil; canon = XCAR (object); object = XCDR (object); |
67 if (!CONSP (table)) return Qnil; eqv = XCAR (table); | 67 if (!CONSP (object)) return Qnil; eqv = XCAR (object); |
68 | 68 |
69 return (STRING256_P (down) | 69 return (STRING256_P (down) |
70 && (NILP (up) || STRING256_P (up)) | 70 && (NILP (up) || STRING256_P (up)) |
71 && ((NILP (canon) && NILP (eqv)) | 71 && ((NILP (canon) && NILP (eqv)) |
72 || (STRING256_P (canon) | 72 || (STRING256_P (canon) |
73 && (NILP (eqv) || STRING256_P (eqv)))) | 73 && (NILP (eqv) || STRING256_P (eqv)))) |
74 ? Qt : Qnil); | 74 ? Qt : Qnil); |
75 } | 75 } |
76 | 76 |
77 static Lisp_Object | 77 static Lisp_Object |
78 check_case_table (Lisp_Object obj) | 78 check_case_table (Lisp_Object object) |
79 { | 79 { |
80 REGISTER Lisp_Object tem; | 80 while (NILP (Fcase_table_p (object))) |
81 | 81 object = wrong_type_argument (Qcase_tablep, object); |
82 while (tem = Fcase_table_p (obj), NILP (tem)) | 82 return object; |
83 obj = wrong_type_argument (Qcase_tablep, obj); | |
84 return (obj); | |
85 } | 83 } |
86 | 84 |
87 DEFUN ("current-case-table", Fcurrent_case_table, 0, 1, 0, /* | 85 DEFUN ("current-case-table", Fcurrent_case_table, 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 */ |
111 | 109 |
112 static Lisp_Object set_case_table (Lisp_Object table, int standard); | 110 static Lisp_Object set_case_table (Lisp_Object table, int standard); |
113 | 111 |
114 | 112 |
115 DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /* | 113 DEFUN ("set-case-table", Fset_case_table, 1, 1, 0, /* |
116 Select a new case table for the current buffer. | 114 Select CASE-TABLE as the new case table for the current buffer. |
117 A case table is a list (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES) | 115 A case table is a list (DOWNCASE UPCASE CANONICALIZE EQUIVALENCES) |
118 where each element is either nil or a string of length 256. | 116 where each element is either nil or a string of length 256. |
119 DOWNCASE maps each character to its lower-case equivalent. | 117 DOWNCASE maps each character to its lower-case equivalent. |
120 UPCASE maps each character to its upper-case equivalent; | 118 UPCASE maps each character to its upper-case equivalent; |
121 if lower and upper case characters are in 1-1 correspondence, | 119 if lower and upper case characters are in 1-1 correspondence, |
132 (this includes chars in the range 128 - 255) are ignored by | 130 (this includes chars in the range 128 - 255) are ignored by |
133 the string/buffer-searching routines. Thus, `case-fold-search' | 131 the string/buffer-searching routines. Thus, `case-fold-search' |
134 will not correctly conflate a-umlaut and A-umlaut even if the | 132 will not correctly conflate a-umlaut and A-umlaut even if the |
135 case tables call for this. | 133 case tables call for this. |
136 */ | 134 */ |
137 (table)) | 135 (case_table)) |
138 { | 136 { |
139 return set_case_table (table, 0); | 137 return set_case_table (case_table, 0); |
140 } | 138 } |
141 | 139 |
142 DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /* | 140 DEFUN ("set-standard-case-table", Fset_standard_case_table, 1, 1, 0, /* |
143 Select a new standard case table for new buffers. | 141 Select CASE-TABLE as the new standard case table for new buffers. |
144 See `set-case-table' for more info on case tables. | 142 See `set-case-table' for more info on case tables. |
145 */ | 143 */ |
146 (table)) | 144 (case_table)) |
147 { | 145 { |
148 return set_case_table (table, 1); | 146 return set_case_table (case_table, 1); |
149 } | 147 } |
150 | 148 |
151 #ifdef MULE | 149 #ifdef MULE |
152 | 150 |
153 static Lisp_Object | 151 static Lisp_Object |