diff --git a/CMakeLists.txt b/CMakeLists.txt index ffe5403..28274de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ project(cpp_statemachine_generator) include(ExternalProject) include(GNUInstallDirs REQUIRED) +set(CMAKE_EXPORT_COMPILE_COMMANDS true) + add_executable(${CMAKE_PROJECT_NAME} "test/XmiFsm.cxx" "test/XmiFsmImpl.cxx" diff --git a/generator/.settings/org.eclipse.core.resources.prefs b/generator/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/generator/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/generator/src/generator/Generator.java b/generator/src/generator/Generator.java index 4e9e793..c57a320 100644 --- a/generator/src/generator/Generator.java +++ b/generator/src/generator/Generator.java @@ -27,6 +27,12 @@ public static void main(String[] args) throws Exception { factory.setDefaultFormatter(new JavaFormatter()); if (filename.endsWith(".uml") || filename.endsWith(".xmi")) { + System.out.println("Loading XMI/UML model " + filename); + var uml = new UmlModel(); + uml.setModelFile(filename); + uml.setName("UML"); + uml.load(); + var uml_module = new EgxModule(factory); uml_module.parse(loader.getResource("generator/XmiProgram.egx")); if (!uml_module.getParseProblems().isEmpty()) { @@ -36,20 +42,21 @@ public static void main(String[] args) throws Exception { } return; } - - var uml = new UmlModel(); - uml.setModelFile(filename); - uml.setName("UML"); - uml.load(); uml_module.getContext().getModelRepository().addModel(uml); uml_module.getContext().setUserInput(new UserInput()); - System.out.println("Generating XMI/UML model " + filename + " to " + out_path); + System.out.println("Generating to " + out_path); uml_module.execute(); } if (filename.endsWith(".scxml")) { + System.out.println("Generating SCXML model " + filename); + var scxml = new PlainXmlModel(); + scxml.setFile(new File(filename)); + scxml.setName("SCXML"); + scxml.load(); + var scxml_module = new EgxModule(factory); scxml_module.parse(loader.getResource("generator/ScxmlProgram.egx")); if (!scxml_module.getParseProblems().isEmpty()) { @@ -60,17 +67,14 @@ public static void main(String[] args) throws Exception { return; } - var scxml = new PlainXmlModel(); - scxml.setFile(new File(filename)); - scxml.setName("SCXML"); - scxml.load(); scxml_module.getContext().getModelRepository().addModel(scxml); scxml_module.getContext().setUserInput(new UserInput()); - System.out.println("Generating SCXML model " + filename + " to " + out_path); + System.out.println("Generating to " + out_path); scxml_module.execute(); } + System.out.println("Successful"); } catch (Exception ex) { ex.printStackTrace(); }