Mercurial > emacs
comparison src/category.c @ 109126:aec1143e8d85
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C.
* src/atimer.c:
* src/bidi.c:
* src/bytecode.c:
* src/callint.c:
* src/callproc.c:
* src/casefiddle.c:
* src/casetab.c:
* src/category.c:
* src/ccl.c:
* src/character.c:
* src/charset.c:
* src/chartab.c:
* src/cmds.c:
* src/coding.c:
* src/composite.c:
* src/data.c:
* src/dbusbind.c:
* src/dired.c:
* src/dispnew.c:
* src/doc.c:
* src/doprnt.c:
* src/ecrt0.c:
* src/editfns.c:
* src/fileio.c:
* src/filelock.c:
* src/filemode.c:
* src/fns.c:
* src/font.c:
* src/fontset.c:
* src/frame.c:
* src/fringe.c:
* src/ftfont.c:
* src/ftxfont.c:
* src/gtkutil.c:
* src/indent.c:
* src/insdel.c:
* src/intervals.c:
* src/keymap.c:
* src/lread.c:
* src/macros.c:
* src/marker.c:
* src/md5.c:
* src/menu.c:
* src/minibuf.c:
* src/prefix-args.c:
* src/print.c:
* src/ralloc.c:
* src/regex.c:
* src/region-cache.c:
* src/scroll.c:
* src/search.c:
* src/sound.c:
* src/strftime.c:
* src/syntax.c:
* src/sysdep.c:
* src/termcap.c:
* src/terminal.c:
* src/terminfo.c:
* src/textprop.c:
* src/tparam.c:
* src/undo.c:
* src/unexelf.c:
* src/window.c:
* src/xfaces.c:
* src/xfns.c:
* src/xfont.c:
* src/xftfont.c:
* src/xgselect.c:
* src/xmenu.c:
* src/xrdb.c:
* src/xselect.c:
* src/xsettings.c:
* src/xsmfns.c:
* src/xterm.c: Likewise.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 04 Jul 2010 00:50:25 -0700 |
parents | 2bc9a0c04c87 |
children | 8cfee7d2955f |
comparison
equal
deleted
inserted
replaced
109125:12b02558bf51 | 109126:aec1143e8d85 |
---|---|
60 /* Category set staff. */ | 60 /* Category set staff. */ |
61 | 61 |
62 static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); | 62 static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object); |
63 | 63 |
64 static Lisp_Object | 64 static Lisp_Object |
65 hash_get_category_set (table, category_set) | 65 hash_get_category_set (Lisp_Object table, Lisp_Object category_set) |
66 Lisp_Object table, category_set; | |
67 { | 66 { |
68 Lisp_Object val; | 67 Lisp_Object val; |
69 struct Lisp_Hash_Table *h; | 68 struct Lisp_Hash_Table *h; |
70 int i; | 69 int i; |
71 unsigned hash; | 70 unsigned hash; |
115 } | 114 } |
116 | 115 |
117 | 116 |
118 /* Category staff. */ | 117 /* Category staff. */ |
119 | 118 |
120 Lisp_Object check_category_table (); | 119 Lisp_Object check_category_table (Lisp_Object table); |
121 | 120 |
122 DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0, | 121 DEFUN ("define-category", Fdefine_category, Sdefine_category, 2, 3, 0, |
123 doc: /* Define CATEGORY as a category which is described by DOCSTRING. | 122 doc: /* Define CATEGORY as a category which is described by DOCSTRING. |
124 CATEGORY should be an ASCII printing character in the range ` ' to `~'. | 123 CATEGORY should be an ASCII printing character in the range ` ' to `~'. |
125 DOCSTRING is the documentation string of the category. The first line | 124 DOCSTRING is the documentation string of the category. The first line |
194 not nil, check the validity of TABLE as a category table. If | 193 not nil, check the validity of TABLE as a category table. If |
195 valid, return TABLE itself, but if not valid, signal an error of | 194 valid, return TABLE itself, but if not valid, signal an error of |
196 wrong-type-argument. */ | 195 wrong-type-argument. */ |
197 | 196 |
198 Lisp_Object | 197 Lisp_Object |
199 check_category_table (table) | 198 check_category_table (Lisp_Object table) |
200 Lisp_Object table; | |
201 { | 199 { |
202 if (NILP (table)) | 200 if (NILP (table)) |
203 return current_buffer->category_table; | 201 return current_buffer->category_table; |
204 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); | 202 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); |
205 return table; | 203 return table; |
222 return Vstandard_category_table; | 220 return Vstandard_category_table; |
223 } | 221 } |
224 | 222 |
225 | 223 |
226 static void | 224 static void |
227 copy_category_entry (table, c, val) | 225 copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val) |
228 Lisp_Object table, c, val; | |
229 { | 226 { |
230 val = Fcopy_sequence (val); | 227 val = Fcopy_sequence (val); |
231 if (CONSP (c)) | 228 if (CONSP (c)) |
232 char_table_set_range (table, XINT (XCAR (c)), XINT (XCDR (c)), val); | 229 char_table_set_range (table, XINT (XCAR (c)), XINT (XCDR (c)), val); |
233 else | 230 else |
238 function copy-sequence because no contents should be shared between | 235 function copy-sequence because no contents should be shared between |
239 the original and the copy. This function is called recursively by | 236 the original and the copy. This function is called recursively by |
240 binding TABLE to a sub char table. */ | 237 binding TABLE to a sub char table. */ |
241 | 238 |
242 Lisp_Object | 239 Lisp_Object |
243 copy_category_table (table) | 240 copy_category_table (Lisp_Object table) |
244 Lisp_Object table; | |
245 { | 241 { |
246 table = copy_char_table (table); | 242 table = copy_char_table (table); |
247 | 243 |
248 if (! NILP (XCHAR_TABLE (table)->defalt)) | 244 if (! NILP (XCHAR_TABLE (table)->defalt)) |
249 XCHAR_TABLE (table)->defalt | 245 XCHAR_TABLE (table)->defalt |
302 return table; | 298 return table; |
303 } | 299 } |
304 | 300 |
305 | 301 |
306 Lisp_Object | 302 Lisp_Object |
307 char_category_set (c) | 303 char_category_set (int c) |
308 int c; | |
309 { | 304 { |
310 return CHAR_TABLE_REF (current_buffer->category_table, c); | 305 return CHAR_TABLE_REF (current_buffer->category_table, c); |
311 } | 306 } |
312 | 307 |
313 DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, | 308 DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, |
342 | 337 |
343 return build_string (str); | 338 return build_string (str); |
344 } | 339 } |
345 | 340 |
346 void | 341 void |
347 set_category_set (category_set, category, val) | 342 set_category_set (Lisp_Object category_set, Lisp_Object category, Lisp_Object val) |
348 Lisp_Object category_set, category, val; | |
349 { | 343 { |
350 do { | 344 do { |
351 int idx = XINT (category) / 8; | 345 int idx = XINT (category) / 8; |
352 unsigned char bits = 1 << (XINT (category) % 8); | 346 unsigned char bits = 1 << (XINT (category) % 8); |
353 | 347 |
418 characters C1 and C2 if they appear in this order, else return 0. | 412 characters C1 and C2 if they appear in this order, else return 0. |
419 Use the macro WORD_BOUNDARY_P instead of calling this function | 413 Use the macro WORD_BOUNDARY_P instead of calling this function |
420 directly. */ | 414 directly. */ |
421 | 415 |
422 int | 416 int |
423 word_boundary_p (c1, c2) | 417 word_boundary_p (int c1, int c2) |
424 int c1, c2; | |
425 { | 418 { |
426 Lisp_Object category_set1, category_set2; | 419 Lisp_Object category_set1, category_set2; |
427 Lisp_Object tail; | 420 Lisp_Object tail; |
428 int default_result; | 421 int default_result; |
429 | 422 |
464 return default_result; | 457 return default_result; |
465 } | 458 } |
466 | 459 |
467 | 460 |
468 void | 461 void |
469 init_category_once () | 462 init_category_once (void) |
470 { | 463 { |
471 /* This has to be done here, before we call Fmake_char_table. */ | 464 /* This has to be done here, before we call Fmake_char_table. */ |
472 Qcategory_table = intern_c_string ("category-table"); | 465 Qcategory_table = intern_c_string ("category-table"); |
473 staticpro (&Qcategory_table); | 466 staticpro (&Qcategory_table); |
474 | 467 |
487 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), | 480 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), |
488 Fmake_vector (make_number (95), Qnil)); | 481 Fmake_vector (make_number (95), Qnil)); |
489 } | 482 } |
490 | 483 |
491 void | 484 void |
492 syms_of_category () | 485 syms_of_category (void) |
493 { | 486 { |
494 Qcategoryp = intern_c_string ("categoryp"); | 487 Qcategoryp = intern_c_string ("categoryp"); |
495 staticpro (&Qcategoryp); | 488 staticpro (&Qcategoryp); |
496 Qcategorysetp = intern_c_string ("categorysetp"); | 489 Qcategorysetp = intern_c_string ("categorysetp"); |
497 staticpro (&Qcategorysetp); | 490 staticpro (&Qcategorysetp); |