Skip to content

Commit

Permalink
- Improve result-file messages
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14637 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 3, 2013
1 parent b889e05 commit 58c283f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Compiler/runtime/SimulationResults.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ static PlotFormat SimulationResultsImpl__openFile(const char *filename, Simulati
else if (0 == strcmp(filename+len-4, ".mat")) format = MATLAB4;
else if (0 == strcmp(filename+len-4, ".plt")) format = PLT;
else if (0 == strcmp(filename+len-4, ".csv")) format = CSV;
else format = UNKNOWN_PLOT;
else {
msg[0] = filename;
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Unknown result-file suffix of file '%s'"), msg, 1);
format = UNKNOWN_PLOT;
}
switch (format) {
case MATLAB4:
if (0!=(msg[0]=omc_new_matlab4_reader(filename,&simresglob->matReader))) {
msg[1] = filename;
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Failed to open simulation result %s: %s\n"), msg, 2);
c_add_message(-1, ErrorType_scripting, ErrorLevel_error, gettext("Failed to open simulation result %s: %s"), msg, 2);
return UNKNOWN_PLOT;
}
break;
Expand Down
18 changes: 16 additions & 2 deletions Compiler/runtime/SimulationResultsCmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,23 @@ void* SimulationResultsCmp_compareResults(const char *filename, const char *reff

/* open files */
/* fprintf(stderr, "Open File %s\n", filename); */
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(filename,&simresglob_c)) return mk_cons(mk_scon("Error Open File!"),mk_nil());
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(filename,&simresglob_c)) {
char *str = (char*) malloc(21+strlen(reffilename));
*str = 0;
strcat(strcat(str,"Error opening file: "),filename);
void *res = mk_scon(str);
free(str);
return mk_cons(res,mk_nil());
}
/* fprintf(stderr, "Open File %s\n", reffilename); */
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(reffilename,&simresglob_ref)) return mk_cons(mk_scon("Error Open RefFile!"),mk_nil());
if (UNKNOWN_PLOT == SimulationResultsImpl__openFile(reffilename,&simresglob_ref)) {
char *str = (char*) malloc(31+strlen(reffilename));
*str = 0;
strcat(strcat(str,"Error opening reference file: "),reffilename);
void *res = mk_scon(str);
free(str);
return mk_cons(res,mk_nil());
}

size = SimulationResultsImpl__readSimulationResultSize(filename,&simresglob_c);
/* fprintf(stderr, "Read size of File %s size= %d\n", filename,size); */
Expand Down

0 comments on commit 58c283f

Please sign in to comment.