Mercurial > hg > xemacs-beta
comparison src/casetab.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 3742ea8250b5 4ee73bbe4f8e |
children | b5df3737028a |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
46 (3) `canon' maps each character to a "canonical" lowercase, such that if | 46 (3) `canon' maps each character to a "canonical" lowercase, such that if |
47 two different uppercase characters map to the same lowercase character, | 47 two different uppercase characters map to the same lowercase character, |
48 or vice versa, both characters will have the same entry in the canon | 48 or vice versa, both characters will have the same entry in the canon |
49 table. | 49 table. |
50 | 50 |
51 (4) `equiv' lists the "equivalence classes" defined by `canon'. Imagine | 51 (4) `eqv' lists the "equivalence classes" defined by `canon'. Imagine |
52 that all characters are divided into groups having the same `canon' | 52 that all characters are divided into groups having the same `canon' |
53 entry; these groups are called "equivalence classes" and `equiv' lists | 53 entry; these groups are called "equivalence classes" and `eqv' lists them |
54 them by linking the characters in each equivalence class together in a | 54 by linking the characters in each equivalence class together in a |
55 circular list. | 55 circular list. That is, to find out all all the members of a given char's |
56 | 56 equivalence classe, you need something like the following code: |
57 `canon' is used when doing case-insensitive comparisons. `equiv' is | 57 |
58 (let* ((char ?i) | |
59 (original-char char) | |
60 (standard-case-eqv (case-table-eqv (standard-case-table)))) | |
61 (loop | |
62 with res = (list char) | |
63 until (eq (setq char (get-char-table char standard-case-eqv)) | |
64 original-char) | |
65 do (push char res) | |
66 finally return res)) | |
67 | |
68 (Where #'case-table-eqv doesn't yet exist, and probably never will, given | |
69 that the C code needs to keep it in a consistent state so Lisp can't mess | |
70 around with it.) | |
71 | |
72 `canon' is used when doing case-insensitive comparisons. `eqv' is | |
58 used in the Boyer-Moore search code. | 73 used in the Boyer-Moore search code. |
59 */ | 74 */ |
60 | 75 |
61 #include <config.h> | 76 #include <config.h> |
62 #include "lisp.h" | 77 #include "lisp.h" |
105 { XD_LISP_OBJECT, offsetof (Lisp_Case_Table, case_eqv_table) }, | 120 { XD_LISP_OBJECT, offsetof (Lisp_Case_Table, case_eqv_table) }, |
106 { XD_END } | 121 { XD_END } |
107 }; | 122 }; |
108 | 123 |
109 | 124 |
110 DEFINE_LISP_OBJECT("case-table", case_table, | 125 DEFINE_DUMPABLE_LISP_OBJECT ("case-table", case_table, |
111 mark_case_table, print_case_table, 0, | 126 mark_case_table, print_case_table, 0, |
112 0, 0, case_table_description, Lisp_Case_Table); | 127 0, 0, case_table_description, Lisp_Case_Table); |
113 | 128 |
114 static Lisp_Object | 129 static Lisp_Object |
115 allocate_case_table (int init_tables) | 130 allocate_case_table (int init_tables) |
116 { | 131 { |
117 Lisp_Object obj = ALLOC_LISP_OBJECT (case_table); | 132 Lisp_Object obj = ALLOC_LISP_OBJECT (case_table); |