-;;; mel-ccl.el: CCL based encoder/decoder of Quoted-Printable
-;;; and Q-encoding
+;;; mel-q-ccl.el --- Quoted-Printable encoder/decoder using CCL.
;; Copyright (C) 1998 Tanaka Akira
;; 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.
(eval-when-compile
+(defvar eof-block-branches)
+(defvar eof-block-reg)
(defun mel-ccl-set-eof-block (branch)
(let ((p (assoc branch eof-block-branches)))
(unless p
eof-block-branches (cons p eof-block-branches)))
`(,eof-block-reg = ,(cdr p))))
+)
+
+(eval-when-compile
(defun mel-ccl-try-to-read-crlf (input-crlf reg
succ
,succ
,crlf-fail))))
+)
+
+(eval-when-compile
+
;; Generated CCL program works not properly on 20.2 because CCL_EOF_BLOCK
;; is not executed.
(defun mel-ccl-encode-quoted-printable-generic (input-crlf output-crlf)
(defun quoted-printable-ccl-encode-region (start end)
"Encode the region from START to END with quoted-printable encoding."
- (interactive "r")
+ (interactive "*r")
(decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
(defun quoted-printable-ccl-insert-encoded-file (filename)
"Encode contents of the file named as FILENAME, and insert it."
- (interactive (list (read-file-name "Insert encoded file: ")))
+ (interactive "*fInsert encoded file: ")
(insert-file-contents-as-coding-system
'mel-ccl-quoted-printable-lf-lf-rev filename))
(defun quoted-printable-ccl-decode-region (start end)
"Decode the region from START to END with quoted-printable
encoding."
- (interactive "r")
+ (interactive "*r")
(encode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
-(defun quoted-printable-ccl-write-decoded-region
- (start end filename)
+(defun quoted-printable-ccl-write-decoded-region (start end filename)
"Decode quoted-printable encoded current region and write out to FILENAME."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(write-region-as-coding-system 'mel-ccl-quoted-printable-lf-lf-rev
start end filename))
(unless (featurep 'xemacs)
(defun q-encoding-ccl-encoded-length (string &optional mode)
(let ((status [nil nil nil nil nil nil nil nil nil]))
- (fillarray status nil)
+ (fillarray status nil) ; XXX: Is this necessary?
(ccl-execute-on-string
(cond
((eq mode 'text) 'mel-ccl-count-uq)
'q-encoding-ccl-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "Q"))
- (if (and (string-match Q-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" Q-encoded-text-regexp "\\'"))
+ string)
(q-encoding-ccl-decode-string string)
(error "Invalid encoded-text %s" string)))
(provide 'mel-q-ccl)
-;;; mel-q-ccl.el ends here
+;;; mel-q-ccl.el ends here.