Skip to content

Commit

Permalink
[Janitor mode] Fix whitespace
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22835 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
OpenModelica-Hudson committed Oct 21, 2014
1 parent a88f41d commit 7e6f28e
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 114 deletions.
176 changes: 88 additions & 88 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -2339,7 +2339,7 @@ case func as EXTERNAL_FUNCTION(extReturn= return) then
match extName
case "OpenModelica_regex"
then ""

else
match fn
case func as EXTERNAL_FUNCTION(__) then
Expand All @@ -2358,13 +2358,13 @@ case func as EXTERNAL_FUNCTION(extReturn= return) then
* The function has annotation(Include=...>)
* the external function definition should be present
* in one of these files and have this prototype:
* extern <%extReturnType(extReturn)%> <%fn_name%>(<%fargsStrEscaped%>);
*/
* extern <%extReturnType(extReturn)%> <%fn_name%>(<%fargsStrEscaped%>);
*/
>>
else
<<
extern <%extReturnType(return)%> <%extName%>(<%fargsStr%>);/*extern c*/
>>
extern <%extReturnType(return)%> <%extName%>(<%fargsStr%>);/*extern c*/
>>
end match
end extFunDef;

Expand Down Expand Up @@ -2805,73 +2805,73 @@ case efn as EXTERNAL_FUNCTION(extArgs=extArgs) then
; empty /* increase the counter! */
)
let &outVarAssign = buffer ""
let &outVarCopy = buffer ""
let _ = match outVars
let &outVarCopy = buffer ""
let _ = match outVars

case {var} then
//(outVars |> var hasindex i1 fromindex 0 =>
varOutput(fn, var,0, &varDecls, &outVarInits, &outVarCopy, &outVarAssign, simCode, useFlatArrayNotation)
// ;separator="\n"; empty /* increase the counter! */



else
(List.restOrEmpty(outVars) |> var hasindex i1 fromindex 1 => varOutputTuple(fn, var,i1, &varDecls, &outVarInits, &outVarCopy, &outVarAssign, simCode, useFlatArrayNotation)
;separator="\n"; empty /* increase the counter! */
)
;separator="\n"; empty /* increase the counter! */
)
end match



let &varDecls1 = buffer ""
let &outVarInits1 = buffer ""
let &outVarCopy1 = buffer ""
let &outVarAssign1 = buffer ""

let _ = match outVars

case {var} then "1"
else
(List.restOrEmpty(outVars) |> var hasindex i1 fromindex 1 => varOutputTuple(fn, var,i1, &varDecls1, &outVarInits1, &outVarCopy1, &outVarAssign1, simCode, useFlatArrayNotation)
;separator="\n"; empty /* increase the counter! */
)
end match
;separator="\n"; empty /* increase the counter! */
)
end match

let functionBodyExternalFunctionreturn = match outVarAssign1
case "" then << <%if retVar then 'output = <%retVar%>;' %> >>
else (extArgs |> extArg =>
match extArg
case SIMEXTARG(cref=c, isInput =iI, outputIndex=oi, isArray=true, type_=t) then
match t
case T_ARRAY(__)then
match ty
case T_BOOL(__) then
if(iI)
then ""
else
<< <%outVarAssign1%> >>
)
match extArg
case SIMEXTARG(cref=c, isInput =iI, outputIndex=oi, isArray=true, type_=t) then
match t
case T_ARRAY(__)then
match ty
case T_BOOL(__) then
if(iI)
then ""
else
<< <%outVarAssign1%> >>
)

end match

let fnBody = <<
void /*<%retType%>*/ Functions::<%fname%>(<%funArgs |> var => funArgDefinition(var,simCode,useFlatArrayNotation) ;separator=", "%><%if funArgs then if outVars then "," else ""%> <%if retVar then '<%retType%>& output' %>)/*function2*/
{
/* functionBodyExternalFunction: varDecls */
<%varDecls%>
/* functionBodyExternalFunction: preExp */
<%preExp%>
<%inputAssign%>
<%inputAssign%>
/* functionBodyExternalFunction: outputAlloc */
<%outVarInits%>
/* functionBodyExternalFunction: callPart */
<%callPart%>
<%outputAssign%>
/*testout1*/
<%outputAssign%>
/*testout1*/
/*testout ende*/
/*testout ende*/
/* functionBodyExternalFunction: return */
<%functionBodyExternalFunctionreturn%>
}
Expand Down Expand Up @@ -3031,7 +3031,7 @@ case EXTERNAL_FUNCTION(__) then
<%match extReturn case SIMEXTARG(__) then extFunCallVardecl(extReturn, &varDecls /*BUFD*/)%>
<%dynamicCheck%>
<%returnAssign%><%extName%>(<%args%>);
<%extArgs |> arg => extFunCallVarcopy(arg,fname,useTuple) ;separator="\n"%>
<%extArgs |> arg => extFunCallVarcopy(arg,fname,useTuple) ;separator="\n"%>
<%match extReturn case SIMEXTARG(__) then extFunCallVarcopy(extReturn,fname,useTuple)%>
>>
end extFunCallC;
Expand All @@ -3043,8 +3043,8 @@ match arg
case SIMEXTARG(outputIndex=oi, isArray=false, type_=ty, cref=c) then
match oi case 0 then
<<
/*testarg<%extVarName2(c)%>*/
>>
/*testarg<%extVarName2(c)%>*/
>>
else
let cr = '<%extVarName2(c)%>'
match useTuple
Expand Down Expand Up @@ -3094,13 +3094,13 @@ template extArg(SimExtArg extArg, Text &preExp /*BUFP*/, Text &varDecls /*BUFP*/
match extArg
case SIMEXTARG(cref=c, outputIndex=oi, isArray=true, type_=t) then
//let name = if oi then 'out.targTest5<%oi%>' else contextCref2(c,contextFunction)
let name = contextCref2(c,contextFunction)
let name = contextCref2(c,contextFunction)
let shortTypeStr = expTypeShort(t)
let boolCast = extCBoolCast(extArg, &preExp, &varDecls, &inputAssign /*BUFD*/, &outputAssign /*BUFD*/)
<<
<%boolCast%>
>>
let boolCast = extCBoolCast(extArg, &preExp, &varDecls, &inputAssign /*BUFD*/, &outputAssign /*BUFD*/)
<<
<%boolCast%>
>>

case SIMEXTARG(cref=c, isInput=ii, outputIndex=0, type_=t) then
let cr = '<%contextCref2(c,contextFunction)%>'
if acceptMetaModelicaGrammar() then
Expand All @@ -3121,47 +3121,47 @@ end extArg;


template extCBoolCast(SimExtArg extArg, Text &preExp, Text &varDecls /*BUFP*/, Text &inputAssign /*BUFD*/, Text &outputAssign /*BUFD*/)
::=
match extArg
case SIMEXTARG(cref=c, isInput =iI, outputIndex=oi, isArray=true, type_=t)then
let name = contextCref2(c,contextFunction)
match type_
case T_ARRAY(__)then
let dimsStr = dimensionsList(dims) |> dim as Integer => '<%dim%>';separator=","
let dimStr = listLength(dims)
match ty
::=
match extArg
case SIMEXTARG(cref=c, isInput =iI, outputIndex=oi, isArray=true, type_=t)then
let name = contextCref2(c,contextFunction)
match type_
case T_ARRAY(__)then
let dimsStr = dimensionsList(dims) |> dim as Integer => '<%dim%>';separator=","
let dimStr = listLength(dims)
match ty
case T_BOOL(__) then
let tmp = tempDecl('StatArrayDim<%dimStr%><int, <%dimsStr%> > ', &varDecls /*BUFD*/)
if(iI)
then
<<
<%tmp%>.getData()
<%inputAssignTest(c, contextFunction, tmp, &inputAssign)%>
>>
else
<<
<%tmp%>.getData()
<%outputAssignTest(c, contextFunction, tmp, &outputAssign)%>
>>
end match
else
let tmp = tempDecl('StatArrayDim<%dimStr%><int, <%dimsStr%> > ', &varDecls /*BUFD*/)

if(iI)
then
<<
<%tmp%>.getData()
<%inputAssignTest(c, contextFunction, tmp, &inputAssign)%>
>>
else
<<
<%tmp%>.getData()
<%outputAssignTest(c, contextFunction, tmp, &outputAssign)%>
>>
end match

else
'(<%extType2(t,iI,true)%>)<%name%>.getData() '
end extCBoolCast;

template inputAssignTest(DAE.ComponentRef cref, Context context, Text tmp, Text &inputAssign /*BUFD*/)
::=
let &inputAssign += 'convertBoolToInt(<%contextCref2(cref,context)%>, <%tmp%>); '
<<
>>
let &inputAssign += 'convertBoolToInt(<%contextCref2(cref,context)%>, <%tmp%>); '
<<
>>
end inputAssignTest;

template outputAssignTest(DAE.ComponentRef cref, Context context, Text tmp, Text &outputAssign /*BUFD*/)
::=
let &outputAssign += 'convertIntToBool(<%tmp%>,<%contextCref2(cref,context)%>); '
<<
>>
let &outputAssign += 'convertIntToBool(<%tmp%>,<%contextCref2(cref,context)%>); '
<<
>>
end outputAssignTest;

template daeExternalCExp(Exp exp, Context context, Text &preExp /*BUFP*/, Text &varDecls /*BUFP*/,SimCode simCode,Boolean useFlatArrayNotation)
Expand Down Expand Up @@ -3205,7 +3205,7 @@ template varOutput(Function fn, Variable var, Integer ix, Text &varDecls,
"Generates code to copy result value from a function to dest."
::=
match fn
case FUNCTION(__)
case FUNCTION(__)
case EXTERNAL_FUNCTION(__) then
let fname = underscorePath(name)
match var
Expand Down Expand Up @@ -3258,7 +3258,7 @@ case var as VARIABLE(__) then
case var as FUNCTION_PTR(__) then
let &varAssign += 'ToDo: Function Ptr assign'
""
else "irgendwas"
else "irgendwas"
end varOutput;


Expand All @@ -3272,7 +3272,7 @@ template varOutputTuple(Function fn, Variable var, Integer ix, Text &varDecls,
"Generates code to copy result value from a function to dest."
::=
match fn
case FUNCTION(__)
case FUNCTION(__)
case EXTERNAL_FUNCTION(__) then
let fname = underscorePath(name)
match var
Expand Down Expand Up @@ -3674,7 +3674,7 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
<%varDecls%>
<%initextvars%>
<%initextvars%>
initializeAlgVars();
initializeDiscreteAlgVars();
initializeIntAlgVars();
Expand All @@ -3693,7 +3693,7 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
<%initEventHandling%>
initEquations();
<%initALgloopSolvers%>
Expand All @@ -3717,7 +3717,7 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
<%initialequations%>
<%init2(simCode,modelInfo,useFlatArrayNotation)%>
>>
end match
end match
end init;


Expand Down Expand Up @@ -5475,7 +5475,7 @@ match simVar
then
let &dims = buffer "" /*BUFD*/
let arrayName = arraycref2(name,dims)
let arraysize = arrayextentDims(name,v.numArrayElement)
let arraysize = arrayextentDims(name,v.numArrayElement)
<<
StatArrayDim<%dims%><<%variableType(type_)%>, <%arraysize%> > <%arrayName%>;
>>
Expand Down Expand Up @@ -10866,7 +10866,7 @@ case CREF(ty= t as DAE.T_ARRAY(__)) then
match context
case SIMULATION_CONTEXT(__) then
<<
<%lhsStr%>.assign(<%rhsStr%> )/*blabla*/;
<%lhsStr%>.assign(<%rhsStr%> )/*blabla*/;
>>
else
'<%lhsStr%>.assign(<%rhsStr%>);'
Expand Down
52 changes: 26 additions & 26 deletions SimulationRuntime/cpp/Core/Math/ArrayOperations.cpp
Expand Up @@ -295,35 +295,35 @@ min_max (BaseArray<T>& x)

void convertBoolToInt( BaseArray<bool> & a ,BaseArray<int> & b )
{
b.setDims(a.getDims());
int numEle = a.getNumElems();
for (int i = 0; i <= numEle; i++)
{
if (a(i))
{
b(i) = 1;
}
else
{
b(i) = 0;
}
}
b.setDims(a.getDims());
int numEle = a.getNumElems();
for (int i = 0; i <= numEle; i++)
{
if (a(i))
{
b(i) = 1;
}
else
{
b(i) = 0;
}
}
}
void convertIntToBool( BaseArray<int> & a ,BaseArray<bool> & b )
{
b.setDims(a.getDims());
int numEle = a.getNumElems();
for (int i = 0; i <= numEle; i++)
{
if (a(i))
{
b(i) = true;
}
else
{
b(i) = false;
}
}
b.setDims(a.getDims());
int numEle = a.getNumElems();
for (int i = 0; i <= numEle; i++)
{
if (a(i))
{
b(i) = true;
}
else
{
b(i) = false;
}
}
}


Expand Down

0 comments on commit 7e6f28e

Please sign in to comment.