summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-11-24 16:37:34 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-11-24 16:37:34 (GMT)
commitc6740774eaa2a41442456cf588644c9693e8d5e2 (patch)
tree9ec2cb418ffad6fee082ae5ddd285504d7492510 /apps
parentfa50ad507898d1e119ddd9ed35fd9b3b0ccf2659 (diff)
downloaduscxml-c6740774eaa2a41442456cf588644c9693e8d5e2.zip
uscxml-c6740774eaa2a41442456cf588644c9693e8d5e2.tar.gz
uscxml-c6740774eaa2a41442456cf588644c9693e8d5e2.tar.bz2
Added java transformation target
Diffstat (limited to 'apps')
-rw-r--r--apps/uscxml-transform.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/uscxml-transform.cpp b/apps/uscxml-transform.cpp
index b5f42c4..b85879a 100644
--- a/apps/uscxml-transform.cpp
+++ b/apps/uscxml-transform.cpp
@@ -2,6 +2,7 @@
#include "uscxml/Interpreter.h"
#include "uscxml/util/String.h"
#include "uscxml/transform/ChartToC.h"
+#include "uscxml/transform/ChartToJava.h"
#include "uscxml/transform/ChartToVHDL.h"
#include "uscxml/transform/ChartToPromela.h"
@@ -39,7 +40,8 @@ void printUsageAndExit(const char* progName) {
printf("Options\n");
printf("\t-t c : convert to C program\n");
printf("\t-t pml : convert to spin/promela program\n");
- printf("\t-t vhdl : convert to VHDL hardware description\n");
+ printf("\t-t vhdl : convert to VHDL hardware description\n");
+ printf("\t-t java : convert to Java classes\n");
printf("\t-t flat : flatten to SCXML state-machine\n");
printf("\t-a FILE : write annotated SCXML document for transformation\n");
printf("\t-X {PARAMETER} : pass additional parameters to the transformation\n");
@@ -187,7 +189,8 @@ int main(int argc, char** argv) {
outType != "scxml" &&
outType != "pml" &&
outType != "c" &&
- outType != "vhdl" &&
+ outType != "vhdl" &&
+ outType != "java" &&
outType != "min" &&
std::find(options.begin(), options.end(), "priority") == options.end() &&
std::find(options.begin(), options.end(), "domain") == options.end() &&
@@ -279,6 +282,21 @@ int main(int argc, char** argv) {
}
}
+ if (outType == "java") {
+ transformer = ChartToJava::transform(interpreter);
+ transformer.setExtensions(extensions);
+ transformer.setOptions(options);
+
+ if (outputFile.size() == 0 || outputFile == "-") {
+ transformer.writeTo(std::cout);
+ } else {
+ std::ofstream outStream;
+ outStream.open(outputFile.c_str());
+ transformer.writeTo(outStream);
+ outStream.close();
+ }
+ }
+
if (outType == "vhdl") {
transformer = ChartToVHDL::transform(interpreter);
transformer.setExtensions(extensions);