X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fmain%2Fmain.lisp;h=800c2079069a7ff23d9905090503de9b9ee758c0;hb=bb7b484;hp=b0d82ebb2a00d2c721c6da4664a093f177509ddc;hpb=687ec5dde86dc5e9a46f1441051d2b1da13c4478;p=clnl diff --git a/src/main/main.lisp b/src/main/main.lisp index b0d82eb..800c207 100644 --- a/src/main/main.lisp +++ b/src/main/main.lisp @@ -14,18 +14,18 @@ (defun p (result) result) -(defun run () - "RUN => RESULT +(defun run (&optional file) + "RUN &optional FILE => RESULT ARGUMENTS AND VALUES: + FILE: nlogo file with which to initialize RESULT: undefined, the system terminates at the end of the loop DESCRIPTION: RUN starts up the CLNL system." - (boot) - (sb-thread:make-thread #'clnl-cli:run) + (boot file) (clnl-interface:run)) (defvar *callback* nil) @@ -205,6 +205,10 @@ EXAMPLES: (lambda (proc) (create-proc-body proc prims)) (clnl-code-parser:procedures code-ast)) (clnl-random:set-seed ,seed) + (clnl-model:set-current-interface ',(clnl-model:interface model)) + ,@(when netlogo-callback + `((clnl-model:set-callback + (lambda (,(intern "NETLOGO-CODE" *model-package*)) ,(netlogo-callback-body prims))))) ,(create-world-call model globals code-ast) ,@(when netlogo-callback `((funcall ,netlogo-callback @@ -258,6 +262,8 @@ DESCRIPTION: (clnl-code-parser:procedures code-ast)) (defun ,boot-fn () (clnl-random:set-seed ,seed) + (clnl-model:set-current-interface ',(clnl-model:interface model)) + (clnl-model:set-callback (symbol-function ',netlogo-callback-fn)) ,(create-world-call model globals code-ast) ,@(when initialize-interface `((clnl-interface:initialize :dims ',(clnl-model:world-dimensions model))))) ,@(when netlogo-callback-fn