From: morioka Date: Tue, 7 Jul 1998 07:46:47 +0000 (+0000) Subject: (mime-entity-implementation-alist): Moved from mime.el. X-Git-Tag: chao-1_8-199811302358~35 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9842b232bcba2863d2cd1cb4f7565b857da9b9b6;p=elisp%2Fflim.git (mime-entity-implementation-alist): Moved from mime.el. (mm-define-backend): New macro. (mm-define-method): New macro. --- diff --git a/mime-def.el b/mime-def.el index accf0a0..bc9632e 100644 --- a/mime-def.el +++ b/mime-def.el @@ -255,6 +255,42 @@ message/rfc822, `mime-entity' structures of them are included in (make-variable-buffer-local 'mime-message-structure) +;;; @ for mm-backend +;;; + +(defvar mime-entity-implementation-alist nil) + +(defmacro mm-define-backend (type &optional parents) + (if parents + `(let ((rest ',(reverse parents))) + (while rest + (set-alist 'mime-entity-implementation-alist + ',type + (cdr (assq (car rest) + mime-entity-implementation-alist))) + (setq rest (cdr rest)) + )))) + +(defmacro mm-define-method (name args &rest body) + (let* ((specializer (car args)) + (class (nth 1 specializer)) + (self (car specializer))) + `(let ((imps (cdr (assq ',class mime-entity-implementation-alist))) + (func (lambda ,(if self + (cons self (cdr args)) + (cdr args)) + ,@body))) + (if imps + (set-alist 'mime-entity-implementation-alist + ',class (put-alist ',name func imps)) + (set-alist 'mime-entity-implementation-alist + ',class + (list (cons ',name func))) + )))) + +(put 'mm-define-method 'lisp-indent-function 'defun) + + ;;; @ end ;;;