From: okada Date: Sun, 15 Apr 2001 20:11:26 +0000 (+0000) Subject: sync up with flim-1_14 X-Git-Tag: slim-1_14_7~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03a49791badf61ed36a383bf04182c5ee2661cf7;p=elisp%2Fflim.git sync up with flim-1_14 --- diff --git a/ChangeLog b/ChangeLog index e80f2c9..38a7913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,58 @@ +2001-04-15 Shuhei KOBAYASHI + + * eword-decode.el (eword-lexical-analyze-internal): + Fix typo. [cf. ] + +2001-04-10 Akihiro Arisawa + + * std11.el (std11-lexical-analyze): Fix typo. + +2001-03-19 Shuhei KOBAYASHI + + * hmac-md5.el, hmac-sha1.el: Revert to load-time check. + Don't require 'poe. + +2001-03-18 Shuhei KOBAYASHI + + * mel-b-dl.el: Don't do `dynamic-call' at compile-time. + (base64-dl-handle): Don't eval at compile-time. + +2001-03-18 Shuhei KOBAYASHI + + * hmac-md5.el, sha1.el: Update Copyright header. + +2001-03-18 Shuhei KOBAYASHI + + Support for built-in `md5' of Emacs 21. + + * md5.el (md5-dl-module): Moved from md5-dl.el. + Use it for test whether to require 'md5-dl. + + * md5-dl.el: Removed hack for compiler. + (md5-dl-handle): Do `dynamic-link' unconditionally. + (md5-region): Not interactive. + (md5): Removed autoload cookie. + + * sha1.el: Removed hack for compiler. + Use `sha1-dl-module' for test whether to require 'sha1-dl. + (sha1-encode, sha1-encode-binary): Removed compatibility code + for another sha1.el since it was broken. + + * sha1-dl.el: Removed hack for compiler. + (sha1-dl-handle): Do `dynamic-link' unconditionally. + +2001-03-18 Shuhei KOBAYASHI + + * hmac-md5.el: Require 'poe. + Provide 'md5 if built-in `md5' is found. + (md5-binary): Define with `defun-maybe-cond'. + (md5-binary) [v21]: Removed extra arguments. + (hmac-md5-96): New function. + + * hmac-sha1.el: Require 'poe. + (sha1-binary): Define with `defun-maybe'. + (hmac-sha1-96): New function. + 2001-03-11 Shuhei KOBAYASHI * mel-g.el: Update Copyright header. diff --git a/eword-decode.el b/eword-decode.el index 0fc7d33..e4143e6 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -749,7 +749,7 @@ be the result.") ) (setq rest (cdr rest))) (or r - (list (cons 'error (substring string start)) (1+ len))) + (cons (cons 'error (substring string start)) (1+ len))) )) (setq dest (cons (car ret) dest) start (cdr ret)) diff --git a/hmac-md5.el b/hmac-md5.el index 946d1b1..d003b50 100644 --- a/hmac-md5.el +++ b/hmac-md5.el @@ -3,8 +3,6 @@ ;; Copyright (C) 1999, 2001 Free Software Foundation, Inc. ;; Author: Shuhei KOBAYASHI -;; Kenichi OKADA -;; Maintainer: Kenichi OKADA ;; Keywords: HMAC, RFC 2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5 ;; This file is part of FLIM (Faithful Library about Internet Message). @@ -67,29 +65,34 @@ (eval-when-compile (require 'hmac-def)) (require 'hex-util) ; (decode-hex-string STRING) +;; Kludge for Emacs pretest 21.0.90 - 21.0.100 !!! +;; they have `md5' as a built-in function but do not provide 'md5. +(eval-and-compile + (if (and (fboundp 'md5) + (subrp (symbol-function 'md5))) + (provide 'md5))) (require 'md5) ; expects (md5 STRING) -;; We cannot define this function in md5.el because recent XEmacs provides -;; built-in md5 function and provides feature 'md5 at startup. -(if (and (featurep 'xemacs) - (fboundp 'md5) - (subrp (symbol-function 'md5)) - (condition-case nil - ;; `md5' of XEmacs 21 takes 4th arg CODING (and 5th arg NOERROR). - (md5 "" nil nil 'binary) ; => "fb5d2156096fa1f254352f3cc3fada7e" - (error nil))) - ;; XEmacs 21. - (defun md5-binary (string &optional start end) - "Return the MD5 of STRING in binary form." - (decode-hex-string (md5 string start end 'binary))) - ;; not XEmacs 21 and not DL. - (if (not (fboundp 'md5-binary)) - (defun md5-binary (string) - "Return the MD5 of STRING in binary form." - (decode-hex-string (md5 string))))) +;; To share *.elc files between Emacs w/ and w/o DL patch, +;; this check must be done at load-time. +(cond + ((fboundp 'md5-binary) + ;; do nothing. + ) + ((condition-case nil + ;; `md5' of v21 takes 4th arg CODING (and 5th arg NOERROR). + (md5 "" nil nil 'binary) ; => "d41d8cd98f00b204e9800998ecf8427e" + (wrong-number-of-arguments nil)) + (defun md5-binary (string) + "Return the MD5 of STRING in binary form." + (decode-hex-string (md5 string nil nil 'binary)))) + (t + (defun md5-binary (string) + "Return the MD5 of STRING in binary form." + (decode-hex-string (md5 string))))) (define-hmac-function hmac-md5 md5-binary 64 16) ; => (hmac-md5 TEXT KEY) -;; (define-hmac-function hmac-md5-96 md5-binary 64 16 96) +(define-hmac-function hmac-md5-96 md5-binary 64 16 96) (provide 'hmac-md5) diff --git a/hmac-sha1.el b/hmac-sha1.el index ab4f109..70b665f 100644 --- a/hmac-sha1.el +++ b/hmac-sha1.el @@ -67,14 +67,19 @@ (require 'hex-util) ; (decode-hex-string STRING) (require 'sha1) ; expects (sha1 STRING) -;;; For consintency with hmac-md5.el, we define this function here. -(or (fboundp 'sha1-binary) - (defun sha1-binary (string) - "Return the SHA1 of STRING in binary form." - (decode-hex-string (sha1 string)))) +;; To share *.elc files between Emacs w/ and w/o DL patch, +;; this check must be done at load-time. +(cond + ((fboundp 'sha1-binary) + ;; do nothing. + ) + (t + (defun sha1-binary (string) + "Return the SHA1 of STRING in binary form." + (decode-hex-string (sha1 string))))) (define-hmac-function hmac-sha1 sha1-binary 64 20) ; => (hmac-sha1 TEXT KEY) -;; (define-hmac-function hmac-sha1-96 sha1-binary 64 20 96) +(define-hmac-function hmac-sha1-96 sha1-binary 64 20 96) (provide 'hmac-sha1) diff --git a/md5-dl.el b/md5-dl.el index 8473ee2..bcbf897 100644 --- a/md5-dl.el +++ b/md5-dl.el @@ -26,34 +26,19 @@ ;;; Code: -(eval-when-compile - (defun-maybe md5-string (a)) - (defun-maybe dynamic-link (a)) - (defun-maybe dynamic-call (a b))) +(provide 'md5-dl) ; beware of circular dependency. +(eval-when-compile (require 'md5)) ; md5-dl-module. -(defvar md5-dl-module - (if (and (fboundp 'md5-string) - (subrp (symbol-function 'md5-string))) - nil - (if (fboundp 'dynamic-link) - (let ((path (expand-file-name "md5.so" exec-directory))) - (and (file-exists-p path) - path))))) - -(defvar md5-dl-handle - (and (stringp md5-dl-module) - (file-exists-p md5-dl-module) - (dynamic-link md5-dl-module))) +;;; This file is loaded (from "md5.el") only when md5-dl-module is exists. +(defvar md5-dl-handle (dynamic-link md5-dl-module)) ;;; md5-dl-module provides `md5-string'. (dynamic-call "emacs_md5_init" md5-dl-handle) (defun md5-region (beg end) - (interactive "r") (md5-string (buffer-substring-no-properties beg end))) -;;; Note that XEmacs built-in version takes two more args: CODING and NOERROR. -;;;###autoload +;;; Note that v21 `md5' takes two more args: CODING and NOERROR. (defun md5 (object &optional beg end) "Return the MD5 (a secure message digest algorithm) of an object. OBJECT is either a string or a buffer. diff --git a/md5.el b/md5.el index 168236e..8c4d7c0 100644 --- a/md5.el +++ b/md5.el @@ -49,15 +49,27 @@ ;;; Code: +(defvar md5-dl-module + (cond + ((and (fboundp 'md5) + (subrp (symbol-function 'md5))) + nil) + ((fboundp 'dynamic-link) + ;; Should we take care of `dynamic-link-path'? + (let ((path (expand-file-name "md5.so" exec-directory))) + (if (file-exists-p path) + path + nil))) + (t + nil))) + (cond ((and (fboundp 'md5) (subrp (symbol-function 'md5))) - ;; recent XEmacs has `md5' as a built-in function. - ;; (and 'md5 is already provided.) + ;; do nothing. ) - ((and (fboundp 'dynamic-link) - (file-exists-p (expand-file-name "md5.so" exec-directory))) - ;; Emacs with DL patch. + ((and (stringp md5-dl-module) + (file-exists-p md5-dl-module)) (require 'md5-dl)) (t (require 'md5-el))) diff --git a/mel-b-dl.el b/mel-b-dl.el index 47b1b81..c298b14 100644 --- a/mel-b-dl.el +++ b/mel-b-dl.el @@ -26,14 +26,12 @@ (require 'mime-def) -(eval-and-compile - (defvar base64-dl-handle - (and (stringp base64-dl-module) - (file-exists-p base64-dl-module) - (dynamic-link base64-dl-module))) - - (dynamic-call "emacs_base64_init" base64-dl-handle) - ) +(defvar base64-dl-handle + (and (stringp base64-dl-module) + (file-exists-p base64-dl-module) + (dynamic-link base64-dl-module))) + +(dynamic-call "emacs_base64_init" base64-dl-handle) ;; base64-dl-module provides `encode-base64-string' and `decode-base64-string'. (defalias 'base64-encode-string 'encode-base64-string) diff --git a/sha1-dl.el b/sha1-dl.el index b60969a..4716d4d 100644 --- a/sha1-dl.el +++ b/sha1-dl.el @@ -27,15 +27,10 @@ ;;; Code: (provide 'sha1-dl) ; beware of circular dependency. -(eval-when-compile - (require 'sha1) ; sha1-dl-module. - (defun-maybe dynamic-link (a)) - (defun-maybe dynamic-call (a b))) - -(defvar sha1-dl-handle - (and (stringp sha1-dl-module) - (file-exists-p sha1-dl-module) - (dynamic-link sha1-dl-module))) +(eval-when-compile (require 'sha1)) ; sha1-dl-module. + +;;; This file is loaded (from "sha1.el") only when sha1-dl-module exists. +(defvar sha1-dl-handle (dynamic-link sha1-dl-module)) ;;; sha1-dl-module provides `sha1-string' and `sha1-binary'. (dynamic-call "emacs_sha1_init" sha1-dl-handle) diff --git a/sha1.el b/sha1.el index 0e3b7ac..a9e5e9d 100644 --- a/sha1.el +++ b/sha1.el @@ -3,8 +3,6 @@ ;; Copyright (C) 1999, 2001 Free Software Foundation, Inc. ;; Author: Shuhei KOBAYASHI -;; Kenichi OKADA -;; Maintainer: Kenichi OKADA ;; Keywords: SHA1, FIPS 180-1 ;; This file is part of FLIM (Faithful Library about Internet Message). @@ -40,39 +38,27 @@ ;;; Code: -(require 'hex-util) - -(eval-when-compile - (or (fboundp 'sha1-string) - (defun sha1-string (a)))) - (defvar sha1-dl-module - (if (and (fboundp 'sha1-string) - (subrp (symbol-function 'sha1-string))) - nil - (if (fboundp 'dynamic-link) - (let ((path (expand-file-name "sha1.so" exec-directory))) - (and (file-exists-p path) - path))))) + (cond + ((and (fboundp 'sha1) + (subrp (symbol-function 'sha1))) + nil) + ((fboundp 'dynamic-link) + ;; Should we take care of `dynamic-link-path'? + (let ((path (expand-file-name "sha1.so" exec-directory))) + (if (file-exists-p path) + path + nil))) + (t + nil))) (cond - (sha1-dl-module - ;; Emacs with DL patch. + ((and (stringp sha1-dl-module) + (file-exists-p sha1-dl-module)) (require 'sha1-dl)) (t (require 'sha1-el))) -;; compatibility for another sha1.el by Keiichi Suzuki. -(defun sha1-encode (string) - (decode-hex-string - (sha1-string string))) -(defun sha1-encode-binary (string) - (decode-hex-string - (sha1-string string))) - -(make-obsolete 'sha1-encode "It's old API.") -(make-obsolete 'sha1-encode-binary "It's old API.") - (provide 'sha1) ;;; sha1.el ends here diff --git a/std11.el b/std11.el index 051d45a..97f9359 100644 --- a/std11.el +++ b/std11.el @@ -396,7 +396,7 @@ be the result." (null (setq r (funcall func string start)))) (setq rest (cdr rest))) (or r - (list (cons 'error (substring string start)) (1+ len))) + (cons (cons 'error (substring string start)) (1+ len))) )) (setq dest (cons (car ret) dest) start (cdr ret))