commit: dump make-coding-system

Ben Wing ben at xemacs.org
Tue Feb 23 06:23:10 EST 2010


changeset:   5068:c673987f5f3d
user:        Ben Wing <ben at xemacs.org>
date:        Mon Feb 22 21:26:18 2010 -0600
files:       lisp/ChangeLog lisp/coding.el lisp/dumped-lisp.el lisp/mule/make-coding-system.el
description:
dump make-coding-system

-------------------- ChangeLog entries follow: --------------------

lisp/ChangeLog addition:

2010-02-22  Ben Wing  <ben at 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.


diff -r 7d7ae8db0341 -r c673987f5f3d lisp/ChangeLog
--- a/lisp/ChangeLog	Mon Feb 22 21:23:02 2010 -0600
+++ b/lisp/ChangeLog	Mon Feb 22 21:26:18 2010 -0600
@@ -1,3 +1,26 @@
+2010-02-22  Ben Wing  <ben at 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.
+	
+
 2010-02-22  Ben Wing  <ben at xemacs.org>
 
 	* cl-seq.el:
diff -r 7d7ae8db0341 -r c673987f5f3d lisp/coding.el
--- a/lisp/coding.el	Mon Feb 22 21:23:02 2010 -0600
+++ b/lisp/coding.el	Mon Feb 22 21:26:18 2010 -0600
@@ -5,7 +5,7 @@
 ;; Copyright (C) 1995 Amdahl Corporation.
 ;; Copyright (C) 1995 Sun Microsystems.
 ;; Copyright (C) 1997 MORIOKA Tomohiko
-;; Copyright (C) 2000, 2001, 2002 Ben Wing.
+;; Copyright (C) 2000, 2001, 2002, 2010 Ben Wing.
 
 ;; This file is part of XEmacs.
 
@@ -464,27 +464,25 @@
   (and (query-coding-string char coding-system)
        (encode-coding-string char coding-system)))
 
-(if (featurep 'mule)
-    (progn
-      ;; Under Mule, we do much of the complicated coding system creation in
-      ;; Lisp and especially at compile time. We need some function
-      ;; definition for this function to be created in this file, but we can
-      ;; leave assigning the docstring to the autoload cookie
-      ;; handling later. Thankfully; that docstring is big.
-      (autoload 'make-coding-system "mule/make-coding-system")
+(defun decode-char (quote-ucs code &optional restriction) 
+  "FSF compatibility--return Mule character with Unicode codepoint CODE.
+The second argument must be 'ucs, the third argument is ignored.  "
+  ;; We're prepared to accept invalid Unicode in unicode-to-char, but not in
+  ;; this function, which is the API that should actually be used, since
+  ;; it's available in GNU and in Mule-UCS.
+  (check-argument-range code #x0 #x10FFFF)
+  (assert (eq quote-ucs 'ucs) t
+	  "Sorry, decode-char doesn't yet support anything but the UCS.  ")
+  (unicode-to-char code))
 
-      ;; (During byte-compile before dumping, make-coding-system may already
-      ;; have been loaded, make sure not to overwrite the correct compiler
-      ;; macro:)
-      (when (eq 'autoload (car (symbol-function 'make-coding-system)))
-        ;; Make sure to pick up the correct compiler macro when compiling
-        ;; files:
-        (define-compiler-macro make-coding-system (&whole form name type
-                                                   &optional description props)
-          (load (second (symbol-function 'make-coding-system)))
-          (funcall (get 'make-coding-system 'cl-compiler-macro)
-                   form name type description props))))
+(defun encode-char (char quote-ucs &optional restriction)
+  "FSF compatibility--return the Unicode code point of CHAR.
+The second argument must be 'ucs, the third argument is ignored.  "
+  (assert (eq quote-ucs 'ucs) t
+	  "Sorry, encode-char doesn't yet support anything but the UCS.  ")
+  (char-to-unicode char))
 
+(unless (featurep 'mule)
   ;; Mule's not available; 
   (fset 'make-coding-system (symbol-function 'make-coding-system-internal))
   (define-coding-system-alias 'escape-quoted 'binary)
diff -r 7d7ae8db0341 -r c673987f5f3d lisp/dumped-lisp.el
--- a/lisp/dumped-lisp.el	Mon Feb 22 21:23:02 2010 -0600
+++ b/lisp/dumped-lisp.el	Mon Feb 22 21:26:18 2010 -0600
@@ -160,6 +160,7 @@
        "code-process"
        ;; Provide basic commands to set coding systems to user
        "code-cmds"
+       (when (featurep 'mule) "mule/make-coding-system")
        "unicode"
 	;;;;;;;;;;;;;;;;;; MULE support
        (when (featurep 'mule)
diff -r 7d7ae8db0341 -r c673987f5f3d lisp/mule/make-coding-system.el
--- a/lisp/mule/make-coding-system.el	Mon Feb 22 21:23:02 2010 -0600
+++ b/lisp/mule/make-coding-system.el	Mon Feb 22 21:26:18 2010 -0600
@@ -2,6 +2,7 @@
 ;;; much of the implementation of the fixed-width coding system type.
 
 ;; Copyright (C) 2009 Free Software Foundation
+;; Copyright (C) 2010 Ben Wing.
 
 ;; Author: Aidan Kehoe
 
@@ -25,13 +26,6 @@
 ;;; Commentary:
 
 ;;; Code:
-
-(defvar fixed-width-private-use-start (decode-char 'ucs #xE000)
-  "Start of a 256 code private use area for fixed-width coding systems.
-
-This is used to ensure that distinct octets on disk for a given coding
-system map to distinct XEmacs characters, preventing spurious changes when
-a file is read, not changed, and then written.  ")
 
 (defun fixed-width-generate-helper (decode-table encode-table
 				   encode-failure-octet)
@@ -323,7 +317,7 @@
   (check-argument-type #'listp unicode-map)
   (let ((decode-table (make-vector 256 nil))
         (encode-table (make-hash-table :size 256 :rehash-threshold 0.999))
-	(private-use-start (encode-char fixed-width-private-use-start 'ucs))
+	(private-use-start #xE000)
         (invalid-sequence-code-point-start
          (eval-when-compile
            (char-to-unicode



More information about the XEmacs-Patches mailing list