Skip to content

Commit

Permalink
- System.os now returns "OSX" on OSX.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5680 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 16, 2010
1 parent ac68f9b commit af858ed
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Compiler/System.mo
Expand Up @@ -550,7 +550,7 @@ end windowsNewline;
public function os "Returns a string with the operating system name

For linux: 'linux'
For OSX: 'linux'
For OSX: 'OSX'
For Windows : 'Windows_NT' (the name of env var OS )

Why it returns linux for OSX, we have no clue. But it does, so let's
Expand Down
8 changes: 5 additions & 3 deletions Compiler/Util.mo
Expand Up @@ -171,9 +171,11 @@ public function linuxDotSlash "If operating system is Linux/Unix, return a './',
output String str;
algorithm
str := matchcontinue()
case() equation
"linux" = System.os();
then "./";
case()
equation
str = System.os();
true = ("linux" ==& str) or ("OSX" ==& str);
then "./";
case() then "";
end matchcontinue;
end linuxDotSlash;
Expand Down
4 changes: 4 additions & 0 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -2508,7 +2508,11 @@ RML_END_LABEL

RML_BEGIN_LABEL(System__os)
{
#ifdef __APPLE_CC__
rmlA0 = (void*) mk_scon("OSX");
#else
rmlA0 = (void*) mk_scon("linux");
#endif
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL
Expand Down
26 changes: 26 additions & 0 deletions Compiler/susan_codegen/SimCode/SimCodeC.mo
Expand Up @@ -20282,6 +20282,32 @@ algorithm
txt = Tpl.writeText(txt, i_tvar);
then (txt, i_preExp, i_varDecls);

case ( txt,
DAE.CALL(tuple_ = false, builtin = true, path = Absyn.IDENT(name = "min"), expLst = {i_array}),
i_context,
i_preExp,
i_varDecls )
local
DAE.Exp i_array;
Tpl.Text txt_3;
Tpl.Text i_tvar;
Tpl.Text i_arr__tp__str;
Tpl.Text i_expVar;
equation
(i_expVar, i_preExp, i_varDecls) = daeExp(emptyTxt, i_array, i_context, i_preExp, i_varDecls);
i_arr__tp__str = expTypeFromExpArray(emptyTxt, i_array);
txt_3 = expTypeFromExpModelica(emptyTxt, i_array);
(i_tvar, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(txt_3), i_varDecls);
i_preExp = Tpl.writeText(i_preExp, i_tvar);
i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(" = min_"));
i_preExp = Tpl.writeText(i_preExp, i_arr__tp__str);
i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("(&"));
i_preExp = Tpl.writeText(i_preExp, i_expVar);
i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(");"));
i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_NEW_LINE());
txt = Tpl.writeText(txt, i_tvar);
then (txt, i_preExp, i_varDecls);

case ( txt,
DAE.CALL(tuple_ = false, builtin = true, path = Absyn.IDENT(name = "promote"), expLst = {i_A, i_n}),
i_context,
Expand Down

0 comments on commit af858ed

Please sign in to comment.