From 5c78ed5408800e5fb3464a824214513871e28fae Mon Sep 17 00:00:00 2001 From: morioka Date: Sun, 20 Sep 1998 05:57:18 +0000 Subject: [PATCH] - Rename mel-dl.el to mel-b-dl.el. - Move `mel-define-service' from mel.el to mime-def.el. --- FLIM-ELS | 2 +- README.en | 31 ++++++++-------- mel-dl.el | 123 ------------------------------------------------------------- mel.el | 13 +------ 4 files changed, 18 insertions(+), 151 deletions(-) delete mode 100644 mel-dl.el diff --git a/FLIM-ELS b/FLIM-ELS index 5dee670..db6b59d 100644 --- a/FLIM-ELS +++ b/FLIM-ELS @@ -12,7 +12,7 @@ mailcap)) (if (fboundp 'dynamic-link) - (setq flim-modules (cons 'mel-dl flim-modules)) + (setq flim-modules (cons 'mel-b-dl flim-modules)) ) ;;; FLIM-ELS ends here diff --git a/README.en b/README.en index 9d90e48..81d8b20 100644 --- a/README.en +++ b/README.en @@ -11,21 +11,22 @@ What's FLIM mime.el --- MIME library - mime-def.el --- Definitions about MIME format - - mime-parse.el --- MIME parser - - mel.el --- MIME encoder/decoder - mel-dl.el --- base64 (b-encoding) encoder/decoder - (for Emacs 20 with dynamic loading support) - mel-b.el --- base64 (b-encoding) encoder/decoder - (for other emacsen) - mel-q.el --- quoted-printable and q-encoding encoder/decoder - mel-u.el --- unofficial module for uuencode - mel-g.el --- unofficial module for gzip64 - - eword-decode.el --- encoded-word decoder - eword-encode.el --- encoded-word encoder + mime-def.el --- Definitions about MIME format + + mime-parse.el --- MIME parser + + mel.el --- MIME encoder/decoder + mel-b-dl.el --- base64 (B-encoding) encoder/decoder + (for Emacs 20 with dynamic loading support) + mel-b.el --- base64 (B-encoding) encoder/decoder + (for other emacsen) + mel-q.el --- quoted-printable and Q-encoding + encoder/decoder + mel-u.el --- unofficial module for uuencode + mel-g.el --- unofficial module for gzip64 + + eword-decode.el --- encoded-word decoder + eword-encode.el --- encoded-word encoder mailcap.el --- mailcap parser and utility diff --git a/mel-dl.el b/mel-dl.el deleted file mode 100644 index 1995d5d..0000000 --- a/mel-dl.el +++ /dev/null @@ -1,123 +0,0 @@ -;;; mel-dl.el: Base64 encoder/decoder using DL module - -;; Copyright (C) 1998 Free Software Foundation, Inc. - -;; Author: MORIOKA Tomohiko -;; 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) -(require 'mime-def) - -(eval-and-compile - (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) - ) - -(defun base64-encode-region (start end) - "Encode current region by base64. -START and END are buffer positions." - (interactive "r") - (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") - (let ((str (buffer-substring start end))) - (delete-region start end) - (condition-case err - (insert (decode-base64-string str)) - (error (message (nth 1 err))) - ))) - -(defalias 'base64-encode-string 'encode-base64-string) -(defalias 'base64-decode-string 'decode-base64-string) - - -(mel-define-method-function (mime-encode-string string (nil "base64")) - 'encode-base64-string) -(mel-define-method-function (mime-decode-string string (nil "base64")) - 'decode-base64-string) -(mel-define-method-function (mime-encode-region start end (nil "base64")) - 'base64-encode-region) -(mel-define-method-function (mime-decode-region start end (nil "base64")) - 'base64-decode-region) - -(mel-define-method-function (encoded-text-encode-string string (nil "B")) - 'encode-base64-string) - -(mel-define-method encoded-text-decode-string (string (nil "B")) - (if (and (string-match B-encoded-text-regexp string) - (string= string (match-string 0 string))) - (decode-base64-string string) - (error "Invalid encoded-text %s" string))) - - -;;; @ base64 encoder/decoder for file -;;; - -(mel-define-method mime-insert-encoded-file (filename (nil "base64")) - "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: "))) - (insert (encode-base64-string - (with-temp-buffer - (insert-file-contents-as-binary filename) - (buffer-string)))) - (or (bolp) - (insert "\n")) - ) - -(mel-define-method mime-write-decoded-region (start end filename - (nil "base64")) - "Decode and write current region encoded by base64 into FILENAME. -START and END are buffer positions." - (interactive - (list (region-beginning) (region-end) - (read-file-name "Write decoded region to file: "))) - (let ((str (buffer-substring start end))) - (with-temp-buffer - (insert (decode-base64-string str)) - (write-region-as-binary (point-min) (point-max) filename) - ))) - - -;;; @ end -;;; - -(provide 'mel-dl) - -;;; mel-dl.el ends here. diff --git a/mel.el b/mel.el index 43b3b65..d9ccfc6 100644 --- a/mel.el +++ b/mel.el @@ -54,17 +54,6 @@ ) f)))) -(defmacro mel-define-service (name args &rest rest) - `(progn - (defvar ,(intern (format "%s-obarray" name)) [nil]) - (defun ,name ,args - ,@rest - (funcall (mel-find-function ',name ,(car (last args))) - ,@(mm-arglist-to-arguments (butlast args))) - ))) - -(put 'mel-define-service 'lisp-indent-function 'defun) - ;;; @ setting for modules ;;; @@ -82,7 +71,7 @@ (mel-use-module 'mel-u '("x-uue" "x-uuencode")) (if base64-dl-module - (mel-use-module 'mel-dl '("base64" "B")) + (mel-use-module 'mel-b-dl '("base64" "B")) ) -- 1.7.10.4