pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

(devel/flim) Ancient version, but OK with emacs28 for now



Module Name:	pkgsrc-wip
Committed By:	Makoto Fujiwara <makoto%if.t.u-tokyo.ac.jp@localhost>
Pushed By:	mef
Date:		Thu Aug 31 07:38:15 2023 +0900
Changeset:	0afff2d3acf270aa09b9d7f0bd0ee2edd404ee52

Modified Files:
	flim/Makefile
	flim/PLIST
	flim/buildlink3.mk
	flim/distinfo
	flim/patches/patch-ab
	flim/patches/patch-ac
	flim/patches/patch-mime-parse.el

Log Message:
(devel/flim) Ancient version, but OK with emacs28 for now

The patches have been made from
   https://github.com/wanderlust/flim/
and from lexical-binding branch (which does not exist today)
on 2020-09-05 snapshot

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0afff2d3acf270aa09b9d7f0bd0ee2edd404ee52

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 flim/Makefile                    |  12 +-
 flim/PLIST                       |  42 +---
 flim/buildlink3.mk               |   4 +-
 flim/distinfo                    |  46 +++-
 flim/patches/patch-ab            |   4 +
 flim/patches/patch-ac            |   4 +
 flim/patches/patch-mime-parse.el | 527 +++++++++++++++++++++++++++++++++++++--
 7 files changed, 570 insertions(+), 69 deletions(-)

diffs:
diff --git a/flim/Makefile b/flim/Makefile
index 79b4bbf691..8a3755fef1 100644
--- a/flim/Makefile
+++ b/flim/Makefile
@@ -11,7 +11,7 @@ HOMEPAGE=	http://git.chise.org/elisp/flim/
 COMMENT=	Emacs lisp library for message representation/encoding
 LICENSE=	gnu-gpl-v2 OR gnu-gpl-v3
 
-TOOL_DEPENDS+=	qkc-[0-9]*:../../converters/qkc
+BUILD_DEPENDS+=	qkc-[0-9]*:../../converters/qkc
 
 INSTALLATION_DIRS+=	${EMACS_LISPPREFIX:C|^${PREFIX}/||}/flim \
 			${EMACS_INFOPREFIX:C|^${PREFIX}/||}
@@ -35,6 +35,10 @@ MAKEFLAGS.xemacs+=	XEMACS=${EMACS_BIN} \
 EMACS_MODULES=		base
 EMACS_BUILDLINK=	# empty
 
+post-patch:
+	${RM} -f ${WRKSRC}/hmac-def.el
+	${RM} -f ${WRKSRC}/hex-utile.el
+
 post-build:
 	cd ${WRKSRC}; for i in mime-en mime-ja; do			\
 		${RM} -f $${i}.info*;					\
@@ -58,11 +62,11 @@ post-install:
 		${INSTALL_DATA} "$$f" ${DESTDIR}${EMACS_INFOPREFIX};	\
 	done
 
-.include "../../wip/emacs-git/modules.mk"
+.include "../../editors/emacs/modules.mk"
 
 .if (${EMACS_FLAVOR} != "xemacs")
-BUILDLINK_API_DEPENDS.apel+=	apel>=10.7
-.include "../../wip/apel-git/buildlink3.mk"
+BUILDLINK_API_DEPENDS.apel+=	apel>=10.8
+.include "../../devel/apel/buildlink3.mk"
 .endif
 
 .include "../../mk/bsd.pkg.mk"
diff --git a/flim/PLIST b/flim/PLIST
index 37cb367967..08e800ca6a 100644
--- a/flim/PLIST
+++ b/flim/PLIST
@@ -1,44 +1,20 @@
-@comment $NetBSD: PLIST,v 1.10 2010/07/24 06:57:42 wiz Exp $
-${EMACS_INFOPREFIX}/mime-en.info
-${EMACS_INFOPREFIX}/mime-ja.info
-${FOR_xemacs214}${EMACS_LISPPREFIX}/flim/auto-autoloads.el
-${FOR_xemacs214}${EMACS_LISPPREFIX}/flim/auto-autoloads.elc
-${FOR_xemacs214}${EMACS_LISPPREFIX}/flim/custom-load.el
-${FOR_xemacs214}${EMACS_LISPPREFIX}/flim/custom-load.elc
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/auto-autoloads.el
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/auto-autoloads.elc
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/custom-load.el
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/custom-load.elc
+@comment $NetBSD$
+info/mime-en.info
+info/mime-ja.info
 ${EMACS_LISPPREFIX}/flim/eword-decode.el
 ${EMACS_LISPPREFIX}/flim/eword-decode.elc
 ${EMACS_LISPPREFIX}/flim/eword-encode.el
 ${EMACS_LISPPREFIX}/flim/eword-encode.elc
 ${EMACS_LISPPREFIX}/flim/hex-util.el
-${EMACS_LISPPREFIX}/flim/hex-util.elc
-${EMACS_LISPPREFIX}/flim/hmac-def.el
-${EMACS_LISPPREFIX}/flim/hmac-def.elc
 ${EMACS_LISPPREFIX}/flim/hmac-md5.el
-${EMACS_LISPPREFIX}/flim/hmac-md5.elc
 ${EMACS_LISPPREFIX}/flim/hmac-sha1.el
-${EMACS_LISPPREFIX}/flim/hmac-sha1.elc
 ${EMACS_LISPPREFIX}/flim/luna.el
 ${EMACS_LISPPREFIX}/flim/luna.elc
 ${EMACS_LISPPREFIX}/flim/lunit.el
 ${EMACS_LISPPREFIX}/flim/lunit.elc
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/mailcap.el
-${FOR_xemacs215}${EMACS_LISPPREFIX}/flim/mailcap.elc
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/md4.el
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/md4.elc
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/md4.el
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/md4.elc
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/md5-el.el
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/md5-el.elc
 ${EMACS_LISPPREFIX}/flim/md5.el
-${EMACS_LISPPREFIX}/flim/md5.elc
 ${EMACS_LISPPREFIX}/flim/mel-b-ccl.el
-${EMACS_LISPPREFIX}/flim/mel-b-ccl.elc
 ${EMACS_LISPPREFIX}/flim/mel-b-el.el
-${EMACS_LISPPREFIX}/flim/mel-b-el.elc
 ${EMACS_LISPPREFIX}/flim/mel-g.el
 ${EMACS_LISPPREFIX}/flim/mel-g.elc
 ${EMACS_LISPPREFIX}/flim/mel-q-ccl.el
@@ -65,28 +41,16 @@ ${EMACS_LISPPREFIX}/flim/mmexternal.el
 ${EMACS_LISPPREFIX}/flim/mmexternal.elc
 ${EMACS_LISPPREFIX}/flim/mmgeneric.el
 ${EMACS_LISPPREFIX}/flim/mmgeneric.elc
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/ntlm.el
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/ntlm.elc
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/ntlm.el
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/ntlm.elc
 ${EMACS_LISPPREFIX}/flim/qmtp.el
 ${EMACS_LISPPREFIX}/flim/qmtp.elc
 ${EMACS_LISPPREFIX}/flim/sasl-cram.el
-${EMACS_LISPPREFIX}/flim/sasl-cram.elc
 ${EMACS_LISPPREFIX}/flim/sasl-digest.el
-${EMACS_LISPPREFIX}/flim/sasl-digest.elc
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/sasl-ntlm.el
-${FOR_emacs20}${EMACS_LISPPREFIX}/flim/sasl-ntlm.elc
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/sasl-ntlm.el
-${FOR_emacs21}${EMACS_LISPPREFIX}/flim/sasl-ntlm.elc
 ${EMACS_LISPPREFIX}/flim/sasl-scram.el
 ${EMACS_LISPPREFIX}/flim/sasl-scram.elc
 ${EMACS_LISPPREFIX}/flim/sasl.el
 ${EMACS_LISPPREFIX}/flim/sasl.elc
 ${EMACS_LISPPREFIX}/flim/sha1-el.el
-${EMACS_LISPPREFIX}/flim/sha1-el.elc
 ${EMACS_LISPPREFIX}/flim/sha1.el
-${EMACS_LISPPREFIX}/flim/sha1.elc
 ${EMACS_LISPPREFIX}/flim/smtp.el
 ${EMACS_LISPPREFIX}/flim/smtp.elc
 ${EMACS_LISPPREFIX}/flim/std11.el
diff --git a/flim/buildlink3.mk b/flim/buildlink3.mk
index 7d349b332a..2649177e77 100644
--- a/flim/buildlink3.mk
+++ b/flim/buildlink3.mk
@@ -7,11 +7,11 @@ BUILDLINK_TREE+=	flim
 FLIM_BUILDLINK3_MK:=
 
 BUILDLINK_API_DEPENDS.flim+=	${EMACS_PKGNAME_PREFIX}flim>=1.14
-BUILDLINK_PKGSRCDIR.flim?=	../../devel/flim
+BUILDLINK_PKGSRCDIR.flim?=	../../local-mef/flim-git
 
 BUILDLINK_CONTENTS_FILTER.flim=	${EGREP} '.*\.el$$|.*\.elc$$'
 
-.include "../../wip/apel-git/buildlink3.mk"
+.include "../../devel/apel/buildlink3.mk"
 .endif # FLIM_BUILDLINK3_MK
 
 BUILDLINK_TREE+=	-flim
diff --git a/flim/distinfo b/flim/distinfo
index 2454b99d03..5ed91aa60f 100644
--- a/flim/distinfo
+++ b/flim/distinfo
@@ -1,8 +1,46 @@
 $NetBSD: distinfo,v 1.11 2015/11/03 03:27:26 agc Exp $
 
-RMD160 (flim-1.14.9.tar.gz) = d7fb99ffabe477afd958589e8e386b7d4e628822
+BLAKE2s (flim-1.14.9.tar.gz) = a21dfc084bedd6ba75f20988d5e1e5fae0d758dd5e0f977527c165ebedc77375
 SHA512 (flim-1.14.9.tar.gz) = a272a30f27cea24f537b9bf3a6dbb25113deff0ab8e1c03bd802e4d32d673d567d282297ed9e4d35217f069699a1fc25bfdde09778171a188dfa46f49e9bb7dd
 Size (flim-1.14.9.tar.gz) = 182065 bytes
-SHA1 (patch-ab) = 3351e64e3e54c379cf4fd2bf3e5c29b2c247d02d
-SHA1 (patch-ac) = c2e17d653d0e8d8182c070d82b7cf1458968c049
-SHA1 (patch-mime-parse.el) = 3b0b833498bf44759985402981d678594a2ffaba
+SHA1 (patch-ChangeLog) = dcbda73d526164f238dbd17b5a0344ed3aa989ac
+SHA1 (patch-FLIM-CFG) = e0aae8ed5fb4ce512cc747d5851177ddefa17973
+SHA1 (patch-FLIM-ELS) = d16541599be8bc2d672d79803fc148e34efd2096
+SHA1 (patch-FLIM-MK) = 700f41267470380d12fba0a09f86a621e3746d9f
+SHA1 (patch-README.en) = 341c8f1f87f753c5b2a7b303176fa87c4548bd1f
+SHA1 (patch-README.ja) = 854f4fad821e8598909250d929187a1d80094147
+SHA1 (patch-ab) = 9f19f6575917bb4c590c8e788b69741b27bccf52
+SHA1 (patch-ac) = 7c1f6a9d8bed1d87f4215bde996c8cfd1f3ea42d
+SHA1 (patch-eword-decode.el) = 959b211d5a065af3d683a37534fc1e7a553fb134
+SHA1 (patch-eword-encode.el) = 38e09ace5b2a53e9b43d34dee844423b4303f031
+SHA1 (patch-flim-pkg.el) = 5277943f6d8fe8bd3f20c0be7c6a00ddf0488f83
+SHA1 (patch-ftp.in) = 1e51ceb9f57bb7e129d20963fc32e7e4620b7543
+SHA1 (patch-hmac-md5.el) = 2c30a6956eb7d435394a034a937a5a5fd0b894ca
+SHA1 (patch-hmac-sha1.el) = a6db75b2148ea420947b8fd5803546c11867ca4e
+SHA1 (patch-luna.el) = 6f1fb1d9e59ae56099505a44f70a19dc43469d71
+SHA1 (patch-lunit.el) = 06a3e027cd33c39db0380176297d3698410eed3f
+SHA1 (patch-md5.el) = 10c057206ea895c84d6b0e8bd5c4da7efad24eba
+SHA1 (patch-mel-g.el) = de50971f68edf041e3f4cf7d973d1c8304107e40
+SHA1 (patch-mel-q-ccl.el) = fe8dc432dfc3056c2b51c7f24079515b2bd30790
+SHA1 (patch-mel-q.el) = 5e1d79f820ea5a6a3cf1a1c13bea837b49f11271
+SHA1 (patch-mel-u.el) = a9759efefb416ccb31aeeba3272e33d46927b792
+SHA1 (patch-mel.el) = d2b7cecd3138199b73f710455d64e46d7dad0663
+SHA1 (patch-mime-conf.el) = 391e8fe58e82d0fe59e0f5ce5fa5b340d9cdf33b
+SHA1 (patch-mime-def.el) = 5187e0d51c1a3fa1755aa9a775857243c0616ff4
+SHA1 (patch-mime-parse.el) = f350bd586bbac8e43b385bc5e822114e54989b66
+SHA1 (patch-mime-parse.el-00) = 557e8bb815cf361acc1f7c6b0d6867aa6a2dad64
+SHA1 (patch-mime.el) = 299c288a9a3b7a9c106f69b515a9d8f691c128a0
+SHA1 (patch-mmbuffer.el) = e6b7952fb3a7e9fb5f27a5ba4f341a71c015fd96
+SHA1 (patch-mmcooked.el) = e58c52c8aa4ce88943584da8212f3100c472b733
+SHA1 (patch-mmexternal.el) = f824dc52ee089d735b618c774ee4e62cd2112038
+SHA1 (patch-mmgeneric.el) = 9a442bb894df4b332e74198908ab135a9b0b4877
+SHA1 (patch-qmtp.el) = be0d13e634038b6e575af17b83539e1467ad90fd
+SHA1 (patch-sasl-cram.el) = 3e539e8144cba639dbef52c0c8402e17a2814253
+SHA1 (patch-sasl-digest.el) = fbc2fe257d100fc2a2e9ceb8c154ff1d4507e687
+SHA1 (patch-sasl-scram.el) = fbb75a628d3641891f52e40c9adac0e797532c27
+SHA1 (patch-sasl-xoauth2.el) = e8bc389bf9c0b6f7554ac8ff00132a0c6e79c790
+SHA1 (patch-sasl.el) = de724edbf09fbd8d58ef774591068c2d253c185f
+SHA1 (patch-sha1.el) = 408a37f445c911beda840840740bd4bf53fe3716
+SHA1 (patch-smtp.el) = bce1cbc11893d7d3211d050b58dc6739dd200723
+SHA1 (patch-std11.el) = 698204e171a938e546cf21dd751c0fdedd90371b
+SHA1 (patch-tests_test-rfc2231.el) = fe8e549c290d0cdda33de60ea380650771508035
diff --git a/flim/patches/patch-ab b/flim/patches/patch-ab
index 5e73a3454a..5847f1a614 100644
--- a/flim/patches/patch-ab
+++ b/flim/patches/patch-ab
@@ -1,3 +1,7 @@
+$NetBSD$
+
+sync to  lexical-binding
+
 $NetBSD: patch-ab,v 1.1 2003/04/13 04:16:18 uebayasi Exp $
 
 Add missing directory entry
diff --git a/flim/patches/patch-ac b/flim/patches/patch-ac
index ed815d5d56..5e4a3ae00b 100644
--- a/flim/patches/patch-ac
+++ b/flim/patches/patch-ac
@@ -1,3 +1,7 @@
+$NetBSD$
+
+sync to  lexical-binding
+
 $NetBSD: patch-ac,v 1.2 2003/04/17 04:56:34 uebayasi Exp $
 
 Add missing directory entry
diff --git a/flim/patches/patch-mime-parse.el b/flim/patches/patch-mime-parse.el
index a2230c0f26..0caed3ec0f 100644
--- a/flim/patches/patch-mime-parse.el
+++ b/flim/patches/patch-mime-parse.el
@@ -1,24 +1,511 @@
 $NetBSD$
 
-string-to-int -> string-to-number
+sync to  lexical-binding
 
---- mime-parse.el~	2005-07-06 11:09:04.000000000 +0900
-+++ mime-parse.el	2016-12-28 10:41:55.000000000 +0900
-@@ -97,7 +97,7 @@ be the result."
-     (insert text)
-     (goto-char (point-min))
-     (while (re-search-forward "%[0-9A-Fa-f][0-9A-Fa-f]" nil t)
--      (insert (prog1 (string-to-int
-+      (insert (prog1 (string-to-number
- 		      (buffer-substring (point)(- (point) 2))
- 		      16)
+--- /tmp/wip/flim/work/flim-1.14.9/./mime-parse.el	2020-09-05 13:48:06.215015344 +0900
++++ ././mime-parse.el	2020-09-05 16:02:39.901141091 +0900
+@@ -1,4 +1,4 @@
+-;;; mime-parse.el --- MIME message parser
++;;; mime-parse.el --- MIME message parser  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1994,95,96,97,98,99,2001 Free Software Foundation, Inc.
+ 
+@@ -25,9 +25,13 @@
+ 
+ ;;; Code:
+ 
+-(require 'mime-def)
++(require 'pccl)
++(require 'broken)
++
+ (require 'luna)
++(require 'mime-def)
+ (require 'std11)
++(require 'mime)
+ 
+ (autoload 'mime-entity-body-buffer "mime")
+ (autoload 'mime-entity-body-start-point "mime")
+@@ -37,6 +41,131 @@
+ ;;; @ lexical analyzer
+ ;;;
+ 
++(unless-broken ccl-usable
++(define-ccl-program mime-default-ccl-lexical-analyzer
++  ;; r0 input
++  ;; r1 flag means any character exists.
++  ;; r2 in parse flag
++  ;;    1 atom, 2 spaces 3 comment (no output) 4 encloser 5 error
++  ;; r3 comment depth
++  (eval-when-compile
++    (let* ((wrt `(if (r0 == ?\") (write "\\\"")
++		   (if (r0 == ?\\) (write "\\\\")
++		     (write r0))))
++	   (atm `((branch r2
++			  ((r2 = 1)
++			   (write "(mime-token . \"")
++			   (write-read-repeat r0))
++			  (write-read-repeat r0)
++			  ((r2 = 1)
++			   (write "(mime-token . \"")
++			   (write-read-repeat r0)))))
++	   (ts  `((if (r2 == 1) ((write "\")") (r2 = 0)))
++		  (write "(tspecials . \"")
++		  ,wrt
++		  (write "\")")
++		  (read r0)
++		  (repeat)))
++	   (sp  `((branch r2
++			  ((r2 = 2)
++			   (read r0)
++			   (repeat))
++			  ((write "\")")
++			   (r2 = 2)
++			   (read r0)
++			   (repeat))
++			  ((read r0) (repeat)))))
++	   (err `((branch r2
++			  ((write "(error . \""))
++			  ((write "\")")
++			   (write "(error . \""))
++			  ((write "(error . \"")))
++		  (r2 = 5)
++		  (loop
++		   (write-read-repeat r0))))
++	   (enc (lambda (name tag)
++		  `((if (r2 == 1) ((write "\")")))
++		    (write ,(concat "(" name " . \""))
++		    (r2 = 4)
++		    (loop
++		     (read-branch
++		      r0
++		      ,@(let* ((count (1+ (max tag ?\\)))
++			       (result (make-vector count '(write-repeat r0))))
++			  (aset result tag '(break))
++			  (aset result ?\\ `((write "\\\\")
++					     (read r0)
++					     ,wrt
++					     (repeat)))
++			  (aset result ?\" '((write "\\\"") (repeat)))
++			  (mapcar 'identity result)))
++		     (write-repeat r0))
++		    (write "\")")
++		    (r2 = 0)
++		    (read r0)
++		    (repeat))))
++	   (qs (funcall enc "quoted-string" ?\"))
++	   (dl (funcall enc "domain-literal" ?\]))
++	   (cm  `((if (r2 == 1) ((write "\")")))
++		  (r2 = 3)
++		  (r3 = 1)
++		  (loop
++		   (read-branch
++		    r0
++		    ,@(let* ((count (1+ (max ?\( ?\) ?\\)))
++			     (result (make-vector count '(repeat))))
++			(aset result ?\( '((r3 += 1) (repeat)))
++			(aset result ?\) '((r3 -= 1)
++					   (if (r3 < 1) (break)
++					     (repeat))))
++			(aset result ?\\ `((read r0) (repeat)))
++			(mapcar 'identity result)))
++		   (repeat))
++		  (r2 = 0)
++		  (read r0)
++		  (repeat))))
++      `(8
++	((r2 = 0)
++	 (read r0)
++	 (r1 = 1)
++	 (write "((")
++	 (loop
++	  (branch r0
++		  ,@(mapcar (lambda (elt) (eval elt))
++			    '(err err err err err err err err
++				  err sp  sp  err err err err err
++				  err err err err err err err err
++				  err err err err err err err err
++				  sp  atm qs  atm atm atm atm atm
++				  cm  ts  atm atm ts  atm atm ts 
++				  atm atm atm atm atm atm atm atm
++				  atm atm ts  ts  ts  ts  ts  ts
++				  ts  atm atm atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm atm dl  ts  ts)))
++	  ,@atm))
++	((branch r1
++		 (write "(nil . t)")
++		 (branch r2
++			 (write ") . t)")
++			 (write "\")) . t)")
++			 (write ") . t)")
++			 (write "))")
++			 (write "\")))")
++			 (write "\")) . t)")))))))))
++
++(defcustom mime-ccl-lexical-analyzer
++  (static-unless (or (broken-p 'ccl-usable)
++		     (broken-p 'ccl-execute-eof-block))
++    'mime-default-ccl-lexical-analyzer)
++  "Specify CCL-program symbol for `mime-lexical-analyze'.
++When nil, do not use CCL.
++See docstring of `std11-ccl-lexical-analyzer' for details of CCL-program.
++If you modify `mime-lexical-analyzer', set this variable to nil or prepare corresponding CCL-program."
++  :group 'mime
++  :type '(choice symbol (const :tag "Do not use CCL." nil)))
++
+ (defcustom mime-lexical-analyzer
+   '(std11-analyze-quoted-string
+     std11-analyze-domain-literal
+@@ -70,22 +199,27 @@
+ 
+ (defun mime-lexical-analyze (string)
+   "Analyze STRING as lexical tokens of MIME."
+-  (let ((ret (std11-lexical-analyze string mime-lexical-analyzer))
+-        prev tail)
+-    ;; skip leading linear-white-space.
+-    (while (memq (car (car ret)) '(spaces comment))
+-      (setq ret (cdr ret)))
+-    (setq prev ret
+-          tail (cdr ret))
+-    ;; remove linear-white-space.
+-    (while tail
+-      (if (memq (car (car tail)) '(spaces comment))
+-          (progn
+-            (setcdr prev (cdr tail))
+-            (setq tail (cdr tail)))
+-        (setq prev (cdr prev)
+-              tail (cdr tail))))
+-    ret))
++  (let (ret prev tail)
++    (if (and mime-ccl-lexical-analyzer
++	     (cdr (setq ret (read (ccl-execute-on-string
++				   mime-ccl-lexical-analyzer
++				   (make-vector 9 0) (or string ""))))))
++	(car ret)
++      (setq ret (std11-lexical-analyze string mime-lexical-analyzer))
++      ;; skip leading linear-white-space.
++      (while (memq (car (car ret)) '(spaces comment))
++	(setq ret (cdr ret)))
++      (setq prev ret
++	    tail (cdr ret))
++      ;; remove linear-white-space.
++      (while tail
++	(if (memq (car (car tail)) '(spaces comment))
++	    (progn
++	      (setcdr prev (cdr tail))
++	      (setq tail (cdr tail)))
++	  (setq prev (cdr prev)
++		tail (cdr tail))))
++      ret)))
+ 
+ 
+ ;;; @ field parser
+@@ -103,11 +237,7 @@
                  (delete-region (point)(- (point) 3)))))
-@@ -147,7 +147,7 @@ property of the decoded-value."
-           (let* ((attribute (downcase
- 			     (substring (car params) 0 (match-end 1))))
-                  (section (if (match-beginning 2)
--			      (string-to-int
-+			      (string-to-number
- 			       (substring (car params)
- 					  (1+ (match-beginning 2))
- 					  (match-end 2)))
+     (setq text (buffer-string))
+     (when charset
+-      ;; I believe that `decode-mime-charset-string' of mcs-e20.el should
+-      ;; be independent of the value of `enable-multibyte-characters'.
+-      (erase-buffer)
+-      (set-buffer-multibyte t)
+-      (setq text (decode-mime-charset-string text charset)))
++      (setq text (mime-charset-decode-string text charset)))
+     (when language
+       (put-text-property 0 (length text) 'mime-language language text))
+     text))
+@@ -122,7 +252,7 @@
+                                  (concat mime-attribute-char-regexp "+")))
+                (goto-char (match-end 0)))
+              (not (eobp)))
+-      (insert (prog1 (format "%%%02X" (char-int (char-after)))
++      (insert (prog1 (format "%%%02X" (char-int (following-char)))
+                 (delete-region (point)(1+ (point))))))
+     (buffer-string)))
+ 
+@@ -237,7 +367,211 @@
+ 
+ ;;; for compatibility with flim-1_13-rfc2231 API.
+ (defalias 'mime-parse-parameters-from-list 'mime-decode-parameters)
+-(make-obsolete 'mime-parse-parameters-from-list 'mime-decode-parameters)
++(make-obsolete 'mime-parse-parameters-from-list
++	       'mime-decode-parameters "28 Feb 2001")
++
++
++;;; @ parameter value encoder
++;;;
++
++(defun mime-divide-extended-parameter (name value)
++  "Divide MIME parameter value \"NAME=VALUE\" into segments.
++Each of \" NAME*n*=SEGMENT_n\;\" will be no more than 78 characters.
++Return value is a list of string when division is performed, otherwise
++return value is just a string."
++  ;; `limit' must be more than (length "CHARSET'LANGUAGE'%XX").
++  ;;
++  ;; Since MIME spec does not limit either length of CHARSET or length
++  ;; of LANGUAGE, we choose 30 for minimum `limit' based on the longest
++  ;; name of charset that Emacs supports ("ISO-2022-CN-EXT"; 15 chars).
++  ;;
++  ;; Anyway, if `name' is too long, we will ignore 78 chars limit.
++  (let ((limit (max (- 78 4 (length name)) 30))); (length " *=;") => 4
++    (if (> limit (length value))
++	value
++      (let ((count 0)
++	    result)
++	(setq limit (max (- limit 2) 30))	; (length "*n") => 2
++	(with-temp-buffer
++	  (set-buffer-multibyte nil)
++	  (insert value)
++	  (while (> (point-max) limit)
++	    (goto-char (- limit 3))		; (length "%XX") => 3
++	    (cond
++	     ((eq (following-char) ?%)
++	      (forward-char 3))
++	     ((progn
++		(forward-char)
++		(eq (following-char) ?%)))
++	     ((progn
++		(forward-char)
++		(eq (following-char) ?%)))
++	     (t
++	      (forward-char)))
++	    (setq result (cons (prog1 (buffer-substring (point-min)(point))
++				 (delete-region (point-min)(point)))
++			       result)
++		  count (1+ count))
++	    (when (zerop (% count 10))
++	      (setq limit (max (1- limit) 30))))
++	  (nreverse
++	   (cons (buffer-substring (point-min)(point-max))
++		 result)))))))
++
++(defun mime-encode-extended-parameter (name value)
++  "Encode MIME parameter value \"NAME=VALUE\" as an extended-parameter.
++If encoding is unnecessary, return nil.
++If division is performed, return value is a list of string, otherwise
++return value is just a string."
++  (let ((language (get-text-property 0 'mime-language value)))
++    (when (or language
++	      (string-match "[^ -~]" value)) ; Nonmatching printable US-ASCII.
++      (with-temp-buffer
++	(let ((charset (find-mime-charset-by-charsets
++			(find-charset-string value))))
++	  (setq value (mime-charset-encode-string value charset))
++	  (set-buffer-multibyte nil)
++	  (insert value)
++	  (goto-char (point-min))
++	  (insert (symbol-name charset)
++		  ?'
++		  (if language (symbol-name language) "")
++		  ?')
++	  (while (re-search-forward mime-non-attribute-char-regexp nil t)
++	    (insert (prog1 (format "%%%02X" (preceding-char))
++		      (delete-region (1- (point))(point)))))
++	  (mime-divide-extended-parameter name (buffer-string)))))))
++
++(defun mime-divide-regular-parameter (name value)
++  "Divide MIME parameter value \"NAME=VALUE\" into segments.
++Each of \" NAME*n=SEGMENT_n\;\" will be no more than 78 characters.
++Return value is a list of string when division is performed, otherwise
++just a string is returned."
++  (let ((limit (max (- (eval-when-compile (- 78 (length " =\"\";")))
++		       (length name))
++		    30)))
++    (if (> limit (length value))
++	(concat "\"" value "\"")
++      (let ((count 0)
++	    result)
++	(setq limit (max (- limit 2) 30))	; (length "*n") => 2
++	(setq limit (1- limit))			; XXX
++	(with-temp-buffer
++	  (set-buffer-multibyte nil)
++	  (insert value)
++	  (while (> (point-max) limit)
++	    (goto-char (point-min))
++	    (while (< (point) limit)
++	      (when (eq (following-char) ?\\)
++		(forward-char))
++	      (forward-char))
++	    (setq result (cons (concat "\""
++				       (prog1 (buffer-substring
++					       (point-min)(point))
++					 (delete-region
++					  (point-min)(point)))
++				       "\"")
++			       result)
++		  count (1+ count))
++	    (when (zerop (% count 10))
++	      (setq limit (max (1- limit) 30))))
++	  (nreverse
++	   (cons (concat "\""
++			 (buffer-substring (point-min)(point-max))
++			 "\"")
++		 result)))))))
++
++(defun mime-encode-regular-parameter (name value)
++  "Encode MIME parameter value \"NAME=VALUE\" as a regular-parameter.
++If division is performed, return value is a list of string, otherwise
++return value is just a string."
++  (with-temp-buffer
++    (set-buffer-multibyte nil)
++    (insert value)
++    (goto-char (point-min))
++    (while (not (eobp))
++      (when (memq (following-char) '(?\\ ?\"))
++	(insert ?\\))
++      (forward-char 1))
++    (mime-divide-regular-parameter name (buffer-string))))
++
++(defun mime-encode-parameters (params)
++  "Encode PARAMS plist with MIME Parameter-Value Extensions.
++Return value is an alist of MIME parameter values."
++  (let (name value encoded result)
++    (while params
++      (setq name (car params)
++            value (car (cdr params))
++            params (cdr (cdr params)))
++      (cond
++       ;; first two clauses are for backward compatibility,
++       ;; especially for "ftp.in" in the distribution.
++       ((not (string-match (eval-when-compile
++			     (concat "^\\(" mime-attribute-char-regexp "+\\)"
++				     "\\(\\*[0-9]+\\)?" ; continuation
++				     "\\(\\*\\)?$")) ; charset/language
++			   name))
++	;; invalid parameter name.
++	;; XXX: Should we signal an error?
++	)
++       ((> (match-end 0) (match-end 1))
++	;; this parameter value is already encoded.
++	(setq result (cons (cons name
++				 (if (match-beginning 3)
++				     ;; extended-parameter
++				     value
++				   ;; regular-parameter
++				   (std11-wrap-as-quoted-string value)))
++			   result)))
++       ((setq encoded (mime-encode-extended-parameter name value))
++	;; extended-parameter
++	(if (stringp encoded)
++	    (setq result (cons (cons (concat name "*") encoded) result))
++	  ;; with continuation
++	  (let ((section 0))
++	    (while encoded
++	      (setq result (cons (cons (concat name
++					       "*" (int-to-string section)
++					       "*")
++				       (car encoded))
++				 result)
++		    section (1+ section)
++		    encoded(cdr encoded))))))
++       (t
++	;; regular-parameter
++	(setq encoded (mime-encode-regular-parameter name value))
++        (if (stringp encoded)
++            (setq result (cons (cons name encoded) result))
++	  ;; with continuation
++          (let ((section 0))
++            (while encoded
++              (setq result (cons (cons (concat name
++                                               "*" (int-to-string section))
++				       (car encoded))
++				 result)
++		    section (1+ section)
++		    encoded (cdr encoded))))))))
++    (nreverse result)))
++
++(provide 'mime-parse)
++(require 'eword-encode)
++
++(defun mime-encode-parameters-broken-mime (params)
++  "Encode PARAMS plist compatibly with Outlook.
++Return value is an alist of MIME parameter values."
++  (let (result)
++    (while (cadr params)
++      (setq result
++	    `((,(car params)
++	       . ,(eword-encode-string (cadr params)
++				       (+ (length (car params)) 3)))
++	      . ,result)
++	    params (cddr params)))
++    (nreverse result)))
++
++
++;;; @ field parser
++;;;
+ 
+ (defun mime-parse-parameters (tokens)
+   "Parse TOKENS as MIME parameter values.
+@@ -294,8 +628,7 @@
+ If Content-Type field is not found, return nil."
+   (let ((field-body (std11-field-body "Content-Type")))
+     (if field-body
+-	(mime-parse-Content-Type field-body)
+-      )))
++	(mime-parse-Content-Type field-body))))
+ 
+ 
+ ;;; @@ Content-Disposition
+@@ -321,8 +654,7 @@
+ If Content-Disposition field is not found, return nil."
+   (let ((field-body (std11-field-body "Content-Disposition")))
+     (if field-body
+-	(mime-parse-Content-Disposition field-body)
+-      )))
++	(mime-parse-Content-Disposition field-body))))
+ 
+ 
+ ;;; @@ Content-Transfer-Encoding
+@@ -345,8 +677,7 @@
+ If Content-Transfer-Encoding field is not found, return nil."
+   (let ((field-body (std11-field-body "Content-Transfer-Encoding")))
+     (if field-body
+-	(mime-parse-Content-Transfer-Encoding field-body)
+-      )))
++	(mime-parse-Content-Transfer-Encoding field-body))))
+ 
+ 
+ ;;; @@ Content-ID / Message-ID
+@@ -360,10 +691,13 @@
+ ;;;###autoload
+ (defun mime-uri-parse-cid (string)
+   "Parse STRING as cid URI."
+-  (mime-parse-msg-id (cons '(specials . "<")
+-			   (nconc
+-			    (cdr (cdr (std11-lexical-analyze string)))
+-			    '((specials . ">"))))))
++  (when (string-match "^cid:" string)
++    (setq string (concat "<" (substring string 4) ">"))
++    (let ((parser (cdr (assq 'Content-Id mime-field-parser-alist))))
++      (if parser
++	  (funcall parser (eword-lexical-analyze string))
++	(mime-decode-field-body string 'Content-Id 'plain)))))
++
+ 
+ 
+ ;;; @ message parser
+@@ -470,12 +804,8 @@
+ 	    body-start (point-min)))
+     (save-restriction
+       (narrow-to-region header-start header-end)
+-      (setq content-type (or (let ((str (std11-fetch-field "Content-Type")))
+-			       (if str
+-				   (mime-parse-Content-Type str)
+-				 ))
+-			     default-ctl))
+-      )
++      (setq content-type (or (mime-read-Content-Type)
++			     default-ctl)))
+     (luna-make-entity representation-type
+ 		      :location (current-buffer)
+ 		      :content-type content-type
+@@ -485,8 +815,7 @@
+ 		      :header-start header-start
+ 		      :header-end header-end
+ 		      :body-start body-start
+-		      :body-end body-end)
+-    ))
++		      :body-end body-end)))
+ 
+ 
+ ;;; @ for buffer


Home | Main Index | Thread Index | Old Index