Skip to content

Commit

Permalink
- Hardcoded xsltproc and gnuplot paths for simulations on Windows
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8088 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Mar 4, 2011
1 parent a05f009 commit cf3e038
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions c_runtime/simulation_modelinfo.c
Expand Up @@ -115,7 +115,7 @@ static void printProfilingDataHeader(FILE *fout, DATA *data) {
int i;
indent(fout, 2); fprintf(fout, "<filename>%s_prof.data</filename>\n", data->modelFilePrefix);
indent(fout, 2); fprintf(fout, "<format>\n");
indent(fout, 4); fprintf(fout, "<double>step</double>\n");
indent(fout, 4); fprintf(fout, "<uint32>step</uint32>\n");
indent(fout, 4); fprintf(fout, "<double>time</double>\n");
indent(fout, 4); fprintf(fout, "<double>cpu time</double>\n");
for (i = 0; i < data->nFunctions; i++) {
Expand Down Expand Up @@ -237,21 +237,33 @@ int printModelInfo(DATA *data, const char *filename, const char *plotfile, const
char *buf;
int genHtmlRes;
omhome = getenv("OPENMODELICAHOME");
buf = malloc(200 + 2*strlen(plotfile) + (omhome ? strlen(omhome) : 0));
#if defined(__MINGW32__) || defined(_MSC_VER)
buf = malloc(200 + 2*strlen(plotfile) + 2*(omhome ? strlen(omhome) : 0));
assert(buf);
sprintf(buf, "gnuplot %s", plotfile);
fclose(plotCommands);
if (0 != system(buf)) {
fprintf(stderr, "Warning: Plot command failed: %s\n", buf);
#if defined(__MINGW32__) || defined(_MSC_VER)
if (omhome) {
sprintf(buf, "%s/lib/libexec/gnuplot/binary/gnuplot.exe %s", omhome, plotfile);
fclose(plotCommands);
if (0 != system(buf)) {
fprintf(stderr, "Warning: Plot command failed: %s\n", buf);
}
}
#else
if (0 != pclose(plotCommands)) {
fprintf(stderr, "Warning: Plot command failed\n");
}
#endif
if (omhome) {
sprintf(buf, "xsltproc -o %s_prof.html %s/share/omc/scripts/default_profiling.xsl %s_prof.xml", data->modelFilePrefix, omhome, data->modelFilePrefix);
#if defined(__MINGW32__) || defined(_MSC_VER)
char *xsltproc;
sprintf(buf, "%s/lib/omc/libexec/xsltproc/xsltproc.exe", omhome);
xsltproc = strdup(buf);
#else
const char *xsltproc = "xsltproc";
#endif
sprintf(buf, "%s -o %s_prof.html %s/share/omc/scripts/default_profiling.xsl %s_prof.xml", xsltproc, data->modelFilePrefix, omhome, data->modelFilePrefix);
#if defined(__MINGW32__) || defined(_MSC_VER)
free(xsltproc);
#endif
genHtmlRes = system(buf);
} else {
strcpy(buf, "OPENMODELICAHOME missing");
Expand Down

0 comments on commit cf3e038

Please sign in to comment.