comparison lisp/mule/make-coding-system.el @ 5068:c673987f5f3d

dump make-coding-system -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2010-02-22 Ben Wing <ben@xemacs.org> * mule/make-coding-system.el: * mule/make-coding-system.el (fixed-width-generate-helper): * mule/make-coding-system.el (fixed-width-private-use-start): Removed. * mule/make-coding-system.el (fixed-width-create-decode-encode-tables): * coding.el: * coding.el (decode-char): New. * coding.el (featurep): * coding.el (encode-char): New. * dumped-lisp.el (preloaded-file-list): Dump make-coding-system. Aidan's hack to avoid dumping this file never really worked right -- with some configurations (not clear exactly which ones) `make-coding-system.el' gets dumped anyway due to calls to `make-coding-system' in unicode.el, with the result that the documentation of functions in make-coding-system.el gets lost. Also needed to remove defvar fixed-width-private-use-start and incorporate it inline, due to bootstrapping issues -- the call to decode-char introduced a cross-dependency between unicode.el and make-coding-system.el.
author Ben Wing <ben@xemacs.org>
date Mon, 22 Feb 2010 21:26:18 -0600
parents c69aeb86b2a3
children baffa6ca776a
comparison
equal deleted inserted replaced
5067:7d7ae8db0341 5068:c673987f5f3d
1 ;;; make-coding-system.el; Provides the #'make-coding-system function and 1 ;;; make-coding-system.el; Provides the #'make-coding-system function and
2 ;;; much of the implementation of the fixed-width coding system type. 2 ;;; much of the implementation of the fixed-width coding system type.
3 3
4 ;; Copyright (C) 2009 Free Software Foundation 4 ;; Copyright (C) 2009 Free Software Foundation
5 ;; Copyright (C) 2010 Ben Wing.
5 6
6 ;; Author: Aidan Kehoe 7 ;; Author: Aidan Kehoe
7 8
8 ;; This file is part of XEmacs. 9 ;; This file is part of XEmacs.
9 10
23 ;; Boston, MA 02110-1301, USA. 24 ;; Boston, MA 02110-1301, USA.
24 25
25 ;;; Commentary: 26 ;;; Commentary:
26 27
27 ;;; Code: 28 ;;; Code:
28
29 (defvar fixed-width-private-use-start (decode-char 'ucs #xE000)
30 "Start of a 256 code private use area for fixed-width coding systems.
31
32 This is used to ensure that distinct octets on disk for a given coding
33 system map to distinct XEmacs characters, preventing spurious changes when
34 a file is read, not changed, and then written. ")
35 29
36 (defun fixed-width-generate-helper (decode-table encode-table 30 (defun fixed-width-generate-helper (decode-table encode-table
37 encode-failure-octet) 31 encode-failure-octet)
38 "Helper func, `fixed-width-generate-encode-program-and-skip-chars-strings', 32 "Helper func, `fixed-width-generate-encode-program-and-skip-chars-strings',
39 which see. 33 which see.
321 vector, and ENCODE-TABLE will be a hash table mapping from 256 numbers 315 vector, and ENCODE-TABLE will be a hash table mapping from 256 numbers
322 to 256 distinct characters." 316 to 256 distinct characters."
323 (check-argument-type #'listp unicode-map) 317 (check-argument-type #'listp unicode-map)
324 (let ((decode-table (make-vector 256 nil)) 318 (let ((decode-table (make-vector 256 nil))
325 (encode-table (make-hash-table :size 256 :rehash-threshold 0.999)) 319 (encode-table (make-hash-table :size 256 :rehash-threshold 0.999))
326 (private-use-start (encode-char fixed-width-private-use-start 'ucs)) 320 (private-use-start #xE000)
327 (invalid-sequence-code-point-start 321 (invalid-sequence-code-point-start
328 (eval-when-compile 322 (eval-when-compile
329 (char-to-unicode 323 (char-to-unicode
330 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 3)))) 324 (aref (decode-coding-string "\xd8\x00\x00\x00" 'utf-16-be) 3))))
331 desired-ucs decode-table-entry) 325 desired-ucs decode-table-entry)