Throughout: Use shiny new macros.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Dec 2006 15:03:55 +0000 (15:03 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 10 Dec 2006 15:13:32 +0000 (15:13 +0000)
In particular, with-parsed-body and setf-default are useful.

net.lisp
zone
zone.lisp

index 64c796d..40882de 100644 (file)
--- a/net.lisp
+++ b/net.lisp
@@ -75,8 +75,7 @@
    `stringify'.  The START and END arguments may be used to parse out a
    substring."
   (setf str (stringify str))
-  (unless end
-    (setf end (length str)))
+  (setf-default end (length str))
   (let ((addr 0) (noct 0))
     (loop
       (let* ((pos (position #\. str :start start :end end))
 (defun string-ipnet (str &key (start 0) (end nil))
   "Parse an IP-network from the string STR."
   (setf str (stringify str))
-  (unless end (setf end (length str)))
+  (setf-default end (length str))
   (let ((sl (position #\/ str :start start :end end)))
     (if sl
        (make-ipnet (parse-ipaddr (subseq str start sl))
diff --git a/zone b/zone
index de68201..8befb1d 100755 (executable)
--- a/zone
+++ b/zone
@@ -1,6 +1,5 @@
 #! /usr/local/bin/runlisp
 ;;; -*-lisp-*-
 
-(clc:clc-require "mdw")
 (clc:clc-require "zone")
 (zone.frontend:main)
index 37e7499..adcfb7e 100644 (file)
--- a/zone.lisp
+++ b/zone.lisp
   (setf types (listify types))
   (let* ((type (car types))
         (func (intern (format nil "ZONE-PARSE/~:@(~A~)" type))))
-    (multiple-value-bind (doc decls body) (parse-body body)
+    (with-parsed-body (doc decls body body)
       (with-gensyms (col tname ttype tttl tdata tdefsubp i)
        `(progn
           (dolist (,i ',types)