summaryrefslogtreecommitdiffhomepage
path: root/tools/dfagen/examples/ex1_cb.c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dfagen/examples/ex1_cb.c.patch')
-rw-r--r--tools/dfagen/examples/ex1_cb.c.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/dfagen/examples/ex1_cb.c.patch b/tools/dfagen/examples/ex1_cb.c.patch
new file mode 100644
index 00000000..bc4cc924
--- /dev/null
+++ b/tools/dfagen/examples/ex1_cb.c.patch
@@ -0,0 +1,41 @@
+--- ex1_cb_skel.c 2008-01-06 18:00:55.000000000 +0100
++++ ex1_cb.c 2008-01-06 18:02:10.000000000 +0100
+@@ -7,6 +7,10 @@
+ */
+ #include "ex1_cb.h"
+
++#include <stdio.h>
++
++struct door_t { ex1_state_t fsm; };
++
+ /*
+ * OPEN =close=>
+ * => CLOSED
+@@ -15,6 +19,7 @@
+ ex1_branch_t
+ ex1__OPEN__close (door_t *user)
+ {
++ printf ("close the door\n");
+ return ex1_next (OPEN, close);
+ }
+
+@@ -26,7 +31,18 @@
+ ex1_branch_t
+ ex1__CLOSED__open (door_t *user)
+ {
++ printf ("open the door\n");
+ return ex1_next (CLOSED, open);
+ }
+
+-
++int
++main (void)
++{
++ door_t door;
++ ex1_init (&door);
++ ex1_handle_event (&door, EX1_EVENT_close);
++ ex1_handle_event (&door, EX1_EVENT_open);
++ printf ("now, will crash:\n");
++ ex1_handle_event (&door, EX1_EVENT_open);
++ return 0;
++}