/[emacs]/emacs/lisp/international/mule.el
ViewVC logotype

Diff of /emacs/lisp/international/mule.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.188.2.2 by handa, Sun Sep 28 23:56:11 2003 UTC revision 1.188.2.3 by handa, Mon Nov 17 03:57:03 2003 UTC
# Line 36  Version number and name of this version Line 36  Version number and name of this version
36  (defconst mule-version-date "2003.9.1" "\  (defconst mule-version-date "2003.9.1" "\
37  Distribution date of this version of MULE (multilingual environment).")  Distribution date of this version of MULE (multilingual environment).")
38    
   
   
 ;;; CHARACTER  
 (defalias 'char-valid-p 'characterp)  
 (make-obsolete 'char-valid-p 'characterp "22.1")  
   
39    
40  ;;; CHARSET  ;;; CHARSET
41    
42    ;; Backward compatibility code for handling emacs-mule charsets.
43    (defvar private-char-area-1-min #xF0000)
44    (defvar private-char-area-1-max #xFFFFE)
45    (defvar private-char-area-2-min #x100000)
46    (defvar private-char-area-2-max #x10FFFE)
47    
48    ;; Table of emacs-mule charsets indexed by their emacs-mule ID.
49    (defvar emacs-mule-charset-table (make-vector 256 nil))
50    (aset emacs-mule-charset-table 0 'ascii)
51    
52    ;; Convert the argument of old-style calll of define-charset to a
53    ;; property list used by the new-style.
54    ;; INFO-VECTOR is a vector of the format:
55    ;;   [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE
56    ;;    SHORT-NAME LONG-NAME DESCRIPTION]
57    
58    (defun convert-define-charset-argument (emacs-mule-id info-vector)
59      (let* ((dim (aref info-vector 0))
60             (chars (aref info-vector 1))
61             (total (if (= dim 1) chars (* chars chars)))
62             (code-space (if (= dim 1) (if (= chars 96) [32 127] [33 126])
63                           (if (= chars 96) [32 127 32 127] [33 126 33 126])))
64             code-offset)
65        (if (integerp emacs-mule-id)
66            (or (= emacs-mule-id 0)
67                (and (>= emacs-mule-id 129) (< emacs-mule-id 256))
68                (error "Invalid CHARSET-ID: %d" emacs-mule-id))
69          (let (from-id to-id)
70            (if (= dim 1) (setq from-id 160 to-id 224)
71              (setq from-id 224 to-id 255))
72            (while (and (< from-id to-id)
73                        (not (aref emacs-mule-charset-table from-id)))
74              (setq from-id (1+ from-id)))
75            (if (= from-id to-id)
76                (error "No more room for the new Emacs-mule charset"))
77            (setq emacs-mule-id from-id)))
78        (if (> (- private-char-area-1-max private-char-area-1-min) total)
79            (setq code-offset private-char-area-1-min
80                  private-char-area-1-min (+ private-char-area-1-min total))
81          (if (> (- private-char-area-2-max private-char-area-2-min) total)
82              (setq code-offset private-char-area-2-min
83                    private-char-area-2-min (+ private-char-area-2-min total))
84            (error "No more space for a new charset.")))
85        (list :dimension dim
86              :code-space code-space
87              :iso-final-char (aref info-vector 4)
88              :code-offset code-offset
89              :emacs-mule-id emacs-mule-id)))
90    
91  (defun define-charset (name docstring &rest props)  (defun define-charset (name docstring &rest props)
92    "Define NAME (symbol) as a charset with DOCSTRING.    "Define NAME (symbol) as a charset with DOCSTRING.
93  The remaining arguments must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE  The remaining arguments must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE
# Line 103  number of the charset for ISO-2022 encod Line 146  number of the charset for ISO-2022 encod
146    
147  `:emacs-mule-id'  `:emacs-mule-id'
148    
149  VALUE must be an integer of 0, 128..255.  If omitted, the charset  VALUE must be an integer of 0, 129..255.  If omitted, the charset
150  can't be encoded by coding-systems of type `emacs-mule'.  can't be encoded by coding-systems of type `emacs-mule'.
151    
152  `:ascii-compatible-p'  `:ascii-compatible-p'
# Line 172  corresponding Unicode character code. Line 215  corresponding Unicode character code.
215  If it is a string, it is a name of file that contains the above  If it is a string, it is a name of file that contains the above
216  information.  The file format is the same as what described for `:map'  information.  The file format is the same as what described for `:map'
217  attribute."  attribute."
218      (when (vectorp (car props))
219        ;; Old style code:
220        ;;   (define-charset CHARSET-ID CHARSET-SYMBOL INFO-VECTOR)
221        ;; Convert the argument to make it fit with the current style.
222        (let ((vec (car props)))
223          (setq props (convert-define-charset-argument name vec)
224                name docstring
225                docstring (aref vec 8))))
226    (let ((attrs (mapcar 'list '(:dimension    (let ((attrs (mapcar 'list '(:dimension
227                                 :code-space                                 :code-space
228                                 :min-code                                 :min-code
# Line 196  attribute." Line 247  attribute."
247              (setq dimension (/ (length (plist-get props :code-space)) 2))              (setq dimension (/ (length (plist-get props :code-space)) 2))
248              (setq props (plist-put props :dimension dimension)))))              (setq props (plist-put props :dimension dimension)))))
249    
250        ;; If :emacs-mule-id is specified, update emacs-mule-charset-table.
251        (let ((emacs-mule-id (plist-get props :emacs-mule-id)))
252          (if (integerp emacs-mule-id)
253              (aset emacs-mule-charset-table emacs-mule-id name)))
254    
255      (dolist (slot attrs)      (dolist (slot attrs)
256        (setcdr slot (plist-get props (car slot))))        (setcdr slot (plist-get props (car slot))))
257    
# Line 405  Now we have the variable `charset-list'. Line 461  Now we have the variable `charset-list'.
461    charset-list)    charset-list)
462  (make-obsolete 'charset-list "Use variable `charset-list'" "22.1")  (make-obsolete 'charset-list "Use variable `charset-list'" "22.1")
463    
464    
465    ;;; CHARACTER
466    (defalias 'char-valid-p 'characterp)
467    (make-obsolete 'char-valid-p 'characterp "22.1")
468    
469  (defun generic-char-p (char)  (defun generic-char-p (char)
470    "Always return nil.  This is provided for backward compatibility."    "Always return nil.  This is provided for backward compatibility."
471    nil)    nil)
472  (make-obsolete 'generic-char-p "Generic characters no longer exist" "22.1")  (make-obsolete 'generic-char-p "Generic characters no longer exist" "22.1")
473    
474    (defun make-char-internal (charset-id &optional code1 code2)
475      (let ((charset (aref emacs-mule-charset-table charset-id)))
476        (or charset
477            (error "Invalid Emacs-mule charset ID: %d" charset-id))
478        (make-char charset code1 code2)))
479    
480  ;; Coding system stuff  ;; Coding system stuff
481    

Legend:
Removed from v.1.188.2.2  
changed lines
  Added in v.1.188.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26