Skip to content

Commit

Permalink
rem whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaRB authored and OpenModelica-Hudson committed Apr 21, 2016
1 parent 459a362 commit 077a6e6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
59 changes: 29 additions & 30 deletions Compiler/Script/Binding.mo
Expand Up @@ -144,11 +144,11 @@ algorithm
case SCode.CLASS(n, _, _, _, _, SCode.PARTS(elist, _,_,_,_,_,_,_), _, _)
equation
(true) = isOfType(elist, typeName);

then {el};
case _
equation print("noName\n");
// print(SCodeDump.unparseElementStr(el));
// print(SCodeDump.unparseElementStr(el));
then {};
end matchcontinue;
end getAllElementsOfType2;
Expand All @@ -168,7 +168,7 @@ output Boolean result;
String name;
case {} then (false);
case SCode.EXTENDS(Absyn.IDENT(name), _, mod, _, _)::rest
equation
equation
true = (name == typeName);
then (true);
case el::rest
Expand Down Expand Up @@ -227,15 +227,15 @@ output Absyn.Class out_vmodel;
new_exp = parseAggregator(exp, Absyn.FUNCTIONARGS({Absyn.LIST(toExpList(out_es, {}))}, {}));
// print("new TEMPLATE : " + Dump.dumpExpStr(new_exp) + "\n");
out_class = updateClass(vmodel, typeSpec, {(new_exp, "")}, iname, env, false, {}, "");
end if;
end if;
then out_class;

case CLIENT_E(components, typeSpec, def, iname, predecessors,
MEDIATOR(mType, template, clients, providers, preferred)::_) /* preferred bindings indicated */
equation
out_es = getProviders(providers, vmodel, env, {});
out_class = updateClass(vmodel, typeSpec, out_es, iname, env, true, preferred, "");

then out_class;
case NO_PRED()
equation
Expand All @@ -254,7 +254,7 @@ output list<Absyn.Exp> out_es;
list<tuple<Absyn.Exp, String>> rest;
Absyn.Exp exp;
case {} then in_es;
case (exp, _)::rest
case (exp, _)::rest
then toExpList(rest, exp::in_es);
end matchcontinue;
end toExpList;
Expand Down Expand Up @@ -420,21 +420,21 @@ algorithm
// print(Dump.unparseTypeSpec(typeSpec));
// print(" + ");
// print(Dump.unparseTypeSpec(tSpec));
// print ("... \n");
// print ("... \n");
//if Interactive.isPrimitive(Absyn.pathToCref(path), defs) then fail(); end if;

if (Absyn.typeSpecPathString(typeSpec) == Absyn.typeSpecPathString(tSpec)) then
print("Found provider \n");
if(hasPreferred) then // handle preferred bindings
e_list := applyModifiersPreferred(components, exp, instance_name, pathInClass, finalPrefix, redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec, preferred);
e_list := applyModifiersPreferred(components, exp, instance_name, pathInClass, finalPrefix, redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec, preferred);
else
e_list := applyModifiers(components, exp, instance_name, 0, finalPrefix, redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec);
end if;
else
print("NOT Found provider \n");
e_list := { Absyn.ELEMENTITEM(Absyn.ELEMENT(finalPrefix,redeclareKeywords ,innerOuter, Absyn.COMPONENTS(attributes,tSpec, components), info , constrainClass))};

end if;
end if;
then listAppend(e_list, parseElems(rest, defs, typeSpec, exp, instance_name, hasPreferred, preferred, pathInClass));
case (e_item::rest)
then e_item::parseElems(rest, defs, typeSpec, exp, instance_name, hasPreferred, preferred, pathInClass);
Expand Down Expand Up @@ -474,7 +474,7 @@ protected function applyModifiersPreferred
client_pref = getPreferredBinding(ename, preferred);
cnew = applyModifierPreferred(comps, e, client_pref, instance_name, ename);
enew = Absyn.ELEMENTITEM(Absyn.ELEMENT(finalPrefix,redeclareKeywords ,innerOuter, Absyn.COMPONENTS(attributes,tSpec, cnew), info , constrainClass));

then enew::applyModifiersPreferred(comps, rest, instance_name, typeSp, finalPrefix,redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec, preferred);
case _::rest
then applyModifiersPreferred(comps, rest, instance_name, typeSp, finalPrefix, redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec, preferred);
Expand Down Expand Up @@ -561,7 +561,7 @@ protected function applyModifiers
equation
cnew = applyModifier(comps, e, instance_name, counter);
enew = Absyn.ELEMENTITEM(Absyn.ELEMENT(finalPrefix,redeclareKeywords ,innerOuter, Absyn.COMPONENTS(attributes,tSpec, cnew), info , constrainClass));

then enew::applyModifiers(comps, rest, instance_name, counter+1, finalPrefix,redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec);
case _::rest
then applyModifiers(comps, rest, instance_name, counter, finalPrefix,redeclareKeywords ,innerOuter, info , constrainClass, attributes,tSpec);
Expand All @@ -582,7 +582,7 @@ protected function applyModifier
Option<Absyn.ComponentCondition> condition "condition" ;
Option<Absyn.Comment> comment "comment" ;
Absyn.Ident name, new_name ;

Absyn.ArrayDim arrayDim "Array dimensions, if any" ;
Option<Absyn.Modification> modification "Optional modification" ;
case {} then {};
Expand Down Expand Up @@ -708,7 +708,7 @@ protected function applyTemplate
Absyn.Ident name;
list<tuple<Absyn.Exp, String>> new_es;
String pathInClass;
case {}
case {}
equation
then in_es;
case (clist, pathInClass)::rest
Expand All @@ -732,12 +732,12 @@ protected function applyTemplate2
local
list<Absyn.ComponentItem> rest;
Absyn.Ident name, newName;
case {}
case {}
equation
//print("EMPTY COMPONENT MATCH\n");
then in_es;
case Absyn.COMPONENTITEM(Absyn.COMPONENT(name, _, _), _, _)::rest
equation
equation
newName = if(pathInClass == "") then name else pathInClass + "." + name;
// print("Applying template to" + newName + "\n");
then applyTemplate2(exp, rest, (parseExpression(exp, newName), newName)::in_es, pathInClass);
Expand Down Expand Up @@ -861,7 +861,7 @@ algorithm
path := Absyn.typeSpecPath(typeSpec);
// print ("TESTING PROVIDERS ... ");
// print(Dump.unparseTypeSpec(typeSpec));
// print ("... \n");
// print ("... \n");
//if Interactive.isPrimitive(Absyn.pathToCref(path), env) then fail(); end if;
def := Interactive.getPathedClassInProgram(path,env); // load the element
if (Absyn.typeSpecPathString(typeSpec) == className) then
Expand Down Expand Up @@ -903,8 +903,8 @@ algorithm
Option<Absyn.Modification> modification "Optional modification" ;
case {} then in_components;
case Absyn.COMPONENTITEM(Absyn.COMPONENT(name, arrayDim, modification), condition, comment)::rest
equation
newName = if(pathInClass == "") then name else pathInClass + "." + name;
equation
newName = if(pathInClass == "") then name else pathInClass + "." + name;
tmp = getAllProviderInstances(className, template, e_items, env, in_components, newName);
then parseComponents(className, template, e_items, env, rest, tmp, pathInClass);
case _::rest
Expand Down Expand Up @@ -962,7 +962,7 @@ algorithm
path := Absyn.typeSpecPath(typeSpec);
// print ("TESTING in parseElementList ... ");
// print(Dump.unparseTypeSpec(typeSpec));
// print ("... \n");
// print ("... \n");
// if Interactive.isPrimitive(Absyn.pathToCref(path), env) then fail(); end if;
// print("HERE\n");
def := Interactive.getPathedClassInProgram(path,env); // load the element
Expand All @@ -978,7 +978,7 @@ algorithm
l1 := buildInstList(def, env, new_predecessors, mediators, l2);
then parseElementInstList(rest, env, predecessors, mediators, l1);
case (_::rest)
equation
equation
//print("parseElementInstList unmatched pattern\n");
then parseElementInstList(rest, env, predecessors, mediators, in_client_list);
end matchcontinue;
Expand Down Expand Up @@ -1081,7 +1081,7 @@ algorithm
case SCode.CLASS(n, _, _, _, SCode.R_RECORD(_), SCode.PARTS(elist, _,_,_,_,_,_,_), _, _)
equation
(true, SOME(mod)) = isMediator(elist);
Absyn.STRING(template) = getValue(mod, "template", "string");
Absyn.STRING(template) = getValue(mod, "template", "string");
str1 = System.stringReplace(template, "%", "");
str2 = System.stringReplace(str1, ":", "all");
Absyn.STRING(mType) = getValue(mod, "mType", "string");
Expand All @@ -1092,15 +1092,15 @@ algorithm
// build providers
Absyn.ARRAY(pMod) = getValue(mod, "providers", "array");
prvs = getProviderList(pMod, {});

// build preferred
Absyn.ARRAY(prMod) = getValue(mod, "preferred", "array");
pref = getPreferredList(prMod, {});

then {MEDIATOR(mType,str2, cls, prvs, pref)};
case _
equation print("noName\n");
// print(SCodeDump.unparseElementStr(el));
// print(SCodeDump.unparseElementStr(el));
then {};
end matchcontinue;
end getMediatorDefsElement;
Expand Down Expand Up @@ -1173,7 +1173,7 @@ output list<Provider> n_val;
list<Absyn.NamedArg> argNames;
list<Absyn.Exp> rest;
String className, providerTemplate, instance;

case {}
then val;
case Absyn.CALL(_, Absyn.FUNCTIONARGS(_, argNames))::rest
Expand Down Expand Up @@ -1262,9 +1262,9 @@ output Absyn.Exp val;
case ({}, "bool")
then Absyn.BOOL(false); // client not mandatory by default
case ({}, "array")
then Absyn.ARRAY({});
then Absyn.ARRAY({});
case ({}, "string")
then Absyn.STRING("");
then Absyn.STRING("");
case (SCode.NAMEMOD(n, SCode.MOD(_,_,_, SOME((eval)), _))::rest, _)
equation
if(n <> name) then fail(); end if;
Expand All @@ -1274,6 +1274,5 @@ output Absyn.Exp val;
end matchcontinue;
end getValueR;


annotation(__OpenModelica_Interface="backend");
end Binding;
end Binding;
11 changes: 5 additions & 6 deletions Compiler/Script/Figaro.mo
Expand Up @@ -133,7 +133,7 @@ algorithm
Ident fb;
String ft;
SCode.Element program, cdef;
list<SCode.Element> e;
list<SCode.Element> e;
Ident cn;
Path bcp;
SCode.Mod m;
Expand All @@ -149,10 +149,9 @@ algorithm
then fcAddFigaroClass(ft, program, cn, tn, e);
case (fb, ft, program, SOME(cn), SCode.EXTENDS(baseClassPath = bcp, modifications = m), e)
equation
print("TEST " + getLastIdent(bcp) + "\n");
cdef = SCodeUtil.getElementWithPathCheckBuiltin(e, bcp);
tn = fcMod1(m);
then fcAddFigaroClass(ft, program, cn, tn, e);
then fcAddFigaroClass(ft, program, cn, tn, e);
// Nested class of some sort.
case (fb, ft, program, _, SCode.CLASS(name = n, classDef = cd), e)
then fcClassDef(fb, ft, program, n, cd, e);
Expand Down Expand Up @@ -192,7 +191,7 @@ algorithm
String ft;
SCode.Element program;
Ident cn;
list<SCode.Element> e;
list<SCode.Element> e;
list<SCode.Element> el;
TypeSpec ts;
SCode.Mod m;
Expand Down Expand Up @@ -225,7 +224,7 @@ algorithm
String ft;
SCode.Element program;
Option<Ident> cn;
list<SCode.Element> e;
list<SCode.Element> e;
SCode.Element first;
list<SCode.Element> rest;
list<FigaroClass> rf, rr;
Expand Down Expand Up @@ -1132,4 +1131,4 @@ algorithm
end printToken;

annotation(__OpenModelica_Interface="frontend");
end Figaro;
end Figaro;

0 comments on commit 077a6e6

Please sign in to comment.