Skip to content

Commit

Permalink
Implemented support for checkExamplePackages(function for checking an…
Browse files Browse the repository at this point in the history
…y Example dir in a package )

Implemented front end, "constrain" function. 


git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@3860 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Björn Zachrisson committed Feb 12, 2009
1 parent aa21102 commit 85bfdbb
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
26 changes: 25 additions & 1 deletion Compiler/Builtin.mo
Expand Up @@ -2510,8 +2510,30 @@ protected constant tuple<Types.TType, Option<Type_a>> option2boolean=(

protected constant tuple<Types.TType, Option<Type_a>> anyInteger2any=(
Types.T_FUNCTION({("x1",(Types.T_NOTYPE(),NONE)),("x2",(Types.T_INTEGER({}),NONE))},(Types.T_NOTYPE(),NONE)),NONE);
//----

protected constant tuple<Types.TType, Option<Type_a>> array1dimrealarray1dimrealarray1dimreal2real=(
Types.T_FUNCTION(
{
("x",(Types.T_ARRAY(Types.DIM(SOME(1)),(Types.T_REAL({}),NONE)),NONE)),
("y",(Types.T_ARRAY(Types.DIM(SOME(1)),(Types.T_REAL({}),NONE)),NONE)),
("z",(Types.T_ARRAY(Types.DIM(SOME(1)),(Types.T_REAL({}),NONE)),NONE))
},
(Types.T_REAL({}),NONE)),NONE);
protected constant tuple<Types.TType, Option<Type_a>> realrealreal2real=(
Types.T_FUNCTION(
{
("x",(Types.T_REAL({}),NONE)),
("y",(Types.T_REAL({}),NONE)),
("z",(Types.T_REAL({}),NONE))
},(Types.T_REAL({}),NONE)),NONE);
protected constant tuple<Types.TType, Option<Type_a>> intintint2int =(
Types.T_FUNCTION(
{
("x",(Types.T_INTEGER({}),NONE)),
("y",(Types.T_INTEGER({}),NONE)),
("z",(Types.T_INTEGER({}),NONE))
},(Types.T_INTEGER({}),NONE)),NONE);

public function isTanh
input Absyn.Path inPath;
algorithm
Expand Down Expand Up @@ -3207,6 +3229,8 @@ algorithm
env = Env.extendFrameT(env, "sqrt", real2real);
env = Env.extendFrameT(env, "mod", intInt2int);
env = Env.extendFrameT(env, "mod", realReal2real);
env = Env.extendFrameT(env, "constrain", realrealreal2real);
env = Env.extendFrameT(env, "constrain", intintint2int);
/*
env = Env.extendFrameT(env, "semiLinear", realRealReal2real);
env = Env.extendFrameT(env, "delay", realReal2real);
Expand Down
53 changes: 51 additions & 2 deletions Compiler/Static.mo
Expand Up @@ -4908,6 +4908,51 @@ algorithm
Types.PROP(ty1,c) );
end matchcontinue;
end elabBuiltinSkew;

protected function elabBuiltinConstrain "
author: BZ, 2009-01
This function handles the built-in elabBuiltinconstrain function.
"
input Env.Cache inCache;
input Env.Env inEnv;
input list<Absyn.Exp> inAbsynExpLst;
input list<Absyn.NamedArg> inNamedArg;
input Boolean impl;
output Env.Cache outCache;
output Exp.Exp outExp;
output Types.Properties outProperties;
algorithm
(outCache,outExp,outProperties):=
matchcontinue (inCache,inEnv,inAbsynExpLst,inNamedArg,impl)
local
Exp.Exp e1,e2,e3;
tuple<Types.TType, Option<Absyn.Path>> tp,arr_tp;
Types.Const c1,c2,c3,const;
Exp.Type tp1,tp2,tp3,etp;
list<Env.Frame> env;
Absyn.Exp e,v1,v2,v3;
list<Exp.Exp> expl,expl_1,args_1;
list<Integer> dims;
Env.Cache cache;
Types.Properties prop;
list<Absyn.Exp> args;
list<Absyn.NamedArg> nargs;
list<Slot> slots,newslots;
list<Types.Var> tvars;
Option<Absyn.Path> opath1,opath2;
Types.Type ty1,ty2,ty3;
case (cache,env,{v1,v2,v3},nargs,impl)
equation
(cache,e1,Types.PROP(ty1,c1),_) = elabExp(cache,env, v1, impl, NONE,true);
(cache,e2,Types.PROP(ty2,c2),_) = elabExp(cache,env, v2, impl, NONE,true);
(cache,e3,Types.PROP(ty3,c3),_) = elabExp(cache,env, v3, impl, NONE,true);
then
(cache,
Exp.CALL(Absyn.IDENT("constrain"),{e1,e2,e3},false,true,Exp.OTHER()),
Types.PROP(ty1,c1) );
end matchcontinue;
end elabBuiltinConstrain;

protected function elabBuiltinVector "function: elabBuiltinVector
author: PA
Expand Down Expand Up @@ -5230,6 +5275,8 @@ algorithm

case "skew" then elabBuiltinSkew;

case "constrain" then elabBuiltinConstrain;

end matchcontinue;
end elabBuiltinHandler;

Expand Down Expand Up @@ -6271,9 +6318,11 @@ algorithm
then
(cache,Exp.CALL(Absyn.IDENT("echo"),{bool_exp_1},false,true,Exp.STRING()),Types.PROP((Types.T_BOOL({}),NONE),Types.C_CONST()),SOME(st));

case (cache,env,Absyn.CREF_IDENT(name = "getClassesInModelicaPath"),{},{},impl,SOME(st))
then (cache,Exp.CALL(Absyn.IDENT("getClassesInModelicaPath"),{},false,true,Exp.STRING()),Types.PROP((Types.T_BOOL({}),NONE),Types.C_CONST()),SOME(st));

case (cache,env,Absyn.CREF_IDENT(name = "checkExamplePackages"),{},{},impl,SOME(st))
then
(cache,Exp.CALL(Absyn.IDENT("checkExamplePackages"),{},false,true,Exp.STRING()),Types.PROP((Types.T_BOOL({}),NONE),Types.C_CONST()),SOME(st));
then (cache,Exp.CALL(Absyn.IDENT("checkExamplePackages"),{},false,true,Exp.STRING()),Types.PROP((Types.T_BOOL({}),NONE),Types.C_CONST()),SOME(st));

case (cache,env,Absyn.CREF_IDENT(name = "dumpXMLDAE"),{Absyn.CREF(componentReg = cr)},args,impl,SOME(st))
local Absyn.Path className; Exp.Exp storeInTemp,asInSimulationCode;
Expand Down

0 comments on commit 85bfdbb

Please sign in to comment.