From 40ded1b8f413409cd756a9bd3919c389c9f841a6 Mon Sep 17 00:00:00 2001 Message-Id: <40ded1b8f413409cd756a9bd3919c389c9f841a6.1715734339.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 23 Apr 2006 01:47:26 +0100 Subject: [PATCH] defzoneparse: Parse the body; handle docstring and declarations properly. Organization: Straylight/Edgeware From: Mark Wooding --- zone.lisp | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/zone.lisp b/zone.lisp index 1f421a5..79c6c19 100644 --- a/zone.lisp +++ b/zone.lisp @@ -502,25 +502,28 @@ (defsubp (gensym "DEFSUBP"))) (setf types (listify types)) (let* ((type (car types)) (func (intern (format nil "ZONE-PARSE/~:@(~A~)" type)))) - (with-gensyms (col tname ttype tttl tdata tdefsubp i) - `(progn - (dolist (,i ',types) - (setf (get ,i 'zone-parse) ',func)) - (defun ,func (,name ,data ,ttl ,col ,zname ,defsubp) - (declare (ignorable ,zname ,defsubp)) - (flet ((,list (&key ((:name ,tname) ,name) - ((:type ,ttype) ,type) - ((:data ,tdata) ,data) - ((:ttl ,tttl) ,ttl) - ((:defsubp ,tdefsubp) nil)) - (collect (make-zone-record :name ,tname - :type ,ttype - :data ,tdata - :ttl ,tttl - :defsubp ,tdefsubp) - ,col))) - ,@body)) - ',type)))) + (multiple-value-bind (doc decls body) (parse-body body) + (with-gensyms (col tname ttype tttl tdata tdefsubp i) + `(progn + (dolist (,i ',types) + (setf (get ,i 'zone-parse) ',func)) + (defun ,func (,name ,data ,ttl ,col ,zname ,defsubp) + ,@doc + ,@decls + (declare (ignorable ,zname ,defsubp)) + (flet ((,list (&key ((:name ,tname) ,name) + ((:type ,ttype) ,type) + ((:data ,tdata) ,data) + ((:ttl ,tttl) ,ttl) + ((:defsubp ,tdefsubp) nil)) + (collect (make-zone-record :name ,tname + :type ,ttype + :data ,tdata + :ttl ,tttl + :defsubp ,tdefsubp) + ,col))) + ,@body)) + ',type))))) (defun zone-parse-records (zone records) (let ((zname (zone-name zone))) -- [mdw]