## The runtime support library.
SUBDIRS += lib
+## The tests and examples.
+SUBDIRS += test
+
###----- That's all, folks --------------------------------------------------
dnl--------------------------------------------------------------------------
dnl Output.
-AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile])
+AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile test/Makefile])
AC_OUTPUT
dnl----- That's all, folks --------------------------------------------------
;;;--------------------------------------------------------------------------
;;; Test expression parser.
-(defparse token (:context (context character-parser-context) parser)
- (with-gensyms (value)
- (expand-parser-spec context
- `(seq ((,value ,parser) :whitespace) ,value))))
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defparse token (:context (context character-parser-context) parser)
+ (with-gensyms (value)
+ (expand-parser-spec context
+ `(seq ((,value ,parser) :whitespace) ,value)))))
(let ((add (binop "+" (x y 5) `(+ ,x ,y)))
(sub (binop "-" (x y 5) `(- ,x ,y)))
;;; Testing.
(defmethod perform ((op test-op) (system (eql (find-system "sod-test"))))
- (operate 'load-op system)
- (funcall (find-symbol "RUN-TESTS" "SOD-TEST")))
-
-;;;--------------------------------------------------------------------------
-;;; Hacks.
-
-(defmethod perform :around
- ((op compile-op) (component (eql (find-system "sod-test"))))
- (let ((*compile-file-failure-behaviour* :warn))
- (call-next-method)))
+ (handler-bind (((or warning style-warning)
+ (lambda (cond)
+ (declare (ignore cond))
+ (invoke-restart 'muffle-warning))))
+ (operate 'load-op system)
+ (funcall (find-symbol "RUN-TESTS" "SOD-TEST"))))
;;;----- That's all, folks --------------------------------------------------
(defmethod perform ((op test-op) (component (eql (find-system "sod"))))
(declare (ignore op component))
- (operate 'test-op "sod-test" :force t))
+ (handler-bind (((or warning style-warning)
+ (lambda (cond)
+ (declare (ignore cond))
+ (invoke-restart 'muffle-warning))))
+ (operate 'test-op "sod-test")))
;;;----- That's all, folks --------------------------------------------------
--- /dev/null
+### -*-makefile-*-
+###
+### Build script for SOD examples and tests
+###
+### (c) 2015 Straylight/Edgeware
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the Sensble Object Design, an object system for C.
+###
+### SOD is free software; you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published by
+### the Free Software Foundation; either version 2 of the License, or
+### (at your option) any later version.
+###
+### SOD is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+### GNU General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with SOD; if not, write to the Free Software Foundation,
+### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+include $(top_srcdir)/vars.am
+
+###--------------------------------------------------------------------------
+### The silly Chimaera example.
+
+check_PROGRAMS += chimaera
+
+EXTRA_DIST += chimaera.sod
+nodist_chimaera_SOURCES = chimaera.c chimaera.h
+BUILT_SOURCES += $(nodist_chimaera_SOURCES)
+
+EXTRA_DIST += chimaera.ref
+CLEANFILES += chimaera.out
+check-local:: chimaera chimaera.ref
+ ./chimaera >chimaera.out
+ diff -u $(srcdir)/chimaera.ref chimaera.out
+
+###----- That's all, folks --------------------------------------------------
--- /dev/null
+provoking Lion as a lion
+Munch!
+tickle Lion #0...
+Munch!
+tickle Lion #1...
+Munch!
+tickle Lion #2...
+Munch!
+provoking Goat as a goat
+Bonk!
+tickle Goat #0...
+Bonk!
+tickle Goat #1...
+Bonk!
+tickle Goat #2...
+Bonk!
+provoking Serpent as a serpent
+Nom!
+tickle Serpent #0...
+Sssss!
+tickle Serpent #1...
+Sssss!
+tickle Serpent #2...
+Nom!
+provoking Chimaera as a lion
+Munch!
+provoking Chimaera as a goat
+Bonk!
+provoking Chimaera as a serpent
+Nom!
+tickle Chimaera #0...
+Munch!
+tickle Chimaera #1...
+Munch!
+tickle Chimaera #2...
+Munch!