[noctool-cvs] CVS source

jprewett jprewett at common-lisp.net
Fri Jan 23 18:04:39 UTC 2009


Update of /project/noctool/cvsroot/source
In directory cl-net:/tmp/cvs-serv21492

Modified Files:
	tests.lisp 
Log Message:

added WITH-SLOT-ACCESSORS macro:
	essentially WITH-ACCESSORS with syntax more like WITH-SLOTS.
	
used WITH-SLOT-ACCESSORS to replace WITH-SLOTS call so that the accessor will be used instead of the SLOT-VALUE.  This makes :AFTER methods (etc.) on (SETF accessor) work(!).

made minor bugfix to PROCESS-DISK:
	have disk store its available space in the DISK-MAX slot



--- /project/noctool/cvsroot/source/tests.lisp	2008/12/19 21:14:23	1.14
+++ /project/noctool/cvsroot/source/tests.lisp	2009/01/23 18:04:39	1.15
@@ -40,10 +40,14 @@
                    (interval monitor)
                    (if (>= (alert-level monitor) *alerting*) .5 1)))))))
 
+;; syntactic sugar on top of with-accessors to make it more like with-slots
+(defmacro with-slot-accessors ((&rest accessors) instance &body body)
+  (let ((acc-list (mapcar (lambda (x) `(,x ,x)) accessors)))
+    `(with-accessors ,acc-list ,instance , at body)))
 
 (defmethod process ((monitor ping-monitor))
   (without-errors NIL
-    (with-slots (equipment ping-count ping-interval max-rtt alert-level max-fail graph) monitor
+    (with-slot-accessors (equipment ping-count ping-interval max-rtt alert-level max-fail graph) monitor
       (let ((kit equipment))
         (let ((data (make-ping (name kit) :interval ping-interval :count ping-count)))
           (let ((failed (count -1.0 data :test #'=))
@@ -130,10 +134,10 @@
                  (add-graphs platter)
                  (push platter
                        (disk-list monitor)))
-		    
                (when platter
                  (setf (mountpoint platter) mount)
                  (setf (disk-free platter) free)
+                 (setf (disk-max platter) disk)
                  (add-value (disk-graph platter) used)
                  (setf (last-updated platter) (get-universal-time))
                  (let ((percent (if (= 0 disk) 100 (* 100 (/ used disk)))))





More information about the noctool-cvs mailing list