projects
/
elisp
/
flim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
release.
[elisp/flim.git]
/
mel-b-ccl.el
diff --git
a/mel-b-ccl.el
b/mel-b-ccl.el
index
02fd3e3
..
7e31dfa
100644
(file)
--- a/
mel-b-ccl.el
+++ b/
mel-b-ccl.el
@@
-1,8
+1,8
@@
-;;; mel-b-ccl.el: CCL based encoder/decoder of Base64
+;;; mel-b-ccl.el --- Base64 encoder/decoder using CCL.
-;; Copyright (C) 1998 Tanaka Akira
+;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc.
-;; Author: Tanaka Akira <akr@jaist.ac.jp>
+;; Author: Tanaka Akira <akr@m17n.org>
;; Created: 1998/9/17
;; Keywords: MIME, Base64
;; Created: 1998/9/17
;; Keywords: MIME, Base64
@@
-19,7
+19,7
@@
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; 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
+;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
@@
-288,9
+288,10
@@
abcdefghijklmnopqrstuvwxyz\
(&optional quantums-per-line output-crlf terminate-with-newline)
`(2
((r3 = 0)
(&optional quantums-per-line output-crlf terminate-with-newline)
`(2
((r3 = 0)
+ (r2 = 0)
+ (read r1)
(loop
(loop
- (r2 = 0)
- (read-branch
+ (branch
r1
,@(mapcar
(lambda (r1)
r1
,@(mapcar
(lambda (r1)
@@
-331,6
+332,8
@@
abcdefghijklmnopqrstuvwxyz\
(nth r1 mel-ccl-64-to-256-table))
mel-ccl-64-table)))
(r3 += 1)
(nth r1 mel-ccl-64-to-256-table))
mel-ccl-64-table)))
(r3 += 1)
+ (r2 = 0)
+ (read r1)
,@(when quantums-per-line
`((if (r3 == ,quantums-per-line)
((write ,(if output-crlf "\r\n" "\n"))
,@(when quantums-per-line
`((if (r3 == ,quantums-per-line)
((write ,(if output-crlf "\r\n" "\n"))
@@
-398,19
+401,27
@@
abcdefghijklmnopqrstuvwxyz\
(unless-broken ccl-execute-eof-block-on-decoding-some
(unless-broken ccl-execute-eof-block-on-decoding-some
- (defun base64-ccl-encode-string (string)
+ (defun base64-ccl-encode-string (string &optional no-line-break)
"Encode STRING with base64 encoding."
"Encode STRING with base64 encoding."
- (decode-coding-string string 'mel-ccl-base64-lf-rev))
+ (if no-line-break
+ (decode-coding-string string 'mel-ccl-b-rev)
+ (decode-coding-string string 'mel-ccl-base64-lf-rev)))
+ (defalias-maybe 'base64-encode-string 'base64-ccl-encode-string)
- (defun base64-ccl-encode-region (start end)
+ (defun base64-ccl-encode-region (start end &optional no-line-break)
"Encode region from START to END with base64 encoding."
"Encode region from START to END with base64 encoding."
- (interactive "r")
- (decode-coding-region start end 'mel-ccl-base64-lf-rev))
+ (interactive "*r")
+ (if no-line-break
+ (decode-coding-region start end 'mel-ccl-b-rev)
+ (decode-coding-region start end 'mel-ccl-base64-lf-rev)))
+ (defalias-maybe 'base64-encode-region 'base64-ccl-encode-region)
(defun base64-ccl-insert-encoded-file (filename)
"Encode contents of file FILENAME to base64, and insert the result."
(defun base64-ccl-insert-encoded-file (filename)
"Encode contents of file FILENAME to base64, and insert the result."
- (interactive (list (read-file-name "Insert encoded file: ")))
- (insert-file-contents-as-coding-system 'mel-ccl-base64-lf-rev filename))
+ (interactive "*fInsert encoded file: ")
+ (let ((coding-system-for-read 'mel-ccl-base64-lf-rev)
+ format-alist)
+ (insert-file-contents filename)))
(mel-define-method-function (mime-encode-string string (nil "base64"))
'base64-ccl-encode-string)
(mel-define-method-function (mime-encode-string string (nil "base64"))
'base64-ccl-encode-string)
@@
-427,18
+438,20
@@
abcdefghijklmnopqrstuvwxyz\
(defun base64-ccl-decode-string (string)
"Decode base64 encoded STRING"
(encode-coding-string string 'mel-ccl-b-rev))
(defun base64-ccl-decode-string (string)
"Decode base64 encoded STRING"
(encode-coding-string string 'mel-ccl-b-rev))
+(defalias-maybe 'base64-decode-string 'base64-ccl-decode-string)
(defun base64-ccl-decode-region (start end)
"Decode base64 encoded the region from START to END."
(defun base64-ccl-decode-region (start end)
"Decode base64 encoded the region from START to END."
- (interactive "r")
+ (interactive "*r")
(encode-coding-region start end 'mel-ccl-b-rev))
(encode-coding-region start end 'mel-ccl-b-rev))
+(defalias-maybe 'base64-decode-region 'base64-ccl-decode-region)
(defun base64-ccl-write-decoded-region (start end filename)
"Decode the region from START to END and write out to FILENAME."
(defun base64-ccl-write-decoded-region (start end filename)
"Decode the region from START to END and write out to FILENAME."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
- (write-region-as-coding-system 'mel-ccl-b-rev start end filename))
+ (interactive "*r\nFWrite decoded region to file: ")
+ (let ((coding-system-for-write 'mel-ccl-b-rev)
+ jka-compr-compression-info-list jam-zcat-filename-list)
+ (write-region start end filename)))
(mel-define-method-function (mime-decode-string string (nil "base64"))
'base64-ccl-decode-string)
(mel-define-method-function (mime-decode-string string (nil "base64"))
'base64-ccl-decode-string)
@@
-449,8
+462,9
@@
abcdefghijklmnopqrstuvwxyz\
'base64-ccl-write-decoded-region)
(mel-define-method encoded-text-decode-string (string (nil "B"))
'base64-ccl-write-decoded-region)
(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)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" B-encoded-text-regexp "\\'"))
+ string)
(base64-ccl-decode-string string)
(error "Invalid encoded-text %s" string)))
(base64-ccl-decode-string string)
(error "Invalid encoded-text %s" string)))
@@
-460,4
+474,4
@@
abcdefghijklmnopqrstuvwxyz\
(provide 'mel-b-ccl)
(provide 'mel-b-ccl)
-;;; mel-b-ccl.el ends here
+;;; mel-b-ccl.el ends here.