Skip to content

Commit

Permalink
Fixed bugs with whitespace when calling plot, etc. in windows.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1969 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Nov 17, 2005
1 parent 0b55bef commit 3fb865b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 29 deletions.
27 changes: 17 additions & 10 deletions Compiler/Ceval.rml
Expand Up @@ -1161,9 +1161,9 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s

win_citation() => cit &
System.path_delimiter => pd &
Util.string_append_list([cit,".", pd, executable, " -m ",
method_str," >> output.log 2>&1",
cit]) => sim_call &
Util.string_append_list([cit,".", pd, executable,cit, " -m ",
method_str," >> output.log 2>&1"
]) => sim_call &
System.system_call(sim_call) => 0 &

Util.string_append_list([executable,"_res.plt"]) => result_file &
Expand Down Expand Up @@ -1267,13 +1267,15 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s
=> (Values.RECORD(_,[Values.STRING(filename)],_),_) &
System.read_ptolemyplot_dataset(filename,vars'',0) => value &
System.pwd() => pwd &
win_citation() => cit &
System.read_env("OPENMODELICAHOME") => omhome &
System.trim(omhome,"\"") => omhome' &
System.path_delimiter => pd &
Util.string_append_list([omhome,pd,"Compiler",pd,"scripts",pd,"doPlot"]) => plotCmd &
Util.string_append_list([cit,omhome',pd,"Compiler",pd,"scripts",pd,"doPlot",cit]) => plotCmd &
Util.string_append_list([pwd,pd,"tmpPlot.plt"]) => tmpPlotFile &
Values.write_ptolemyplot_dataset(tmpPlotFile,value,vars'',"Plot by OpenModelica")
=> res &
Util.string_append_list([plotCmd, " \"", tmpPlotFile,"\""]) => call &
Util.string_append_list([cit,plotCmd, " \"", tmpPlotFile,"\"",cit]) => call &
System.system_call(call) => _
------------------------------------
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("plot"),[Exp.ARRAY(_,_,vars)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf),msg)
Expand Down Expand Up @@ -1458,8 +1460,10 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s
=> (Values.BOOL(false),st)

rule System.read_env("OPENMODELICAHOME") => omhome &
System.trim(omhome,"\"") => omhome' &
win_citation() => cit &
System.path_delimiter => pd &
Util.string_append_list([omhome,pd,"Compiler",pd,"helptext.txt"]) => filename &
Util.string_append_list([omhome',pd,"Compiler",pd,"helptext.txt"]) => filename &
print filename &
System.read_file(filename) => str
--------------------------
Expand Down Expand Up @@ -1747,8 +1751,10 @@ relation change_to_file_dir:(Absyn.ComponentRef, (* class *)

rule (*model no saved! change to OPENMODELICAHOME/work *)
System.read_env("OPENMODELICAHOME") => omhome &
System.trim(omhome,"\"") => omhome' &
System.path_delimiter() => pd &
Util.string_append_list([omhome,pd,"work"]) => dir' &
win_citation() => cit &
Util.string_append_list([cit,omhome',pd,"work",cit]) => dir' &
System.cd(dir') => 0
-------------------------------
change_to_file_dir(class,p) => ()
Expand All @@ -1768,10 +1774,11 @@ relation compile_model: (string) => () =

rule System.path_delimiter => pd &
System.read_env("OPENMODELICAHOME") => omhome &
System.trim(omhome,"\"") => omhome' &
win_citation() => cit &
Util.string_append_list([cit,omhome, pd, "Compiler",
pd, "scripts", pd, "Compile ",
makefilename," > output.log 2>&1",cit
Util.string_append_list([cit,omhome', pd, "Compiler",
pd, "scripts", pd, "Compile",cit," ",
makefilename," > output.log 2>&1"
]) => s_call &
(*> output.log 2>&1 = redirect stderr to stdout and put it in output.log *)

Expand Down
1 change: 1 addition & 0 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -458,6 +458,7 @@ RML_BEGIN_LABEL(System__system_5fcall)
{
char* str = RML_STRINGDATA(rmlA0);
int ret_val;
printf("calling: %s\n",str);
ret_val = system(str);

rmlA0 = (void*) mk_icon(ret_val);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/scripts/doPlot.bat
Expand Up @@ -2,5 +2,5 @@
if defined PTII goto runplot
set PTII=%OPENMODELICAHOME%\ptplot.jar
:runplot
start javaw -classpath "%PTII%" ptolemy.plot.plotml.EditablePlotMLApplication %1
start javaw -classpath %PTII% ptolemy.plot.plotml.EditablePlotMLApplication %1

17 changes: 0 additions & 17 deletions Compiler/winruntime/systemimpl.c
Expand Up @@ -463,23 +463,6 @@ RML_BEGIN_LABEL(System__system_5fcall)
{
int ret_val;
char* str = RML_STRINGDATA(rmlA0);
if (0 && str[0] == '\"') {
char longname[MAX_PATH];
char shortname[MAX_PATH];
char* endpos = strstr(&str[1],"\"");
char* tmp;
char* pathend;
char* mark;

for(pathend = endpos; pathend > str && *pathend != '\\'; pathend--);

strncpy(longname,&str[1],pathend-str-1);
GetShortPathName(longname,shortname,MAX_PATH);
tmp = strdup(str);
sprintf(tmp,"%s%s",shortname,pathend);
mark = strstr(tmp, "\"");
if (mark) *mark = ' ';
}
ret_val = system(str);
rmlA0 = (void*) mk_icon(ret_val);

Expand Down
2 changes: 1 addition & 1 deletion flat_modelica_parser/src/flatmodelicaTokenTypes.txt
@@ -1,4 +1,4 @@
// $ANTLR 2.7.4: flat_modelica_lexer.g -> flatmodelicaTokenTypes.txt$
// $ANTLR 2.7.5 (20050213): flat_modelica_lexer.g -> flatmodelicaTokenTypes.txt$
flatmodelica // output token vocab name
ALGORITHM="algorithm"=4
AND="and"=5
Expand Down

0 comments on commit 3fb865b

Please sign in to comment.