summaryrefslogtreecommitdiff
path: root/cesar/cp2
diff options
context:
space:
mode:
authorschodet2008-06-13 15:04:18 +0000
committerschodet2008-06-13 15:04:18 +0000
commit0c3cf6a048d37e2cf9c0c555597244589f37fc8f (patch)
treef66f753cb9a9d044bc691ac331b21119d0ecad8a /cesar/cp2
parent6aa4e7a349bd141a04e700d33067b956b9e1b51d (diff)
* cp2/fsm:
- changed cp_fsm_branch to a macro. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2334 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2')
-rw-r--r--cesar/cp2/fsm/fsm.h4
-rw-r--r--cesar/cp2/fsm/src/fsm.c2
-rw-r--r--cesar/cp2/fsm/test/utest/src/fsm_stub.c14
-rw-r--r--cesar/cp2/fsm/test/utest/src/test_fsm.c3
4 files changed, 11 insertions, 12 deletions
diff --git a/cesar/cp2/fsm/fsm.h b/cesar/cp2/fsm/fsm.h
index 70801b8269..7db3a7ed39 100644
--- a/cesar/cp2/fsm/fsm.h
+++ b/cesar/cp2/fsm/fsm.h
@@ -58,7 +58,9 @@ cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event);
* The selected branch must correspond to the current handled transition.
*/
void
-cp_fsm_branch (cp_t *ctx, cp_fsm_branch_t branch);
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch);
+#define cp_fsm_branch(ctx, state, event, branch) \
+ cp_fsm_branch_ ((ctx), CP_FSM_BRANCH (state, event, branch))
END_DECLS
diff --git a/cesar/cp2/fsm/src/fsm.c b/cesar/cp2/fsm/src/fsm.c
index 6e0efe4585..26ef330351 100644
--- a/cesar/cp2/fsm/src/fsm.c
+++ b/cesar/cp2/fsm/src/fsm.c
@@ -105,7 +105,7 @@ cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
}
void
-cp_fsm_branch (cp_t *ctx, cp_fsm_branch_t branch)
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch)
{
dbg_assert (ctx);
dbg_assert (ctx->fsm.state < CP_FSM_STATE_NB);
diff --git a/cesar/cp2/fsm/test/utest/src/fsm_stub.c b/cesar/cp2/fsm/test/utest/src/fsm_stub.c
index 39fec11140..ea4fdf4681 100644
--- a/cesar/cp2/fsm/test/utest/src/fsm_stub.c
+++ b/cesar/cp2/fsm/test/utest/src/fsm_stub.c
@@ -75,16 +75,14 @@ cp_fsm__STATE1__error_event_no_branch (cp_t *ctx)
void
cp_fsm__STATE1__error_event_bad_branch (cp_t *ctx)
{
- cp_fsm_branch (ctx, CP_FSM_BRANCH (STATE2, event3, branch1));
+ cp_fsm_branch (ctx, STATE2, event3, branch1);
}
void
cp_fsm__STATE1__error_event_dup_branch (cp_t *ctx)
{
- cp_fsm_branch (ctx, CP_FSM_BRANCH (STATE1, error_event_dup_branch,
- branch1));
- cp_fsm_branch (ctx, CP_FSM_BRANCH (STATE1, error_event_dup_branch,
- branch2));
+ cp_fsm_branch (ctx, STATE1, error_event_dup_branch, branch1);
+ cp_fsm_branch (ctx, STATE1, error_event_dup_branch, branch2);
}
void
@@ -108,14 +106,14 @@ void
cp_fsm__STATE2__event3 (cp_t *ctx)
{
scenario_event (cp_fsm__STATE2__event3, param);
- cp_fsm_branch (ctx, param->branch);
+ cp_fsm_branch_ (ctx, param->branch);
}
void
cp_fsm__STATE3__event1 (cp_t *ctx)
{
scenario_event (cp_fsm__STATE3__event1, param);
- cp_fsm_branch (ctx, param->branch);
+ cp_fsm_branch_ (ctx, param->branch);
}
void
@@ -128,6 +126,6 @@ void
cp_fsm__STATE4__event1 (cp_t *ctx)
{
scenario_event (cp_fsm__STATE4__event1, param);
- cp_fsm_branch (ctx, param->branch);
+ cp_fsm_branch_ (ctx, param->branch);
}
diff --git a/cesar/cp2/fsm/test/utest/src/test_fsm.c b/cesar/cp2/fsm/test/utest/src/test_fsm.c
index 5e737c01fc..2fcce98177 100644
--- a/cesar/cp2/fsm/test/utest/src/test_fsm.c
+++ b/cesar/cp2/fsm/test/utest/src/test_fsm.c
@@ -182,8 +182,7 @@ test_fsm_error_test_case (test_t t)
const char *asserted = NULL;
dbg_fatal_try_begin
{
- cp_fsm_branch (&cp, CP_FSM_BRANCH (STATE1, error_event_no_branch,
- branch1));
+ cp_fsm_branch (&cp, STATE1, error_event_no_branch, branch1);
}
dbg_fatal_try_catch (const char *msg)
{