From ab8c3aef948e70a75d055174293f28f3146a592e Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sun, 22 Nov 2009 23:37:53 +0100 Subject: tools/dfagen: add import support, closes #82 --- tools/dfagen/examples/Makefile | 11 ++++++- tools/dfagen/examples/import.dump.ref | 58 +++++++++++++++++++++++++++++++++++ tools/dfagen/examples/import.fsm | 29 ++++++++++++++++++ tools/dfagen/examples/imported1.fsm | 16 ++++++++++ tools/dfagen/examples/imported2.fsm | 16 ++++++++++ tools/dfagen/examples/imported3.fsm | 20 ++++++++++++ 6 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 tools/dfagen/examples/import.dump.ref create mode 100644 tools/dfagen/examples/import.fsm create mode 100644 tools/dfagen/examples/imported1.fsm create mode 100644 tools/dfagen/examples/imported2.fsm create mode 100644 tools/dfagen/examples/imported3.fsm (limited to 'tools/dfagen/examples') diff --git a/tools/dfagen/examples/Makefile b/tools/dfagen/examples/Makefile index 1f7b3308..ad97b8a4 100644 --- a/tools/dfagen/examples/Makefile +++ b/tools/dfagen/examples/Makefile @@ -1,6 +1,6 @@ CFLAGS = -O2 -Wall -all: ex1 ex2 ex1.png ex2.png ex2_tpl +all: ex1 ex2 ex1.png ex2.png ex2_tpl import.dump.check ex1: ex1.o ex1_cb.o @@ -38,9 +38,18 @@ ex2_tpl: ex2.fsm ex2_tpl.conf %.png: %.dot dot -Tpng $< -o $@ +%.dump: %.fsm + python ../dfagen.py --dump -d $< > $@ + +%.check: % %.ref + diff $^ + +import.dump: import.fsm imported1.fsm imported2.fsm imported3.fsm + clean: rm -f ex1 ex1.o ex1_cb.o ex1.c ex1.h ex1_cb_skel.c ex1_cb.h ex1_cb.c rm -f ex1.dot ex1.png rm -f ex2 ex2.o ex2_cb.o ex2_robot.o ex2.c ex2.h ex2_cb_skel.c ex2_cb.h ex2_cb.c rm -f ex2.dot ex2.png rm -f ex2_tpl_defs.h ex2_tpl_table.h + rm -f import.dump diff --git a/tools/dfagen/examples/import.dump.ref b/tools/dfagen/examples/import.dump.ref new file mode 100644 index 00000000..6cc359de --- /dev/null +++ b/tools/dfagen/examples/import.dump.ref @@ -0,0 +1,58 @@ +Import + Import definitions from other files. + +States: + I1S1 + I1S2 + RS1 + RS2 + I2S1 + I2S2 + I3S1 + I3S2 + +Events: + i1e1 + i1e2 + i2e1 + i2e2 + re1 + re2 + i3e1 + i3e2 + +I1S1: + i1e2 -> I1S2 + +I1S2: + i1e1 -> I1S1 + +RS1: + re2 -> RS2 + i1e2 -> RS2 + i2e2 -> RS2 + i3e2 -> RS2 + +RS2: + re1 -> RS1 + i1e1 -> RS1 + i2e1 -> RS1 + i3e1 -> RS1 + +I2S1: + i2e2 -> I2S2 + +I2S2: + i2e1 -> I2S1 + +I3S1: + i3e2 -> I3S2 + i2e2 -> I3S2 + re2 -> I3S2 + +I3S2: + i3e1 -> I3S1 + i2e1 -> I3S1 + re1 -> I3S1 + + diff --git a/tools/dfagen/examples/import.fsm b/tools/dfagen/examples/import.fsm new file mode 100644 index 00000000..9d4b5cdf --- /dev/null +++ b/tools/dfagen/examples/import.fsm @@ -0,0 +1,29 @@ +# Import root file. +Import + Import definitions from other files. + +import imported1.fsm + +States: + RS1 + RS2 + +import imported2.fsm + +Events: + re1 + re2 + +import imported3.fsm + +RS1: + re2 -> RS2 + i1e2 -> RS2 + i2e2 -> RS2 + i3e2 -> RS2 + +RS2: + re1 -> RS1 + i1e1 -> RS1 + i2e1 -> RS1 + i3e1 -> RS1 diff --git a/tools/dfagen/examples/imported1.fsm b/tools/dfagen/examples/imported1.fsm new file mode 100644 index 00000000..fe4ee9ff --- /dev/null +++ b/tools/dfagen/examples/imported1.fsm @@ -0,0 +1,16 @@ +# Imported first file. +Imported1 + +States: + I1S1 + I1S2 + +Events: + i1e1 + i1e2 + +I1S1: + i1e2 -> I1S2 + +I1S2: + i1e1 -> I1S1 diff --git a/tools/dfagen/examples/imported2.fsm b/tools/dfagen/examples/imported2.fsm new file mode 100644 index 00000000..d9592d3d --- /dev/null +++ b/tools/dfagen/examples/imported2.fsm @@ -0,0 +1,16 @@ +# Imported second file. +Imported2 + +States: + I2S1 + I2S2 + +Events: + i2e1 + i2e2 + +I2S1: + i2e2 -> I2S2 + +I2S2: + i2e1 -> I2S1 diff --git a/tools/dfagen/examples/imported3.fsm b/tools/dfagen/examples/imported3.fsm new file mode 100644 index 00000000..8115cc62 --- /dev/null +++ b/tools/dfagen/examples/imported3.fsm @@ -0,0 +1,20 @@ +# Imported third file. +Imported3 + +States: + I3S1 + I3S2 + +Events: + i3e1 + i3e2 + +I3S1: + i3e2 -> I3S2 + i2e2 -> I3S2 + re2 -> I3S2 + +I3S2: + i3e1 -> I3S1 + i2e1 -> I3S1 + re1 -> I3S1 -- cgit v1.2.3