Modify header.
[elisp/semi.git] / mime-parse.el
index 6e4beff..9f6a9ae 100644 (file)
@@ -1,12 +1,11 @@
 ;;; mime-parse.el --- MIME message parser
 
-;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
+;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: mime-parse.el,v 0.18 1997-09-05 08:10:44 morioka Exp $
 ;; Keywords: parse, MIME, multimedia, mail, news
 
-;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
+;; This file is part of SEMI (Spadework for Emacs MIME Interfaces).
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -39,36 +38,6 @@ which are string or symbol."
                              )))
                     args "")))
 
-(defmacro define-structure (name &rest slots)
-  (let ((pred (symbol-concat name '-p)))
-    (cons 'progn
-         (nconc
-          (list
-           (` (defun (, pred) (obj)
-                (and (vectorp obj)
-                     (eq (elt obj 0) '(, name))
-                     ))
-              )
-           (` (defun (, (symbol-concat name '/create)) (, slots)
-                (, (cons 'vector (cons (list 'quote name) slots)))
-                )
-              ))
-          (let ((i 1))
-            (mapcar (function
-                     (lambda (slot)
-                       (prog1
-                           (` (defun (, (symbol-concat name '/ slot)) (obj)
-                                (if ((, pred) obj)
-                                    (elt obj (, i))
-                                  ))
-                              )
-                         (setq i (+ i 1))
-                         )
-                       )) slots)
-            )
-          (list (list 'quote name))
-          ))))
-
 
 ;;; @ field parser
 ;;;
@@ -186,27 +155,29 @@ and return parsed it. [mime-parse.el]"
 ;;; @ message parser
 ;;;
 
-(define-structure mime::content-info
-  rcnum point-min point-max type parameters encoding children)
-
 (defsubst make-mime-entity-info (rcnum
                                 point-min point-max
-                                media-type media-subtype
-                                parameters encoding children)
-  (let ((ctype (if media-type
-                  (if media-subtype
-                      (format "%s/%s" media-type media-subtype)
-                    (symbol-name media-type)))))
-    (mime::content-info/create rcnum point-min point-max
-                              ctype params encoding
-                              children)
-    ))
-
-(defsubst mime-entity-info-point-min (entity-info)
-  (mime::content-info/point-min entity-info))
-
-(defsubst mime-entity-info-point-max (entity-info)
-  (mime::content-info/point-max entity-info))
+                                media-type media-subtype parameters
+                                encoding children)
+  (vector rcnum point-min point-max
+         media-type media-subtype parameters encoding children))
+
+(defsubst mime-entity-info-rnum (entity-info)          (aref entity-info 0))
+(defsubst mime-entity-info-point-min (entity-info)     (aref entity-info 1))
+(defsubst mime-entity-info-point-max (entity-info)     (aref entity-info 2))
+(defsubst mime-entity-info-media-type (entity-info)    (aref entity-info 3))
+(defsubst mime-entity-info-media-subtype (entity-info) (aref entity-info 4))
+(defsubst mime-entity-info-parameters (entity-info)    (aref entity-info 5))
+(defsubst mime-entity-info-encoding (entity-info)      (aref entity-info 6))
+(defsubst mime-entity-info-children (entity-info)      (aref entity-info 7))
+
+(defsubst mime-entity-info-type/subtype (entity-info)
+  (let ((type (mime-entity-info-media-type entity-info)))
+    (if type
+       (let ((subtype (mime-entity-info-media-subtype entity-info)))
+         (if subtype
+             (format "%s/%s" type subtype)
+           (symbol-name type))))))
 
 (defun mime-parse-multipart (boundary primtype subtype params encoding rcnum)
   (goto-char (point-min))