From: blackh <gra...@li...> - 2004-01-20 06:21:58
|
blackh Mon Jan 19 22:21:58 2004 EDT Added files: /grapevine/raisen/test noOfMatches.xml Modified files: /grapevine configure.ac configure /grapevine/cpp Engine.cpp Engine.h Makefile.in Operation.cpp Operation.h RuleSAXHandler.cpp /grapevine/cpp/lib Makefile.in Log: New 'noOfMatches' function that provides a straight-forward way to count the number of matches of a particular pattern match that exist. Index: grapevine/cpp/lib/Makefile.in diff -u grapevine/cpp/lib/Makefile.in:1.38 grapevine/cpp/lib/Makefile.in:1.39 --- grapevine/cpp/lib/Makefile.in:1.38 Sun Nov 30 02:31:17 2003 +++ grapevine/cpp/lib/Makefile.in Mon Jan 19 22:21:57 2004 @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,7 +10,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# $Id: Makefile.in,v 1.38 2003/11/30 10:31:17 blackh Exp $ +# $Id: Makefile.in,v 1.39 2004/01/20 06:21:57 blackh Exp $ SHELL = @SHELL@ @@ -76,8 +76,11 @@ EXPATINCLUDE = @EXPATINCLUDE@ EXPATLIB = @EXPATLIB@ EXPATLIBNAME = @EXPATLIBNAME@ +HAVE_LIB = @HAVE_LIB@ HOST = @HOST@ +LIB = @LIB@ LN_S = @LN_S@ +LTLIB = @LTLIB@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PACKAGE_VERSION = @PACKAGE_VERSION@ @@ -204,7 +207,7 @@ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + test "$$subdir" != "." || dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -246,7 +249,7 @@ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) mostlyclean-tags: Index: grapevine/raisen/test/noOfMatches.xml +++ grapevine/raisen/test/noOfMatches.xml <?xml version="1.0"?> <!-- $Id: noOfMatches.xml,v 1.1 2004/01/20 06:21:57 blackh Exp $ --> <grapevine> <domain name="test.noOfMatches"> <facts> <cat name="jasper" colour="orange"/> <cat name="xenopus" colour="black"/> <cat name="ee-eye" colour="orange"/> <cat name="smoochi" colour="orange"/> <cat name="syndrome" colour="purple"/> <cat name="bert" colour="purple"/> </facts> <rules> init: i=<init state=""/>, print("noOfMatches(): "), i#state = "one"; init_one: i=<init state="one"/>, { print("1 "), result = noOfMatches(<cat/>), result == 6, print("2 "), result = noOfMatches(<cat colour="orange"/>), result == 3, i#state = "two" } || println("failed: result=" ## result); init_two: i=<init state="two"/>, remember new <cat name="pebbles" colour="black"/>, { print("3 "), result = noOfMatches(<cat colour="black"/>), result == 1, i#state = "three" } || println("failed: result=" ## result); init_three: i=<init state="three"/>, { print("4 "), result = noOfMatches(<cat colour="black"/>), result == 2, i#count = 0, i#state = "four" } || println("failed: result=" ## result); <!-- Check that the rule can track changes in the number of cats --> init_four: i=<init state="four"/>, { expected = i#count, result = noOfMatches(<cat colour="blue"/>), print((i#count+5) ## " "), { i#count < 5, i#count = i#count + 1, remember new <cat name="alfred" colour="blue"/> } || { i#state = "five", } } || println("failed: result=" ## result ## " expected=" ## expected); init_five-0: i=<init state="five"/>, print("11 "), retract <cat name="syndrome"/> || true; init_five-5: i=<init state="five"/>, retract <cat name="bert"/> || true; <!-- Track the numbers of cats --> track_purple_cats-0: i=<init state="five"/>, no = noOfMatches(<cat colour="purple"/>), { no == 0, i#zero = "true" } || true, { no == 1, i#one = "true" } || true; check_five-10: i=<init state="five"/>, { i#zero == "true", i#one == "true", i#state = "six" } || println("failed: i#zero=" ## i#zero ## " i#one=" ## i#one); check_six: <init state="six"/>, println("ok"); </rules> </domain> </grapevine> |