annotate lisp/mule/general-late.el @ 5607:1a507c4c6c42

Refactor out sequence-oriented builtins from fns.c to the new sequence.c. src/ChangeLog addition: 2011-12-04 Aidan Kehoe <kehoea@parhasard.net> * Makefile.in.in (objs): * depend: Add sequence.o to the list of objects and dependencies. * alloc.c: * alloc.c (mark_bit_vector): * alloc.c (print_bit_vector): * alloc.c (bit_vector_equal): * alloc.c (internal_bit_vector_equalp_hash): * alloc.c (bit_vector_hash): * alloc.c (init_alloc_once_early): Move the implementation of the bit vector type here from fns.c. * emacs.c (main_1): Call syms_of_sequence() here, now sequence.c is included. * fns.c (Fold_rassq): Move this together with the rest of the Fold_* functions. * fns.c: * fns.c (syms_of_fns): Move most functions dealing with sequences generally, and especially those taking key arguments, to a separate file, sequence.c. * general-slots.h: Qyes_or_no_p belong here, not fns.c. * lisp.h: Make Flist_length available here, it's used by sequence.c * sequence.c: * sequence.c (check_sequence_range): * sequence.c (Flength): * sequence.c (check_other_nokey): * sequence.c (check_other_key): * sequence.c (check_if_key): * sequence.c (check_match_eq_key): * sequence.c (check_match_eql_key): * sequence.c (check_match_equal_key): * sequence.c (check_match_equalp_key): * sequence.c (check_match_other_key): * sequence.c (check_lss_key): * sequence.c (check_lss_key_car): * sequence.c (check_string_lessp_key): * sequence.c (check_string_lessp_key_car): * sequence.c (get_check_match_function_1): * sequence.c (get_merge_predicate): * sequence.c (count_with_tail): * sequence.c (list_count_from_end): * sequence.c (string_count_from_end): * sequence.c (Fcount): * sequence.c (Fsubseq): * sequence.c (list_position_cons_before): * sequence.c (FmemberX): * sequence.c (Fadjoin): * sequence.c (FassocX): * sequence.c (FrassocX): * sequence.c (position): * sequence.c (Fposition): * sequence.c (Ffind): * sequence.c (delq_no_quit_and_free_cons): * sequence.c (FdeleteX): * sequence.c (FremoveX): * sequence.c (list_delete_duplicates_from_end): * sequence.c (Fdelete_duplicates): * sequence.c (Fremove_duplicates): * sequence.c (Fnreverse): * sequence.c (Freverse): * sequence.c (list_merge): * sequence.c (array_merge): * sequence.c (list_array_merge_into_list): * sequence.c (list_list_merge_into_array): * sequence.c (list_array_merge_into_array): * sequence.c (Fmerge): * sequence.c (list_sort): * sequence.c (array_sort): * sequence.c (FsortX): * sequence.c (Ffill): * sequence.c (mapcarX): * sequence.c (shortest_length_among_sequences): * sequence.c (Fmapconcat): * sequence.c (FmapcarX): * sequence.c (Fmapvector): * sequence.c (Fmapcan): * sequence.c (Fmap): * sequence.c (Fmap_into): * sequence.c (Fsome): * sequence.c (Fevery): * sequence.c (Freduce): * sequence.c (replace_string_range_1): * sequence.c (Freplace): * sequence.c (Fnsubstitute): * sequence.c (Fsubstitute): * sequence.c (subst): * sequence.c (sublis): * sequence.c (Fsublis): * sequence.c (nsublis): * sequence.c (Fnsublis): * sequence.c (Fsubst): * sequence.c (Fnsubst): * sequence.c (tree_equal): * sequence.c (Ftree_equal): * sequence.c (mismatch_from_end): * sequence.c (mismatch_list_list): * sequence.c (mismatch_list_string): * sequence.c (mismatch_list_array): * sequence.c (mismatch_string_array): * sequence.c (mismatch_string_string): * sequence.c (mismatch_array_array): * sequence.c (get_mismatch_func): * sequence.c (Fmismatch): * sequence.c (Fsearch): * sequence.c (venn): * sequence.c (nvenn): * sequence.c (Funion): * sequence.c (Fset_exclusive_or): * sequence.c (Fnset_exclusive_or): * sequence.c (syms_of_sequence): Add this file, containing those general functions that dealt with sequences that were in fns.c. * symsinit.h: Make syms_of_sequence() available here. man/ChangeLog addition: 2011-12-04 Aidan Kehoe <kehoea@parhasard.net> * internals/internals.texi (Basic Lisp Modules): Document sequence.c here too.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 04 Dec 2011 18:42:50 +0000
parents 10f179710250
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
1 ;;; general-late.el --- General Mule code that needs to be run late when
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
2 ;; dumping.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
3 ;; Copyright (C) 2006 Free Software Foundation
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
4
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
5 ;; Author: Aidan Kehoe
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
6
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
7 ;; This file is part of XEmacs.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
8
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
9 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
10 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
11 ;; 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: 4690
diff changeset
12 ;; option) any later version.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
13
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
17 ;; for more details.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
18
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
19 ;; 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: 4690
diff changeset
20 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
21
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
22 ;;; Commentary:
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
23
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
24 ;;; Code:
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
25
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
26 ;; The variable is declared in mule-cmds.el; it's initialised here, to give
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
27 ;; the language-specific code a chance to create its coding systems.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
28
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
29 (setq posix-charset-to-coding-system-hash
4145
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
30 (loop
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
31 ;; We want both normal and internal coding systems in order
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
32 ;; to pick up coding system aliases.
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
33 for coding-system in (coding-system-list 'every)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
34 with res = (make-hash-table :test #'equal)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
35 do
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
36 (setq coding-system (symbol-name coding-system))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
37 (unless (or (string-match #r"\(-unix\|-mac\|-dos\)$" coding-system)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
38 (string-match #r"^\(internal\|mswindows\)" coding-system))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
39 (puthash
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
40 (replace-in-string (downcase coding-system) "[^a-z0-9]" "")
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
41 (coding-system-name (intern coding-system)) res))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
42 finally return res)
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
43
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
44 ;; In a thoughtless act of cultural imperialism, move English, German
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
45 ;; and Japanese to the front of language-info-alist to make start-up a
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
46 ;; fraction faster for those languages.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
47 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
48 (cons (assoc "Japanese" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
49 (delete* "Japanese" language-info-alist :test #'equal :key #'car))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
50 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
51 (cons (assoc "German" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
52 (delete* "German" language-info-alist :test #'equal :key #'car))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
53 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
54 (cons (assoc "English" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
55 (delete* "English" language-info-alist :test #'equal :key #'car))
4246
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
56
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
57 ;; Make Installation-string actually reflect the environment at
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
58 ;; byte-compile time. (We can't necessarily decode it when version.el
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
59 ;; is loaded, since not all the coding systems are available then.)
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
60 Installation-string (if-boundp 'Installation-file-coding-system
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
61 (decode-coding-string
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
62 Installation-string
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
63 Installation-file-coding-system)
4549
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
64 Installation-string)
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
65
4690
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
66 ;; This used to be here to convince the byte-compiler to encode the
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
67 ;; output file using escape-quoted. This is no longer necessary, but
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
68 ;; keeping it here avoids doing the eval-when-compile clause below
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
69 ;; twice, which is a significant improvement.
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
70 system-type (symbol-value (intern "\u0073ystem-type")))
4549
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
71
4690
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
72 ;; When this file is being compiled, all the charsets have been loaded, so
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
73 ;; we can construct the query-skip-chars-arg string correctly.
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
74 (set-unicode-query-skip-chars-args
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
75 (eval-when-compile
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
76 (when-fboundp 'map-charset-chars
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
77 (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
78 for charset in (charset-list)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
79 with skip-chars-string = ""
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
80 do
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
81 (block no-ucs-mapping
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
82 (map-charset-chars
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
83 #'(lambda (begin end)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
84 (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
85 while (and begin (>= end begin))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
86 do
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
87 (when (= -1 (char-to-unicode begin))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
88 (return-from no-ucs-mapping))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
89 (setq begin (int-to-char (1+ begin)))))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
90 charset)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
91 (setq skip-chars-string
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
92 (concat skip-chars-string
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
93 (charset-skip-chars-string charset))))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
94 finally return skip-chars-string)))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
95 unicode-invalid-sequence-regexp-range
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
96 (eval-when-compile
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
97 (concat (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
98 for i from #x80 to #xFF
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
99 collect (aref (decode-coding-string (int-char i)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
100 'utf-8) 0)))))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
101
3767
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
102 ;; At this point in the dump, all the charsets have been loaded. Now, load
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
103 ;; their Unicode mappings.
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
104 (if load-unicode-tables-at-dump-time
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
105 (let ((data-directory (expand-file-name "etc" source-directory)))
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
106 (load-unicode-tables)))
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
107
4246
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
108 ;;; general-late.el ends here