before_install:
- export DISPLAY=:99.0
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x24
- - wget http://frank.kank.net/travissbcl/clnl/ee78f42/$(git rev-parse HEAD)/travissbcl
+ - wget http://frank.kank.net/travissbcl/clnl/076c72b/$(git rev-parse HEAD)/travissbcl
- chmod +x travissbcl
script:
- ./travissbcl --script bin/travis.lisp
* An implementation of sbcl with threads enabled
* The following common lisp libraries (included in deps/tarpit folder)
- * cl-opengl
* alexandria
* babel
* cffi
+ * cl-charms
+ * cl-opengl
+ * cl-ppcre
+ * docgen
* ironclad
* mt19937
* nibbles
* trivial-features
* style-checker
- * docgen
* rlwrap
-# Running
+# Running as a program
-bin/nl has been added for convenience to run the netlogo instance. Currently it bombs if you try to do anything to expressive with it. A good test is
+bin/nl has been added for convenience to run the netlogo instance. It boots up the ncurses command line with an opengl view. Not very many commands are implemented, but it should alert you to that. A good test is
```
crt 10
ask turtles [ fd 1 ]
show random 5
+ask turtles [ fd 5 ]
```
+# Running in a common lisp instance
+
If you'd like to run using your own sbcl instance, you can attach the clnl.asd file wherever you link asd files, and then use:
```lisp
(asdf:load-system :clnl)
-(sb-thread:make-thread #'clnl-interface:run)
(clnl:run)
```
+To view the opengl view, you'll want to open up the interface:
+
+```lisp
+(sb-thread:make-thread #'clnl-interface:run)
+```
+
+(On OSX, the interface should be the main thread)
+
# Testing
If you'd like to see the tests go on your system, there's a number of utilities to look at:
tar zxf ../../deps/tarpit/mt19937-latest.tar.gz &&
tar zxf ../../deps/tarpit/nibbles-v0.12.tar.gz &&
tar zxf ../../deps/tarpit/trivial-features_0.8.tar.gz &&
+ tar zxf ../../deps/tarpit/cl-charms-9bb94ef.tar.gz &&
tar zxf ../../deps/tarpit/style-checker_0.1.tar.gz &&
tar zxf ../../deps/tarpit/docgen_0.1.tar.gz &&
ln -s cl-ppcre-2.0.10/cl-ppcre.asd . &&
ln -s cffi_0.15.0/cffi-grovel.asd . &&
ln -s cffi_0.15.0/cffi-uffi-compat.asd . &&
ln -s trivial-features_0.8/trivial-features.asd . &&
+ ln -s cl-charms/cl-charms.asd . &&
ln -s style-checker_0.1/style-checker.asd . &&
- ln -s docgen_0.1/docgenasd .
+ ln -s docgen_0.1/docgen.asd .
)
--eval "(asdf:load-system :ironclad)" \
--eval "(asdf:load-system :cl-opengl)" \
--eval "(asdf:load-system :cl-glut)" \
+ --eval "(asdf:load-system :cl-charms)" \
--eval "(asdf:load-system :style-checker)" \
--eval "(asdf:load-system :docgen)" \
--eval "(asdf:clear-output-translations)" \
#!/bin/bash
-rlwrap sbcl --script bin/run.lisp
+sbcl --script bin/run.lisp
(push #p"deps/" asdf:*central-registry*)
(asdf:load-system :clnl)
(sb-thread:make-thread #'clnl-interface:run)
-(clnl:run)
+(clnl-cli:run)
(format t "~%~c[1;33mChecking Docs~c[0m~%" #\Esc #\Esc)
(when (not (docgen:pretty-print-validate-packages
- :clnl :clnl-parser :clnl-random :clnl-transpiler :clnl-nvm :clnl-lexer :clnl-interface))
+ :clnl :clnl-parser :clnl-random :clnl-transpiler :clnl-nvm :clnl-lexer :clnl-interface :clnl-cli))
(format t "~c[1;31mFailed doc check!~c[0m~%" #\Esc #\Esc)
(sb-ext:exit :code 1))
(format t "~c[1;32m- Doc Check Passed!~c[0m~%" #\Esc #\Esc)
--- /dev/null
+(in-package #:clnl-cli)
+
+(defvar *cli* nil)
+(defvar *cli-dims* (list 0 0))
+
+(defvar *info* nil)
+
+(defun run ()
+ "RUN => RESULT
+
+ARGUMENTS AND VALUES:
+
+ RESULT: undefined, should never get here
+
+DESCRIPTION:
+
+ RUN runs the command line interface in the running terminal.
+
+ This should become the main REPL for a CLNL program. If you want to use you're
+ own REPL, you should use the rest of the functions in CLNL to recreate it."
+ (initscr)
+ (init-interface)
+ (loop
+ :for str := (cffi:with-foreign-pointer-as-string (str 255) (wgetnstr *cli* str 255))
+ :while str
+ :while (and (string/= str "q") (string/= str "Q"))
+ :do (print-command-and-response str (execute str)))
+ (endwin)
+ (sb-ext:exit :abort t))
+
+(defun execute (str)
+ (handler-case
+ (with-output-to-string (*standard-output*)
+ (clnl:run-commands str))
+ (error (e) (format nil "Ok, something went wrong: ~A" e))))
+
+; for ui, we need to do at a minimum:
+; - cli, first pass, read things in, bottom of the screen,
+; - just use getstr with a limit to be something like screen width - 10 for now
+; - print what the user inputted, dont' bomb on error messages, give target for show
+; - for overly long printing, go ahead and truncate with "..."
+; - for info, this should put out a simple message about the program, maintainer, purpose, links, etc
+
+(defun init-interface ()
+ (let
+ ((cli-height (min 10 (floor (* *lines* .3)))))
+ (setup-info (- *lines* cli-height) *cols*)
+ (setup-cli cli-height *cols* (- *lines* cli-height))))
+
+(defun refresh-cli ()
+ (wmove *cli* (1- (car *cli-dims*)) 0)
+ (whline *cli* (char-code #\Space) (cadr *cli-dims*))
+ (mvwprintw *cli* (1- (car *cli-dims*)) 0 ">")
+ (wmove *cli* (1- (car *cli-dims*)) 2)
+ (wrefresh *cli*))
+
+(defun print-command-and-response (command response)
+ (loop
+ :for i :from 1 :to (- (car *cli-dims*) 3)
+ :do (wmove *cli* i 0)
+ :do (whline *cli* (char-code #\Space) (cadr *cli-dims*)))
+ (mvwprintw *cli* 1 0 (format nil "> ~A" command))
+ (mvwprintw *cli* 3 0 (format nil "~A" response))
+ (refresh-cli))
+
+(defun setup-cli (height width top)
+ (setf *cli* (newwin height width top 0))
+ (setf *cli-dims* (list height width))
+ (whline *cli* 0 (cadr *cli-dims*))
+ (wmove *cli* (- (car *cli-dims*) 2) 0)
+ (whline *cli* (char-code #\.) (cadr *cli-dims*))
+ (wmove *cli* (1- (car *cli-dims*)) 2)
+ (wrefresh *cli*)
+ (refresh-cli))
+
+(defun setup-info (num-tall num-wide)
+ (setf *info* (newwin 20 60 (floor (- num-tall 20) 2) (floor (- num-wide 60) 2)))
+ (mvwprintw *info* 1 1
+ (format nil
+ "
+ .
+ / \\
+ / \\ Welcome to CLNL version ~A!
+ / \\
+ /_______\\
+
+ CLNL is an experiment at creating an alternate
+ implementation of NetLogo.
+
+ You can enter in various netlogo commands below,
+ or use q to quit the program.
+
+ See http://github.com/frankduncan/clnl for more
+ information about CLNL and to keep apprised of
+ any updates that may happen."
+ (asdf:component-version (asdf:find-system :clnl))))
+ (box *info* 0 0)
+ (wrefresh *info*))
(:file "transpile")
(:file "random")
(:file "interface")
+ (:file "cli")
(:file "main")))
(asdf:defsystem clnl
:version "0.0.1"
:maintainer "Frank Duncan (frank@kank.com)"
:author "Frank Duncan (frank@kank.com)"
- :depends-on (:cl-ppcre :mt19937 :cl-opengl :cl-glut :clnl.internal))
+ :depends-on (:cl-ppcre :mt19937 :cl-opengl :cl-glut :cl-charms :clnl.internal))
(cl-glut:post-redisplay))
(defun close-func ()
- (sb-ext:exit))
+ (sb-ext:exit :abort t))
(defun reshape (width height)
(when (and (/= 0 width) (/= 0 height))
See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#show"
(format t "Showing: ~A~%" (dump-object value)))
+(defun world-dimensions ()
+ (list :xmin -10 :xmax 10 :ymin -10 :ymax 10))
+
(defun create-turtle ()
(setf
*turtles*
The NetLogo view interface using opengl. This is responsible for taking the
current state of the enging and displaying it. Will not house any interface
components."))
+
+(defpackage #:clnl-cli
+ (:use :common-lisp :cl-charms/low-level)
+ (:export :run)
+ (:documentation
+ "CLNL CLI
+
+The main NetLogo interface for interacting with the program. Since CLNL is
+a command line interface program with a view for display purposes only, this
+is where all the features that the traditional NetLogo UI lives."))