Mercurial > hg > xemacs-beta
comparison src/chartab.c @ 5125:b5df3737028a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 01:58:04 -0600 |
parents | 623d57b7fbe8 ae48681c47fa |
children | a9c41067dd88 |
comparison
equal
deleted
inserted
replaced
5124:623d57b7fbe8 | 5125:b5df3737028a |
---|---|
110 } | 110 } |
111 return Qnil; | 111 return Qnil; |
112 } | 112 } |
113 | 113 |
114 static int | 114 static int |
115 char_table_entry_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | 115 char_table_entry_equal (Lisp_Object obj1, Lisp_Object obj2, int depth, |
116 int foldcase) | |
116 { | 117 { |
117 Lisp_Char_Table_Entry *cte1 = XCHAR_TABLE_ENTRY (obj1); | 118 Lisp_Char_Table_Entry *cte1 = XCHAR_TABLE_ENTRY (obj1); |
118 Lisp_Char_Table_Entry *cte2 = XCHAR_TABLE_ENTRY (obj2); | 119 Lisp_Char_Table_Entry *cte2 = XCHAR_TABLE_ENTRY (obj2); |
119 int i; | 120 int i; |
120 | 121 |
121 for (i = 0; i < 96; i++) | 122 for (i = 0; i < 96; i++) |
122 if (!internal_equal (cte1->level2[i], cte2->level2[i], depth + 1)) | 123 if (!internal_equal_0 (cte1->level2[i], cte2->level2[i], depth + 1, |
124 foldcase)) | |
123 return 0; | 125 return 0; |
124 | 126 |
125 return 1; | 127 return 1; |
126 } | 128 } |
127 | 129 |
223 } | 225 } |
224 | 226 |
225 static void | 227 static void |
226 decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) | 228 decode_char_table_range (Lisp_Object range, struct chartab_range *outrange) |
227 { | 229 { |
230 xzero (*outrange); | |
228 if (EQ (range, Qt)) | 231 if (EQ (range, Qt)) |
229 outrange->type = CHARTAB_RANGE_ALL; | 232 outrange->type = CHARTAB_RANGE_ALL; |
230 else if (CHAR_OR_CHAR_INTP (range)) | 233 else if (CHAR_OR_CHAR_INTP (range)) |
231 { | 234 { |
232 outrange->type = CHARTAB_RANGE_CHAR; | 235 outrange->type = CHARTAB_RANGE_CHAR; |
310 { | 313 { |
311 struct ptemap *a = (struct ptemap *) arg; | 314 struct ptemap *a = (struct ptemap *) arg; |
312 struct gcpro gcpro1; | 315 struct gcpro gcpro1; |
313 Lisp_Object lisprange; | 316 Lisp_Object lisprange; |
314 if (!a->first) | 317 if (!a->first) |
315 write_c_string (a->printcharfun, " "); | 318 write_ascstring (a->printcharfun, " "); |
316 a->first = 0; | 319 a->first = 0; |
317 lisprange = encode_char_table_range (range); | 320 lisprange = encode_char_table_range (range); |
318 GCPRO1 (lisprange); | 321 GCPRO1 (lisprange); |
319 write_fmt_string_lisp (a->printcharfun, "%s %S", 2, lisprange, val); | 322 write_fmt_string_lisp (a->printcharfun, "%s %S", 2, lisprange, val); |
320 UNGCPRO; | 323 UNGCPRO; |
334 arg.first = 1; | 337 arg.first = 1; |
335 | 338 |
336 write_fmt_string_lisp (printcharfun, "#s(char-table type %s data (", | 339 write_fmt_string_lisp (printcharfun, "#s(char-table type %s data (", |
337 1, char_table_type_to_symbol (ct->type)); | 340 1, char_table_type_to_symbol (ct->type)); |
338 map_char_table (obj, &range, print_table_entry, &arg); | 341 map_char_table (obj, &range, print_table_entry, &arg); |
339 write_c_string (printcharfun, "))"); | 342 write_ascstring (printcharfun, "))"); |
340 | 343 |
341 /* #### need to print and read the default; but that will allow the | 344 /* #### need to print and read the default; but that will allow the |
342 default to be modified, which we don't (yet) support -- but FSF does */ | 345 default to be modified, which we don't (yet) support -- but FSF does */ |
343 } | 346 } |
344 | 347 |
345 static int | 348 static int |
346 char_table_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | 349 char_table_equal (Lisp_Object obj1, Lisp_Object obj2, int depth, int foldcase) |
347 { | 350 { |
348 Lisp_Char_Table *ct1 = XCHAR_TABLE (obj1); | 351 Lisp_Char_Table *ct1 = XCHAR_TABLE (obj1); |
349 Lisp_Char_Table *ct2 = XCHAR_TABLE (obj2); | 352 Lisp_Char_Table *ct2 = XCHAR_TABLE (obj2); |
350 int i; | 353 int i; |
351 | 354 |
352 if (CHAR_TABLE_TYPE (ct1) != CHAR_TABLE_TYPE (ct2)) | 355 if (CHAR_TABLE_TYPE (ct1) != CHAR_TABLE_TYPE (ct2)) |
353 return 0; | 356 return 0; |
354 | 357 |
355 for (i = 0; i < NUM_ASCII_CHARS; i++) | 358 for (i = 0; i < NUM_ASCII_CHARS; i++) |
356 if (!internal_equal (ct1->ascii[i], ct2->ascii[i], depth + 1)) | 359 if (!internal_equal_0 (ct1->ascii[i], ct2->ascii[i], depth + 1, foldcase)) |
357 return 0; | 360 return 0; |
358 | 361 |
359 #ifdef MULE | 362 #ifdef MULE |
360 for (i = 0; i < NUM_LEADING_BYTES; i++) | 363 for (i = 0; i < NUM_LEADING_BYTES; i++) |
361 if (!internal_equal (ct1->level1[i], ct2->level1[i], depth + 1)) | 364 if (!internal_equal_0 (ct1->level1[i], ct2->level1[i], depth + 1, foldcase)) |
362 return 0; | 365 return 0; |
363 #endif /* MULE */ | 366 #endif /* MULE */ |
364 | 367 |
365 return internal_equal (ct1->default_, ct2->default_, depth + 1); | 368 return internal_equal_0 (ct1->default_, ct2->default_, depth + 1, foldcase); |
366 } | 369 } |
367 | 370 |
368 static Hashcode | 371 static Hashcode |
369 char_table_hash (Lisp_Object obj, int depth) | 372 char_table_hash (Lisp_Object obj, int depth) |
370 { | 373 { |
791 | 794 |
792 static int | 795 static int |
793 copy_mapper (struct chartab_range *range, Lisp_Object UNUSED (table), | 796 copy_mapper (struct chartab_range *range, Lisp_Object UNUSED (table), |
794 Lisp_Object val, void *arg) | 797 Lisp_Object val, void *arg) |
795 { | 798 { |
796 put_char_table (VOID_TO_LISP (arg), range, val); | 799 put_char_table (GET_LISP_FROM_VOID (arg), range, val); |
797 return 0; | 800 return 0; |
798 } | 801 } |
799 | 802 |
800 void | 803 void |
801 copy_char_table_range (Lisp_Object from, Lisp_Object to, | 804 copy_char_table_range (Lisp_Object from, Lisp_Object to, |
802 struct chartab_range *range) | 805 struct chartab_range *range) |
803 { | 806 { |
804 map_char_table (from, range, copy_mapper, LISP_TO_VOID (to)); | 807 map_char_table (from, range, copy_mapper, STORE_LISP_IN_VOID (to)); |
805 } | 808 } |
806 | 809 |
807 static Lisp_Object | 810 static Lisp_Object |
808 get_range_char_table_1 (struct chartab_range *range, Lisp_Object table, | 811 get_range_char_table_1 (struct chartab_range *range, Lisp_Object table, |
809 Lisp_Object multi) | 812 Lisp_Object multi) |