This commit was generated by cvs2svn to compensate for changes in r43, which
authormorioka <morioka>
Sun, 11 Jan 1998 17:22:45 +0000 (17:22 +0000)
committermorioka <morioka>
Sun, 11 Jan 1998 17:22:45 +0000 (17:22 +0000)
included commits to RCS files with non-trunk default branches.

README.en [new file with mode: 0644]
mel-dl.el [new file with mode: 0644]

diff --git a/README.en b/README.en
new file mode 100644 (file)
index 0000000..f9d4e3c
--- /dev/null
+++ b/README.en
@@ -0,0 +1,262 @@
+[README for MEL (English Version)]
+by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+$Id: README.en,v 1.8 1997-05-15 05:43:48 morioka Exp $
+
+What's MEL
+===========
+
+  MEL stands for "MIME Encoding Library".  It consists of following
+  modules:
+
+       mel.el   --- main module
+       mel-b.el --- base64 (b-encoding) encoder/decoder
+       mel-q.el --- quoted-printable and q-encoding encoder/decoder
+       mel-u.el --- unofficial module for uuencode
+       mel-g.el --- unofficial module for gzip64
+
+
+Installation
+============
+
+(0) before installing it, please install APEL package.  APEL package
+    is available at:
+
+       ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
+
+(1-a) run in expanded place
+
+  If you don't want to install other directories, please do only
+  following:
+
+       % make
+
+  You can specify the emacs command name, for example
+
+       % make install EMACS=xemacs
+
+  If `EMACS=...' is omitted, EMACS=emacs is used.
+
+(1-b) make install
+
+  If you want to install other directories, please do following:
+
+       % make install
+
+  You can specify the emacs command name, for example
+
+       % make install EMACS=xemacs
+
+  If `EMACS=...' is omitted, EMACS=emacs is used.
+
+  You can specify the prefix of the directory tree for Emacs Lisp
+  programs and shell scripts, for example:
+
+       % make install PREFIX=~/
+
+  If `PREFIX=...' is omitted, the prefix of the directory tree of the
+  specified emacs command is used (perhaps /usr/local).
+
+  For example, if PREFIX=/usr/local and EMACS 19.34 is specified, it
+  will create the following directory tree:
+
+       /usr/local/share/emacs/site-lisp/mel/   --- MEL
+
+  You can specify site-lisp directory, for example
+
+       % make install LISPDIR=~/share/emacs/lisp
+
+  If `LISPDIR=...' is omitted, site-lisp directory of the specified
+  emacs command is used (perhaps /usr/local/share/emacs/site-lisp or
+  /usr/local/lib/xemacs/site-lisp).
+
+  You can specify other optional settings by editing the file
+  MEL-CFG.  Please read comments in it.
+
+
+load-path (for Emacs or MULE)
+=============================
+
+  If you are using Emacs or Mule, please add directory of MEL to
+  load-path.  If you install by default setting, you can write
+  subdirs.el for example:
+
+  --------------------------------------------------------------------
+  (normal-top-level-add-to-load-path '("apel" "mel"))
+  --------------------------------------------------------------------
+
+  If you are using XEmacs, there are no need of setting about
+  load-path.
+
+
+How to use
+==========
+
+Region
+------
+
+Command mime-encode-region (START END ENCODING)
+
+  Encode region START to END of current buffer using ENCODING.
+
+Command mime-decode-region (start end encoding)
+
+  Decode region START to END of current buffer using ENCODING.
+
+Command base64-encode-region (start end)
+
+  Encode current region by base64.
+  START and END are buffer positions.
+
+  This function calls internal base64 encoder if size of region is
+  smaller than `base64-internal-encoding-limit', otherwise it calls
+  external base64 encoder specified by `base64-external-encoder'.  In
+  this case, you must install the program (maybe mmencode included in
+  metamail or XEmacs package).
+
+Command base64-decode-region (start end)
+
+  Decode current region by base64.
+  START and END are buffer positions.
+
+  This function calls internal base64 decoder if size of region is
+  smaller than `base64-internal-decoding-limit', otherwise it calls
+  external base64 decoder specified by `base64-external-decoder'.  In
+  this case, you must install the program (maybe mmencode included in
+  metamail or XEmacs package).
+
+Command quoted-printable-encode-region (start end)
+
+  Encode current region by quoted-printable.
+  START and END are buffer positions.
+
+  This function calls internal quoted-printable encoder if size of
+  region is smaller than `quoted-printable-internal-encoding-limit',
+  otherwise it calls external quoted-printable encoder specified by
+  `quoted-printable-external-encoder'.  In this case, you must install
+  the program (maybe mmencode included in metamail or XEmacs package).
+
+Command quoted-printable-decode-region (start end)
+
+  Decode current region by quoted-printable.
+  START and END are buffer positions.
+
+  This function calls internal quoted-printable decoder if size of
+  region is smaller than `quoted-printable-internal-decoding-limit',
+  otherwise it calls external quoted-printable decoder specified by
+  `quoted-printable-external-decoder'.  In this case, you must install
+  the program (maybe mmencode included in metamail or XEmacs package).
+
+Command uuencode-encode-region (start end)
+
+  Encode region START to END of current buffer using uuencode.
+
+Command uuencode-decode-region (start end)
+
+  Decode region START to END of current buffer using uuencode.
+
+Command gzip64-encode-region (start end)
+
+  Encode region START to END of current buffer using x-gzip64.
+
+Command gzip64-decode-region (start end)
+
+  Decode region START to END of current buffer using x-gzip64.
+
+Variable mime-encoding-method-alist
+
+  Alist of encoding vs. corresponding method to encode region.
+  Each element looks like (STRING . FUNCTION) or (STRING . nil).
+  STRING is content-transfer-encoding.
+  FUNCTION is region encoder and nil means not to encode.
+
+Variable mime-decoding-method-alist
+
+  Alist of encoding vs. corresponding method to decode region.
+  Each element looks like (STRING . FUNCTION).
+  STRING is content-transfer-encoding.
+  FUNCTION is region decoder.
+
+File
+----
+
+Command mime-insert-encoded-file (FILENAME ENCODING)
+
+  Insert file FILENAME encoded by ENCODING format.
+
+Command base64-insert-encoded-file (FILENAME)
+
+  Encode contents of file FILENAME to base64, and insert the result.
+
+  It calls external base64 encoder specified by
+  `base64-external-encoder'.  So you must install the program (maybe
+  mmencode included in metamail or XEmacs package).
+
+Command quoted-printable-insert-encoded-file (FILENAME)
+
+  Insert quoted-printable encoded file.
+
+Command uuencode-insert-encoded-file (FILENAME)
+
+  Insert uuencode encoded file.
+
+Command gzip64-insert-encoded-file (FILENAME)
+
+  Insert gzip64 encoded file.
+
+Variable mime-file-encoding-method-alist
+
+  Alist of encoding vs. corresponding method to insert encoded file.
+  Each element looks like (STRING . FUNCTION).
+  STRING is content-transfer-encoding.
+  FUNCTION is function to insert encoded file.
+
+String
+------
+
+Function base64-encode-string (STRING)
+
+  Encode STRING to base64, and return the result.
+
+Function base64-decode-string (STRING)
+
+  Decode STRING which is encoded in base64, and return the result.
+
+Function q-encoding-encode-string (STRING &optional MODE)
+
+  Encode STRING to Q-encoding of encoded-word, and return the result.
+  MODE allows `text', `comment', `phrase' or nil.  Default value is
+  `phrase'.
+
+Function q-encoding-decode-string (STRING)
+
+  Decode STRING which is encoded in Q-encoding and return the result.
+
+Function base64-encoded-length (STRING)
+
+  Return length of base64 encoded STRING.
+
+Function q-encoded-length (STRING &optional MODE)
+
+  Return length of Q-encoding encoded STRING.
+  MODE allows `text', `comment', `phrase' or nil.  Default value is
+  `phrase'.
+
+
+Bug reports
+===========
+
+  If you write bug-reports and/or suggestions for improvement, please
+  send them to the tm Mailing List:
+
+       bug-tm-en@chamonix.jaist.ac.jp  (English)
+       bug-tm-ja@chamonix.jaist.ac.jp  (Japanese)
+
+  Via the tm ML, you can report tm bugs, obtain the latest release of
+  tm, and discuss future enhancements to tm. To join the tm ML, send
+  e-mail to
+
+       tm-ja-admin@chamonix.jaist.ac.jp        (Japanese)
+       tm-en-admin@chamonix.jaist.ac.jp        (English)
+
+  Since the user registration is done manually, please write the mail
+  body in human-recognizable language (^_^).
diff --git a/mel-dl.el b/mel-dl.el
new file mode 100644 (file)
index 0000000..e42635b
--- /dev/null
+++ b/mel-dl.el
@@ -0,0 +1,123 @@
+;;; mel-dl.el: Base64 encoder/decoder using DL module
+
+;; Copyright (C) 1998 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version: $Id: mel-dl.el,v 1.1 1998-01-11 16:21:43 morioka Exp $
+;; Keywords: MIME, Base64
+
+;; This file is part of MEL (MIME Encoding 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:
+
+(require 'emu)
+
+(defvar base64-dl-module
+  (expand-file-name "base64.so" exec-directory))
+
+(defvar base64-dl-handle
+  (and (file-exists-p base64-dl-module)
+       (dynamic-link base64-dl-module)))
+
+(dynamic-call "emacs_base64_init" base64-dl-handle)
+
+(defalias 'base64-encode-string 'encode-base64-string)
+(defalias 'base64-decode-string 'decode-base64-string)
+
+(defun base64-encode-region (start end)
+  "Encode current region by base64.
+START and END are buffer positions."
+  (interactive "r")
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (let ((str (buffer-substring start end)))
+       (delete-region start end)
+       (insert (encode-base64-string str))
+       )
+      (or (bolp)
+         (insert "\n")
+         )
+      )))
+
+(defun base64-decode-region (start end)
+  "Decode current region by base64.
+START and END are buffer positions."
+  (interactive "r")
+  (save-excursion
+    (save-restriction
+      (narrow-to-region start end)
+      (goto-char (point-min))
+      (while (looking-at ".*\n")
+       (condition-case err
+           (replace-match
+            (decode-base64-string
+             (buffer-substring (match-beginning 0) (1- (match-end 0))))
+            t t)
+         (error
+          (prog1
+              (message (nth 1 err))
+            (replace-match "")))))
+      (if (looking-at ".*$")
+         (condition-case err
+             (replace-match
+              (decode-base64-string
+               (buffer-substring (match-beginning 0) (match-end 0)))
+              t t)
+           (error
+            (prog1
+                (message (nth 1 err))
+              (replace-match "")))
+           ))
+      )))
+
+
+;;; @ base64 encoder/decoder for file
+;;;
+
+(defvar base64-external-encoder '("mmencode")
+  "*list of base64 encoder program name and its arguments.")
+
+(defun base64-insert-encoded-file (filename)
+  "Encode contents of file FILENAME to base64, and insert the result.
+It calls external base64 encoder specified by
+`base64-external-encoder'.  So you must install the program (maybe
+mmencode included in metamail or XEmacs package)."
+  (interactive (list (read-file-name "Insert encoded file: ")))
+  (apply (function call-process) (car base64-external-encoder)
+        filename t nil (cdr base64-external-encoder))
+  )
+
+
+;;; @ etc
+;;;
+
+(defun base64-encoded-length (string)
+  (let ((len (length string)))
+    (* (+ (/ len 3)
+         (if (= (mod len 3) 0) 0 1)
+         ) 4)
+    ))
+
+
+;;; @ end
+;;;
+
+(provide 'mel-dl)
+
+;;; mel-dl.el ends here.