Skip to content

Commit cbb663d

Browse files
author
x02lucpo
committed
corrected a submodelindex error
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1608 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent c3622cb commit cbb663d

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

modeq/runtime/tornadoext.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern "C"
1313
{
1414
#include <assert.h>
1515
#include "rml.h"
16-
#include "../absyn_builder/yacclib.h"
16+
#include "absyn_builder/yacclib.h"
1717

1818
string top_class;
1919

@@ -537,6 +537,7 @@ extern "C"
537537
}
538538
}
539539
if(index > 0) {
540+
output << ends;
540541
output_str << " SetNoSubModels(" << index << ");" << output.str();
541542
}
542543
}
@@ -556,24 +557,27 @@ extern "C"
556557
string component_str_key = string(component_name);
557558
map<string, map<string,variable> >::iterator search;
558559
search = generated_classes.find(class_str_key);
559-
int ret_val = 0;//for error checking
560+
int ret_val = -1;//for error checking
560561

561562
if(search != generated_classes.end()){
562563
map<string,variable>::const_iterator itr;
563564
if(search->second.size() > 0){
564-
int index;
565+
int index = 0;
565566
for(itr = search->second.begin(), index = 0; itr != search->second.end(); ++itr)
566567
{
567-
if(itr->second.type == string("class") && itr->second.name == component_str_key){
568-
ret_val = index++;
568+
if(itr->second.type == string("class")){
569+
if(itr->second.name == component_str_key){
570+
ret_val = index;
571+
}
572+
index += 1;
569573
}
570574
}
571575
}
572576
}
573577

574578
rmlA0 = (void*) mk_icon(ret_val);
575579

576-
if(ret_val == 0)
580+
if(ret_val == -1)
577581
RML_TAILCALLK(rmlFC);
578582
else
579583
RML_TAILCALLK(rmlSC);

modeq/winruntime/tornadoext.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern "C"
1313
{
1414
#include <assert.h>
1515
#include "rml.h"
16-
#include "../absyn_builder/yacclib.h"
16+
#include "absyn_builder/yacclib.h"
1717

1818
string top_class;
1919

@@ -537,6 +537,7 @@ extern "C"
537537
}
538538
}
539539
if(index > 0) {
540+
output << ends;
540541
output_str << " SetNoSubModels(" << index << ");" << output.str();
541542
}
542543
}
@@ -556,24 +557,27 @@ extern "C"
556557
string component_str_key = string(component_name);
557558
map<string, map<string,variable> >::iterator search;
558559
search = generated_classes.find(class_str_key);
559-
int ret_val = 0;//for error checking
560+
int ret_val = -1;//for error checking
560561

561562
if(search != generated_classes.end()){
562563
map<string,variable>::const_iterator itr;
563564
if(search->second.size() > 0){
564-
int index;
565+
int index = 0;
565566
for(itr = search->second.begin(), index = 0; itr != search->second.end(); ++itr)
566567
{
567-
if(itr->second.type == string("class") && itr->second.name == component_str_key){
568-
ret_val = index++;
568+
if(itr->second.type == string("class")){
569+
if(itr->second.name == component_str_key){
570+
ret_val = index;
571+
}
572+
index += 1;
569573
}
570574
}
571575
}
572576
}
573577

574578
rmlA0 = (void*) mk_icon(ret_val);
575579

576-
if(ret_val == 0)
580+
if(ret_val == -1)
577581
RML_TAILCALLK(rmlFC);
578582
else
579583
RML_TAILCALLK(rmlSC);

0 commit comments

Comments
 (0)