view lisp/international/codepage.el @ 90106:bf0d492ea2d5

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-16 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-123 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-124 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17 - miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21 More work on moving images to etc/images * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23 Fix errors with image-file installation * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24 etc/Makefile.in (install): Put gnus-tut.txt in the right place. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25 etc/Makefile.in (install, uninstall): Fix installed image dirs. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26 etc/Makefile.in (install): Create $(etcdir)/images/gnus dir. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-27 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 23 Feb 2005 09:18:23 +0000
parents a01e7a9f1659
children f042e7c0fe20
line wrap: on
line source

;;; codepage.el --- MS-DOS/MS-Windows specific coding systems

;; Copyright (C) 1998, 2005 Free Software Foundation, Inc.

;; Author: Eli Zaretskii
;; Maintainer: FSF
;; Keywords: i18n ms-dos ms-windows codepage obsolete

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Special coding systems for DOS/Windows codepage support.
;; Obsolete.

;;; Code:

;; I doubt we need compatibility versions of any of these autoloaded
;; functions apart from codepage-setup, which users may call.

;; ;;;###autoload
;; (defun cp-make-coding-systems-for-codepage (codepage iso-name offset)
;;   "Create a coding system to convert IBM CODEPAGE into charset ISO-NAME
;; whose first character is at offset OFFSET from the beginning of 8-bit
;; ASCII table.

;; The created coding system has the usual 3 subsidiary systems: for Unix-,
;; DOS- and Mac-style EOL conversion.  However, unlike built-in coding
;; systems, the Mac-style EOL conversion is currently not supported by the
;; decoder and encoder created by this function."
;;   (let* ((decode-table (intern (format "%s-decode-table" codepage)))
;; 	 (nonascii-table
;; 	  (intern (format "%s-nonascii-translation-table" codepage)))
;; 	 (decode-translation
;; 	  (intern (format "%s-decode-translation-table" codepage)))
;; 	 (encode-translation
;; 	  (intern (format "%s-encode-translation-table" codepage))))
;;     (set nonascii-table
;; 	 (make-translation-table-from-vector
;; 	  (cp-decoding-vector-for-codepage
;; 	   (symbol-value decode-table) iso-name offset)))
;;     (define-translation-table encode-translation
;;       (char-table-extra-slot (symbol-value nonascii-table) 0))
;;     ;; For charsets other than ascii, eight-bit-* and ISO-NAME, set
;;     ;; `?' for one-column charsets, and some Japanese character for
;;     ;; wide-column charsets.  CCL encoder convert that Japanese
;;     ;; character to either dos-unsupported-char-glyph or "??".
;;     (let ((tbl (char-table-extra-slot (symbol-value nonascii-table) 0))
;; 	  (undef (if (eq system-type 'ms-dos)
;; 		     (if dos-unsupported-char-glyph
;; 			 (logand dos-unsupported-char-glyph 255)
;; 		       127)
;; 		   ??))
;; 	  (charsets (delq 'ascii
;; 			  (delq 'eight-bit-control
;; 				(delq 'eight-bit-graphic
;; 				      (delq iso-name
;; 					    (copy-sequence charset-list))))))
;; 	  (wide-column-char (make-char 'japanese-jisx0208 32 32)))
;;       (while charsets
;; 	(aset tbl (make-char (car charsets))
;; 	      (if (= (charset-width (car charsets)) 1) undef wide-column-char))
;; 	(setq charsets (cdr charsets))))
;;     (define-translation-table decode-translation
;;       (symbol-value nonascii-table))
;;     (cp-coding-system-for-codepage-1
;;      (intern codepage) ?D iso-name decode-translation encode-translation)
;;     ))

;; ;;;###autoload
;; (defun cp-charset-for-codepage (codepage)
;;   "Return the charset for which there is a translation table to DOS CODEPAGE.
;; CODEPAGE must be the name of a DOS codepage, a string."
;;   (let ((cp-decoder (cp-codepage-decoder codepage)))
;;     (if (null cp-decoder)
;; 	(error "Unsupported codepage %s" codepage)
;;       (get cp-decoder 'charset))))

;; ;;;###autoload
;; (defun cp-language-for-codepage (codepage)
;;   "Return the name of the MULE language environment for CODEPAGE.
;; CODEPAGE must be the name of a DOS codepage, a string."
;;   (let ((cp-decoder (cp-codepage-decoder codepage)))
;;     (if (null cp-decoder)
;; 	(error "Unsupported codepage %s" codepage)
;;       (get cp-decoder 'language))))

;; ;;;###autoload
;; (defun cp-offset-for-codepage (codepage)
;;   "Return the offset to be used in setting up coding systems for CODEPAGE.
;; CODEPAGE must be the name of a DOS codepage, a string."
;;   (let ((cp-decoder (cp-codepage-decoder codepage)))
;;     (if (null cp-decoder)
;; 	(error "Unsupported codepage %s" codepage)
;;       (get cp-decoder 'offset))))

;; ;;;###autoload
;; (defun cp-supported-codepages ()
;;   "Return an alist of supported codepages.

;; Each association in the alist has the form (NNN . CHARSET), where NNN is the
;; codepage number, and CHARSET is the MULE charset which is the closest match
;; for the character set supported by that codepage.

;; A codepage NNN is supported if a variable called `cpNNN-decode-table' exists,
;; is a vector, and has a charset property."
;;   (save-match-data
;;     (let (alist chset sname)
;;       (mapatoms
;;        (function
;; 	(lambda (sym)
;; 	  (if (and (boundp sym)
;; 		   (string-match "\\`cp\\([1-9][0-9][0-9][0-9]?\\)-decode-table\\'"
;; 				 (setq sname (symbol-name sym)))
;; 		   (vectorp (symbol-value sym))
;; 		   (setq chset (get sym 'charset)))
;; 	      (setq alist
;; 		    (cons (cons (match-string 1 sname) chset) alist))))))
;;       alist)))

;;;###autoload
(defun codepage-setup (&optional codepage)
  "Obsolete.  All coding systems are set up initially."
  (interactive))
(make-obsolete 'codepage-setup "no longer relevant" "23.1")

(provide 'codepage)

;;; arch-tag: 80328de8-b94e-4386-be26-5876105731f0
;;; codepage.el ends here