More files.
authorSimon Josefsson <jas@extundo.com>
Thu, 26 Sep 2002 04:41:54 +0000 (04:41 +0000)
committerSimon Josefsson <jas@extundo.com>
Thu, 26 Sep 2002 04:41:54 +0000 (04:41 +0000)
pgg/mcs-xmu.el [new file with mode: 0644]
pgg/pces-raw.el [new file with mode: 0644]
pgg/poem-xm.el [new file with mode: 0644]

diff --git a/pgg/mcs-xmu.el b/pgg/mcs-xmu.el
new file mode 100644 (file)
index 0000000..e80c925
--- /dev/null
@@ -0,0 +1,101 @@
+;;; mcs-xmu.el --- Functions to unify ISO646 characters for XEmacs-mule
+
+;; Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Keywords: emulation, compatibility, Mule
+
+;; This file is part of APEL (A Portable Emacs Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;;    This module will be loaded from mcs-xm automatically.
+;;    There is no guarantee that it will work alone.
+
+;;; Code:
+
+(defcustom mime-iso646-character-unification-alist
+  (eval-when-compile
+    (let (dest
+         (i 33))
+      (while (< i 92)
+       (setq dest
+             (cons (cons (char-to-string (make-char 'latin-jisx0201 i))
+                         (format "%c" i))
+                   dest))
+       (setq i (1+ i)))
+      (setq i 93)
+      (while (< i 126)
+       (setq dest
+             (cons (cons (char-to-string (make-char 'latin-jisx0201 i))
+                         (format "%c" i))
+                   dest))
+       (setq i (1+ i)))
+      (nreverse dest)))
+  "Alist unified string vs. canonical string."
+  :group 'i18n
+  :type '(repeat (cons string string)))
+
+(defcustom mime-unified-character-face nil
+  "Face of unified character."
+  :group 'i18n
+  :type 'face)
+
+(defcustom mime-character-unification-limit-size 2048
+  "Limit size to unify characters.  It is referred by the function
+`decode-mime-charset-region-with-iso646-unification'.  If the length of
+the specified region (start end) is larger than its value, the function
+works for only decoding MIME-CHARSET.  If it is nil, size is unlimited."
+  :group 'i18n
+  :type '(radio (integer :tag "Max size")
+               (const :tag "Unlimited" nil)))
+
+(defun decode-mime-charset-region-with-iso646-unification (start end charset
+                                                                lbt)
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (if (prog1
+             (or (null mime-character-unification-limit-size)
+                 (<= (- end start) mime-character-unification-limit-size))
+           (decode-mime-charset-region-default start end charset lbt))
+         (let ((rest mime-iso646-character-unification-alist))
+           (while rest
+             (let ((pair (car rest))
+                   case-fold-search)
+               (goto-char (point-min))
+               (while (search-forward (car pair) nil t)
+                 (let ((str (cdr pair)))
+                   (if mime-unified-character-face
+                       (put-text-property
+                        0 (length str)
+                        'face mime-unified-character-face str))
+                   (replace-match str 'fixed-case 'literal)
+                   )
+                 ))
+             (setq rest (cdr rest)))))
+      )))
+
+
+;;; @ end
+;;;
+
+(require 'product)
+(product-provide (provide 'mcs-xmu) (require 'apel-ver))
+
+;;; mcs-xmu.el ends here
diff --git a/pgg/pces-raw.el b/pgg/pces-raw.el
new file mode 100644 (file)
index 0000000..ada032c
--- /dev/null
@@ -0,0 +1,172 @@
+;;; pces-raw.el --- pces submodule for emacsen without coding-system features
+
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <tomo@m17n.org>
+;; Keywords: emulation, compatibility, Mule
+
+;; This file is part of APEL (A Portable Emacs Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+;;; @ coding-system
+;;;
+
+(defun decode-coding-string (string coding-system)
+  "Decode the STRING which is encoded in CODING-SYSTEM."
+  (copy-sequence string))
+
+(defun encode-coding-string (string coding-system)
+  "Encode the STRING as CODING-SYSTEM."
+  (copy-sequence string))
+
+(defun decode-coding-region (start end coding-system)
+  "Decode the text between START and END which is encoded in CODING-SYSTEM."
+  0)
+
+(defun encode-coding-region (start end coding-system)
+  "Encode the text between START and END to CODING-SYSTEM."
+  0)
+
+(defun detect-coding-region (start end)
+  "Detect coding-system of the text in the region between START and END."
+  )
+
+(defun set-buffer-file-coding-system (coding-system &optional force)
+  "Set buffer-file-coding-system of the current buffer to CODING-SYSTEM."
+  )
+
+
+;;; @ without code-conversion
+;;;
+
+(defmacro as-binary-process (&rest body)
+  (` (let (selective-display)  ; Disable ^M to nl translation.
+       (,@ body))))
+
+(defmacro as-binary-input-file (&rest body)
+  (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
+       (,@ body))))
+
+(defmacro as-binary-output-file (&rest body)
+  (` (let ((emx-binary-mode t)) ; Stop CRLF to LF conversion in OS/2
+       (,@ body))))
+
+(defun write-region-as-binary (start end filename
+                                    &optional append visit lockname)
+  "Like `write-region', q.v., but don't code conversion."
+  (let ((emx-binary-mode t))
+    (write-region start end filename append visit lockname)))
+
+(defun insert-file-contents-as-binary (filename
+                                      &optional visit beg end replace)
+  "Like `insert-file-contents', q.v., but don't code and format conversion.
+Like `insert-file-contents-literary', but it allows find-file-hooks,
+automatic uncompression, etc.
+
+Namely this function ensures that only format decoding and character
+code conversion will not take place."
+  (let ((emx-binary-mode t))
+    ;; Returns list of absolute file name and length of data inserted.
+    (insert-file-contents filename visit beg end replace)))
+
+(defun write-region-as-raw-text-CRLF (start end filename
+                                           &optional append visit lockname)
+  "Like `write-region', q.v., but write as network representation."
+  (let ((the-buf (current-buffer)))
+    (with-temp-buffer
+      (insert-buffer-substring the-buf start end)
+      (goto-char (point-min))
+      (while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
+       (replace-match "\\1\r\n"))
+      (write-region (point-min)(point-max) filename append visit lockname))))
+
+(defalias 'insert-file-contents-as-raw-text 'insert-file-contents)
+
+(defalias 'insert-file-contents-as-raw-text-CRLF 'insert-file-contents)
+
+(defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
+  "Like `find-file-noselect', q.v., but don't code and format conversion."
+  (let ((emx-binary-mode t))
+    (find-file-noselect filename nowarn rawfile)))
+
+(defalias 'find-file-noselect-as-raw-text 'find-file-noselect)
+
+(defalias 'find-file-noselect-as-raw-text-CRLF 'find-file-noselect)
+
+(defun save-buffer-as-binary (&optional args)
+  "Like `save-buffer', q.v., but don't encode."
+  (let ((emx-binary-mode t))
+    (save-buffer args)))
+
+(defun save-buffer-as-raw-text-CRLF (&optional args)
+  "Like `save-buffer', q.v., but save as network representation."
+  (if (buffer-modified-p)
+      (save-restriction
+       (widen)
+       (let ((the-buf (current-buffer))
+             (filename (buffer-file-name)))
+         (if filename
+             (prog1
+                 (with-temp-buffer
+                   (insert-buffer the-buf)
+                   (goto-char (point-min))
+                   (while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
+                     (replace-match "\\1\r\n"))
+                   (setq buffer-file-name filename)
+                   (save-buffer args))
+               (set-buffer-modified-p nil)
+               (clear-visited-file-modtime)))))))
+
+(defun open-network-stream-as-binary (name buffer host service)
+  "Like `open-network-stream', q.v., but don't code conversion."
+  (let ((emx-binary-mode t))
+    (open-network-stream name buffer host service)))
+
+
+;;; @ with code-conversion (but actually it might be not done)
+;;;
+
+(defun insert-file-contents-as-coding-system
+  (coding-system filename &optional visit beg end replace)
+  "Like `insert-file-contents', q.v., but CODING-SYSTEM is used to decode."
+  (insert-file-contents filename visit beg end replace))
+
+(defun write-region-as-coding-system
+  (coding-system start end filename &optional append visit lockname)
+  "Like `write-region', q.v., but CODING-SYSTEM is used to encode."
+  (let (jka-compr-compression-info-list jam-zcat-filename-list)
+    (write-region start end filename append visit lockname)))
+
+(defun find-file-noselect-as-coding-system
+  (coding-system filename &optional nowarn rawfile)
+  "Like `find-file-noselect', q.v., CODING-SYSTEM is used to decode."
+  (find-file-noselect filename nowarn rawfile))
+
+(defun save-buffer-as-coding-system (coding-system &optional args)
+  "Like `save-buffer', q.v., CODING-SYSTEM is used to encode."
+  (save-buffer args))
+
+
+;;; @ end
+;;;
+
+(require 'product)
+(product-provide (provide 'pces-raw) (require 'apel-ver))
+
+;;; pces-raw.el ends here
diff --git a/pgg/poem-xm.el b/pgg/poem-xm.el
new file mode 100644 (file)
index 0000000..798ce14
--- /dev/null
@@ -0,0 +1,94 @@
+;;; poem-xm.el --- poem module for XEmacs-mule; -*-byte-compile-dynamic: t;-*-
+
+;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <tomo@m17n.org>
+;; Keywords: emulation, compatibility, Mule
+
+;; This file is part of APEL (A Portable Emacs Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(eval-when-compile
+  (require 'poe))
+
+
+;;; @ buffer representation
+;;;
+
+(defsubst-maybe set-buffer-multibyte (flag)
+  "Set the multibyte flag of the current buffer to FLAG.
+If FLAG is t, this makes the buffer a multibyte buffer.
+If FLAG is nil, this makes the buffer a single-byte buffer.
+The buffer contents remain unchanged as a sequence of bytes
+but the contents viewed as characters do change.
+\[Emacs 20.3 emulating function]"
+  flag)
+
+
+;;; @ character
+;;;
+
+;; avoid bug of XEmacs
+(or (integerp (car (cdr (split-char ?a))))
+    (defun split-char (char)
+      "Return list of charset and one or two position-codes of CHAR."
+      (let ((charset (char-charset char)))
+       (if (eq charset 'ascii)
+           (list charset (char-int char))
+         (let ((i 0)
+               (len (charset-dimension charset))
+               (code (if (integerp char)
+                         char
+                       (char-int char)))
+               dest)
+           (while (< i len)
+             (setq dest (cons (logand code 127) dest)
+                   code (lsh code -7)
+                   i (1+ i)))
+           (cons charset dest)))))
+    )
+
+(defmacro char-next-index (char index)
+  "Return index of character succeeding CHAR whose index is INDEX."
+  `(1+ ,index))
+
+(defun-maybe char-length (char)
+  "Return indexing length of multi-byte form of CHAR."
+  1)
+
+
+;;; @ string
+;;;
+
+(defun-maybe string-to-int-list (str)
+  (mapcar #'char-int str))
+
+(defun-maybe string-to-char-list (str)
+  (mapcar #'identity str))
+
+(defalias 'looking-at-as-unibyte 'looking-at)
+
+
+;;; @ end
+;;;
+
+(require 'product)
+(product-provide (provide 'poem-xm) (require 'apel-ver))
+
+;;; poem-xm.el ends here