Skip to content

Commit

Permalink
- Removed elabBuiltinInteger
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7504 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 20, 2010
1 parent 8bbc8e0 commit 8056417
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 51 deletions.
18 changes: 6 additions & 12 deletions Compiler/FrontEnd/Builtin.mo
Expand Up @@ -97,6 +97,12 @@ function floor
external \"builtin\";
end floor;
function integer
input Real x;
output Integer y;
external \"builtin\";
end integer;
function sqrt
input Real x(unit=\"'p\");
output Real y(unit=\"'p(1/2)\");
Expand Down Expand Up @@ -1140,12 +1146,6 @@ protected constant DAE.Type stringIntInt2string=(
protected constant DAE.Type real2real=(
DAE.T_FUNCTION({("x",DAE.T_REAL_DEFAULT)},DAE.T_REAL_DEFAULT,DAE.FUNCTION_ATTRIBUTES_DEFAULT),NONE());

protected constant DAE.Type real2int=(
DAE.T_FUNCTION({("x",DAE.T_REAL_DEFAULT)},DAE.T_INTEGER_DEFAULT,DAE.FUNCTION_ATTRIBUTES_DEFAULT),NONE());

protected constant DAE.Type int2real=(
DAE.T_FUNCTION({("x",DAE.T_INTEGER_DEFAULT)},DAE.T_REAL_DEFAULT,DAE.FUNCTION_ATTRIBUTES_DEFAULT),NONE());

protected constant DAE.Type realReal2real=(
DAE.T_FUNCTION(
{("x",DAE.T_REAL_DEFAULT),("y",DAE.T_REAL_DEFAULT)},DAE.T_REAL_DEFAULT,DAE.FUNCTION_ATTRIBUTES_DEFAULT),NONE());
Expand Down Expand Up @@ -3086,12 +3086,9 @@ algorithm
env = Env.extendFrameC(env, stateSelectType);
env = Env.extendFrameV(env, timeVar,NONE(), Env.VAR_UNTYPED(), {}) "see also variableIsBuiltin";

env = Env.extendFrameT(env, "initial", nil2real) "non-functions" ;
env = Env.extendFrameT(env, "terminal", nil2real);
env = Env.extendFrameT(env, "event", bool2bool);
env = Env.extendFrameT(env, "switch", bool2bool);
env = Env.extendFrameT(env, "timeEvent", realReal2bool);
env = Env.extendFrameT(env, "sample", realReal2bool);
env = Env.extendFrameT(env, "semiLinear", realRealReal2Real);
env = Env.extendFrameT(env, "change", real2bool);
env = Env.extendFrameT(env, "edge", bool2bool);
Expand All @@ -3108,7 +3105,6 @@ algorithm
env = Env.extendFrameT(env, "boolean", bool2bool);
env = Env.extendFrameT(env, "boolean", real2bool);
env = Env.extendFrameT(env, "boolean", int2bool);
env = Env.extendFrameT(env, "integer", real2int);
env = Env.extendFrameT(env, "Integer", enumeration2int);
env = Env.extendFrameT(env, "abs", real2real) "differentiable functions" ;
env = Env.extendFrameT(env, "abs", int2int) "differentiable functions" ;
Expand Down Expand Up @@ -3368,8 +3364,6 @@ algorithm
env = Env.extendFrameT(env, "transpose", array6dimstring2matrixstring);
env = Env.extendFrameT(env, "outerproduct", vectorVector2int) "Only real and int makes sense here. And maybe bool." ;
env = Env.extendFrameT(env, "outerproduct", vectorVector2real);
env = Env.extendFrameT(env, "initial", nil2bool);
env = Env.extendFrameT(env, "terminal", nil2bool);
env = Env.extendFrameT(env, "diagonal", array1dimint2matrixint);
env = Env.extendFrameT(env, "diagonal", array1dimreal2matrixreal);
env = Env.extendFrameT(env, "diagonal", array1dimbool2matrixbool);
Expand Down
39 changes: 0 additions & 39 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -4746,44 +4746,6 @@ algorithm
end matchcontinue;
end elabBuiltinRem;

protected function elabBuiltinInteger
"function: elabBuiltinInteger
This function elaborates on the builtin operator integer, which extracts
the Integer value of a Real value."
input Env.Cache inCache;
input Env.Env inEnv;
input list<Absyn.Exp> inAbsynExpLst;
input list<Absyn.NamedArg> inNamedArg;
input Boolean inBoolean;
input Prefix.Prefix inPrefix;
input Absyn.Info info;
output Env.Cache outCache;
output DAE.Exp outExp;
output DAE.Properties outProperties;
algorithm
(outCache,outExp,outProperties):=
matchcontinue (inCache,inEnv,inAbsynExpLst,inNamedArg,inBoolean,inPrefix,info)
local
DAE.Exp s1_1;
DAE.Const c;
list<Env.Frame> env;
Absyn.Exp s1;
Boolean impl;
Env.Cache cache;
DAE.Properties prop;
DAE.DAElist dae;
DAE.Type ty;
String exp_str;
Prefix.Prefix pre;
case (cache,env,{s1},_,impl,pre,info)
equation
(cache,s1_1,prop) =
verifyBuiltInHandlerType(cache,env,{s1},impl,Types.isIntegerOrRealOrSubTypeOfEither,"integer",pre,info);
then
(cache,s1_1,prop);
end matchcontinue;
end elabBuiltinInteger;

protected function elabBuiltinBoolean
"function: elabBuiltinBoolean
This function elaborates on the builtin operator boolean, which extracts
Expand Down Expand Up @@ -6376,7 +6338,6 @@ algorithm
case "pre" then elabBuiltinPre;
case "abs" then elabBuiltinAbs;
case "div" then elabBuiltinDiv;
case "integer" then elabBuiltinInteger;
case "boolean" then elabBuiltinBoolean;
case "mod" then elabBuiltinMod;
case "rem" then elabBuiltinRem;
Expand Down

0 comments on commit 8056417

Please sign in to comment.