* pccl-om.el (toplevel): Don't require `poem'.
authoryamaoka <yamaoka>
Wed, 16 Dec 1998 02:47:03 +0000 (02:47 +0000)
committeryamaoka <yamaoka>
Wed, 16 Dec 1998 02:47:03 +0000 (02:47 +0000)
Use `code-convert-string' instead of `encode-coding-string' or
`decode-coding-string'.

* poem-om.el (binary): EMACS 20 emulating coding-system for Mule 2.3 based on
Emacs 19.[28-34].
(raw-text): EMACS 20 emulating coding-system based on native CCL for Mule 2.3
based on Emacs 19.[28-34].
(raw-text-dos): Likewise.
(find-file-noselect-as-binary): Separate for some Mules.

ChangeLog
pccl-om.el
poem-om.el

index 1ee197f..5091cd0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1998-12-16  Katsumi Yamaoka   <yamaoka@jpl.org>
+
+       * pccl-om.el (toplevel): Don't require `poem'.
+       Use `code-convert-string' instead of `encode-coding-string' or
+       `decode-coding-string'.
+
+       * poem-om.el (binary): EMACS 20 emulating coding-system for Mule
+       2.3 based on Emacs 19.[28-34].
+       (raw-text): EMACS 20 emulating coding-system based on native CCL
+       for Mule 2.3 based on Emacs 19.[28-34].
+       (raw-text-dos): Likewise.
+       (find-file-noselect-as-binary): Separate for some Mules.
+
 1998-12-15  Tanaka Akira  <akr@jaist.ac.jp>
 
        * pccl-20.el: Do not require 'poem.
index bb9204e..cb12774 100644 (file)
@@ -26,8 +26,6 @@
 
 ;;; Code:
 
-(require 'poem)
-
 (eval-when-compile (require 'ccl))
 (require 'broken)
 
@@ -82,19 +80,19 @@ If CCL-PROG is symbol, it is dereferenced.
 
 (broken-facility ccl-execute-eof-block-on-encoding-null
   "Emacs forgets executing CCL_EOF_BLOCK with encoding on empty input."
-  (equal (encode-coding-string "" 'test-ccl-eof-block-cs) "[EOF]"))
+  (equal (code-convert-string "" *internal* 'test-ccl-eof-block-cs) "[EOF]"))
 
 (broken-facility ccl-execute-eof-block-on-encoding-some
   "Emacs forgets executing CCL_EOF_BLOCK with encoding on non-empty input."
-  (equal (encode-coding-string "a" 'test-ccl-eof-block-cs) "a[EOF]"))
+  (equal (code-convert-string "a" *internal* 'test-ccl-eof-block-cs) "a[EOF]"))
 
 (broken-facility ccl-execute-eof-block-on-decoding-null
   "Emacs forgets executing CCL_EOF_BLOCK with decoding on empty input."
-  (equal (decode-coding-string "" 'test-ccl-eof-block-cs) "[EOF]"))
+  (equal (code-convert-string "" 'test-ccl-eof-block-cs *internal*) "[EOF]"))
 
 (broken-facility ccl-execute-eof-block-on-decoding-some
   "Emacs forgets executing CCL_EOF_BLOCK with decoding on non-empty input."
-  (equal (decode-coding-string "a" 'test-ccl-eof-block-cs) "a[EOF]"))
+  (equal (code-convert-string "a" 'test-ccl-eof-block-cs *internal*) "a[EOF]"))
 
 (broken-facility ccl-execute-eof-block-on-encoding
   "Emacs may forget executing CCL_EOF_BLOCK with encoding."
index 9875330..710f1ce 100644 (file)
 
 (defalias 'set-buffer-file-coding-system 'set-file-coding-system)
 
+(when (and (boundp 'MULE) running-emacs-19)
+  (define-ccl-program ccl-decode-raw-text
+    '(1
+      ((read r1 r0)
+       (loop
+        (r2 = (r1 == ?\x0d))
+        (r2 &= (r0 == ?\x0a))
+        (if r2
+            ((write ?\x0a)
+             (read r1 r0)
+             (repeat))
+          ((write r1)
+           (r1 = (r0 + 0))
+           (read r0)
+           (repeat)
+           ))))
+      (write r1))
+    "Convert line-break code from CRLF to LF.")
+
+  (define-ccl-program ccl-encode-raw-text
+    '(1
+      ((read r0)
+       (loop (write-read-repeat r0))))
+    "Pass through without any conversions.")
+
+  (define-ccl-program ccl-encode-raw-text-CRLF
+    '(2
+      ((loop
+        (read r0)
+        (if (r0 == ?\x0a)
+            (write "\x0d\x0a")
+          (write r0))
+        (repeat))))
+    "Convert line-break code from LF to CRLF.")
+
+  (make-coding-system
+   'raw-text 4 ?=
+   "No conversion"
+   nil
+   (cons ccl-decode-raw-text ccl-encode-raw-text))
+
+  (make-coding-system
+   'raw-text-dos 4 ?=
+   "No conversion"
+   nil
+   (cons ccl-decode-raw-text ccl-encode-raw-text-CRLF))
+
+  (make-coding-system
+   'binary nil ?=
+   "No conversion")
+  )
 
 ;;; @ without code-conversion
 ;;;
@@ -202,6 +253,10 @@ find-file-hooks, etc.
          (replace-match "\\1\r\n"))
        (write-region-as-binary (point-min)(point-max)
                                filename append visit lockname))))
+
+  (defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
+    "Like `find-file-noselect', q.v., but don't code and format conversion."
+    (as-binary-input-file (find-file-noselect filename nowarn rawfile)))
   )
  (t
   ;; for MULE 2.3 based on Emacs 19.28.
@@ -222,11 +277,11 @@ find-file-hooks, etc.
          (replace-match "\\1\r\n"))
        (write-region-as-binary (point-min)(point-max)
                                filename append visit))))
-  ))
 
-(defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
-  "Like `find-file-noselect', q.v., but don't code and format conversion."
-  (as-binary-input-file (find-file-noselect filename nowarn rawfile)))
+  (defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
+    "Like `find-file-noselect', q.v., but don't code and format conversion."
+    (as-binary-input-file (find-file-noselect filename nowarn)))
+  ))
 
 (defun find-file-noselect-as-raw-text (filename &optional nowarn rawfile)
   "Like `find-file-noselect', q.v., but it does not code and format conversion