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