* lex.el (lex-gen-ccel-unibyte-automata-state): Jump start of loop
[elisp/flim.git] / mel-b.el
index dd59d7e..e9a382a 100644 (file)
--- a/mel-b.el
+++ b/mel-b.el
@@ -150,7 +150,6 @@ external decoder is called.")
       )))
 
 (defun base64-internal-decode-string (string)
-  "Decode STRING which is encoded in base64, and return the result."
   (let ((len (length string))
        (i 0)
        dest)
@@ -188,8 +187,6 @@ external decoder is called.")
                    ))))))))))
     dest))
 
-(defalias 'base64-decode-string 'base64-internal-decode-string)
-
 
 ;;; @ base64 encoder/decoder for region
 ;;;
@@ -237,6 +234,17 @@ external decoder is called.")
                              t t nil (cdr base64-external-decoder))
                       )))
 
+(defun base64-external-decode-string (string)
+  (with-temp-buffer
+    (insert string)
+    (as-binary-process (apply (function call-process-region)
+                             (point-min) (point-max)
+                             (car base64-external-decoder)
+                             t t nil (cdr base64-external-decoder))
+                      )
+    (buffer-string)))
+
+
 (defun base64-encode-region (start end)
   "Encode current region by base64.
 START and END are buffer positions.
@@ -267,6 +275,20 @@ metamail or XEmacs package)."
     (base64-internal-decode-region start end)
     ))
 
+(defun base64-decode-string (string)
+  "Decode STRING which is encoded in base64, and return the result.
+This function calls internal base64 decoder if size of STRING 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)."
+  (interactive "r")
+  (if (and base64-internal-decoding-limit
+          (> (length string) base64-internal-decoding-limit))
+      (base64-external-decode-string string)
+    (base64-internal-decode-string string)
+    ))
+
 
 ;;; @ base64 encoder/decoder for file
 ;;;