X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=clnl;a=blobdiff_plain;f=src%2Fmain%2Fnvm%2Fbase.lisp;h=1a80dc3fa87deea9f4bed2cb8432e232b4fed5e7;hp=063dfb5523bd7105f0698b5e11bbb59fb86da2bd;hb=89cb3482de1fefc2d8e5f67e1e04a0790e8cd243;hpb=bc6386a709da76fef1393a11a7251b4be7032fda diff --git a/src/main/nvm/base.lisp b/src/main/nvm/base.lisp index 063dfb5..1a80dc3 100644 --- a/src/main/nvm/base.lisp +++ b/src/main/nvm/base.lisp @@ -15,6 +15,7 @@ (defvar *breeds* nil) (define-condition stop nil nil) +(define-condition death nil nil) (defmacro with-stop-handler (&rest forms) "MACRO WITH-STOP-HANDLER &rest FORMS => HANDLED-FORM @@ -31,7 +32,16 @@ DESCRIPTION: :stop is returned." `(handler-case (progn ,@forms) (stop (s) (declare (ignore s)) :stop))) -(defstruct turtle who breed color heading xcor ycor (label "") (label-color 9.9d0) (size 1d0) shape own-vars) +(defmacro with-stop-and-death-handler (&rest forms) + `(handler-case + (progn ,@forms) + (stop (s) (declare (ignore s)) :stop) + (death (d) (declare (ignore d)) :death))) + +(defmacro defcommand (name args docstring &rest body) + `(defun ,name ,args ,docstring ,@body :undefined)) + +(defstruct turtle who breed color heading xcor ycor (label "") label-color size shape own-vars) (defstruct patch color xcor ycor own-vars turtles) (defun agentset-list (agentset)