Mercurial > hg > xemacs-beta
annotate lisp/mule/kinsoku.el @ 5327:d1b17a33450b
Move the heavy lifting from cl-seq.el to C.
src/ChangeLog addition:
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
Move the heavy lifting from cl-seq.el to C, finally making those
functions first-class XEmacs citizens, with circularity checking,
built-in support for tests other than #'eql, and as much
compatibility with current Common Lisp as Paul Dietz' tests require.
* fns.c (check_eq_nokey, check_eq_key, check_eql_nokey)
(check_eql_key, check_equal_nokey, check_equal_key)
(check_equalp_nokey, check_equalp_key, check_string_match_nokey)
(check_string_match_key, check_other_nokey, check_other_key)
(check_if_nokey, check_if_key, check_match_eq_key)
(check_match_eql_key, check_match_equal_key)
(check_match_equalp_key, check_match_other_key): New. These are
basically to provide function pointers to be used by Lisp
functions that take TEST, TEST-NOT and KEY arguments.
(get_check_match_function_1, get_check_test_function)
(get_check_match_function): These functions work out which of the
previous list of functions to use, given the keywords supplied by
the user.
(count_with_tail): New. This is the bones of #'count.
(list_count_from_end, string_count_from_end): Utility functions
for #'count.
(Fcount): New, moved from cl-seq.el.
(list_position_cons_before): New. The implementation of #'member*,
and important in implementing various other functions.
(FmemberX, Fadjoin, FassocX, FrassocX, Fposition, Ffind)
(FdeleteX, FremoveX, Fdelete_duplicates, Fremove_duplicates)
(Fnsubstitute, Fsubstitute, Fsublis, Fnsublis, Fsubst, Fnsubst)
(Ftree_equal, Fmismatch, Fsearch, Fintersection, Fnintersection)
(Fsubsetp, Fset_difference, Fnset_difference, Fnunion, Funion)
(Fset_exclusive_or, Fnset_exclusive_or): New, moved here from
cl-seq.el.
(position): New. The implementation of #'find and #'position.
(list_delete_duplicates_from_end, subst, sublis, nsublis)
(tree_equal, mismatch_from_end, mismatch_list_list)
(mismatch_list_string, mismatch_list_array)
(mismatch_string_array, mismatch_string_string)
(mismatch_array_array, get_mismatch_func): Helper C functions for
the Lisp-visible functions.
(venn, nvenn): New. The implementation of the main Lisp functions that
treat lists as sets.
lisp/ChangeLog addition:
2010-12-30 Aidan Kehoe <kehoea@parhasard.net>
* cl-seq.el:
Move the heavy lifting from this file to C. Dump the
cl-parsing-keywords macro, but don't use defun* for the functions
we define that do take keywords, dynamic scope lossage makes that
not practical.
* subr.el (sort, fillarray): Move these aliases here.
(map-plist): #'nsublis is now built-in, but at this point #'eql
isn't necessarily available as a test; use #'eq.
* obsolete.el (cl-delete-duplicates): Make this available for old
compiler macros and old code.
(memql): Document that this is equivalent to #'member*, and worse.
* cl.el (adjoin, subst): Removed. These are in C.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 30 Dec 2010 01:59:52 +0000 |
parents | cd167465bf69 |
children | 3889ef128488 b9167d522a9a |
rev | line source |
---|---|
502 | 1 ;; kinsoku.el -- Kinsoku (line wrap) processing for XEmacs/Mule -*- coding: iso-2022-7bit; -*- |
333 | 2 |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
4 ;; This file is part of Mule (MULtilingual Enhancement of XEmacs). | |
5 ;; This file contains Japanese and Chinese characters. | |
6 | |
5287
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
908
diff
changeset
|
7 ;; This file is part of XEmacs. |
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
908
diff
changeset
|
8 |
333 | 9 ;; XEmacs is free software; you can redistribute it and/or modify it |
10 ;; under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; XEmacs is distributed in the hope that it will be useful, but | |
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 ;; General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with XEmacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;; Written by Jareth Hein (jhod@po.iijnet.or.jp) based off of | |
25 ;; code by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) from | |
26 ;; Mule-2.3 | |
27 | |
28 ;;; Special characters for JIS code | |
29 ;;; "$B!!!"!#!$!%!&!'!'!(!)!*!+!,!-!.!/(B" | |
30 ;;; "$B!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?(B" | |
31 ;;; "$B!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O(B" | |
32 ;;; "$B!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_(B" | |
33 ;;; "$B!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o(B" | |
34 ;;; "$B!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~(B" | |
35 ;;; "$B"!"""#"$"%"&"'"(")"*"+","-".(B " | |
36 ;;; "$B&!&"&#&$&%&&&'&(&)&*&+&,&-&.&/(B" | |
37 ;;; "$B&0&1&2&3&4&5&6&7&8(B" | |
38 ;;; "$B&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O(B" | |
39 ;;; "$B&P&Q&R&S&T&U&V&W&X(B" | |
40 ;;; "$B'!'"'#'$'%'&'''(')'*'+','-'.'/(B" | |
41 ;;; "$B'0'1'2'3'4'5'6'7'8'9':';'<'='>'?(B" | |
42 ;;; "$B'@'A(B" | |
43 ;;; "$B'Q'R'S'T'U'V'W'X'Y'Z'['\']'^'_!I(B | |
44 ;;; "$B'`'a'b'c'd'e'f'g'h'i'j'k'l'm'n'o(B" | |
45 ;;; "$B'p'q(B" | |
46 ;;; $B#0#1#2#3#4#5#6#7#8#9#A#B#C#D#E#F(B | |
47 ;;; "$B$!$#$%$'$)$C$c$e$g$n(B" | |
48 ;;; "$B%!%#%%%'%)%C%c%e%g%n%u%v(B" | |
49 | |
50 ;;; Special characters for GB | |
51 ;;; | |
52 ;;; $A!!!"!#!$!%!&!'!(!)!*!+!,!-!.!/(B | |
53 ;;;$A!0!1!2!3!4!5!6!7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x$y$z${$|$}$~(B | |
125 ;;; $(0%!%"%#%$%%%&%'%(%)%*%+%,%-%.%/(B | |
126 ;;;$(0%0%1%2%3%4%5%6%7%8%9%:%;%<%=%>%?(B | |
127 | |
128 (defvar kinsoku-ascii nil "Do kinsoku-processing for ASCII.") | |
129 (make-variable-buffer-local 'kinsoku-ascii) | |
130 (set-default 'kinsoku-ascii nil) | |
131 (defvar kinsoku-jis t "Do kinsoku-processing for JISX0208.") | |
132 (make-variable-buffer-local 'kinsoku-jis) | |
133 (set-default 'kinsoku-jis t) | |
134 (defvar kinsoku-gb t "Do kinsoku-processing for GB2312.") | |
135 (make-variable-buffer-local 'kinsoku-gb) | |
136 (set-default 'kinsoku-gb t) | |
137 (defvar kinsoku-big5 t "Do kinsoku-processing for Big5..") | |
138 (make-variable-buffer-local 'kinsoku-big5) | |
139 (set-default 'kinsoku-big5 t) | |
140 | |
141 (defvar kinsoku-ascii-bol "!)-_~}]:;',.?" "BOL kinsoku for ASCII.") | |
142 (defvar kinsoku-ascii-eol "({[" "EOL kinsoku for ASCII.") | |
143 (defvar kinsoku-jis-bol | |
144 (concat "$B!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>(B" | |
145 "$B!?!@!A!B!C!D!E!G!I!K!M!O!Q!S!U!W!Y![!k!l!m!n(B" | |
146 "$B$!$#$%$'$)$C$c$e$g$n%!%#%%%'%)%C%c%e%g%n%u%v(B") | |
147 "BOL kinsoku for JISX0208.") | |
148 (defvar kinsoku-jis-eol | |
149 "$B!F!H!J!L!N!P!R!T!V!X!Z!k!l!m!n!w!x(B" | |
150 "EOL kinsoku for JISX0208.") | |
151 (defvar kinsoku-gb-bol | |
152 (concat "$A!"!##.#,!$!%!&!'!(!)!*!+!,!-!/!1#)!3!5!7!9!;!=(B" | |
153 "$A!?#;#:#?#!!@!A!B!C!c!d!e!f#/#\#"#_#~#|(e(B") | |
154 "BOL kinsoku for GB2312.") | |
155 (defvar kinsoku-gb-eol | |
156 (concat "$A!.!0#"#(!2!4!6!8!:!<!>!c!d!e#@!f!l(B" | |
157 "$A(E(F(G(H(I(J(K(L(M(N(O(P(Q(R(S(T(U(V(W(X(Y(h(B") | |
158 "EOL kinsoku for GB2312.") | |
159 (defvar kinsoku-big5-bol | |
160 (concat "$(0!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2(B" | |
161 "$(0!3!4!5!6!7!8!9!:!;!<!=!?!A!C!E!G!I!K(B" | |
162 "$(0!M!O!Q(B $(0!S!U!W!Y![!]!_!a!c!e!g!i!k!q(B" | |
163 "$(0"#"$"%"&"'"(")"*"+","2"3"4"j"k"l"x%7(B") | |
164 "BOL kinsoku for BIG5.") | |
165 (defvar kinsoku-big5-eol | |
166 (concat "$(0!>!@!B!D!F!H!J!L!N!P!R!T!V!X!Z!\!^!`!b(B" | |
167 "$(0!d!f!h!j!k!q!p"i"j"k"n"x$u$v$w$x$y$z${(B" | |
168 "$(0$|$}$~%!%"%#%$%%%&%'%(%)%*%+%:(B") | |
169 "EOL kinsoku for BIG5.") | |
170 | |
171 (define-category ?s "Kinsoku forbidden start of line characters") | |
172 (define-category ?e "Kinsoku forbidden end of line characters") | |
173 | |
174 ;; kinsoku ascii | |
771 | 175 (loop for char in (string-to-list kinsoku-ascii-bol) |
333 | 176 do (modify-category-entry char ?s)) |
908 | 177 (loop for char in (string-to-list kinsoku-ascii-eol) |
333 | 178 do (modify-category-entry char ?e)) |
179 ;; kinsoku-jis | |
771 | 180 (loop for char in (string-to-list kinsoku-jis-bol) |
333 | 181 do (modify-category-entry char ?s)) |
771 | 182 (loop for char in (string-to-list kinsoku-jis-eol) |
333 | 183 do (modify-category-entry char ?e)) |
184 ;; kinsoku-gb | |
908 | 185 (loop for char in (string-to-list kinsoku-gb-bol) |
333 | 186 do (modify-category-entry char ?s)) |
908 | 187 (loop for char in (string-to-list kinsoku-gb-eol) |
333 | 188 do (modify-category-entry char ?e)) |
189 ;; kinsoku-big5 | |
908 | 190 (loop for char in (string-to-list kinsoku-big5-bol) |
333 | 191 do (modify-category-entry char ?s)) |
908 | 192 (loop for char in (string-to-list kinsoku-big5-eol) |
333 | 193 do (modify-category-entry char ?e)) |
194 | |
195 (defun kinsoku-bol-p () | |
196 "Check if point would break forbidden beginning-of-line rules | |
197 Uses category \'s\' to check. | |
198 point$B$G2~9T$9$k$H9TF,6XB'$K?($l$k$+$I$&$+$r$+$($9!#(B | |
199 $B9TF,6XB'J8;z$O(B\'s\'$B$N(Bcategory$B$G;XDj$9$k!#(B" | |
908 | 200 (let ((before (char-before)) |
201 (after (char-after))) | |
202 (if (and after | |
333 | 203 (or |
908 | 204 (and kinsoku-ascii (char-in-category-p after ?a)) |
205 (and kinsoku-jis (or (char-in-category-p after ?j) | |
206 (and before | |
207 (char-in-category-p before ?j)))) | |
208 (and kinsoku-gb (or (char-in-category-p after ?c) | |
209 (and before | |
210 (char-in-category-p before ?c)))) | |
211 (and kinsoku-big5 (or (char-in-category-p after ?t) | |
212 (and before | |
213 (char-in-category-p before ?t)))))) | |
214 (char-in-category-p after ?s) | |
333 | 215 nil))) |
216 | |
217 (defun kinsoku-eol-p () | |
218 "Check if point would break forbidden end-of-line rules | |
219 Uses category \'e\' to check. | |
220 point$B$G2~9T$9$k$H9TKv6XB'$K?($l$k$+$I$&$+$r$+$($9!#(B | |
221 $B9TKv6XB'J8;z$O(B\'s\'$B$N(Bcategory$B$G;XDj$9$k!#(B" | |
908 | 222 (let ((before (char-before)) |
223 (after (char-after))) | |
224 (if (and before | |
333 | 225 (or |
908 | 226 (and kinsoku-ascii (char-in-category-p before ?a)) |
227 (and kinsoku-jis (or (char-in-category-p before ?j) | |
228 (and after | |
229 (char-in-category-p after ?j)))) | |
230 (and kinsoku-gb (or (char-in-category-p before ?c) | |
231 (and after | |
232 (char-in-category-p after ?c)))) | |
233 (and kinsoku-big5 (or (char-in-category-p before ?t) | |
234 (and after | |
235 (char-in-category-p after ?t)))))) | |
236 (char-in-category-p before ?e) | |
333 | 237 nil))) |
238 | |
239 (defvar kinsoku-extend-limit nil | |
240 "Defines how many characters kinsoku will search forward before giving up. | |
241 A value of nil equates to infinity. | |
242 $B6XB'=hM}$G9T$r?-$P$7$FNI$$H>3QJ8;z?t$r;XDj$9$k!#(B | |
243 $BHsIi@0?t0J30$N>l9g$OL58BBg$r0UL#$9$k!#(B") | |
244 | |
245 (defun kinsoku-process () | |
246 "Move to a point that will not break forbidden line break rules. | |
247 $B6XB'$K?($l$J$$E@$X0\F0$9$k!#(B | |
248 point$B$,9TF,6XB'$K?($l$k>l9g$O9T$r?-$P$7$F!"6XB'$K?($l$J$$E@$rC5$9!#(B | |
249 point$B$,9TKv6XB'$K?($l$k>l9g$O9T$r=L$a$F!"6XB'$K?($l$J$$E@$rC5$9!#(B | |
250 $B$?$@$7!"9T?-$P$7H>3QJ8;z?t$,(Bkinsoku-extend-limit$B$r1[$($k$H!"(B | |
251 $B9T$r=L$a$F6XB'$K?($l$J$$E@$rC5$9!#(B" | |
252 (let ((bol-kin nil) (eol-kin nil)) | |
253 (if (and (not (bolp)) | |
254 (not (eolp)) | |
255 (or (setq bol-kin (kinsoku-bol-p)) | |
256 (setq eol-kin (kinsoku-eol-p)))) | |
257 (cond(bol-kin (kinsoku-process-extend)) | |
258 (eol-kin (kinsoku-process-shrink)))))) | |
259 | |
260 (defun kinsoku-process-extend () | |
261 "Move point forward to a permissable for line-breaking. | |
262 $B9T$r?-$P$7$F6XB'$K?($l$J$$E@$X0\F0$9$k!#(B" | |
263 (let ((max-column (+ fill-column | |
264 (if (and (numberp kinsoku-extend-limit) | |
265 (>= kinsoku-extend-limit 0)) | |
266 kinsoku-extend-limit | |
267 10000))) ;;; 10000 is deliberatly unreasonably large | |
268 ch1 ch2) | |
269 (while (and (setq ch1 (char-after)) | |
270 (<= (+ (current-column) | |
271 (char-width ch1 )) | |
272 max-column) | |
273 (not (bolp)) | |
274 (not (eolp)) | |
275 (or (kinsoku-eol-p) | |
276 (kinsoku-bol-p) | |
277 ;;; don't break in the middle of an English word | |
278 (and (char-in-category-p ch1 ?a) | |
279 (setq ch2 (char-before)) | |
280 (char-in-category-p ch2 ?a) | |
281 (= ?w (char-syntax ch2)) | |
282 (= ?w (char-syntax ch1))))) | |
283 (forward-char)) | |
284 (if (or (kinsoku-eol-p) (kinsoku-bol-p)) | |
285 (kinsoku-process-shrink)))) | |
286 | |
287 (defun kinsoku-process-shrink () | |
288 "Move point backward to a point permissable for line-breaking. | |
289 $B9T$r=L$a$F6XB'$K?($l$J$$E@$X0\F0$9$k!#(B" | |
290 (let (ch1 ch2) | |
291 (while (and (not (bolp)) | |
292 (not (eolp)) | |
293 (or (kinsoku-bol-p) | |
294 (kinsoku-eol-p) | |
295 ;;; don't break in the middle of an English word | |
296 (and | |
297 (char-in-category-p (setq ch1 (following-char)) ?a) | |
298 (char-in-category-p (setq ch2 (preceding-char)) ?a) | |
299 (= ?w (char-syntax ch2)) | |
300 (= ?w (char-syntax ch1))))) | |
301 (backward-char)))) |