From 164ac3a34cbac441e82b256c97cb8784ea9d482c Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 17 Mar 2008 22:53:01 +0100 Subject: * tools/dfagen: - added dfagen. --- tools/dfagen/examples/ex2_cb.c.patch | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tools/dfagen/examples/ex2_cb.c.patch (limited to 'tools/dfagen/examples/ex2_cb.c.patch') diff --git a/tools/dfagen/examples/ex2_cb.c.patch b/tools/dfagen/examples/ex2_cb.c.patch new file mode 100644 index 00000000..f1402431 --- /dev/null +++ b/tools/dfagen/examples/ex2_cb.c.patch @@ -0,0 +1,67 @@ +--- ex2_cb_skel.c 2008-01-06 18:02:50.000000000 +0100 ++++ ex2_cb.c 2008-01-06 18:02:50.000000000 +0100 +@@ -6,6 +6,9 @@ + * A barman robot. + */ + #include "ex2_cb.h" ++#include "ex2_robot.h" ++ ++#include + + /* + * FILLING_GLASS =command=> +@@ -37,6 +40,7 @@ + ex2_branch_t + ex2__FILLING_GLASS__glass_filled (robot_t *user) + { ++ puts ("stop filling"); + return ex2_next (FILLING_GLASS, glass_filled); + } + +@@ -48,6 +52,8 @@ + ex2_branch_t + ex2__IDLE__replace_bottle (robot_t *user) + { ++ puts ("reset glass counter"); ++ user->bottle = 3; + return ex2_next (IDLE, replace_bottle); + } + +@@ -63,9 +69,25 @@ + ex2_branch_t + ex2__IDLE__command (robot_t *user) + { +- return ex2_next_branch (IDLE, command, empty_bottle); +- return ex2_next_branch (IDLE, command, without_ice); +- return ex2_next_branch (IDLE, command, with_ice); ++ if (user->bottle) ++ { ++ user->bottle--; ++ if (user->ice) ++ { ++ puts ("open the ice door"); ++ return ex2_next_branch (IDLE, command, with_ice); ++ } ++ else ++ { ++ puts ("start filling"); ++ return ex2_next_branch (IDLE, command, without_ice); ++ } ++ } ++ else ++ { ++ puts ("empty bottle, please replace it"); ++ return ex2_next_branch (IDLE, command, empty_bottle); ++ } + } + + /* +@@ -99,6 +121,8 @@ + ex2_branch_t + ex2__DROPPING_ICE__ice_dropped (robot_t *user) + { ++ puts ("close the ice door"); ++ puts ("start filling"); + return ex2_next (DROPPING_ICE, ice_dropped); + } + -- cgit v1.2.3