annotate lisp/international/codepage.el @ 30360:92f92a541686

(Fprevious_overlay_change): Avoid memory leak.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 21 Jul 2000 14:33:35 +0000
parents 9473e3466947
children 6ca8f913d1df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
1 ;;; codepage.el --- MS-DOS/MS-Windows specific coding systems.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
4
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
5 ;; Author: Eli Zaretskii
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
7 ;; Keywords: i18n ms-dos ms-windows codepage
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
14 ;; any later version.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
20
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
28 ;; Special coding systems for DOS/Windows codepage support.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29 ;;
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
30 ;; These coding systems perform conversion from the DOS/Windows
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
31 ;; codepage encoding to one of the ISO-8859 character sets. Each
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
32 ;; codepage has its corresponding ISO-8859 charset, chosen so as to be
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
33 ;; able to convert all (or most) of the characters. The idea is that
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
34 ;; Emacs internally works with the usual MULE charsets, and the
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
35 ;; conversion to and from the DOS codepage is performed on I/O only.
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
36 ;; See term/internal.el for the complementary setup of the DOS
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
37 ;; terminal display and input methods.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 ;;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
39 ;; Thanks to Ken'ichi Handa <handa@etl.go.jp> for writing the CCL
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40 ;; encoders/decoders, and for help in debugging this code.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 ;;; Code:
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 (defun cp-coding-system-for-codepage-1 (coding mnemonic iso-name
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 decoder encoder)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 "Make coding system CODING for a DOS codepage using translation tables.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 MNEMONIC is a character to be displayed on mode line for the coding system.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48 ISO-NAME is the name of the ISO-8859 charset which corresponds to this
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 codepage.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 DECODER is a translation table for converting characters in the DOS codepage
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 encoding to Emacs multibyte characters.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 ENCODER is a translation table for encoding Emacs multibyte characters into
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
53 external DOS codepage codes."
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 (save-match-data
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 (let* ((coding-name (symbol-name coding))
24279
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
56 (undef (if (eq system-type 'ms-dos)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
57 (if dos-unsupported-char-glyph
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
58 (logand dos-unsupported-char-glyph 255)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
59 127)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
60 ??))
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
61 (ccl-decoder
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
62 (ccl-compile
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
63 ;; The 4 here supplies the buf_magnification parameter
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
64 ;; for the CCL program. A multibyte character may take
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
65 ;; at most 4-bytes.
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
66 `(4 (loop (read r1)
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
67 (if (r1 >= 128)
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
68 ((r0 = ,(charset-id 'ascii))
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
69 (translate-character ,decoder r0 r1)
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
70 (write-multibyte-character r0 r1))
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
71 (write r1))
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
72 (repeat)))))
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
73 (ccl-encoder
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
74 (ccl-compile
24662
5d61c3793c06 (cp-coding-system-for-codepage-1):
Andrew Innes <andrewi@gnu.org>
parents: 24454
diff changeset
75 ;; The 2 here supplies the buf_magnification parameter for
5d61c3793c06 (cp-coding-system-for-codepage-1):
Andrew Innes <andrewi@gnu.org>
parents: 24454
diff changeset
76 ;; the CCL program. Since the -dos coding system generates
5d61c3793c06 (cp-coding-system-for-codepage-1):
Andrew Innes <andrewi@gnu.org>
parents: 24454
diff changeset
77 ;; \r\n for each \n, a factor of 2 covers even the worst case
5d61c3793c06 (cp-coding-system-for-codepage-1):
Andrew Innes <andrewi@gnu.org>
parents: 24454
diff changeset
78 ;; of empty lines with a single \n.
5d61c3793c06 (cp-coding-system-for-codepage-1):
Andrew Innes <andrewi@gnu.org>
parents: 24454
diff changeset
79 `(2 (loop (read-multibyte-character r0 r1)
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
80 (if (r0 != ,(charset-id 'ascii))
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
81 ((translate-character ,encoder r0 r1)
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
82 (if (r0 == ,(charset-id 'japanese-jisx0208))
24279
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
83 ((r1 = ,undef)
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
84 (write r1)))))
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
85 (write-repeat r1))))))
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
86
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
87 ;; Make coding system CODING.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 (make-coding-system
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 coding 4 mnemonic
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90 (concat "8-bit encoding of " (symbol-name iso-name)
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
91 " characters using IBM codepage " coding-name)
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
92 (cons ccl-decoder ccl-encoder)
29258
aa05ee69de27 (cp-coding-system-for-codepage-1): Add
Eli Zaretskii <eliz@gnu.org>
parents: 29189
diff changeset
93 `((safe-charsets ascii eight-bit-control eight-bit-graphic ,iso-name)
29721
b722da8919f6 (cp-coding-system-for-codepage-1): Delete special codes for
Kenichi Handa <handa@m17n.org>
parents: 29258
diff changeset
94 (valid-codes (0 . 255)))))))
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 (defun cp-decoding-vector-for-codepage (table charset offset)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 "Create a vector for decoding IBM PC characters using conversion table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 TABLE into an ISO-8859 character set CHARSET whose first non-ASCII
24033
a5d31e58291b (codepage-setup): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 24009
diff changeset
99 character is generated by (make-char CHARSET OFFSET)."
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 (let* ((len (length table))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101 (undefined-char
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 (if (eq system-type 'ms-dos)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 (if dos-unsupported-char-glyph
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 (logand dos-unsupported-char-glyph 255)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 127)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106 32))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 (vec1 (make-vector 256 undefined-char))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 (i 0))
29189
59e5b57b10db (cp-decoding-vector-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 29180
diff changeset
109 (while (< i 256)
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110 (aset vec1 i i)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 (setq i (1+ i)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 (setq i 0)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 (while (< i len)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114 (if (aref table i)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 (aset vec1 (aref table i) (make-char charset (+ i offset))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116 (setq i (1+ i)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 vec1))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 ;;; You don't think I created all these tables below by hand, do you?
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120 ;;; The following Awk script will create the table for cp850-to-Latin-1
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
121 ;;; conversion from the RFC 1345 file (the other tables are left as an
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122 ;;; excercise):
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123 ;;; BEGIN { n_pages = 11;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 ;;; pn["IBM437"] = 0; pn["IBM850"] = 1; pn["IBM851"] = 2;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
125 ;;; pn["IBM852"] = 3; pn["IBM855"] = 4; pn["IBM860"] = 5;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
126 ;;; pn["IBM861"] = 6; pn["IBM862"] = 7; pn["IBM863"] = 8;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
127 ;;; pn["IBM864"] = 9; pn["IBM865"] = 10;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
128 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
129 ;;; $1 == "&charset" { charset = $2; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
130 ;;; $1 == "&code" { code = $2; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
131 ;;; /^ [^&]/ {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
132 ;;; if ((charset ~ /^IBM(437|8(5[0125]|6[0-5]))$/) || (charset ~ /^ISO_8859-1/))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
133 ;;; {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
134 ;;; for (i = 1; i <= NF; i++)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
135 ;;; chars[charset,code++] = $i;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
138 ;;;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139 ;;; END {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
140 ;;; for (i = 160; i < 256; i++)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
141 ;;; {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
142 ;;; c = chars["ISO_8859-1:1987",i];
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143 ;;; if (c == "??") # skip unused positions
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
144 ;;; {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
145 ;;; printf " nil";
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
146 ;;; if ((i - 159)%16 == 0)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147 ;;; printf "\n";
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 ;;; continue;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 ;;; found = 0;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
151 ;;; for (j in pn)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
152 ;;; map[j] = "nil";
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
153 ;;; for (combined in chars)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
154 ;;; {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
155 ;;; candidate = chars[combined];
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
156 ;;; split (combined, separate, SUBSEP);
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
157 ;;; if (separate[1] == "IBM850" && candidate == c)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
158 ;;; {
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
159 ;;; found = 1;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
160 ;;; map[separate[1]] = separate[2];
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
161 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
162 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
163 ;;; printf " %s", map["IBM850"];
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
164 ;;; if ((i - 159)%16 == 0)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
165 ;;; printf "\n";
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
166 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
167 ;;; }
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
168
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
169 ;;; WARNING WARNING WARNING!!!
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
170 ;;;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
171 ;;; If you want to get fancy with these tables, remember that the inverse
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
172 ;;; tables, created by `cp-decoding-vector-for-codepage' above, are installed
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
173 ;;; on MS-DOS as nonascii-translation-table (see `dos-codepage-setup' on
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
174 ;;; internal.el). Therefore, you should NOT put any codes below 128 in
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
175 ;;; these tables! Otherwise, various Emacs commands and functions will
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
176 ;;; mysteriously fail! For example, a typical screwup is to map the Latin-N
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
177 ;;; acute accent character to the apostrophe, and have all regexps which
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
178 ;;; end with "\\'" begin to fail (e.g., the automatic setting of the major
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
179 ;;; mode by file name extension will stop working).
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
180 ;;;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
181 ;;; You HAVE BEEN warned!
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
182
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
183 ;; US/English/PC-8/IBM-2. This doesn't support Latin-1 characters very
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
184 ;; well, but why not use what we can salvage?
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
185 (defvar cp437-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
186 ;; Nth element is the code of a cp437 glyph for the multibyte
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
187 ;; character created by (make-char 'latin-iso8859-1 (+ N 160)).
24064
e4cc744bdce5 (cp850-decode-table): Replace nil
Eli Zaretskii <eliz@gnu.org>
parents: 24033
diff changeset
188 ;; The element nil means there's no corresponding cp437 glyph.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
189 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
190 255 173 155 156 nil 157 179 nil nil nil 166 174 170 196 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
191 248 241 253 nil nil nil nil 249 nil nil 167 175 172 171 nil 168
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
192 nil nil nil nil 142 143 146 128 nil 144 nil nil nil nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
193 nil 165 nil nil nil nil 153 nil nil nil nil nil 154 nil nil 225
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
194 133 160 131 nil 132 134 145 135 138 130 136 137 141 161 140 139
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
195 nil 164 149 162 147 nil 148 246 nil 151 163 150 129 nil nil 152]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
196 "Table for converting ISO-8859-1 characters into codepage 437 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
197 (setplist 'cp437-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
198 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
199
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
200 ;; Multilingual (Latin-1)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
201 (defvar cp850-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
202 ;; Nth element is the code of a cp850 glyph for the multibyte
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
203 ;; character created by (make-char 'latin-iso8859-1 (+ N 160)).
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
204 ;; The element nil means there's no corresponding cp850 glyph.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
205 [
24072
749d25833f30 (cp850-decode-table): Fix previous change.
Eli Zaretskii <eliz@gnu.org>
parents: 24064
diff changeset
206 255 173 189 156 207 190 221 245 249 184 166 174 170 240 169 nil
24085
8dc3b068c0db (cp855-decode-table, cp850-decode-table): Fill some nil entries.
Eli Zaretskii <eliz@gnu.org>
parents: 24072
diff changeset
207 248 241 253 252 239 230 244 250 247 251 167 175 172 171 243 168
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
208 183 181 182 199 142 143 146 128 212 144 210 211 222 214 215 216
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
209 209 165 227 224 226 229 153 158 157 235 233 234 154 237 231 225
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
210 133 160 131 198 132 134 145 135 138 130 136 137 141 161 140 139
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
211 208 164 149 162 147 228 148 246 155 151 163 150 129 236 232 152]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
212 "Table for converting ISO-8859-1 characters into codepage 850 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
213 (setplist 'cp850-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
214 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
215
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
216 ;; Greek
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
217 (defvar cp851-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
218 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
219 255 nil nil 156 nil nil nil 245 249 nil nil 174 nil 240 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
220 248 241 nil nil 239 nil 134 nil 141 143 144 175 146 171 149 152
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
221 161 164 165 166 167 168 169 170 172 173 181 182 184 183 189 190
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
222 198 199 nil 207 208 209 210 211 212 213 nil nil 155 157 158 159
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
223 252 214 215 216 221 222 224 225 226 227 228 229 230 231 232 233
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
224 234 235 237 236 238 242 243 244 246 250 160 251 162 163 253 nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
225 "Table for converting ISO-8859-7 characters into codepage 851 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
226 (setplist 'cp851-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
227 '(charset greek-iso8859-7 language "Greek" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
228
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
229 ;; Slavic/Eastern Europe (Latin-2)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
230 (defvar cp852-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
231 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
232 255 164 244 157 207 149 151 245 249 230 184 155 141 240 166 189
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
233 248 165 247 136 239 150 152 243 242 231 173 156 171 241 167 190
24088
bb95d3d24ff9 (cp852-decode-table): Fill a nil entry.
Eli Zaretskii <eliz@gnu.org>
parents: 24085
diff changeset
234 232 181 182 198 142 145 143 128 172 144 168 211 183 214 215 210
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
235 209 227 213 224 226 138 153 158 252 222 233 235 154 237 221 225
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
236 234 160 131 199 132 146 134 135 159 130 169 137 216 161 140 212
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
237 208 228 229 162 147 139 148 246 253 133 163 251 129 236 238 250]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
238 "Table for converting ISO-8859-2 characters into codepage 852 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
239 (setplist 'cp852-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
240 '(charset latin-iso8859-2 language "Latin-2" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
241
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
242 ;; Russian
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
243 (defvar cp855-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
244 [
24085
8dc3b068c0db (cp855-decode-table, cp850-decode-table): Fill some nil entries.
Eli Zaretskii <eliz@gnu.org>
parents: 24072
diff changeset
245 255 133 129 131 135 137 139 141 143 145 147 149 151 240 153 155
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
246 161 163 236 173 167 169 234 244 184 190 199 209 211 213 215 221
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
247 226 228 230 232 171 182 165 252 246 250 159 242 238 248 157 224
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
248 160 162 235 172 166 168 233 243 183 189 198 208 210 212 214 216
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
249 225 227 229 231 170 181 164 251 245 249 158 241 237 247 156 222
24085
8dc3b068c0db (cp855-decode-table, cp850-decode-table): Fill some nil entries.
Eli Zaretskii <eliz@gnu.org>
parents: 24072
diff changeset
250 239 132 128 130 134 136 138 140 142 144 146 148 150 253 152 154]
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
251 "Table for converting ISO-8859-5 characters into codepage 855 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
252 (setplist 'cp855-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
253 '(charset cyrillic-iso8859-5 language "Cyrillic-ISO" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
254
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
255 ;; Turkish
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
256 (defvar cp857-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
257 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
258 255 nil nil 156 207 nil 245 249 152 158 166 nil 240 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
259 248 nil 253 252 239 nil nil nil nil 141 159 167 nil 171 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
260 183 181 182 142 nil nil 128 212 144 210 211 222 214 215 216
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
261 165 227 224 226 nil 153 232 nil 235 233 234 154 nil nil 225
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
262 133 160 131 132 nil nil 135 138 130 136 137 236 161 140 139
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
263 164 149 162 147 nil 148 246 nil 151 163 150 129 nil nil 250]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
264 "Table for converting ISO-8859-3 characters into codepage 857 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
265 (setplist 'cp857-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
266 '(charset latin-iso8859-3 language "Latin-3" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
267
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
268 ;; Portuguese
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
269 (defvar cp860-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
270 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
271 255 173 155 156 nil nil 179 nil nil nil 166 174 170 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
272 nil 241 253 nil nil nil nil 249 nil nil 167 175 172 171 nil 168
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
273 145 134 143 142 nil nil nil 128 146 144 137 nil 152 nil 139 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
274 nil 165 159 169 140 153 nil nil nil 157 150 nil 154 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
275 133 160 131 132 nil nil nil 135 138 130 136 nil 141 161 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
276 nil 164 149 162 147 148 nil 246 nil 151 163 nil 129 nil nil nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
277 "Table for converting ISO-8859-1 characters into codepage 860 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
278 (setplist 'cp860-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
279 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
280
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
281 ;; Icelandic
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
282 (defvar cp861-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
283 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
284 255 173 nil 156 nil nil nil nil nil nil nil 174 170 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
285 nil 241 253 nil nil nil nil 249 nil nil nil 175 172 171 nil 168
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
286 nil 164 nil nil 142 143 146 128 nil 144 nil nil nil 165 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
287 139 nil 159 166 nil nil 153 nil 157 nil 167 nil 154 151 141 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
288 133 160 131 nil 132 134 145 135 138 130 136 137 nil 161 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
289 140 nil nil 162 147 nil 148 246 155 nil 163 150 129 152 149 nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
290 "Table for converting ISO-8859-1 characters into codepage 861 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
291 (setplist 'cp861-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
292 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
293
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
294 ;; Hebrew
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
295 (defvar cp862-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
296 ;; Nth element is the code of a cp862 glyph for the multibyte
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
297 ;; character created by (make-char 'hebrew-iso8859-8 (+ N 160)).
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
298 ;; The element nil means there's no corresponding cp862 glyph.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
299 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
300 255 173 155 156 nil 157 179 nil nil nil nil 174 170 196 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
301 248 241 253 nil nil 230 nil 249 nil nil 246 175 172 171 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
302 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
303 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 205
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
304 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
305 144 145 146 147 148 149 150 151 152 153 154 nil nil nil nil nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
306 "Table for converting ISO-8859-8 characters into codepage 862 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
307 (setplist 'cp862-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
308 '(charset hebrew-iso8859-8 language "Hebrew" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
309
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
310 ;; French Canadian
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
311 (defvar cp863-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
312 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
313 255 nil 155 156 152 nil 160 143 164 nil nil 174 170 nil nil 167
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
314 nil 241 253 166 161 nil 134 249 165 nil nil 175 172 171 173 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
315 142 nil 132 nil nil nil nil 128 145 144 146 148 nil nil 168 149
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
316 nil nil nil nil 153 nil nil nil nil 157 nil 158 154 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
317 133 nil 131 nil nil nil nil 135 138 130 136 137 141 nil 140 139
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
318 nil nil nil 162 147 nil nil 246 nil 151 163 150 129 nil nil nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
319 "Table for converting ISO-8859-1 characters into codepage 863 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
320 (setplist 'cp863-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
321 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
322
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
323 ;; Arabic
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
324 ;; FIXME: Emacs doesn't seem to support the "Arabic" language
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
325 ;; environment yet. So this is only partially usable, for now
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
326 (defvar cp864-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
327 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
328 255 nil nil nil 164 nil nil nil nil nil nil nil 172 161 nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
329 nil nil nil nil nil nil nil nil nil nil nil 187 nil nil nil 191
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
330 nil 193 194 195 196 nil 198 199 169 201 170 171 173 174 175 207
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
331 208 209 210 188 189 190 235 215 216 223 238 nil nil nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
332 224 247 248 252 251 239 242 243 232 233 253 nil nil nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
333 nil 241 nil nil nil nil nil nil nil nil nil nil nil nil nil nil]
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
334 "Table for converting ISO-8859-6 characters into codepage 864 glyphs.")
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
335 (setplist 'cp864-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
336 '(charset arabic-iso8859-6 language nil offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
337
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
338 ;; Arabic OEM codepage used by Windows
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
339 ;; FIXME: Emacs doesn't seem to support the "Arabic" language
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
340 ;; environment yet. So this is only partially usable, for now
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
341 (defvar cp720-decode-table
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
342 [
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
343 255 nil nil nil 148 nil nil nil nil nil nil nil nil 196 nil nil
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
344 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
345 nil 152 153 154 155 157 158 159 160 161 162 163 164 165 166 167
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
346 168 169 170 171 172 173 224 225 226 227 228 nil nil nil nil nil
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
347 149 229 231 232 233 234 235 236 237 238 239 241 242 243 244 245
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
348 246 145 146 nil nil nil nil nil nil nil nil nil nil nil nil nil]
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
349 "Table for converting ISO-8859-6 characters into codepage 720 glyphs.")
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
350 (setplist 'cp720-decode-table
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
351 '(charset arabic-iso8859-6 language nil offset 160))
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
352
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
353
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
354 ;; Nordic (Norwegian/Danish)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
355 (defvar cp865-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
356 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
357 255 173 nil 156 nil nil nil nil nil nil 166 174 170 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
358 nil 241 253 nil nil nil nil 249 nil nil 167 175 172 171 nil 168
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
359 nil nil nil nil 142 143 146 128 nil 144 nil nil nil nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
360 nil 165 nil nil nil nil 153 nil 157 nil nil nil 154 nil nil nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
361 133 160 131 nil 132 134 145 135 138 130 136 137 141 161 140 139
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
362 nil 164 149 162 147 nil 148 246 155 151 163 150 129 nil nil 152]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
363 "Table for converting ISO-8859-1 characters into codepage 865 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
364 (setplist 'cp865-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
365 '(charset latin-iso8859-1 language "Latin-1" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
366
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
367 ;; Greek (yes, another one!)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
368 (defvar cp869-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
369 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
370 255 139 140 156 nil nil 138 245 249 151 nil 174 137 240 nil 142
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
371 248 241 153 154 239 247 134 136 141 143 144 175 146 171 149 152
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
372 161 164 165 166 167 168 169 170 172 173 181 182 183 184 189 190
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
373 198 199 nil 207 208 209 210 211 212 213 145 150 155 157 158 159
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
374 252 214 215 216 221 222 224 225 226 227 228 229 230 231 232 233
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
375 234 235 237 236 238 242 243 244 246 250 160 251 162 163 253 nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
376 "Table for converting ISO-8859-7 characters into codepage 869 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
377 (setplist 'cp869-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
378 '(charset greek-iso8859-7 language "Greek" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
379
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
380 ;; Greek OEM codepage used by Windows
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
381 (defvar cp737-decode-table
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
382 [
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
383 255 nil nil nil nil nil 179 nil nil nil nil nil nil 196 nil nil
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
384 248 241 253 nil nil nil 234 250 235 236 237 nil 238 nil 239 240
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
385 nil 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
386 143 144 nil 145 146 147 148 149 150 151 244 245 225 226 227 229
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
387 nil 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
388 167 168 170 169 171 172 173 174 175 224 228 232 230 231 233 nil]
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
389 "Table for converting ISO-8859-7 characters into codepage 737 glyphs.")
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
390 (setplist 'cp737-decode-table
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
391 '(charset greek-iso8859-7 language "Greek" offset 160))
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
392
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
393 ;; Conversion from codepage 775 to Latin-4 for Baltic countries.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
394 (defvar cp775-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
395 [
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
396 255 181 nil 138 150 nil 234 245 166 190 237 149 173 240 207 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
397 248 208 nil 139 239 nil 235 nil nil 213 137 133 nil nil 216 nil
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
398 160 nil nil nil 142 143 146 189 182 144 183 nil 184 nil nil 161
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
399 nil 238 226 232 nil 229 153 158 157 198 nil nil 154 nil 199 225
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
400 131 nil nil nil 132 134 145 212 209 130 210 nil 211 nil nil 140
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
401 nil 236 147 233 nil 228 148 nil 155 214 nil nil 129 nil 215 nil]
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
402 "Table for converting ISO-8859-4 characters into codepage 775 glyphs.")
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
403 (setplist 'cp775-decode-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
404 '(charset latin-iso8859-4 language "Latin-4" offset 160))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
405
24454
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
406 ;; Support for the Windows 12xx series of codepages that MS has
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
407 ;; butchered from the ISO-8859 specs. This does not add support for
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
408 ;; the extended characters that MS has added in the 128 - 159 coding
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
409 ;; range, only translates those characters that can be expressed in
29922
9473e3466947 (cp-coding-system-for-codepage-1): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 29721
diff changeset
410 ;; the corresponding iso-8859 charset.
24454
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
411
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
412 ;; Codepage Mapping:
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
413 ;;
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
414 ;; Windows-1250: ISO-8859-2 (Central Europe) - differs in some positions
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
415 ;; Windows-1251: ISO-8859-5 (Cyrillic) - differs wildly
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
416 ;; Windows-1252: ISO-8859-1 (West Europe) - exact match
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
417 ;; Windows-1253: ISO-8859-7 (Greek) - differs in some positions
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
418 ;; Windows-1254: ISO-8859-9 (Turkish) - exact match
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
419 ;; Windows-1255: ISO-8859-8 (Hebrew) - exact match
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
420 ;; Windows-1256: ISO-8859-6 (Arabic) - half match
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
421 ;; Windows-1257: ISO-8859-4 (Baltic) - differs, future Latin-7
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
422 ;; Windows-1258: VISCII (Vietnamese) - Completely different
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
423
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
424 (defvar cp1250-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
425 [
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
426 160 165 162 163 164 188 140 167 168 138 170 141 143 173 142 175
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
427 176 185 178 179 180 190 156 161 184 154 186 157 159 189 158 191
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
428 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
429 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
430 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
431 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
432 "ISO-8859-2 to Windows-1250 (Central Europe) codepage decoding table")
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
433 (setplist 'cp1250-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
434 '(charset latin-iso8859-2 language "Latin-2" offset 160))
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
435
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
436 (defvar cp1251-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
437 [
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
438 160 168 128 129 170 189 178 175 163 138 140 142 141 173 161 143
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
439 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
440 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
441 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
442 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
443 185 184 144 131 186 190 179 191 188 154 156 158 157 167 162 159 ]
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
444 "ISO-8859-5 to Windows-1251 (Cyrillic) codepage decoding table")
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
445 (setplist 'cp1251-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
446 '(charset cyrillic-iso8859-5 language "Cyrillic-ISO" offset 160))
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
447
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
448 ;; cp1253 is missing nbsp so we cannot quite translate perfectly. It
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
449 ;; also has two micro/mu characters which would require more complex
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
450 ;; processing to accomodate.
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
451 (defvar cp1253-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
452 [
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
453 nil 145 146 163 nil nil 166 167 168 169 nil 171 172 173 nil 151
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
454 176 177 178 179 180 161 162 183 184 185 186 187 188 189 190 191
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
455 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
456 208 209 nil 211 212 213 214 215 216 217 218 219 220 221 222 223
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
457 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
458 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 nil ]
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
459 "ISO-8859-7 to Windows-1253 (Greek) codepage decoding table")
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
460 (setplist 'cp1253-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
461 '(charset greek-iso8859-7 language "Greek" offset 160))
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
462
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
463 ;; Since Latin-7 is not yet official, and Emacs does not support it,
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
464 ;; provide translation between Windows-1257 and Latin-4 the best we
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
465 ;; can.
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
466 (defvar cp1257-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
467 [
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
468 160 192 nil 170 164 nil 207 167 nil 208 199 204 nil 173 222 nil
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
469 176 224 nil 186 nil nil 239 nil nil 240 231 236 nil nil 254 nil
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
470 194 nil nil nil 196 197 175 193 200 201 198 nil 203 nil nil 206
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
471 nil 210 212 205 nil 213 214 215 168 216 nil nil 220 nil 219 223
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
472 226 nil nil nil 228 229 191 225 232 233 230 nil 235 nil nil 238
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
473 nil 242 244 237 nil 245 246 247 184 248 nil nil 252 nil 251 nil ]
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
474 "ISO-8859-4 to Windows-1257 (Baltic) codepage decoding table")
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
475 (setplist 'cp1257-decode-table
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
476 '(charset latin-iso8859-4 language "Latin-4" offset 160))
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
477
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
478 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
479 (defun cp-make-coding-systems-for-codepage (codepage iso-name offset)
23952
4ef8ec98dd43 (cp-make-coding-systems-for-codepage): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 23920
diff changeset
480 "Create a coding system to convert IBM CODEPAGE into charset ISO-NAME
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 whose first character is at offset OFFSET from the beginning of 8-bit
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
482 ASCII table.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483
23952
4ef8ec98dd43 (cp-make-coding-systems-for-codepage): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 23920
diff changeset
484 The created coding system has the usual 3 subsidiary systems: for Unix-,
4ef8ec98dd43 (cp-make-coding-systems-for-codepage): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 23920
diff changeset
485 DOS- and Mac-style EOL conversion. However, unlike built-in coding
4ef8ec98dd43 (cp-make-coding-systems-for-codepage): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 23920
diff changeset
486 systems, the Mac-style EOL conversion is currently not supported by the
4ef8ec98dd43 (cp-make-coding-systems-for-codepage): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 23920
diff changeset
487 decoder and encoder created by this function."
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
488 (let* ((decode-table (intern (format "%s-decode-table" codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
489 (nonascii-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
490 (intern (format "%s-nonascii-translation-table" codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
491 (decode-translation
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
492 (intern (format "%s-decode-translation-table" codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493 (encode-translation
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
494 (intern (format "%s-encode-translation-table" codepage))))
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
495 (set nonascii-table
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
496 (make-translation-table-from-vector
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
497 (cp-decoding-vector-for-codepage
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
498 (symbol-value decode-table) iso-name offset)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
499 (define-translation-table encode-translation
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
500 (char-table-extra-slot (symbol-value nonascii-table) 0))
29180
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
501 ;; For charsets other than ascii, eight-bit-* and ISO-NAME, set
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
502 ;; `?' for one-column charsets, and some Japanese character for
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
503 ;; wide-column charsets. CCL encoder convert that Japanese
24279
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
504 ;; character to either dos-unsupported-char-glyph or "??".
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
505 (let ((tbl (char-table-extra-slot (symbol-value nonascii-table) 0))
24279
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
506 (undef (if (eq system-type 'ms-dos)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
507 (if dos-unsupported-char-glyph
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
508 (logand dos-unsupported-char-glyph 255)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
509 127)
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
510 ??))
29180
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
511 (charsets (delq 'ascii
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
512 (delq 'eight-bit-control
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
513 (delq 'eight-bit-graphic
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
514 (delq iso-name
e2cb024e88cd (cp-make-coding-systems-for-codepage):
Eli Zaretskii <eliz@gnu.org>
parents: 24662
diff changeset
515 (copy-sequence charset-list))))))
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
516 (wide-column-char (make-char 'japanese-jisx0208 32 32)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
517 (while charsets
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
518 (aset tbl (make-char (car charsets))
24279
7334c513dc7d (cp-coding-system-for-codepage-1): On MS-DOS,
Eli Zaretskii <eliz@gnu.org>
parents: 24088
diff changeset
519 (if (= (charset-width (car charsets)) 1) undef wide-column-char))
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
520 (setq charsets (cdr charsets))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
521 (define-translation-table decode-translation
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
522 (symbol-value nonascii-table))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
523 (cp-coding-system-for-codepage-1
23920
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
524 (intern codepage) ?D iso-name decode-translation encode-translation)
efcf2fcda617 (cp-coding-system-for-codepage-1):
Eli Zaretskii <eliz@gnu.org>
parents: 23915
diff changeset
525 ))
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
526
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
527 (defun cp-codepage-decoder (codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
528 "If CODEPAGE is the name of a supported codepage, return its decode table;
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
529 otherwise return nil."
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
530 (let ((cp (if (symbolp codepage) (symbol-name codepage) codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
531 (cond
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
532 ((stringp cp)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
533 (intern-soft (format "%s-decode-table" cp)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
534 (t nil))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
535
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
536 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
537 (defun cp-charset-for-codepage (codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
538 "Return the charset for which there is a translation table to DOS CODEPAGE.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
539 CODEPAGE must be the name of a DOS codepage, a string."
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
540 (let ((cp-decoder (cp-codepage-decoder codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
541 (if (null cp-decoder)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
542 (error "Unsupported codepage %s" codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
543 (get cp-decoder 'charset))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
544
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
545 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
546 (defun cp-language-for-codepage (codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
547 "Return the name of the MULE language environment for CODEPAGE.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
548 CODEPAGE must be the name of a DOS codepage, a string."
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
549 (let ((cp-decoder (cp-codepage-decoder codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
550 (if (null cp-decoder)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
551 (error "Unsupported codepage %s" codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
552 (get cp-decoder 'language))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
553
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
554 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
555 (defun cp-offset-for-codepage (codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
556 "Return the offset to be used in setting up coding systems for CODEPAGE.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
557 CODEPAGE must be the name of a DOS codepage, a string."
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
558 (let ((cp-decoder (cp-codepage-decoder codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
559 (if (null cp-decoder)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
560 (error "Unsupported codepage %s" codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
561 (get cp-decoder 'offset))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
562
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
563 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
564 (defun cp-supported-codepages ()
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
565 "Return an alist of supported codepages.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
566
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
567 Each association in the alist has the form (NNN . CHARSET), where NNN is the
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
568 codepage number, and CHARSET is the MULE charset which is the closest match
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
569 for the character set supported by that codepage.
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
570
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
571 A codepage NNN is supported if a variable called `cpNNN-decode-table' exists,
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
572 is a vector, and has a charset property."
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
573 (save-match-data
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
574 (let (alist chset sname)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
575 (mapatoms
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
576 (function
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
577 (lambda (sym)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
578 (if (and (boundp sym)
24454
fe0089dd2d2f (cp1250-decode-table, cp1251-decode-table, cp1253-decode-table,
Eli Zaretskii <eliz@gnu.org>
parents: 24371
diff changeset
579 (string-match "\\`cp\\([1-9][0-9][0-9][0-9]?\\)-decode-table\\'"
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
580 (setq sname (symbol-name sym)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
581 (vectorp (symbol-value sym))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
582 (setq chset (get sym 'charset)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
583 (setq alist
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
584 (cons (cons (match-string 1 sname) chset) alist))))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
585 alist)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
586
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
587 ;;;###autoload
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
588 (defun codepage-setup (codepage)
24033
a5d31e58291b (codepage-setup): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 24009
diff changeset
589 "Create a coding system cpCODEPAGE to support the IBM codepage CODEPAGE.
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
590
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
591 These coding systems are meant for encoding and decoding 8-bit non-ASCII
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
592 characters used by the IBM codepages, typically in conjunction with files
24033
a5d31e58291b (codepage-setup): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 24009
diff changeset
593 read/written by MS-DOS software, or for display on the MS-DOS terminal."
23915
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
594 (interactive
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
595 (let ((completion-ignore-case t)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
596 (candidates (cp-supported-codepages)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
597 (list (completing-read "Setup DOS Codepage: (default 437) " candidates
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
598 nil t nil nil "437"))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
599 (let ((cp (format "cp%s" codepage)))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
600 (cp-make-coding-systems-for-codepage
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
601 cp (cp-charset-for-codepage cp) (cp-offset-for-codepage cp))))
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
602
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
603 (provide 'codepage)
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
604
7ce49fb0dfbc Initial revision
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
605 ;; codepage.el ends here