diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | test/ctest/CTestCustom.ctest.in | 3 | ||||
-rw-r--r-- | test/src/test-c-machine.scxml.c | 208 | ||||
-rw-r--r-- | test/src/test-extensions.cpp | 24 | ||||
-rw-r--r-- | test/src/test-gen-c.cpp | 35 |
5 files changed, 151 insertions, 123 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bc105cf..772c636 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -46,7 +46,9 @@ endfunction() # simple one file tests USCXML_TEST_COMPILE(NAME test-utils LABEL general/test-utils FILES src/test-utils.cpp) -USCXML_TEST_COMPILE(NAME test-extensions LABEL general/test-extensions FILES src/test-extensions.cpp ../contrib/src/uscxml/PausableDelayedEventQueue.cpp) +if(WITH_DM_LUA) + USCXML_TEST_COMPILE(NAME test-extensions LABEL general/test-extensions FILES src/test-extensions.cpp ../contrib/src/uscxml/PausableDelayedEventQueue.cpp ../contrib/src/uscxml/ExtendedLuaDataModel.cpp) +endif() USCXML_TEST_COMPILE(NAME test-url LABEL general/test-url FILES src/test-url.cpp) USCXML_TEST_COMPILE(NAME test-lifecycle LABEL general/test-lifecycle FILES src/test-lifecycle.cpp) USCXML_TEST_COMPILE(NAME test-validating LABEL general/test-validating FILES src/test-validating.cpp) diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index 8f30989..6d4fa56 100644 --- a/test/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in @@ -175,6 +175,8 @@ set(CTEST_CUSTOM_TESTS_IGNORE # we do not support io processors yet "w3c/gen/c/ecma/test201.scxml" # basichttp "w3c/gen/c/ecma/test453.scxml" # functions as first-class objects + "w3c/gen/c/ecma/test446.scxml" # No URLs at runtime anymore + "w3c/gen/c/ecma/test552.scxml" # No URLs at runtime anymore "w3c/gen/c/ecma/test500.scxml" # _ioprocessors "w3c/gen/c/ecma/test501.scxml" # _ioprocessors "w3c/gen/c/ecma/test509.scxml" # _ioprocessors / basichttp @@ -222,6 +224,7 @@ set(CTEST_CUSTOM_TESTS_IGNORE "w3c/gen/c/lua/test532.scxml" # _ioprocessors / basichttp "w3c/gen/c/lua/test534.scxml" # _ioprocessors / basichttp "w3c/gen/c/lua/test558.scxml" # content per url + "w3c/gen/c/lua/test552.scxml" # content per url "w3c/gen/c/lua/test567.scxml" # _ioprocessors / basichttp "w3c/gen/c/lua/test569.scxml" # _ioprocessors "w3c/gen/c/lua/test577.scxml" # basichttp diff --git a/test/src/test-c-machine.scxml.c b/test/src/test-c-machine.scxml.c index 586a286..f39e5dc 100644 --- a/test/src/test-c-machine.scxml.c +++ b/test/src/test-c-machine.scxml.c @@ -1,6 +1,6 @@ /** Generated from source: - file:///Users/sradomski/Documents/TK/Code/uscxml2/test/w3c/lua/test240.scxml + file:///Users/sradomski/Documents/TK/Code/uscxml/test/w3c/lua/test240.scxml */ #ifndef USCXML_NO_STDTYPES_H @@ -208,7 +208,7 @@ struct uscxml_machine { }; /** - * All information pertaining to a <data> element-> + * All information pertaining to a <data> element * With late data binding, blocks of data elements are separated by NULL * use USCXML_ELEM_DATA_IS_SET to test for end of a block. */ @@ -220,7 +220,7 @@ struct uscxml_elem_data { }; /** - * All information pertaining to an <assign> element-> + * All information pertaining to an <assign> element */ struct uscxml_elem_assign { const char* location; @@ -229,7 +229,7 @@ struct uscxml_elem_assign { }; /** - * All information pertaining to any state element-> + * All information pertaining to any state element */ struct uscxml_state { const char* name; /* eventual name */ @@ -245,7 +245,7 @@ struct uscxml_state { }; /** - * All information pertaining to a <transitions> element-> + * All information pertaining to a <transition> element */ struct uscxml_transition { const USCXML_NR_STATES_TYPE source; @@ -260,7 +260,7 @@ struct uscxml_transition { }; /** - * All information pertaining to a <foreach> element-> + * All information pertaining to a <foreach> element */ struct uscxml_elem_foreach { const char* array; @@ -269,7 +269,7 @@ struct uscxml_elem_foreach { }; /** - * All information pertaining to a <param> element-> + * All information pertaining to a <param> element * Blocks of params are separated by NULL params, use * USCXML_ELEM_PARAM_IS_SET to test for end of a block. */ @@ -280,7 +280,7 @@ struct uscxml_elem_param { }; /** - * All information pertaining to a <donedata> element-> + * All information pertaining to a <donedata> element */ struct uscxml_elem_donedata { const USCXML_NR_STATES_TYPE source; @@ -290,7 +290,7 @@ struct uscxml_elem_donedata { }; /** - * All information pertaining to an <invoke> element-> + * All information pertaining to an <invoke> element */ struct uscxml_elem_invoke { const uscxml_machine* machine; @@ -310,7 +310,7 @@ struct uscxml_elem_invoke { }; /** - * All information pertaining to a <send> element-> + * All information pertaining to a <send> element */ struct uscxml_elem_send { const char* event; @@ -321,7 +321,7 @@ struct uscxml_elem_send { const char* typeexpr; const char* id; const char* idlocation; - const char* delay; + unsigned long delay; const char* delayexpr; const char* namelist; /* not space-separated, still as in attribute value */ const char* content; @@ -368,25 +368,25 @@ struct uscxml_ctx { #endif /* forward declare machines to allow references */ -extern const uscxml_machine _uscxml_F2DFDF85_machine; -extern const uscxml_machine _uscxml_88325DE6_machine; -extern const uscxml_machine _uscxml_8B0504D7_machine; +extern const uscxml_machine _uscxml_ED395C23__machine; +extern const uscxml_machine _uscxml_7847B274__machine; +extern const uscxml_machine _uscxml_DB2A83B0__machine; #ifndef USCXML_NO_ELEM_INFO -static const uscxml_elem_data _uscxml_F2DFDF85_elem_datas[2] = { +static const uscxml_elem_data _uscxml_ED395C23__elem_datas[2] = { /* id, src, expr, content */ { "Var1", NULL, "1", NULL }, { NULL, NULL, NULL, NULL } }; -static const uscxml_elem_param _uscxml_F2DFDF85_elem_params[2] = { +static const uscxml_elem_param _uscxml_ED395C23__elem_params[2] = { /* name, expr, location */ { "Var1", "1", NULL }, { NULL, NULL, NULL } }; -static const uscxml_elem_send _uscxml_F2DFDF85_elem_sends[1] = { +static const uscxml_elem_send _uscxml_ED395C23__elem_sends[1] = { { /* event */ "timeout", /* eventexpr */ NULL, @@ -396,7 +396,7 @@ static const uscxml_elem_send _uscxml_F2DFDF85_elem_sends[1] = { /* typeexpr */ NULL, /* id */ NULL, /* idlocation */ NULL, - /* delay */ "2000", + /* delay */ 2000, /* delayexpr */ NULL, /* namelist */ NULL, /* content */ NULL, @@ -405,7 +405,7 @@ static const uscxml_elem_send _uscxml_F2DFDF85_elem_sends[1] = { } }; -static const uscxml_elem_donedata _uscxml_F2DFDF85_elem_donedatas[1] = { +static const uscxml_elem_donedata _uscxml_ED395C23__elem_donedatas[1] = { /* source, content, contentexpr, params */ { 0, NULL, NULL, NULL } }; @@ -414,9 +414,9 @@ static const uscxml_elem_donedata _uscxml_F2DFDF85_elem_donedatas[1] = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_elem_invoke _uscxml_F2DFDF85_elem_invokes[2] = { +static const uscxml_elem_invoke _uscxml_ED395C23__elem_invokes[2] = { { - /* machine */ &_uscxml_88325DE6_machine, + /* machine */ &_uscxml_7847B274__machine, /* type */ "http://www.w3.org/TR/scxml/", /* typeexpr */ NULL, /* src */ NULL, @@ -432,7 +432,7 @@ static const uscxml_elem_invoke _uscxml_F2DFDF85_elem_invokes[2] = { /* contentexpr */ NULL, }, { - /* machine */ &_uscxml_8B0504D7_machine, + /* machine */ &_uscxml_DB2A83B0__machine, /* type */ "http://www.w3.org/TR/scxml/", /* typeexpr */ NULL, /* src */ NULL, @@ -442,7 +442,7 @@ static const uscxml_elem_invoke _uscxml_F2DFDF85_elem_invokes[2] = { /* sourcename */ "s02", /* namelist */ NULL, /* autoforward */ 0, - /* params */ &_uscxml_F2DFDF85_elem_params[0], + /* params */ &_uscxml_ED395C23__elem_params[0], /* finalize */ NULL, /* content */ NULL, /* contentexpr */ NULL, @@ -453,32 +453,32 @@ static const uscxml_elem_invoke _uscxml_F2DFDF85_elem_invokes[2] = { #ifndef USCXML_NO_EXEC_CONTENT -static int _uscxml_F2DFDF85_s0_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_ED395C23__s0_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_send != NULL) { - if ((ctx->exec_content_send(ctx, &_uscxml_F2DFDF85_elem_sends[0])) != USCXML_ERR_OK) return err; + if ((ctx->exec_content_send(ctx, &_uscxml_ED395C23__elem_sends[0])) != USCXML_ERR_OK) return err; } else { return USCXML_ERR_MISSING_CALLBACK; } return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_s0_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { - _uscxml_F2DFDF85_s0_on_entry_0(ctx, state, event); +static int _uscxml_ED395C23__s0_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { + _uscxml_ED395C23__s0_on_entry_0(ctx, state, event); return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_s01_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) { - ctx->invoke(ctx, s, &_uscxml_F2DFDF85_elem_invokes[0], uninvoke); +static int _uscxml_ED395C23__s01_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) { + ctx->invoke(ctx, s, &_uscxml_ED395C23__elem_invokes[0], uninvoke); return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_s02_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) { - ctx->invoke(ctx, s, &_uscxml_F2DFDF85_elem_invokes[1], uninvoke); +static int _uscxml_ED395C23__s02_invoke(const uscxml_ctx* ctx, const uscxml_state* s, const uscxml_elem_invoke* invocation, unsigned char uninvoke) { + ctx->invoke(ctx, s, &_uscxml_ED395C23__elem_invokes[1], uninvoke); return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_pass_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_ED395C23__pass_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_log != NULL) { if unlikely((ctx->exec_content_log(ctx, "Outcome", "'pass'")) != USCXML_ERR_OK) return err; @@ -488,12 +488,12 @@ static int _uscxml_F2DFDF85_pass_on_entry_0(const uscxml_ctx* ctx, const uscxml_ return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_pass_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { - _uscxml_F2DFDF85_pass_on_entry_0(ctx, state, event); +static int _uscxml_ED395C23__pass_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { + _uscxml_ED395C23__pass_on_entry_0(ctx, state, event); return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_fail_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_ED395C23__fail_on_entry_0(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_log != NULL) { if unlikely((ctx->exec_content_log(ctx, "Outcome", "'fail'")) != USCXML_ERR_OK) return err; @@ -503,8 +503,8 @@ static int _uscxml_F2DFDF85_fail_on_entry_0(const uscxml_ctx* ctx, const uscxml_ return USCXML_ERR_OK; } -static int _uscxml_F2DFDF85_fail_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { - _uscxml_F2DFDF85_fail_on_entry_0(ctx, state, event); +static int _uscxml_ED395C23__fail_on_entry(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { + _uscxml_ED395C23__fail_on_entry_0(ctx, state, event); return USCXML_ERR_OK; } @@ -512,7 +512,7 @@ static int _uscxml_F2DFDF85_fail_on_entry(const uscxml_ctx* ctx, const uscxml_st #ifndef USCXML_NO_ELEM_INFO -static const uscxml_state _uscxml_F2DFDF85_states[6] = { +static const uscxml_state _uscxml_ED395C23__states[6] = { { /* state number 0 */ /* name */ NULL, /* parent */ 0, @@ -522,13 +522,13 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { /* children */ { 0x32 /* 010011 */ }, /* completion */ { 0x02 /* 010000 */ }, /* ancestors */ { 0x00 /* 000000 */ }, - /* data */ &_uscxml_F2DFDF85_elem_datas[0], + /* data */ &_uscxml_ED395C23__elem_datas[0], /* type */ USCXML_STATE_COMPOUND, }, { /* state number 1 */ /* name */ "s0", /* parent */ 0, - /* onentry */ _uscxml_F2DFDF85_s0_on_entry, + /* onentry */ _uscxml_ED395C23__s0_on_entry, /* onexit */ NULL, /* invoke */ NULL, /* children */ { 0x0c /* 001100 */ }, @@ -542,7 +542,7 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { /* parent */ 1, /* onentry */ NULL, /* onexit */ NULL, - /* invoke */ _uscxml_F2DFDF85_s01_invoke, + /* invoke */ _uscxml_ED395C23__s01_invoke, /* children */ { 0x00 /* 000000 */ }, /* completion */ { 0x00 /* 000000 */ }, /* ancestors */ { 0x03 /* 110000 */ }, @@ -554,7 +554,7 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { /* parent */ 1, /* onentry */ NULL, /* onexit */ NULL, - /* invoke */ _uscxml_F2DFDF85_s02_invoke, + /* invoke */ _uscxml_ED395C23__s02_invoke, /* children */ { 0x00 /* 000000 */ }, /* completion */ { 0x00 /* 000000 */ }, /* ancestors */ { 0x03 /* 110000 */ }, @@ -564,7 +564,7 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { { /* state number 4 */ /* name */ "pass", /* parent */ 0, - /* onentry */ _uscxml_F2DFDF85_pass_on_entry, + /* onentry */ _uscxml_ED395C23__pass_on_entry, /* onexit */ NULL, /* invoke */ NULL, /* children */ { 0x00 /* 000000 */ }, @@ -576,7 +576,7 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { { /* state number 5 */ /* name */ "fail", /* parent */ 0, - /* onentry */ _uscxml_F2DFDF85_fail_on_entry, + /* onentry */ _uscxml_ED395C23__fail_on_entry, /* onexit */ NULL, /* invoke */ NULL, /* children */ { 0x00 /* 000000 */ }, @@ -591,7 +591,7 @@ static const uscxml_state _uscxml_F2DFDF85_states[6] = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_transition _uscxml_F2DFDF85_transitions[5] = { +static const uscxml_transition _uscxml_ED395C23__transitions[5] = { { /* transition number 1 with priority 0 target: s02 */ @@ -664,22 +664,22 @@ static const uscxml_transition _uscxml_F2DFDF85_transitions[5] = { #ifndef USCXML_NO_ELEM_INFO #ifndef USCXML_MACHINE -# define USCXML_MACHINE _uscxml_F2DFDF85_machine +# define USCXML_MACHINE _uscxml_ED395C23__machine #endif -#define USCXML_MACHINE_0 _uscxml_F2DFDF85_machine -#define USCXML_MACHINE_TEST240_SCXML _uscxml_F2DFDF85_machine +#define USCXML_MACHINE_0 _uscxml_ED395C23__machine +#define USCXML_MACHINE_TEST240_SCXML _uscxml_ED395C23__machine -const uscxml_machine _uscxml_F2DFDF85_machine = { +const uscxml_machine _uscxml_ED395C23__machine = { /* flags */ 0, /* nr_states */ 6, /* nr_transitions */ 5, /* name */ "test240.scxml", /* datamodel */ "lua", - /* uuid */ "F2DFDF85E1407B6D03CC162B96F43FC7", - /* states */ &_uscxml_F2DFDF85_states[0], - /* transitions */ &_uscxml_F2DFDF85_transitions[0], + /* uuid */ "ED395C2320352170727CA99C3797822B", + /* states */ &_uscxml_ED395C23__states[0], + /* transitions */ &_uscxml_ED395C23__transitions[0], /* parent */ NULL, - /* donedata */ &_uscxml_F2DFDF85_elem_donedatas[0], + /* donedata */ &_uscxml_ED395C23__elem_donedatas[0], /* script */ NULL }; @@ -687,13 +687,13 @@ const uscxml_machine _uscxml_F2DFDF85_machine = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_elem_data _uscxml_88325DE6_elem_datas[2] = { +static const uscxml_elem_data _uscxml_7847B274__elem_datas[2] = { /* id, src, expr, content */ { "Var1", NULL, "0", NULL }, { NULL, NULL, NULL, NULL } }; -static const uscxml_elem_send _uscxml_88325DE6_elem_sends[2] = { +static const uscxml_elem_send _uscxml_7847B274__elem_sends[2] = { { /* event */ "success", /* eventexpr */ NULL, @@ -703,7 +703,7 @@ static const uscxml_elem_send _uscxml_88325DE6_elem_sends[2] = { /* typeexpr */ NULL, /* id */ NULL, /* idlocation */ NULL, - /* delay */ NULL, + /* delay */ 0, /* delayexpr */ NULL, /* namelist */ NULL, /* content */ NULL, @@ -719,7 +719,7 @@ static const uscxml_elem_send _uscxml_88325DE6_elem_sends[2] = { /* typeexpr */ NULL, /* id */ NULL, /* idlocation */ NULL, - /* delay */ NULL, + /* delay */ 0, /* delayexpr */ NULL, /* namelist */ NULL, /* content */ NULL, @@ -728,7 +728,7 @@ static const uscxml_elem_send _uscxml_88325DE6_elem_sends[2] = { } }; -static const uscxml_elem_donedata _uscxml_88325DE6_elem_donedatas[1] = { +static const uscxml_elem_donedata _uscxml_7847B274__elem_donedatas[1] = { /* source, content, contentexpr, params */ { 0, NULL, NULL, NULL } }; @@ -741,26 +741,26 @@ static const uscxml_elem_donedata _uscxml_88325DE6_elem_donedatas[1] = { #ifndef USCXML_NO_EXEC_CONTENT -static int _uscxml_88325DE6_sub01_transition0_is_enabled(const uscxml_ctx* ctx, const uscxml_transition* transition) { +static int _uscxml_7847B274__sub01_transition0_is_enabled(const uscxml_ctx* ctx, const uscxml_transition* transition) { if likely(ctx->is_true != NULL) { return (ctx->is_true(ctx, "Var1==1")); } return USCXML_ERR_MISSING_CALLBACK; } -static int _uscxml_88325DE6_sub01_transition0_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_7847B274__sub01_transition0_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_send != NULL) { - if ((ctx->exec_content_send(ctx, &_uscxml_88325DE6_elem_sends[0])) != USCXML_ERR_OK) return err; + if ((ctx->exec_content_send(ctx, &_uscxml_7847B274__elem_sends[0])) != USCXML_ERR_OK) return err; } else { return USCXML_ERR_MISSING_CALLBACK; } return USCXML_ERR_OK; } -static int _uscxml_88325DE6_sub01_transition1_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_7847B274__sub01_transition1_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_send != NULL) { - if ((ctx->exec_content_send(ctx, &_uscxml_88325DE6_elem_sends[1])) != USCXML_ERR_OK) return err; + if ((ctx->exec_content_send(ctx, &_uscxml_7847B274__elem_sends[1])) != USCXML_ERR_OK) return err; } else { return USCXML_ERR_MISSING_CALLBACK; } @@ -771,7 +771,7 @@ static int _uscxml_88325DE6_sub01_transition1_on_trans(const uscxml_ctx* ctx, co #ifndef USCXML_NO_ELEM_INFO -static const uscxml_state _uscxml_88325DE6_states[3] = { +static const uscxml_state _uscxml_7847B274__states[3] = { { /* state number 0 */ /* name */ NULL, /* parent */ 0, @@ -781,7 +781,7 @@ static const uscxml_state _uscxml_88325DE6_states[3] = { /* children */ { 0x06 /* 011 */ }, /* completion */ { 0x02 /* 010 */ }, /* ancestors */ { 0x00 /* 000 */ }, - /* data */ &_uscxml_88325DE6_elem_datas[0], + /* data */ &_uscxml_7847B274__elem_datas[0], /* type */ USCXML_STATE_COMPOUND, }, { /* state number 1 */ @@ -814,7 +814,7 @@ static const uscxml_state _uscxml_88325DE6_states[3] = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_transition _uscxml_88325DE6_transitions[2] = { +static const uscxml_transition _uscxml_7847B274__transitions[2] = { { /* transition number 0 with priority 0 target: subFinal1 */ @@ -822,8 +822,8 @@ static const uscxml_transition _uscxml_88325DE6_transitions[2] = { /* target */ { 0x04 /* 001 */ }, /* event */ NULL, /* condition */ "Var1==1", - /* is_enabled */ _uscxml_88325DE6_sub01_transition0_is_enabled, - /* ontrans */ _uscxml_88325DE6_sub01_transition0_on_trans, + /* is_enabled */ _uscxml_7847B274__sub01_transition0_is_enabled, + /* ontrans */ _uscxml_7847B274__sub01_transition0_on_trans, /* type */ USCXML_TRANS_SPONTANEOUS, /* conflicts */ { 0x03 /* 11 */ }, /* exit set */ { 0x06 /* 011 */ } @@ -836,7 +836,7 @@ static const uscxml_transition _uscxml_88325DE6_transitions[2] = { /* event */ NULL, /* condition */ NULL, /* is_enabled */ NULL, - /* ontrans */ _uscxml_88325DE6_sub01_transition1_on_trans, + /* ontrans */ _uscxml_7847B274__sub01_transition1_on_trans, /* type */ USCXML_TRANS_SPONTANEOUS, /* conflicts */ { 0x03 /* 11 */ }, /* exit set */ { 0x06 /* 011 */ } @@ -848,22 +848,22 @@ static const uscxml_transition _uscxml_88325DE6_transitions[2] = { #ifndef USCXML_NO_ELEM_INFO #ifndef USCXML_MACHINE -# define USCXML_MACHINE _uscxml_88325DE6_machine +# define USCXML_MACHINE _uscxml_7847B274__machine #endif -#define USCXML_MACHINE_1 _uscxml_88325DE6_machine -#define USCXML_MACHINE_TEST240_SCXML_S01_INVOKE0_CONTENT0_SCXML0 _uscxml_88325DE6_machine +#define USCXML_MACHINE_1 _uscxml_7847B274__machine +#define USCXML_MACHINE_TEST240_SCXML_S01_INVOKE0_CONTENT0_SCXML0 _uscxml_7847B274__machine -const uscxml_machine _uscxml_88325DE6_machine = { +const uscxml_machine _uscxml_7847B274__machine = { /* flags */ 0, /* nr_states */ 3, /* nr_transitions */ 2, /* name */ "test240.scxml.s01_invoke0_content0_scxml0", /* datamodel */ "lua", - /* uuid */ "88325DE699193976BBBCF380C181A014", - /* states */ &_uscxml_88325DE6_states[0], - /* transitions */ &_uscxml_88325DE6_transitions[0], - /* parent */ &_uscxml_F2DFDF85_machine, - /* donedata */ &_uscxml_88325DE6_elem_donedatas[0], + /* uuid */ "7847B274CA8610349BFA9F21A78B590E", + /* states */ &_uscxml_7847B274__states[0], + /* transitions */ &_uscxml_7847B274__transitions[0], + /* parent */ &_uscxml_ED395C23__machine, + /* donedata */ &_uscxml_7847B274__elem_donedatas[0], /* script */ NULL }; @@ -871,13 +871,13 @@ const uscxml_machine _uscxml_88325DE6_machine = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_elem_data _uscxml_8B0504D7_elem_datas[2] = { +static const uscxml_elem_data _uscxml_DB2A83B0__elem_datas[2] = { /* id, src, expr, content */ { "Var1", NULL, "0", NULL }, { NULL, NULL, NULL, NULL } }; -static const uscxml_elem_send _uscxml_8B0504D7_elem_sends[2] = { +static const uscxml_elem_send _uscxml_DB2A83B0__elem_sends[2] = { { /* event */ "success", /* eventexpr */ NULL, @@ -887,7 +887,7 @@ static const uscxml_elem_send _uscxml_8B0504D7_elem_sends[2] = { /* typeexpr */ NULL, /* id */ NULL, /* idlocation */ NULL, - /* delay */ NULL, + /* delay */ 0, /* delayexpr */ NULL, /* namelist */ NULL, /* content */ NULL, @@ -903,7 +903,7 @@ static const uscxml_elem_send _uscxml_8B0504D7_elem_sends[2] = { /* typeexpr */ NULL, /* id */ NULL, /* idlocation */ NULL, - /* delay */ NULL, + /* delay */ 0, /* delayexpr */ NULL, /* namelist */ NULL, /* content */ NULL, @@ -912,7 +912,7 @@ static const uscxml_elem_send _uscxml_8B0504D7_elem_sends[2] = { } }; -static const uscxml_elem_donedata _uscxml_8B0504D7_elem_donedatas[1] = { +static const uscxml_elem_donedata _uscxml_DB2A83B0__elem_donedatas[1] = { /* source, content, contentexpr, params */ { 0, NULL, NULL, NULL } }; @@ -925,26 +925,26 @@ static const uscxml_elem_donedata _uscxml_8B0504D7_elem_donedatas[1] = { #ifndef USCXML_NO_EXEC_CONTENT -static int _uscxml_8B0504D7_sub02_transition0_is_enabled(const uscxml_ctx* ctx, const uscxml_transition* transition) { +static int _uscxml_DB2A83B0__sub02_transition0_is_enabled(const uscxml_ctx* ctx, const uscxml_transition* transition) { if likely(ctx->is_true != NULL) { return (ctx->is_true(ctx, "Var1==1")); } return USCXML_ERR_MISSING_CALLBACK; } -static int _uscxml_8B0504D7_sub02_transition0_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_DB2A83B0__sub02_transition0_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_send != NULL) { - if ((ctx->exec_content_send(ctx, &_uscxml_8B0504D7_elem_sends[0])) != USCXML_ERR_OK) return err; + if ((ctx->exec_content_send(ctx, &_uscxml_DB2A83B0__elem_sends[0])) != USCXML_ERR_OK) return err; } else { return USCXML_ERR_MISSING_CALLBACK; } return USCXML_ERR_OK; } -static int _uscxml_8B0504D7_sub02_transition1_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { +static int _uscxml_DB2A83B0__sub02_transition1_on_trans(const uscxml_ctx* ctx, const uscxml_state* state, const void* event) { int err = USCXML_ERR_OK; if likely(ctx->exec_content_send != NULL) { - if ((ctx->exec_content_send(ctx, &_uscxml_8B0504D7_elem_sends[1])) != USCXML_ERR_OK) return err; + if ((ctx->exec_content_send(ctx, &_uscxml_DB2A83B0__elem_sends[1])) != USCXML_ERR_OK) return err; } else { return USCXML_ERR_MISSING_CALLBACK; } @@ -955,7 +955,7 @@ static int _uscxml_8B0504D7_sub02_transition1_on_trans(const uscxml_ctx* ctx, co #ifndef USCXML_NO_ELEM_INFO -static const uscxml_state _uscxml_8B0504D7_states[3] = { +static const uscxml_state _uscxml_DB2A83B0__states[3] = { { /* state number 0 */ /* name */ NULL, /* parent */ 0, @@ -965,7 +965,7 @@ static const uscxml_state _uscxml_8B0504D7_states[3] = { /* children */ { 0x06 /* 011 */ }, /* completion */ { 0x02 /* 010 */ }, /* ancestors */ { 0x00 /* 000 */ }, - /* data */ &_uscxml_8B0504D7_elem_datas[0], + /* data */ &_uscxml_DB2A83B0__elem_datas[0], /* type */ USCXML_STATE_COMPOUND, }, { /* state number 1 */ @@ -998,7 +998,7 @@ static const uscxml_state _uscxml_8B0504D7_states[3] = { #ifndef USCXML_NO_ELEM_INFO -static const uscxml_transition _uscxml_8B0504D7_transitions[2] = { +static const uscxml_transition _uscxml_DB2A83B0__transitions[2] = { { /* transition number 0 with priority 0 target: subFinal2 */ @@ -1006,8 +1006,8 @@ static const uscxml_transition _uscxml_8B0504D7_transitions[2] = { /* target */ { 0x04 /* 001 */ }, /* event */ NULL, /* condition */ "Var1==1", - /* is_enabled */ _uscxml_8B0504D7_sub02_transition0_is_enabled, - /* ontrans */ _uscxml_8B0504D7_sub02_transition0_on_trans, + /* is_enabled */ _uscxml_DB2A83B0__sub02_transition0_is_enabled, + /* ontrans */ _uscxml_DB2A83B0__sub02_transition0_on_trans, /* type */ USCXML_TRANS_SPONTANEOUS, /* conflicts */ { 0x03 /* 11 */ }, /* exit set */ { 0x06 /* 011 */ } @@ -1020,7 +1020,7 @@ static const uscxml_transition _uscxml_8B0504D7_transitions[2] = { /* event */ NULL, /* condition */ NULL, /* is_enabled */ NULL, - /* ontrans */ _uscxml_8B0504D7_sub02_transition1_on_trans, + /* ontrans */ _uscxml_DB2A83B0__sub02_transition1_on_trans, /* type */ USCXML_TRANS_SPONTANEOUS, /* conflicts */ { 0x03 /* 11 */ }, /* exit set */ { 0x06 /* 011 */ } @@ -1032,22 +1032,22 @@ static const uscxml_transition _uscxml_8B0504D7_transitions[2] = { #ifndef USCXML_NO_ELEM_INFO #ifndef USCXML_MACHINE -# define USCXML_MACHINE _uscxml_8B0504D7_machine +# define USCXML_MACHINE _uscxml_DB2A83B0__machine #endif -#define USCXML_MACHINE_2 _uscxml_8B0504D7_machine -#define USCXML_MACHINE_TEST240_SCXML_S02_INVOKE0_CONTENT0_SCXML0 _uscxml_8B0504D7_machine +#define USCXML_MACHINE_2 _uscxml_DB2A83B0__machine +#define USCXML_MACHINE_TEST240_SCXML_S02_INVOKE0_CONTENT0_SCXML0 _uscxml_DB2A83B0__machine -const uscxml_machine _uscxml_8B0504D7_machine = { +const uscxml_machine _uscxml_DB2A83B0__machine = { /* flags */ 0, /* nr_states */ 3, /* nr_transitions */ 2, /* name */ "test240.scxml.s02_invoke0_content0_scxml0", /* datamodel */ "lua", - /* uuid */ "8B0504D789C25925F9E8A0C290F83773", - /* states */ &_uscxml_8B0504D7_states[0], - /* transitions */ &_uscxml_8B0504D7_transitions[0], - /* parent */ &_uscxml_F2DFDF85_machine, - /* donedata */ &_uscxml_8B0504D7_elem_donedatas[0], + /* uuid */ "DB2A83B067CD692F49AB0A6A6F13C5D0", + /* states */ &_uscxml_DB2A83B0__states[0], + /* transitions */ &_uscxml_DB2A83B0__transitions[0], + /* parent */ &_uscxml_ED395C23__machine, + /* donedata */ &_uscxml_DB2A83B0__elem_donedatas[0], /* script */ NULL }; @@ -1346,6 +1346,7 @@ ESTABLISH_ENTRY_SET: bit_or(entry_set, USCXML_GET_STATE(i).completion, nr_states_bytes); break; } +#ifndef USCXML_NO_HISTORY case USCXML_STATE_HISTORY_SHALLOW: case USCXML_STATE_HISTORY_DEEP: { if (!bit_has_and(USCXML_GET_STATE(i).completion, ctx->history, nr_states_bytes) && @@ -1393,6 +1394,7 @@ ESTABLISH_ENTRY_SET: } break; } +#endif case USCXML_STATE_INITIAL: { for (j = 0; j < USCXML_NUMBER_TRANS; j++) { if (ctx->machine->transitions[j].source == i) { diff --git a/test/src/test-extensions.cpp b/test/src/test-extensions.cpp index 7024689..626f8e5 100644 --- a/test/src/test-extensions.cpp +++ b/test/src/test-extensions.cpp @@ -4,6 +4,7 @@ #include "uscxml/interpreter/BasicEventQueue.h" #include "uscxml/interpreter/BasicDelayedEventQueue.h" #include "uscxml/PausableDelayedEventQueue.h" +#include "uscxml/ExtendedLuaDataModel.h" #include <event2/util.h> // for evutil_socket_t @@ -107,6 +108,27 @@ bool testPausableEventQueue() { } + +static const char *customLuaExtension = + "<scxml datamodel=\"lua\">" + " <script>" + " GetSomeResult();" + " </script>" + " <state/>" + "</scxml>" + ; + +bool testLuaExtension() { + Factory::getInstance()->registerDataModel(new ExtendedLuaDataModel()); + Interpreter exLua = Interpreter::fromXML(customLuaExtension, ""); + InterpreterState state; + + while ((state = exLua.step(0)) != USCXML_IDLE) {} + + return true; +} + int main(int argc, char** argv) { - testPausableEventQueue(); + testLuaExtension(); +// testPausableEventQueue(); } diff --git a/test/src/test-gen-c.cpp b/test/src/test-gen-c.cpp index e184c10..b7cee32 100644 --- a/test/src/test-gen-c.cpp +++ b/test/src/test-gen-c.cpp @@ -21,7 +21,7 @@ #ifndef AUTOINCLUDE_TEST #include "test-c-machine.scxml.c" -//#include "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/test/gen/c/ecma/test446.scxml.machine.c" +//#include "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/test/gen/c/lua/test192.scxml.machine.c" #endif //#include "uscxml/util/URL.h" @@ -546,25 +546,24 @@ public: } size_t delayMs = 0; - std::string delay; if (send->delayexpr != NULL) { - delay = USER_DATA(ctx)->dataModel.evalAsData(send->delayexpr).atom; - } else if (send->delay != NULL) { - delay = send->delay; - } - if (delay.size() > 0) { - boost::trim(delay); - - NumAttr delayAttr(delay); - if (iequals(delayAttr.unit, "ms")) { - delayMs = strTo<uint32_t>(delayAttr.value); - } else if (iequals(delayAttr.unit, "s")) { - delayMs = strTo<double>(delayAttr.value) * 1000; - } else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds - delayMs = strTo<uint32_t>(delayAttr.value); - } else { - std::cerr << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'"; + std::string delay = USER_DATA(ctx)->dataModel.evalAsData(send->delayexpr).atom; + if (delay.size() > 0) { + boost::trim(delay); + + NumAttr delayAttr(delay); + if (iequals(delayAttr.unit, "ms")) { + delayMs = strTo<uint32_t>(delayAttr.value); + } else if (iequals(delayAttr.unit, "s")) { + delayMs = strTo<double>(delayAttr.value) * 1000; + } else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds + delayMs = strTo<uint32_t>(delayAttr.value); + } else { + std::cerr << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'"; + } } + } else if (send->delay > 0) { + delayMs = send->delay; } if (USER_DATA(ctx)->invokeId.size() > 0) { |