summaryrefslogtreecommitdiff
path: root/tools/dfagen/examples/tpl
diff options
context:
space:
mode:
authorNicolas Schodet2008-03-25 23:04:37 +0100
committerNicolas Schodet2008-03-25 23:04:37 +0100
commit55ea6889987a9ca1e7429951e0e94be0fa99d7af (patch)
tree48469a2386f302b6c7dfa814d6094b61e89d223c /tools/dfagen/examples/tpl
parent1ea652e0d5185aee5ca60182302d7bb2d4056b46 (diff)
* tools/dfagen:
- fixed warning in doc. - fixed missing newline. - added use of non default templates. - added warning about parser.g. - removed .orig file when patching.
Diffstat (limited to 'tools/dfagen/examples/tpl')
-rw-r--r--tools/dfagen/examples/tpl/template_defs.h46
-rw-r--r--tools/dfagen/examples/tpl/template_table.h12
2 files changed, 58 insertions, 0 deletions
diff --git a/tools/dfagen/examples/tpl/template_defs.h b/tools/dfagen/examples/tpl/template_defs.h
new file mode 100644
index 00000000..54fabba4
--- /dev/null
+++ b/tools/dfagen/examples/tpl/template_defs.h
@@ -0,0 +1,46 @@
+#ifndef %(prefix)s_defs_h
+#define %(prefix)s_defs_h
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * %(name)s
+ *
+%(*comments)s */
+
+/* %(name)s states. */
+enum %(prefix)s_state_t
+{
+%(states)s %(PREFIX)s_STATE_NB
+};
+typedef enum %(prefix)s_state_t %(prefix)s_state_t;
+
+/* %(name)s events. */
+enum %(prefix)s_event_t
+{
+%(events)s %(PREFIX)s_EVENT_NB
+};
+typedef enum %(prefix)s_event_t %(prefix)s_event_t;
+
+/* Only care about next state. */
+#define _BRANCH(state, event, to) (%(PREFIX)s_STATE_ ## to)
+
+/* %(name)s branches. */
+enum %(prefix)s_branch_t
+{
+%(branches)s};
+typedef enum %(prefix)s_branch_t %(prefix)s_branch_t;
+
+#undef _BRANCH
+
+/* %(name)s transition type. */
+typedef %(prefix)s_branch_t (*%(prefix)s_transition_t) (void);
+
+/* Value to return to follow the only branch. */
+#define %(prefix)s_next(state, event) \
+ %(PREFIX)s_BRANCH__ ## state ## __ ## event ## __
+
+/* Value to return to follow a given branch. */
+#define %(prefix)s_next_branch(state, event, branch) \
+ %(PREFIX)s_BRANCH__ ## state ## __ ## event ## __ ## branch
+
+#endif /* %(prefix)s_defs_h */
diff --git a/tools/dfagen/examples/tpl/template_table.h b/tools/dfagen/examples/tpl/template_table.h
new file mode 100644
index 00000000..817197fa
--- /dev/null
+++ b/tools/dfagen/examples/tpl/template_table.h
@@ -0,0 +1,12 @@
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * %(name)s
+ *
+%(*comments)s */
+
+/* %(name)s transition table. */
+static const %(prefix)s_transition_t
+%(prefix)s_transition_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_NB] = {
+%(transition_table)s};
+