]> code.delx.au - gnu-emacs/blob - lisp/international/codepage.el
Split XEmacs/Emacs definitions and sample setup code into separate files
[gnu-emacs] / lisp / international / codepage.el
1 ;;; codepage.el --- MS-DOS/MS-Windows specific coding systems
2
3 ;; Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
4 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021
7
8 ;; Author: Eli Zaretskii
9 ;; Maintainer: FSF
10 ;; Keywords: i18n ms-dos ms-windows codepage obsolete
11
12 ;; This file is part of GNU Emacs.
13
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; any later version.
18
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
23
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
28
29 ;;; Commentary:
30
31 ;; Special coding systems for DOS/Windows codepage support.
32 ;; Obsolete.
33
34 ;;; Code:
35
36 (defvar dos-unsupported-char-glyph)
37
38 ;; I doubt we need compatibility versions of any of these autoloaded
39 ;; functions apart from codepage-setup, which users may call.
40
41 ;; ;;;###autoload
42 ;; (defun cp-make-coding-systems-for-codepage (codepage iso-name offset)
43 ;; "Create a coding system to convert IBM CODEPAGE into charset ISO-NAME
44 ;; whose first character is at offset OFFSET from the beginning of 8-bit
45 ;; ASCII table.
46
47 ;; The created coding system has the usual 3 subsidiary systems: for Unix-,
48 ;; DOS- and Mac-style EOL conversion. However, unlike built-in coding
49 ;; systems, the Mac-style EOL conversion is currently not supported by the
50 ;; decoder and encoder created by this function."
51 ;; (let* ((decode-table (intern (format "%s-decode-table" codepage)))
52 ;; (nonascii-table
53 ;; (intern (format "%s-nonascii-translation-table" codepage)))
54 ;; (decode-translation
55 ;; (intern (format "%s-decode-translation-table" codepage)))
56 ;; (encode-translation
57 ;; (intern (format "%s-encode-translation-table" codepage))))
58 ;; (set nonascii-table
59 ;; (make-translation-table-from-vector
60 ;; (cp-decoding-vector-for-codepage
61 ;; (symbol-value decode-table) iso-name offset)))
62 ;; (define-translation-table encode-translation
63 ;; (char-table-extra-slot (symbol-value nonascii-table) 0))
64 ;; ;; For charsets other than ascii, eight-bit-* and ISO-NAME, set
65 ;; ;; `?' for one-column charsets, and some Japanese character for
66 ;; ;; wide-column charsets. CCL encoder convert that Japanese
67 ;; ;; character to either dos-unsupported-char-glyph or "??".
68 ;; (let ((tbl (char-table-extra-slot (symbol-value nonascii-table) 0))
69 ;; (undef (if (eq system-type 'ms-dos)
70 ;; (if dos-unsupported-char-glyph
71 ;; (logand dos-unsupported-char-glyph 255)
72 ;; 127)
73 ;; ??))
74 ;; (charsets (delq 'ascii
75 ;; (delq 'eight-bit-control
76 ;; (delq 'eight-bit-graphic
77 ;; (delq iso-name
78 ;; (copy-sequence charset-list))))))
79 ;; (wide-column-char (make-char 'japanese-jisx0208 32 32)))
80 ;; (while charsets
81 ;; (aset tbl (make-char (car charsets))
82 ;; (if (= (charset-width (car charsets)) 1) undef wide-column-char))
83 ;; (setq charsets (cdr charsets))))
84 ;; (define-translation-table decode-translation
85 ;; (symbol-value nonascii-table))
86 ;; (cp-coding-system-for-codepage-1
87 ;; (intern codepage) ?D iso-name decode-translation encode-translation)
88 ;; ))
89
90 ;; ;;;###autoload
91 ;; (defun cp-charset-for-codepage (codepage)
92 ;; "Return the charset for which there is a translation table to DOS CODEPAGE.
93 ;; CODEPAGE must be the name of a DOS codepage, a string."
94 ;; (let ((cp-decoder (cp-codepage-decoder codepage)))
95 ;; (if (null cp-decoder)
96 ;; (error "Unsupported codepage %s" codepage)
97 ;; (get cp-decoder 'charset))))
98
99 ;; ;;;###autoload
100 ;; (defun cp-language-for-codepage (codepage)
101 ;; "Return the name of the MULE language environment for CODEPAGE.
102 ;; CODEPAGE must be the name of a DOS codepage, a string."
103 ;; (let ((cp-decoder (cp-codepage-decoder codepage)))
104 ;; (if (null cp-decoder)
105 ;; (error "Unsupported codepage %s" codepage)
106 ;; (get cp-decoder 'language))))
107
108 ;; ;;;###autoload
109 ;; (defun cp-offset-for-codepage (codepage)
110 ;; "Return the offset to be used in setting up coding systems for CODEPAGE.
111 ;; CODEPAGE must be the name of a DOS codepage, a string."
112 ;; (let ((cp-decoder (cp-codepage-decoder codepage)))
113 ;; (if (null cp-decoder)
114 ;; (error "Unsupported codepage %s" codepage)
115 ;; (get cp-decoder 'offset))))
116
117 ;; ;;;###autoload
118 ;; (defun cp-supported-codepages ()
119 ;; "Return an alist of supported codepages.
120
121 ;; Each association in the alist has the form (NNN . CHARSET), where NNN is the
122 ;; codepage number, and CHARSET is the MULE charset which is the closest match
123 ;; for the character set supported by that codepage.
124
125 ;; A codepage NNN is supported if a variable called `cpNNN-decode-table' exists,
126 ;; is a vector, and has a charset property."
127 ;; (save-match-data
128 ;; (let (alist chset sname)
129 ;; (mapatoms
130 ;; (function
131 ;; (lambda (sym)
132 ;; (if (and (boundp sym)
133 ;; (string-match "\\`cp\\([1-9][0-9][0-9][0-9]?\\)-decode-table\\'"
134 ;; (setq sname (symbol-name sym)))
135 ;; (vectorp (symbol-value sym))
136 ;; (setq chset (get sym 'charset)))
137 ;; (setq alist
138 ;; (cons (cons (match-string 1 sname) chset) alist))))))
139 ;; alist)))
140
141 ;;;###autoload
142 (defun codepage-setup (&optional codepage)
143 "Obsolete. All coding systems are set up initially."
144 (interactive))
145 (make-obsolete 'codepage-setup "no longer relevant" "23.1")
146
147 (provide 'codepage)
148
149 ;;; arch-tag: 80328de8-b94e-4386-be26-5876105731f0
150 ;;; codepage.el ends here