summaryrefslogtreecommitdiffstats
path: root/test/src/test-c-inline.c
diff options
context:
space:
mode:
authorStefan Radomski <sradomski@mintwerk.de>2016-02-11 09:40:02 (GMT)
committerStefan Radomski <sradomski@mintwerk.de>2016-02-11 09:40:02 (GMT)
commit7b428e5435f83a7e7db37094a9197afa2dd09bf5 (patch)
tree8e23dcc47322ddd79ada2bdbb5f0315266b1e1b4 /test/src/test-c-inline.c
parent179fe8cd5cf53893ad1783ff0ff41cf94e24a59b (diff)
downloaduscxml-7b428e5435f83a7e7db37094a9197afa2dd09bf5.zip
uscxml-7b428e5435f83a7e7db37094a9197afa2dd09bf5.tar.gz
uscxml-7b428e5435f83a7e7db37094a9197afa2dd09bf5.tar.bz2
Some tidying up of ANSI-C transformation
Diffstat (limited to 'test/src/test-c-inline.c')
-rw-r--r--test/src/test-c-inline.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/src/test-c-inline.c b/test/src/test-c-inline.c
new file mode 100644
index 0000000..c12ac73
--- /dev/null
+++ b/test/src/test-c-inline.c
@@ -0,0 +1,40 @@
+#include <stdlib.h> // EXIT_SUCCESS
+#include <stdio.h> // printf
+#include <string.h> // memset
+
+/**
+ * Preprocess:
+ * uscxml-transform -tc -i ./test-c-inline.c -o ./test-c-inline.c.scxml.c
+ */
+
+/** INLINE SCXML BEGIN
+<scxml name="test-inline" datamodel="native">
+ <state id="foo">
+ <onentry>
+ enteredFoo();
+ </onentry>
+ </state>
+</scxml>
+INLINE SCXML END */
+
+/**
+ * These function can be called from within executable content
+ */
+void enteredFoo() {
+ printf("Entered Foo!\n");
+}
+
+#include "test-c-inline.c.scxml.c"
+
+int main(int argc, char** argv) {
+ uscxml_ctx ctx;
+ memset(&ctx, 0, sizeof(uscxml_ctx));
+ ctx.machine = &USCXML_MACHINE_TEST_INLINE;
+
+ int err = USCXML_ERR_OK;
+ while(err != USCXML_ERR_DONE) {
+ err = uscxml_step(&ctx);
+ }
+
+ return EXIT_SUCCESS;
+} \ No newline at end of file