From 833522faae8b18ea99d11421b47d479a8c50b030 Mon Sep 17 00:00:00 2001 From: tomo Date: Thu, 14 Dec 2000 05:00:32 +0000 Subject: [PATCH] Apply Handa-san's patch <200012131208.VAA17062@etlken.etl.go.jp>. --- mime/luna.el | 60 ++++++++++++++++++++++++++++++++----------------------- mime/mmbabyl.el | 5 +---- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/mime/luna.el b/mime/luna.el index d9a4fa3..b307ad9 100644 --- a/mime/luna.el +++ b/mime/luna.el @@ -91,8 +91,8 @@ The optional 2nd arg SLOTS is a list of slots CLASS will have." (luna-set-class class (vector 'class oa parents i)))) -;; Return a member of CLASS that has name MEMBER-NAME. -;;;%%% member って何? slots? subclass? +;; Return a member (slot or method) of CLASS that has name +;; MEMBER-NAME. (defun luna-class-find-member (class member-name) (or (stringp member-name) @@ -108,8 +108,9 @@ The optional 2nd arg SLOTS is a list of slots CLASS will have." ret))) -;; Return a member of CLASS that has name MEMBER-NAME. If CLASS -;; doesnt' have such a member, make it for CLASS. +;; Return a member (slot or method) of CLASS that has name +;; MEMBER-NAME. If CLASS doesnt' have such a member, make it in +;; CLASS. (defsubst luna-class-find-or-make-member (class member-name) (or (stringp member-name) @@ -122,10 +123,6 @@ The optional 2nd arg SLOTS is a list of slots CLASS will have." (defmacro luna-class-slot-index (class slot-name) `(get (luna-class-find-member ,class ,slot-name) 'luna-slot-index)) - -;;;%%% docstring を大幅に書き直したので正しいかチェックして! -;;;%%% 特に VAR の意味が分らない。 - (defmacro luna-define-method (name &rest definition) "Define NAME as a method of a luna class. @@ -146,9 +143,14 @@ executed by calling the function `luna-call-next-method' in BODY. Otherwize, call the method only, and the parents' methods are never executed. In this case, METHOD-QUALIFIER is treated as ARGLIST. -ARGLIST has the form ((VAR CLASS) METHOD-ARG-LIST), where VAR is a -variable name, CLASS is a class name, METHOD-ARG-LIST is an argument -list of the method, and its format is like an argument list of lambda. +ARGLIST has the form ((VAR CLASS) METHOD-ARG ...), where VAR is a +variable name that should be bound to an entity that receives the +message NAME, CLASS is a class name. The first argument to the method +is VAR, and the remaining arguments are METHOD-ARGs. + +If VAR is nil, arguments to the method are METHOD-ARGs. This kind of +methods can't be called from generic-function (see +`luna-define-generic'). The optional 4th argument DOCSTRING is the documentation of the method. If it is not string, it is treated as BODY. @@ -250,8 +252,6 @@ The optional 5th BODY is the body of the method." `(luna-class-find-functions (luna-find-class (luna-class-name ,entity)) ,service)) -;;;%%% ENTITY と MESSAGE の説明は合ってる? - (defsubst luna-send (entity message &rest luna-current-method-arguments) "Send MESSAGE to ENTITY, and return the result. ENTITY is an instance of a luna class, and MESSAGE is a method name of @@ -309,7 +309,8 @@ the corresponding SLOTs." ;;; @ interface (generic function) ;;; -;;;%%% どうコメントを書いたらよいか分らない。 +;; Find a method of ENTITY that handles MESSAGE, and call it with +;; arguments LUNA-CURRENT-METHOD-ARGUMENTS. (defun luna-apply-generic (entity message &rest luna-current-method-arguments) (let* ((class (luna-class-name entity)) @@ -338,13 +339,15 @@ the corresponding SLOTs." (nreverse dest))) -;;;%%% generic-function って何?それで define するって具体的にどういう -;;;%%% こと? - (defmacro luna-define-generic (name args &optional doc) - "Define generic-function NAME. -ARGS is the argument list for NAME. -The optional 3rd arg DOC is the documentation string for NAME." + "Define a function NAME that provides a generic interface to the method NAME. +ARGS is the argument list for NAME. The first element of ARGS is an +entity. + +The function handles a message sent to the entity by calling the +method with proper arguments. + +The optional 3rd argument DOC is the documentation string for NAME." (if doc `(progn (defun ,(intern (symbol-name name)) ,args @@ -364,10 +367,18 @@ The optional 3rd arg DOC is the documentation string for NAME." ;;; @ accessor ;;; -;;;%%% internal accessor って何?どう使うの? - (defun luna-define-internal-accessors (class-name) - "Define internal accessors for an entity of CLASS-NAME." + "Define internal accessors for instances of the luna class CLASS-NAME. + +Internal accessors are macros to refer and set a slot value of the +instances. For instance, if the class has SLOT, macros +CLASS-NAME-SLOT-internal and CLASS-NAME-set-SLOT-internal are defined. + +CLASS-NAME-SLOT-internal accepts one argument INSTANCE, and returns +the value of SLOT. + +CLASS-NAME-set-SLOT-internal accepts two arguemnt INSTANCE and VALUE, +and sets SLOT to VALUE." (let ((entity-class (luna-find-class class-name)) parents parent-class) (mapatoms @@ -404,10 +415,9 @@ The optional 3rd arg DOC is the documentation string for NAME." ;; Define super class of all luna classes. (luna-define-class-function 'standard-object) -;;;%%% DOCSTRING 正しい? (luna-define-method initialize-instance ((entity standard-object) &rest init-args) - "Initialize slots of ENTITY whose luna class is `standard-object'." + "Initialize slots of ENTITY by INIT-ARGS." (let* ((c (luna-find-class (luna-class-name entity))) (oa (luna-class-obarray c)) s i) diff --git a/mime/mmbabyl.el b/mime/mmbabyl.el index 559a9e5..763e18e 100644 --- a/mime/mmbabyl.el +++ b/mime/mmbabyl.el @@ -133,15 +133,12 @@ ENTITY is an instance of `mime-babyl-entity'." ;;; @ header field ;;; -;;;%%% docstring を完成させて。 - (luna-define-method mime-insert-header ((entity mime-babyl-entity) &optional invisible-fields visible-fields) "Insert the header of ENTITY in the current buffer. ENTITY is an instance of `mime-babyl-entity'. -The optional 1st arguemnt INVISIBLE-FIELDS is a list of .... -The optional 2nd arguemnt VISIBLE-FIELDS is a list of ...." +The optional arguemnts are currently ignored." (mime-insert-header-from-buffer (mime-buffer-entity-buffer-internal entity) (mime-babyl-entity-visible-header-start-internal entity) -- 1.7.10.4