diff options
Diffstat (limited to 'test/src/test-c-inline.c')
-rw-r--r-- | test/src/test-c-inline.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/src/test-c-inline.c b/test/src/test-c-inline.c index a4b237c..659fcdf 100644 --- a/test/src/test-c-inline.c +++ b/test/src/test-c-inline.c @@ -10,10 +10,16 @@ /** INLINE SCXML BEGIN <scxml name="test-inline" datamodel="native"> <state id="foo"> + <transition target="done" cond="UD->foo == 3" /> <onentry> enteredFoo(); </onentry> </state> + <final id="done"> + <onentry> + enteredDone(); + </onentry> + </final> </scxml> INLINE SCXML END */ @@ -24,15 +30,28 @@ void enteredFoo() { printf("Entered Foo!\n"); } +void enteredDone() { + printf("Entered Done!\n"); +} + +struct userData { + int foo; +}; + +#define UD ((struct userData*)ctx->user_data) #include "test-c-inline.c.scxml.c" + int main(int argc, char** argv) { - uscxml_ctx ctx; + struct userData ud; + uscxml_ctx ctx; int err = USCXML_ERR_OK; - + memset(&ctx, 0, sizeof(uscxml_ctx)); ctx.machine = &USCXML_MACHINE_TEST_INLINE; - + ctx.user_data = &ud; + ud.foo = 3; + while(err != USCXML_ERR_DONE) { err = uscxml_step(&ctx); } |