Mercurial > hg > xemacs-beta
annotate src/casefiddle.c @ 5864:750fab17b299
Make #'parse-integer Lisp-visible, extend it, allowing non-ASCII digits.
src/ChangeLog addition:
2015-02-25 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (read_atom): Use the new calling convention for
parse_integer().
* lisp.h: Change the declaration of parse_integer ().
* number.h (bignum_set_emacs_int, make_bignum_emacs_uint):
New #defines, used in data.c.
* lread.c (read_integer): Ditto.
* lread.c (read1): Ditto.
* data.c (find_highest_value): New.
* data.c (fill_ichar_array): New.
* data.c (build_fixnum_to_char_map): New.
* data.c (Fset_digit_fixnum_map): New.
* data.c (Fdigit_char_p): Moved from cl-extra.el.
* data.c (Fdigit_char): Moved from cl-extra.el.
* data.c (parse_integer): Moved from lread.c.
* data.c (Fparse_integer): Made available to Lisp.
* data.c (syms_of_data): Make the new subrs available.
* data.c (vars_of_data): Make the new vars available.
Expose parse_integer to Lisp, make it follow the Common Lisp API
(with some extensions, to allow us to support non ASCII digit
characters).
lisp/ChangeLog addition:
2015-02-25 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (digit-char-p): Moved to data.c.
* cl-extra.el (digit-char): Moved to data.c.
tests/ChangeLog addition:
2015-02-25 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
parse_integer(), used in #'read, now signals invalid-argument
rather than invalid-read-syntax, check for that.
* automated/lisp-tests.el:
Check #'parse-integer now it's available to Lisp, check
#'digit-char, #'digit-char-p and the congruence in behaviour,
check the XEmacs-specific RADIX-TABLE argument behaviour.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 25 Feb 2015 11:47:12 +0000 |
parents | 56144c8593a8 |
children |
rev | line source |
---|---|
428 | 1 /* XEmacs case conversion functions. |
2 Copyright (C) 1985, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc. | |
826 | 3 Copyright (C) 2002 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4910
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
428 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4910
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4910
diff
changeset
|
10 option) any later version. |
428 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4910
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 19 |
20 /* Synched up with: FSF 19.34, but substantially rewritten by Martin. */ | |
21 | |
22 #include <config.h> | |
23 #include "lisp.h" | |
24 | |
25 #include "buffer.h" | |
26 #include "insdel.h" | |
27 #include "syntax.h" | |
28 | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
29 enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP, |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
30 CASE_CANONICALIZE}; |
428 | 31 |
32 static Lisp_Object | |
444 | 33 casify_object (enum case_action flag, Lisp_Object string_or_char, |
34 Lisp_Object buffer) | |
428 | 35 { |
36 struct buffer *buf = decode_buffer (buffer, 0); | |
37 | |
38 retry: | |
39 | |
444 | 40 if (CHAR_OR_CHAR_INTP (string_or_char)) |
428 | 41 { |
867 | 42 Ichar c; |
444 | 43 CHECK_CHAR_COERCE_INT (string_or_char); |
44 c = XCHAR (string_or_char); | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
45 if (flag == CASE_DOWN) |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
46 { |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
47 c = DOWNCASE (buf, c); |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
48 } |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
49 else if (flag == CASE_UP) |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
50 { |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
51 c = UPCASE (buf, c); |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
52 } |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
53 else |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
54 { |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
55 c = CANONCASE (buf, c); |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
56 } |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
57 |
428 | 58 return make_char (c); |
59 } | |
60 | |
444 | 61 if (STRINGP (string_or_char)) |
428 | 62 { |
826 | 63 Lisp_Object syntax_table = buf->mirror_syntax_table; |
867 | 64 Ibyte *storage = |
2367 | 65 alloca_ibytes (XSTRING_LENGTH (string_or_char) * MAX_ICHAR_LEN); |
867 | 66 Ibyte *newp = storage; |
67 Ibyte *oldp = XSTRING_DATA (string_or_char); | |
68 Ibyte *endp = oldp + XSTRING_LENGTH (string_or_char); | |
428 | 69 int wordp = 0, wordp_prev; |
70 | |
771 | 71 while (oldp < endp) |
428 | 72 { |
867 | 73 Ichar c = itext_ichar (oldp); |
428 | 74 switch (flag) |
75 { | |
76 case CASE_UP: | |
77 c = UPCASE (buf, c); | |
78 break; | |
79 case CASE_DOWN: | |
80 c = DOWNCASE (buf, c); | |
81 break; | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
82 case CASE_CANONICALIZE: |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
83 c = CANONCASE (buf, c); |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
84 break; |
428 | 85 case CASE_CAPITALIZE: |
86 case CASE_CAPITALIZE_UP: | |
87 wordp_prev = wordp; | |
88 wordp = WORD_SYNTAX_P (syntax_table, c); | |
89 if (!wordp) break; | |
90 if (wordp_prev) | |
91 { | |
92 if (flag == CASE_CAPITALIZE) | |
93 c = DOWNCASE (buf, c); | |
94 } | |
95 else | |
96 c = UPCASE (buf, c); | |
97 break; | |
98 } | |
99 | |
867 | 100 newp += set_itext_ichar (newp, c); |
101 INC_IBYTEPTR (oldp); | |
428 | 102 } |
103 | |
104 return make_string (storage, newp - storage); | |
105 } | |
106 | |
444 | 107 string_or_char = wrong_type_argument (Qchar_or_string_p, string_or_char); |
428 | 108 goto retry; |
109 } | |
110 | |
111 DEFUN ("upcase", Fupcase, 1, 2, 0, /* | |
444 | 112 Convert STRING-OR-CHAR to upper case and return that. |
113 STRING-OR-CHAR may be a character or string. The result has the same type. | |
114 STRING-OR-CHAR is not altered--the value is a copy. | |
428 | 115 See also `capitalize', `downcase' and `upcase-initials'. |
116 Optional second arg BUFFER specifies which buffer's case tables to use, | |
117 and defaults to the current buffer. | |
118 */ | |
444 | 119 (string_or_char, buffer)) |
428 | 120 { |
444 | 121 return casify_object (CASE_UP, string_or_char, buffer); |
428 | 122 } |
123 | |
124 DEFUN ("downcase", Fdowncase, 1, 2, 0, /* | |
444 | 125 Convert STRING-OR-CHAR to lower case and return that. |
126 STRING-OR-CHAR may be a character or string. The result has the same type. | |
127 STRING-OR-CHAR is not altered--the value is a copy. | |
428 | 128 Optional second arg BUFFER specifies which buffer's case tables to use, |
129 and defaults to the current buffer. | |
130 */ | |
444 | 131 (string_or_char, buffer)) |
428 | 132 { |
444 | 133 return casify_object (CASE_DOWN, string_or_char, buffer); |
428 | 134 } |
135 | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
136 DEFUN ("canoncase", Fcanoncase, 1, 2, 0, /* |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
137 Convert STRING-OR-CHAR to its canonical lowercase form and return that. |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
138 |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
139 STRING-OR-CHAR may be a character or string. The result has the same type. |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
140 STRING-OR-CHAR is not altered--the value is a copy. |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
141 |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
142 Optional second arg BUFFER specifies which buffer's case tables to use, |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
143 and defaults to the current buffer. |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
144 |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
145 For any N characters that are equivalent in case-insensitive searching, |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
146 their canonical lowercase character will be the same. |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
147 */ |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
148 (string_or_char, buffer)) |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
149 { |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
150 return casify_object (CASE_CANONICALIZE, string_or_char, buffer); |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
151 } |
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
152 |
428 | 153 DEFUN ("capitalize", Fcapitalize, 1, 2, 0, /* |
444 | 154 Convert STRING-OR-CHAR to capitalized form and return that. |
428 | 155 This means that each word's first character is upper case |
156 and the rest is lower case. | |
444 | 157 STRING-OR-CHAR may be a character or string. The result has the same type. |
158 STRING-OR-CHAR is not altered--the value is a copy. | |
428 | 159 Optional second arg BUFFER specifies which buffer's case tables to use, |
160 and defaults to the current buffer. | |
161 */ | |
444 | 162 (string_or_char, buffer)) |
428 | 163 { |
444 | 164 return casify_object (CASE_CAPITALIZE, string_or_char, buffer); |
428 | 165 } |
166 | |
167 /* Like Fcapitalize but change only the initial characters. */ | |
168 | |
169 DEFUN ("upcase-initials", Fupcase_initials, 1, 2, 0, /* | |
444 | 170 Convert the initial of each word in STRING-OR-CHAR to upper case. |
428 | 171 Do not change the other letters of each word. |
444 | 172 STRING-OR-CHAR may be a character or string. The result has the same type. |
173 STRING-OR-CHAR is not altered--the value is a copy. | |
428 | 174 Optional second arg BUFFER specifies which buffer's case tables to use, |
175 and defaults to the current buffer. | |
176 */ | |
444 | 177 (string_or_char, buffer)) |
428 | 178 { |
444 | 179 return casify_object (CASE_CAPITALIZE_UP, string_or_char, buffer); |
428 | 180 } |
181 | |
182 /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. | |
444 | 183 START and END specify range of buffer to operate on. */ |
428 | 184 |
185 static void | |
444 | 186 casify_region_internal (enum case_action flag, Lisp_Object start, |
187 Lisp_Object end, struct buffer *buf) | |
428 | 188 { |
189 /* This function can GC */ | |
665 | 190 Charbpos pos, s, e; |
826 | 191 Lisp_Object syntax_table = buf->mirror_syntax_table; |
428 | 192 int mccount; |
193 int wordp = 0, wordp_prev; | |
194 | |
444 | 195 if (EQ (start, end)) |
428 | 196 /* Not modifying because nothing marked */ |
197 return; | |
198 | |
444 | 199 get_buffer_range_char (buf, start, end, &s, &e, 0); |
200 | |
201 mccount = begin_multiple_change (buf, s, e); | |
202 record_change (buf, s, e - s); | |
428 | 203 |
444 | 204 for (pos = s; pos < e; pos++) |
428 | 205 { |
867 | 206 Ichar oldc = BUF_FETCH_CHAR (buf, pos); |
207 Ichar c = oldc; | |
428 | 208 |
209 switch (flag) | |
210 { | |
211 case CASE_UP: | |
212 c = UPCASE (buf, oldc); | |
213 break; | |
214 case CASE_DOWN: | |
215 c = DOWNCASE (buf, oldc); | |
216 break; | |
217 case CASE_CAPITALIZE: | |
218 case CASE_CAPITALIZE_UP: | |
219 /* !!#### need to revalidate the start and end pointers in case | |
220 the buffer was changed */ | |
221 wordp_prev = wordp; | |
222 wordp = WORD_SYNTAX_P (syntax_table, c); | |
223 if (!wordp) continue; | |
224 if (wordp_prev) | |
225 { | |
226 if (flag == CASE_CAPITALIZE) | |
227 c = DOWNCASE (buf, c); | |
228 } | |
229 else | |
230 c = UPCASE (buf, c); | |
231 break; | |
232 } | |
233 | |
234 if (oldc == c) continue; | |
444 | 235 buffer_replace_char (buf, pos, c, 1, (pos == s)); |
428 | 236 BUF_MODIFF (buf)++; |
237 } | |
238 | |
239 end_multiple_change (buf, mccount); | |
240 } | |
241 | |
242 static Lisp_Object | |
444 | 243 casify_region (enum case_action flag, Lisp_Object start, Lisp_Object end, |
428 | 244 Lisp_Object buffer) |
245 { | |
444 | 246 casify_region_internal (flag, start, end, decode_buffer (buffer, 1)); |
428 | 247 return Qnil; |
248 } | |
249 | |
250 DEFUN ("upcase-region", Fupcase_region, 2, 3, "r", /* | |
251 Convert the region to upper case. In programs, wants two arguments. | |
252 These arguments specify the starting and ending character numbers of | |
253 the region to operate on. When used as a command, the text between | |
254 point and the mark is operated on. | |
255 See also `capitalize-region'. | |
256 Optional third arg BUFFER defaults to the current buffer. | |
257 */ | |
444 | 258 (start, end, buffer)) |
428 | 259 { |
260 /* This function can GC */ | |
444 | 261 return casify_region (CASE_UP, start, end, buffer); |
428 | 262 } |
263 | |
264 DEFUN ("downcase-region", Fdowncase_region, 2, 3, "r", /* | |
265 Convert the region to lower case. In programs, wants two arguments. | |
266 These arguments specify the starting and ending character numbers of | |
267 the region to operate on. When used as a command, the text between | |
268 point and the mark is operated on. | |
269 Optional third arg BUFFER defaults to the current buffer. | |
270 */ | |
444 | 271 (start, end, buffer)) |
428 | 272 { |
273 /* This function can GC */ | |
444 | 274 return casify_region (CASE_DOWN, start, end, buffer); |
428 | 275 } |
276 | |
277 DEFUN ("capitalize-region", Fcapitalize_region, 2, 3, "r", /* | |
278 Convert the region to capitalized form. | |
279 Capitalized form means each word's first character is upper case | |
280 and the rest of it is lower case. | |
281 In programs, give two arguments, the starting and ending | |
282 character positions to operate on. | |
283 Optional third arg BUFFER defaults to the current buffer. | |
284 */ | |
444 | 285 (start, end, buffer)) |
428 | 286 { |
287 /* This function can GC */ | |
444 | 288 return casify_region (CASE_CAPITALIZE, start, end, buffer); |
428 | 289 } |
290 | |
291 /* Like Fcapitalize_region but change only the initials. */ | |
292 | |
293 DEFUN ("upcase-initials-region", Fupcase_initials_region, 2, 3, "r", /* | |
294 Upcase the initial of each word in the region. | |
295 Subsequent letters of each word are not changed. | |
296 In programs, give two arguments, the starting and ending | |
297 character positions to operate on. | |
298 Optional third arg BUFFER defaults to the current buffer. | |
299 */ | |
444 | 300 (start, end, buffer)) |
428 | 301 { |
444 | 302 return casify_region (CASE_CAPITALIZE_UP, start, end, buffer); |
428 | 303 } |
304 | |
305 | |
306 static Lisp_Object | |
307 casify_word (enum case_action flag, Lisp_Object arg, Lisp_Object buffer) | |
308 { | |
665 | 309 Charbpos farend; |
428 | 310 struct buffer *buf = decode_buffer (buffer, 1); |
311 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
312 CHECK_FIXNUM (arg); |
428 | 313 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
314 farend = scan_words (buf, BUF_PT (buf), XFIXNUM (arg)); |
428 | 315 if (!farend) |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
316 farend = XFIXNUM (arg) > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); |
428 | 317 |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
318 casify_region_internal (flag, make_fixnum (BUF_PT (buf)), make_fixnum (farend), buf); |
428 | 319 BUF_SET_PT (buf, max (BUF_PT (buf), farend)); |
320 return Qnil; | |
321 } | |
322 | |
323 DEFUN ("upcase-word", Fupcase_word, 1, 2, "p", /* | |
444 | 324 Convert following word (or COUNT words) to upper case, moving over. |
428 | 325 With negative argument, convert previous words but do not move. |
326 See also `capitalize-word'. | |
327 Optional second arg BUFFER defaults to the current buffer. | |
328 */ | |
444 | 329 (count, buffer)) |
428 | 330 { |
331 /* This function can GC */ | |
444 | 332 return casify_word (CASE_UP, count, buffer); |
428 | 333 } |
334 | |
335 DEFUN ("downcase-word", Fdowncase_word, 1, 2, "p", /* | |
444 | 336 Convert following word (or COUNT words) to lower case, moving over. |
428 | 337 With negative argument, convert previous words but do not move. |
338 Optional second arg BUFFER defaults to the current buffer. | |
339 */ | |
444 | 340 (count, buffer)) |
428 | 341 { |
342 /* This function can GC */ | |
444 | 343 return casify_word (CASE_DOWN, count, buffer); |
428 | 344 } |
345 | |
346 DEFUN ("capitalize-word", Fcapitalize_word, 1, 2, "p", /* | |
444 | 347 Capitalize the following word (or COUNT words), moving over. |
428 | 348 This gives the word(s) a first character in upper case |
349 and the rest lower case. | |
350 With negative argument, capitalize previous words but do not move. | |
351 Optional second arg BUFFER defaults to the current buffer. | |
352 */ | |
444 | 353 (count, buffer)) |
428 | 354 { |
355 /* This function can GC */ | |
444 | 356 return casify_word (CASE_CAPITALIZE, count, buffer); |
428 | 357 } |
358 | |
359 | |
360 void | |
361 syms_of_casefiddle (void) | |
362 { | |
363 DEFSUBR (Fupcase); | |
364 DEFSUBR (Fdowncase); | |
4910
6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
2367
diff
changeset
|
365 DEFSUBR (Fcanoncase); |
428 | 366 DEFSUBR (Fcapitalize); |
367 DEFSUBR (Fupcase_initials); | |
368 DEFSUBR (Fupcase_region); | |
369 DEFSUBR (Fdowncase_region); | |
370 DEFSUBR (Fcapitalize_region); | |
371 DEFSUBR (Fupcase_initials_region); | |
372 DEFSUBR (Fupcase_word); | |
373 DEFSUBR (Fdowncase_word); | |
374 DEFSUBR (Fcapitalize_word); | |
375 } |