Changeset 1868

Show
Ignore:
Timestamp:
1998年08月22日 12時17分21秒 (10 years ago)
Author:
himi
Message:

Emacs 20.3.5 FSF import

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fsf/lisp/international/codepage.el

    r883 r1868  
    5959  (save-match-data 
    6060    (let* ((coding-name (symbol-name coding)) 
    61            (undef (if (eq system-type 'ms-dos) 
    62                       (if dos-unsupported-char-glyph 
    63                           (logand dos-unsupported-char-glyph 255) 
    64                         127) 
    65                     ??)) 
    6661           (ccl-decoder-dos 
    6762            (ccl-compile 
     
    8984           (ccl-encoder-dos 
    9085            (ccl-compile 
    91              ;; The 2 here supplies the buf_magnification parameter for 
    92              ;; the CCL program.  Since the -dos coding system generates 
    93              ;; \r\n for each \n, a factor of 2 covers even the worst case 
    94              ;; of empty lines with a single \n. 
    95              `(2 (loop (read-multibyte-character r0 r1) 
     86             `(1 (loop (read-multibyte-character r0 r1) 
    9687                       (if (r1 == ?\n) 
    9788                           (write ?\r) 
     
    9990                             ((translate-character ,encoder r0 r1) 
    10091                              (if (r0 == ,(charset-id 'japanese-jisx0208)) 
    101                                   ((r1 = ,undef
     92                                  ((r1 = ??
    10293                                   (write r1)))))) 
    10394                       (write-repeat r1))))) 
     
    10899                           ((translate-character ,encoder r0 r1) 
    109100                            (if (r0 == ,(charset-id 'japanese-jisx0208)) 
    110                                 ((r1 = ,undef
     101                                ((r1 = ??
    111102                                 (write r1))))) 
    112103                       (write-repeat r1)))))) 
     
    121112       (cons ccl-decoder-unix ccl-encoder-unix) 
    122113       `((safe-charsets ascii ,iso-name) 
    123          (valid-codes (0 . 255)) 
    124          (charset-origin-alist ,(list iso-name (symbol-name coding) encoder)))) 
     114         (valid-codes (0 . 255)))) 
    125115      ;;; Make coding systems CODING-unix, CODING-dos, CODING-mac. 
    126116      (make-subsidiary-coding-system coding) 
     
    421411          '(charset latin-iso8859-4 language "Latin-4" offset 160)) 
    422412 
    423 ;; Support for the Windows 12xx series of codepages that MS has 
    424 ;; butchered from the ISO-8859 specs. This does not add support for 
    425 ;; the extended characters that MS has added in the 128 - 159 coding 
    426 ;; range, only translates those characters that can be expressed in 
    427 ;; the corresponding iso-8859 codepage. 
    428  
    429 ;; Codepage Mapping: 
    430 ;; 
    431 ;; Windows-1250: ISO-8859-2 (Central Europe) - differs in some positions 
    432 ;; Windows-1251: ISO-8859-5 (Cyrillic)       - differs wildly 
    433 ;; Windows-1252: ISO-8859-1 (West Europe)    - exact match 
    434 ;; Windows-1253: ISO-8859-7 (Greek)          - differs in some positions 
    435 ;; Windows-1254: ISO-8859-9 (Turkish)        - exact match 
    436 ;; Windows-1255: ISO-8859-8 (Hebrew)         - exact match 
    437 ;; Windows-1256: ISO-8859-6 (Arabic)         - half match 
    438 ;; Windows-1257: ISO-8859-4 (Baltic)         - differs, future Latin-7 
    439 ;; Windows-1258: VISCII (Vietnamese)         - Completely different 
    440  
    441 (defvar cp1250-decode-table 
    442   [ 
    443     160 165 162 163 164 188 140 167 168 138 170 141 143 173 142 175 
    444     176 185 178 179 180 190 156 161 184 154 186 157 159 189 158 191 
    445     192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 
    446     208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 
    447     224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 
    448     240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ] 
    449   "ISO-8859-2 to Windows-1250 (Central Europe) codepage decoding table") 
    450 (setplist 'cp1250-decode-table 
    451           '(charset latin-iso8859-2 language "Latin-2" offset 160)) 
    452  
    453 (defvar cp1251-decode-table 
    454   [ 
    455     160 168 128 129 170 189 178 175 163 138 140 142 141 173 161 143 
    456     192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 
    457     208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 
    458     224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 
    459     240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 
    460     185 184 144 131 186 190 179 191 188 154 156 158 157 167 162 159 ] 
    461   "ISO-8859-5 to Windows-1251 (Cyrillic) codepage decoding table") 
    462 (setplist 'cp1251-decode-table 
    463           '(charset cyrillic-iso8859-5 language "Cyrillic-ISO" offset 160)) 
    464  
    465 ;; cp1253 is missing nbsp so we cannot quite translate perfectly. It 
    466 ;; also has two micro/mu characters which would require more complex 
    467 ;; processing to accomodate. 
    468 (defvar cp1253-decode-table 
    469   [ 
    470     nil 145 146 163 nil nil 166 167 168 169 nil 171 172 173 nil 151 
    471     176 177 178 179 180 161 162 183 184 185 186 187 188 189 190 191 
    472     192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 
    473     208 209 nil 211 212 213 214 215 216 217 218 219 220 221 222 223 
    474     224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 
    475     240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 nil ] 
    476   "ISO-8859-7 to Windows-1253 (Greek) codepage decoding table") 
    477 (setplist 'cp1253-decode-table 
    478           '(charset greek-iso8859-7 language "Greek" offset 160)) 
    479  
    480 ;; Since Latin-7 is not yet official, and Emacs does not support it, 
    481 ;; provide translation between Windows-1257 and Latin-4 the best we 
    482 ;; can. 
    483 (defvar cp1257-decode-table 
    484   [ 
    485     160 192 nil 170 164 nil 207 167 nil 208 199 204 nil 173 222 nil 
    486     176 224 nil 186 nil nil 239 nil nil 240 231 236 nil nil 254 nil 
    487     194 nil nil nil 196 197 175 193 200 201 198 nil 203 nil nil 206 
    488     nil 210 212 205 nil 213 214 215 168 216 nil nil 220 nil 219 223 
    489     226 nil nil nil 228 229 191 225 232 233 230 nil 235 nil nil 238 
    490     nil 242 244 237 nil 245 246 247 184 248 nil nil 252 nil 251 nil ] 
    491   "ISO-8859-4 to Windows-1257 (Baltic) codepage decoding table") 
    492 (setplist 'cp1257-decode-table 
    493           '(charset latin-iso8859-4 language "Latin-4" offset 160)) 
    494  
    495413;;;###autoload 
    496414(defun cp-make-coding-systems-for-codepage (codepage iso-name offset) 
     
    519437    ;; one-column charsets, and some Japanese character for 
    520438    ;; wide-column charsets.  CCL encoder convert that Japanese 
    521     ;; character to either dos-unsupported-char-glyph or "??". 
     439    ;; character to "??". 
    522440    (let ((tbl (char-table-extra-slot (symbol-value nonascii-table) 0)) 
    523           (undef (if (eq system-type 'ms-dos) 
    524                      (if dos-unsupported-char-glyph 
    525                          (logand dos-unsupported-char-glyph 255) 
    526                        127) 
    527                    ??)) 
    528441          (charsets (delq 'ascii (delq iso-name 
    529442                                       (copy-sequence charset-list)))) 
     
    531444      (while charsets 
    532445        (aset tbl (make-char (car charsets)) 
    533               (if (= (charset-width (car charsets)) 1) undef wide-column-char)) 
     446              (if (= (charset-width (car charsets)) 1) ?? wide-column-char)) 
    534447        (setq charsets (cdr charsets)))) 
    535448    (define-translation-table decode-translation 
     
    591504        (lambda (sym) 
    592505          (if (and (boundp sym) 
    593                    (string-match "\\`cp\\([1-9][0-9][0-9][0-9]?\\)-decode-table\\'" 
     506                   (string-match "\\`cp\\([1-9][0-9][0-9]\\)-decode-table\\'" 
    594507                                 (setq sname (symbol-name sym))) 
    595508                   (vectorp (symbol-value sym))