X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-parse.el;h=9f6a9aed17f3db70ffe512dda7b5f666a2cc7c07;hb=ef04495e4699892084380191e5f489fe7ff0991b;hp=17790774564ae46f181a639a0f2ffe879ae18ac4;hpb=1dd8e5de474f2750ea4824f1e397eb4687cfc799;p=elisp%2Fsemi.git diff --git a/mime-parse.el b/mime-parse.el index 1779077..9f6a9ae 100644 --- a/mime-parse.el +++ b/mime-parse.el @@ -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 -;; Version: $Id: mime-parse.el,v 0.22 1997-09-05 11:38:33 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,39 +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-rnum (entity-info) - (mime::content-info/rcnum entity-info)) - -(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) - (mime::content-info/type entity-info)) - -(defsubst mime-entity-info-parameters (entity-info) - (mime::content-info/parameters entity-info)) - -(defsubst mime-entity-info-encoding (entity-info) - (mime::content-info/encoding 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))