X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fmain%2Fnvm%2Fbase.lisp;h=fc2db581e6395ae764753febb0c8d8f52e308626;hb=393d2cd66721b93bed149613ceb7ee4fdac408c2;hp=9d07e9b1280ff677b51faf1e65993f924c59cc80;hpb=aa474227efad1f00e26f762b597a1f18a9cc3be5;p=clnl diff --git a/src/main/nvm/base.lisp b/src/main/nvm/base.lisp index 9d07e9b..fc2db58 100644 --- a/src/main/nvm/base.lisp +++ b/src/main/nvm/base.lisp @@ -11,6 +11,23 @@ (defvar *ticks* nil) (defvar *breeds* nil) +(define-condition stop nil nil) + +(defmacro with-stop-handler (&rest forms) + "MACRO WITH-STOP-HANDLER &rest FORMS => HANDLED-FORM + +ARGUMENTS AND VALUES: + + FORMS: body to be handled + HANDLED-FORM: body with handling + +DESCRIPTION: + + WITH-STOP-HANDLER is a convenience macro to handle when + programs issue a stop condition. When one does, a simple + :stop is returned." + `(handler-case (progn ,@forms) (stop (s) :stop))) + (defstruct turtle who color heading xcor ycor (label "") (label-color 9.9d0) (size 1d0) shape) (defstruct patch color xcor ycor)