Skip to content

Commit

Permalink
corrected a submodelindex error
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1608 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Mar 22, 2005
1 parent c3622cb commit cbb663d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions modeq/runtime/tornadoext.cpp
Expand Up @@ -13,7 +13,7 @@ extern "C"
{
#include <assert.h>
#include "rml.h"
#include "../absyn_builder/yacclib.h"
#include "absyn_builder/yacclib.h"

string top_class;

Expand Down Expand Up @@ -537,6 +537,7 @@ extern "C"
}
}
if(index > 0) {
output << ends;
output_str << " SetNoSubModels(" << index << ");" << output.str();
}
}
Expand All @@ -556,24 +557,27 @@ extern "C"
string component_str_key = string(component_name);
map<string, map<string,variable> >::iterator search;
search = generated_classes.find(class_str_key);
int ret_val = 0;//for error checking
int ret_val = -1;//for error checking

if(search != generated_classes.end()){
map<string,variable>::const_iterator itr;
if(search->second.size() > 0){
int index;
int index = 0;
for(itr = search->second.begin(), index = 0; itr != search->second.end(); ++itr)
{
if(itr->second.type == string("class") && itr->second.name == component_str_key){
ret_val = index++;
if(itr->second.type == string("class")){
if(itr->second.name == component_str_key){
ret_val = index;
}
index += 1;
}
}
}
}

rmlA0 = (void*) mk_icon(ret_val);

if(ret_val == 0)
if(ret_val == -1)
RML_TAILCALLK(rmlFC);
else
RML_TAILCALLK(rmlSC);
Expand Down
16 changes: 10 additions & 6 deletions modeq/winruntime/tornadoext.cpp
Expand Up @@ -13,7 +13,7 @@ extern "C"
{
#include <assert.h>
#include "rml.h"
#include "../absyn_builder/yacclib.h"
#include "absyn_builder/yacclib.h"

string top_class;

Expand Down Expand Up @@ -537,6 +537,7 @@ extern "C"
}
}
if(index > 0) {
output << ends;
output_str << " SetNoSubModels(" << index << ");" << output.str();
}
}
Expand All @@ -556,24 +557,27 @@ extern "C"
string component_str_key = string(component_name);
map<string, map<string,variable> >::iterator search;
search = generated_classes.find(class_str_key);
int ret_val = 0;//for error checking
int ret_val = -1;//for error checking

if(search != generated_classes.end()){
map<string,variable>::const_iterator itr;
if(search->second.size() > 0){
int index;
int index = 0;
for(itr = search->second.begin(), index = 0; itr != search->second.end(); ++itr)
{
if(itr->second.type == string("class") && itr->second.name == component_str_key){
ret_val = index++;
if(itr->second.type == string("class")){
if(itr->second.name == component_str_key){
ret_val = index;
}
index += 1;
}
}
}
}

rmlA0 = (void*) mk_icon(ret_val);

if(ret_val == 0)
if(ret_val == -1)
RML_TAILCALLK(rmlFC);
else
RML_TAILCALLK(rmlSC);
Expand Down

0 comments on commit cbb663d

Please sign in to comment.