From: Frank Duncan Date: Tue, 19 Apr 2016 14:36:26 +0000 (-0500) Subject: Add strictmath library X-Git-Tag: v0.1.0~62 X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=34a7f8e17a5b27d1b15b297f999e13a93900408b;p=clnl Add strictmath library --- diff --git a/.travis.yml b/.travis.yml index 58afb74..39f79ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ addons: 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/076c72b/$(git rev-parse HEAD)/travissbcl + - wget http://frank.kank.net/travissbcl/clnl/213ed30/$(git rev-parse HEAD)/travissbcl - chmod +x travissbcl script: - - ./travissbcl --script bin/travis.lisp + - ./travissbcl --script bin/all.lisp diff --git a/README.md b/README.md index 910cfdf..c5b7d58 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ If you'd like to run it from source, you're going to need a few things: * mt19937 * nibbles * trivial-features + * strictmath + * ieee-floats [bin/nl](bin/nl) and [bin/run.lisp](bin/run.lisp) have 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 diff --git a/bin/all.lisp b/bin/all.lisp index a790a20..029e6b7 100644 --- a/bin/all.lisp +++ b/bin/all.lisp @@ -1,5 +1,10 @@ -(when (not (find-package :clnl)) (asdf:load-system :clnl)) -(when (not (find-package :clnl-test)) (asdf:load-system :clnl-test)) +(setf *compile-print* nil) +(require 'asdf) +(asdf:initialize-source-registry `(:source-registry (:tree ,(car (directory "src"))) :INHERIT-CONFIGURATION)) +(asdf:load-system :clnl) +(asdf:load-system :clnl-test) +#-travis(asdf:load-system :style-checker) +#-travis(asdf:load-system :docgen) (format t "~%~c[1;33mRunning Tests~c[0m~%" #\Esc #\Esc) (when (not (clnl-test:run-all-tests)) diff --git a/bin/buildlinuxexec.sh b/bin/buildlinuxexec.sh index 06f0cd8..37c6d8a 100755 --- a/bin/buildlinuxexec.sh +++ b/bin/buildlinuxexec.sh @@ -24,7 +24,9 @@ mkdir -p tmp/deps/ tar zxf ../../deps/common-lisp/mt19937-latest.tar.gz && tar zxf ../../deps/common-lisp/nibbles-v0.12.tar.gz && tar zxf ../../deps/common-lisp/trivial-features_0.8.tar.gz && - tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz + tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz && + tar zxf ../../deps/common-lisp/ieee-floats-92e481a.tar.gz && + tar zxf ../../deps/common-lisp/strictmath_0.1.tar.gz ) SBCL_HOME="" tmp/sbcl/bin/sbcl --core tmp/sbcl/lib/sbcl/sbcl.core \ diff --git a/bin/buildosxexec.sh b/bin/buildosxexec.sh index e0465ee..963973e 100755 --- a/bin/buildosxexec.sh +++ b/bin/buildosxexec.sh @@ -28,7 +28,9 @@ mkdir -p tmp/deps/ tar zxf ../../deps/common-lisp/mt19937-latest.tar.gz && tar zxf ../../deps/common-lisp/nibbles-v0.12.tar.gz && tar zxf ../../deps/common-lisp/trivial-features_0.8.tar.gz && - tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz + tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz && + tar zxf ../../deps/common-lisp/ieee-floats-92e481a.tar.gz && + tar zxf ../../deps/common-lisp/strictmath_0.1.tar.gz ) SBCL_HOME="" tmp/sbcl/bin/sbcl --core tmp/sbcl/lib/sbcl/sbcl.core --no-sysinit --no-userinit \ diff --git a/bin/buildtravisexec.sh b/bin/buildtravisexec.sh index 7791491..28dfd60 100755 --- a/bin/buildtravisexec.sh +++ b/bin/buildtravisexec.sh @@ -26,7 +26,9 @@ mkdir -p tmp/deps/ tar zxf ../../deps/common-lisp/trivial-features_0.8.tar.gz && tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz && tar zxf ../../deps/common-lisp/style-checker_0.1.tar.gz && - tar zxf ../../deps/common-lisp/docgen_0.1.tar.gz + tar zxf ../../deps/common-lisp/docgen_0.1.tar.gz && + tar zxf ../../deps/common-lisp/ieee-floats-92e481a.tar.gz && + tar zxf ../../deps/common-lisp/strictmath_0.1.tar.gz ) SBCL_HOME="" tmp/sbcl/bin/sbcl --core tmp/sbcl/lib/sbcl/sbcl.core \ @@ -41,14 +43,16 @@ SBCL_HOME="" tmp/sbcl/bin/sbcl --core tmp/sbcl/lib/sbcl/sbcl.core \ --eval "(asdf:load-system :cl-charms)" \ --eval "(asdf:load-system :style-checker)" \ --eval "(asdf:load-system :docgen)" \ + --eval "(asdf:load-system :strictmath)" \ --eval "(asdf:clear-output-translations)" \ + --eval "(push :travis *features*)" \ --eval '(sb-ext:save-lisp-and-die "travissbcl" :executable t)' \ chmod +x travissbcl travisname=travissbcl-$(git rev-parse --short HEAD) mv travissbcl $travisname -echo "You should upload via the command: scp $travisname nami:/opt/travis/sbcls/clnl/" +echo "You should upload via the command: scp $travisname nami:/var/travis/sbcls/clnl/" echo "You should also set travisname in .travis.yml to $travisname" rm -rf tmp diff --git a/bin/buildwindowsexec.sh b/bin/buildwindowsexec.sh index b248488..45ffe76 100755 --- a/bin/buildwindowsexec.sh +++ b/bin/buildwindowsexec.sh @@ -35,7 +35,9 @@ mkdir -p tmp/deps/ tar zxf ../../deps/common-lisp/mt19937-latest.tar.gz && tar zxf ../../deps/common-lisp/nibbles-v0.12.tar.gz && tar zxf ../../deps/common-lisp/trivial-features_0.8.tar.gz && - tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz + tar zxf ../../deps/common-lisp/cl-charms-9bb94ef.tar.gz && + tar zxf ../../deps/common-lisp/ieee-floats-92e481a.tar.gz && + tar zxf ../../deps/common-lisp/strictmath_0.1.tar.gz ) cur_dir=$(cygpath -d $PWD) diff --git a/bin/travis.lisp b/bin/travis.lisp deleted file mode 100644 index a5dc59c..0000000 --- a/bin/travis.lisp +++ /dev/null @@ -1,8 +0,0 @@ -(setf *compile-print* nil) -(require 'asdf) -;(setf asdf:*central-registry* (list #p"deps/")) -(asdf:initialize-source-registry `(:source-registry (:tree ,(car (directory "src"))) :IGNORE-INHERITED-CONFIGURATION)) -(asdf:load-system :clnl.internal) -(asdf:load-system :clnl-test.internal) - -(load "bin/all.lisp") diff --git a/deps/common-lisp/ieee-floats-92e481a.tar.gz b/deps/common-lisp/ieee-floats-92e481a.tar.gz new file mode 100644 index 0000000..b16584c Binary files /dev/null and b/deps/common-lisp/ieee-floats-92e481a.tar.gz differ diff --git a/deps/common-lisp/strictmath_0.1.tar.gz b/deps/common-lisp/strictmath_0.1.tar.gz new file mode 100644 index 0000000..fc88c36 Binary files /dev/null and b/deps/common-lisp/strictmath_0.1.tar.gz differ diff --git a/src/main/clnl.asd b/src/main/clnl.asd index 659577f..29e33cc 100644 --- a/src/main/clnl.asd +++ b/src/main/clnl.asd @@ -1,15 +1,16 @@ -; The systems are split up into two because travis will run more smoothly -; if we use a custom built sbcl that has all the deps pre-loaded since -; we are sure those will work just fine :) -; -; You should link to this file in your systems directory, or however you -; handle your asdf configurations. Then just (asdf:load-system :clnl) -; -; There's probably a better way, but I don't know it - (asdf:defsystem clnl - :name "Experiment" - :version "0.0.0" - :maintainer "Frank Duncan (frank@kank.com)" - :author "Frank Duncan (frank@kank.com)" - :depends-on (:cl-ppcre :mt19937 :cl-opengl :cl-glut :cl-charms :clnl.internal)) + :name "Experiment" + :version "0.0.0" + :maintainer "Frank Duncan (frank@kank.com)" + :author "Frank Duncan (frank@kank.com)" + :components ((:file "package") + (:file "model") + (:file "lex") + (:file "parse") + (:file "nvm") + (:file "transpile") + (:file "random") + (:file "interface") + (:file "cli") + (:file "main")) + :depends-on #-travis (:cl-ppcre :mt19937 :cl-opengl :cl-glut :cl-charms :strictmath) #+travis nil) diff --git a/src/main/clnl.internal.asd b/src/main/clnl.internal.asd deleted file mode 100644 index e6614dd..0000000 --- a/src/main/clnl.internal.asd +++ /dev/null @@ -1,21 +0,0 @@ -; The systems are split up into two because travis will run more smoothly -; if we use a custom built sbcl that has all the deps pre-loaded since -; we are sure those will work just fine :) -; -; You should link to this file in your systems directory, or however you -; handle your asdf configurations. Then just (asdf:load-system :clnl) -; -; There's probably a better way, but I don't know it - -(asdf:defsystem clnl.internal - :serial t - :components ((:file "package") - (:file "model") - (:file "lex") - (:file "parse") - (:file "nvm") - (:file "transpile") - (:file "random") - (:file "interface") - (:file "cli") - (:file "main"))) diff --git a/src/main/nvm.lisp b/src/main/nvm.lisp index 37df1cb..018ce7e 100644 --- a/src/main/nvm.lisp +++ b/src/main/nvm.lisp @@ -141,8 +141,12 @@ DESCRIPTION: See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#forward" (when (not (turtle-p *self*)) (error "Gotta call fd in turtle scope, dude (~A)" *self*)) - (setf (turtle-xcor *self*) (+ (turtle-xcor *self*) (* n (sin (* pi (/ (turtle-heading *self*) 180)))))) - (setf (turtle-ycor *self*) (+ (turtle-ycor *self*) (* n (cos (* pi (/ (turtle-heading *self*) 180))))))) + (setf + (turtle-xcor *self*) + (+ (turtle-xcor *self*) (* n (strictmath:sin (strictmath:to-radians (turtle-heading *self*)))))) + (setf + (turtle-ycor *self*) + (+ (turtle-ycor *self*) (* n (strictmath:cos (strictmath:to-radians (turtle-heading *self*))))))) (defun create-turtles (n) "CREATE-TURTLES N => RESULT diff --git a/src/test/clnl-test.asd b/src/test/clnl-test.asd index d65a797..abb713d 100644 --- a/src/test/clnl-test.asd +++ b/src/test/clnl-test.asd @@ -1,7 +1,10 @@ -; For why this is the way it is, see src/main/clnl.asd (asdf:defsystem clnl-test :name "Experiment Tests" :maintainer "Frank Duncan (frank@kank.com)" :author "Frank Duncan (frank@kank.com)" :serial t - :depends-on (:ironclad :clnl clnl-test.internal)) + :components ((:file "package") + (:file "main") + (:file "simpletests") + (:file "viewtests")) + :depends-on (#-travis :ironclad :clnl)) diff --git a/src/test/clnl-test.internal.asd b/src/test/clnl-test.internal.asd deleted file mode 100644 index a20cf88..0000000 --- a/src/test/clnl-test.internal.asd +++ /dev/null @@ -1,6 +0,0 @@ -; For why this is the way it is, see src/main/clnl.asd -(asdf:defsystem clnl-test.internal - :components ((:file "package") - (:file "main") - (:file "simpletests") - (:file "viewtests")))