summaryrefslogtreecommitdiff
path: root/tools/dfagen/examples/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dfagen/examples/tpl')
-rw-r--r--tools/dfagen/examples/tpl/template_defs.h9
-rw-r--r--tools/dfagen/examples/tpl/template_table.h16
2 files changed, 21 insertions, 4 deletions
diff --git a/tools/dfagen/examples/tpl/template_defs.h b/tools/dfagen/examples/tpl/template_defs.h
index 54fabba4..e4e29fd3 100644
--- a/tools/dfagen/examples/tpl/template_defs.h
+++ b/tools/dfagen/examples/tpl/template_defs.h
@@ -15,11 +15,11 @@ enum %(prefix)s_state_t
typedef enum %(prefix)s_state_t %(prefix)s_state_t;
/* %(name)s events. */
-enum %(prefix)s_event_t
+enum %(prefix)s_event_type_t
{
-%(events)s %(PREFIX)s_EVENT_NB
+%(events,%(PREFIX)s_EVENT_TYPE_%(event)s)s %(PREFIX)s_EVENT_TYPE_NB
};
-typedef enum %(prefix)s_event_t %(prefix)s_event_t;
+typedef enum %(prefix)s_event_type_t %(prefix)s_event_type_t;
/* Only care about next state. */
#define _BRANCH(state, event, to) (%(PREFIX)s_STATE_ ## to)
@@ -43,4 +43,7 @@ typedef %(prefix)s_branch_t (*%(prefix)s_transition_t) (void);
#define %(prefix)s_next_branch(state, event, branch) \
%(PREFIX)s_BRANCH__ ## state ## __ ## event ## __ ## branch
+/* Number of initial events. */
+#define %(PREFIX)s_INITIALS_NB %(initials_nb)s
+
#endif /* %(prefix)s_defs_h */
diff --git a/tools/dfagen/examples/tpl/template_table.h b/tools/dfagen/examples/tpl/template_table.h
index 817197fa..39f07bdb 100644
--- a/tools/dfagen/examples/tpl/template_table.h
+++ b/tools/dfagen/examples/tpl/template_table.h
@@ -7,6 +7,20 @@
/* %(name)s transition table. */
static const %(prefix)s_transition_t
-%(prefix)s_transition_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_NB] = {
+%(prefix)s_transition_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_TYPE_NB] = {
%(transition_table)s};
+/* %(name)s only branch table. */
+static const %(prefix)s_state_t
+%(prefix)s_only_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_TYPE_NB] = {
+%(only_branch_table)s};
+
+/* %(name)s initial states. */
+static const %(prefix)s_state_t
+%(prefix)s_initials_table[] = {
+%(initials)s};
+
+/* %(name)s state attributes. */
+static const %(prefix)s_state_t
+%(prefix)s_attr_table[] = {
+%(states,"%(state)s (%(@)s) (%(@in)s) (%(@out|no_out)s)")s};