Skip to content

Commit

Permalink
- bugfix for Modelica.Blocks.Examples.Filter
Browse files Browse the repository at this point in the history
- tap


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13655 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 26, 2012
1 parent be90161 commit c551b35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -972,12 +972,9 @@ template functionUpdateBoundParameters(list<SimEqSystem> parameterEquations)
let () = System.tmpTickReset(0)
let &varDecls = buffer "" /*BUFD*/
let &tmp = buffer ""
let body = (parameterEquations |> eq as SES_SIMPLE_ASSIGN(__) =>
equation_(eq, contextOther, &varDecls /*BUFD*/, &tmp)
;separator="\n")
let divbody = (parameterEquations |> eq as SES_ALGORITHM(__) =>
equation_(eq, contextOther, &varDecls /*BUFD*/, &tmp)
;separator="\n")
let body = (parameterEquations |> eq =>
equation_(eq, contextSimulationDiscrete, &varDecls /*BUFD*/, &tmp)
;separator="\n")
<<
<%&tmp%>
int updateBoundParameters(DATA *data)
Expand All @@ -987,7 +984,6 @@ template functionUpdateBoundParameters(list<SimEqSystem> parameterEquations)
mem_state = get_memory_state();
<%body%>
<%divbody%>
restore_memory_state(mem_state);
return 0;
Expand Down Expand Up @@ -5180,6 +5176,9 @@ case UNARY(exp = e as CREF(__)) then
<<
<%lhsStr%> = -<%rhsStr%>;
>>
case ARRAY(array = {}) then
<<
>>
else
error(sourceInfo(), 'writeLhsCref UNHANDLED: <%ExpressionDump.printExpStr(exp)%> = <%rhsStr%>')
end writeLhsCref;
Expand Down Expand Up @@ -6816,6 +6815,13 @@ template daeExpArray(Exp exp, Context context, Text &preExp /*BUFP*/,
"Generates code for an array expression."
::=
match exp
case ARRAY(array={}) then
let arrayTypeStr = expTypeArray(ty)
let arrayVar = tempDecl(arrayTypeStr, &varDecls /*BUFD*/)
let scalarPrefix = if scalar then "scalar_" else ""
let scalarRef = if scalar then "&" else ""
let &preExp += 'array_alloc_<%scalarPrefix%><%arrayTypeStr%>(&<%arrayVar%>, <%listLength(array)%>,0);<%\n%>'
arrayVar
case ARRAY(__) then
let arrayTypeStr = expTypeArray(ty)
let arrayVar = tempDecl(arrayTypeStr, &varDecls /*BUFD*/)
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/util/read_matlab4.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void omc_free_matlab4_reader(ModelicaMatReader *reader)
void remSpaces(char *ch){
char *ch2 = ch;
unsigned int ui = 0;
unsigned int uj = 0;
unsigned int uj = 0;

for(ui=0;ui<=strlen(ch);ui++){
if(ch[ui]!=' '){
Expand Down

0 comments on commit c551b35

Please sign in to comment.