;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: mime-parse.el,v 0.2 1997-02-22 16:10:50 morioka Exp $
+;; Version: $Id: mime-parse.el,v 0.3 1997-02-24 09:12:12 tmorioka Exp $
;; Keywords: MIME, multimedia, mail, news
;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
;;; Code:
(require 'std11)
-(require 'tl-misc)
(require 'mime-def)
+(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
;;;