X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=clnl;a=blobdiff_plain;f=src%2Fmain%2Fmain.lisp;h=48c3c58c59d5cf82534eb368c4fc6355478bfee2;hp=0997963960d63dff7d1b8d51ec73ea96b118ed2d;hb=057ed8d;hpb=cca1c12f7351ff2414bfd582ecb2cad590aa9b51 diff --git a/src/main/main.lisp b/src/main/main.lisp index 0997963..48c3c58 100644 --- a/src/main/main.lisp +++ b/src/main/main.lisp @@ -29,6 +29,8 @@ DESCRIPTION: (sb-thread:make-thread #'clnl-cli:run) (clnl-interface:run)) +(defvar *callback* nil) + (defun boot (&optional file headless-mode) "BOOT &optional FILE HEADLESS-MODE => RESULT @@ -51,7 +53,8 @@ DESCRIPTION: ((netlogoed-lisp (model->single-form-lisp (if file (with-open-file (str file) (clnl-model:read-from-nlogo str)) (clnl-model:default-model)) - :initialize-interface (not headless-mode))) + :initialize-interface (not headless-mode) + :netlogo-callback (lambda (f) (setf *callback* f)))) (*package* *model-package*)) (eval netlogoed-lisp))) @@ -67,7 +70,8 @@ DESCRIPTION: RUN-COMMANDS will take NetLogo commands, put them through the various stages need to turn them into Common Lisp code, and run it." - (clnl-nvm:with-stop-handler (eval (clnl-transpiler:transpile (clnl-parser:parse (clnl-lexer:lex cmds)))))) + (clnl-nvm:with-stop-handler + (funcall *callback* cmds))) (defun run-reporter (reporter) "RUN-REPORTER REPORTER => RESULT