Skip to content

Commit

Permalink
give more info to debug OMEdit interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo committed Apr 21, 2024
1 parent 8523e60 commit 68c4687
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/main/java/crml/compiler/CRMLC.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ public static void main( String[] args ) throws Exception {

if(cmd.verify != null)
cs.referenceResFolder = cmd.verify;

logger.trace("Output dir: " + cmd.outputDir);

File out_dir = new File(cmd.outputDir);
out_dir.mkdir();

logger.trace("Directory for generated .mo files: " + out_dir.getPath());
logger.trace("Directory for generated .mo files: [" + out_dir.getPath() + "] absolute path: [" + out_dir.getAbsolutePath() + "]");

for(String f : cmd.files){
String path = new File(f).getCanonicalPath();
Expand All @@ -97,10 +99,10 @@ public static void main( String[] args ) throws Exception {
testFiles=file.list();
for (String test : testFiles) {
if(test.endsWith(".crml")) {
logger.trace("Translating: " + test);
logger.trace("Translating test: " + test);
parse_file(path, test, cmd.outputDir, cmd.stacktrace, cmd.printAST ,
cmd.generateExternal, cmd.within);
if(cmd.simulate!=null){
if(cmd.simulate!=null) {
OMCmsg msg;
try {
msg = OMCUtil.compile(test, path, cs);
Expand All @@ -115,13 +117,15 @@ public static void main( String[] args ) throws Exception {
}
}
} else if (file.isFile()){
logger.trace("Translating: " + file);
parse_file("", path, cmd.outputDir, cmd.stacktrace,
cmd.printAST ,cmd.generateExternal, cmd.within);
logger.trace("Translating file: " + file);
String stripped_file_name = Utilities.stripNameEndingAndPath(path);
String outputDir = Utilities.addDirToPath(cmd.outputDir, stripped_file_name);
parse_file("", path, outputDir, cmd.stacktrace,
cmd.printAST, cmd.generateExternal, cmd.within);
if(cmd.simulate!=null){
OMCmsg msg;
try {
msg = OMCUtil.compile(file.getPath(), "", cs);
msg = OMCUtil.compile(file.getPath(), cmd.outputDir, cs);
if(msg.msg.contains("false"))
logger.error("Unable to load Modelica model " + file +
"\n omc fails with the following message: \n" + msg);
Expand Down Expand Up @@ -177,7 +181,7 @@ public static void parse_file (
if (result != null) {

File out_file = new File(gen_dir + java.io.File.separator +
Utilities.stripNameEndingAndPath(Utilities.removeWindowsDriveLetter(file))+ ".mo");
Utilities.stripNameEndingAndPath(Utilities.removeWindowsDriveLetter(file)) + ".mo");

out_file.getParentFile().mkdirs();

Expand All @@ -187,6 +191,7 @@ public static void parse_file (
writer.write(result.contents);
writer.close();
logger.trace("Translated: " + file);
logger.trace("Output Modelica file: " + out_file.getAbsolutePath());

if(generateExternal && !external_var.isEmpty()){
File ext_file = new File(gen_dir + java.io.File.separator +
Expand Down

0 comments on commit 68c4687

Please sign in to comment.