Skip to content

Commit

Permalink
Make use of aux function equivtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel committed Dec 17, 2015
1 parent 3e53596 commit 8000c93
Showing 1 changed file with 20 additions and 47 deletions.
67 changes: 20 additions & 47 deletions Compiler/FrontEnd/Types.mo
Expand Up @@ -610,40 +610,25 @@ Author BZ 2008-05
This function verifies if it is some kind of a Real type we are working with."
input DAE.Type inType;
output Boolean b;
protected
Boolean lb1, lb2;
algorithm
b := matchcontinue(inType)
local Type ty; Boolean lb1,lb2,lb3;
case(ty)
equation
lb1 = isReal(ty);
lb2 = subtype(ty, DAE.T_REAL_DEFAULT);
lb3 = subtype(DAE.T_REAL_DEFAULT,ty);
lb1 = boolOr(lb1,boolAnd(lb2,lb3));
then lb1;

else false;

end matchcontinue;
lb1 := isReal(inType);
lb2 := equivtypes(inType, DAE.T_REAL_DEFAULT);
b := lb1 or lb2;
end isRealOrSubTypeReal;

public function isIntegerOrSubTypeInteger "
Author BZ 2009-02
This function verifies if it is some kind of a Integer type we are working with."
input DAE.Type inType;
output Boolean b;
protected
Boolean lb1, lb2;
algorithm
b := matchcontinue(inType)
local Type ty; Boolean lb1,lb2,lb3;
case(ty)
equation
lb1 = isInteger(ty);
lb2 = subtype(ty, DAE.T_INTEGER_DEFAULT);
lb3 = subtype(DAE.T_INTEGER_DEFAULT,ty);
lb1 = boolOr(lb1,boolAnd(lb2,lb3));
//lb1 = boolOr(lb1,lb2);
then lb1;
else false;
end matchcontinue;
lb1 := isInteger(inType);
lb2 := equivtypes(inType, DAE.T_INTEGER_DEFAULT);
b := lb1 or lb2;
end isIntegerOrSubTypeInteger;

protected function isClockOrSubTypeClock1
Expand Down Expand Up @@ -676,37 +661,25 @@ public function isBooleanOrSubTypeBoolean
This function verifies if it is some kind of a Boolean type we are working with."
input DAE.Type inType;
output Boolean b;
protected
Boolean lb1, lb2;
algorithm
b := matchcontinue(inType)
local Type ty; Boolean lb1,lb2,lb3;
case(ty)
equation
lb1 = isBoolean(ty);
lb2 = subtype(ty, DAE.T_BOOL_DEFAULT);
lb3 = subtype(DAE.T_BOOL_DEFAULT, ty);
lb1 = boolOr(lb1,boolAnd(lb2,lb3));
then lb1;
else false;
end matchcontinue;
lb1 := isBoolean(inType);
lb2 := equivtypes(inType, DAE.T_BOOL_DEFAULT);
b := lb1 or lb2;
end isBooleanOrSubTypeBoolean;

public function isStringOrSubTypeString
"@author: adrpo
This function verifies if it is some kind of a String type we are working with."
input DAE.Type inType;
output Boolean b;
protected
Boolean lb1, lb2;
algorithm
b := matchcontinue(inType)
local Type ty; Boolean lb1,lb2,lb3;
case(ty)
equation
lb1 = isString(ty);
lb2 = subtype(ty, DAE.T_STRING_DEFAULT);
lb3 = subtype(DAE.T_STRING_DEFAULT, ty);
lb1 = boolOr(lb1,boolAnd(lb2,lb3));
then lb1;
else false;
end matchcontinue;
lb1 := isString(inType);
lb2 := equivtypes(inType, DAE.T_STRING_DEFAULT);
b := lb1 or lb2;
end isStringOrSubTypeString;

public function isIntegerOrRealOrSubTypeOfEither
Expand Down

0 comments on commit 8000c93

Please sign in to comment.