1 (in-package #:clnl-model)
3 (defvar *separator* "@#$#@#$#@")
19 (defun read-from-nlogo (str)
20 "READ-FROM-NLOGO STR => MODEL
24 STR: a readable stream
25 MODEL: an object representing the model
29 Takes a stream STR, reads in a nlogo file, parses it, and then
30 returns the model object."
34 ((read-sections (&optional section)
36 ((line (read-line str nil)))
38 (if (string= *separator* line)
39 (cons section (read-sections))
40 (read-sections (append section (list line))))))))
43 :code (nth 0 sections)
44 :interface (nth 1 sections)
45 :info (nth 2 sections)
46 :turtle-shapes (nth 3 sections)
47 :version (nth 4 sections)
48 :preview-commands (nth 5 sections)
49 :system-dynamics (nth 6 sections)
50 :behavior-space (nth 7 sections)
51 :hub-net-client (nth 8 sections)
52 :link-shapes (nth 9 sections)
53 :model-settings (nth 10 sections)
54 :delta-tick (nth 11 sections))))