text
stringlengths
0
252
//----------------------------------------------------------
vector<NT> ScMain::find_localVar_elements (ifstream &debugSymbol, unsigned int lineNum){
vector<NT> Vect_NameType;
vector<string> split_line;
NT NameType;
string line;
GotoLine(debugSymbol, lineNum);
bool findComplexType = 0;
if (debugSymbol.is_open()){
while (getline(debugSymbol, line)) {
if ((!string_finder (line, DCSCMODULE)) && (!line.empty()) && (string_finder (line, CLASS) || string_finder (line, STRUCT))){ //--------- first step of extracting local var of systemC
split_line = split(line, ' ');
remove_element_vector(split_line, "");
if ((split_line.size() > 3) && string_finder (line, CLASS))
NameType.second = split_line[2];
else
NameType.second = split_line[1];
if (string_finder (NameType.second, SCCORE) && string_finder (NameType.second, "<"))
NameType.second = replace_first_occurrence(NameType.second,",",">");
findComplexType = 1;
}
else if (string_finder (line, CAT) && findComplexType && (!string_finder (line, CT)) && string_finder (line,"}")){ //--- second step of complex type
split_line = split(line, ' ');
remove_element_vector(split_line, "");
NameType.first = split_line[1];
NameType.first = replace_first_occurrence(NameType.first,";","");
set_NT_vector (Vect_NameType, NameType);
}
else if (string_finder (line, CAT) && (!string_finder (line, CT))){ //----------- extracting local var of c++ for each function
NameType = find_module_var(line);
set_NT_vector (Vect_NameType, NameType);
}
if (string_finder (line, BLOCK))
return Vect_NameType;
}
}
}
//----------------------------------------------------------
void ScMain::set_static_data_func (string m_name, NT f_name){
Component temp_struct;
int index = find_element(m_name);
if (index != -1){
static_data_final[index].set_func(f_name);
}
else{
temp_struct.set_name (m_name);
temp_struct.set_func(f_name);
static_data_final.push_back(temp_struct);
}
}
//----------------------------------------------------------
int ScMain::find_element (string str){
for (int i=0; i< static_data_final.size(); ++i){
if (static_data_final[i].get_name() == str)
return i;
}
return -1;
}
//----------------------------------------------------------
void ScMain::set_static_data_var (string m_name, NT v_name){
Component temp_struct;
int index = find_element(m_name);
if (index != -1){
static_data_final[index].set_var(v_name);
}
else{
temp_struct.set_name (m_name);
temp_struct.set_var(v_name);
static_data_final.push_back(temp_struct);
}
}
//----------------------------------------------------------
bool ScMain::find_scmain_elements (ifstream &debugSymbol, unsigned int lineNum){
string line, string_type, string_name;
NT name_type;
bool permission_flag = 0;
vector<string> split_line;
GotoLine(debugSymbol, lineNum);
if (debugSymbol.is_open()){
while (getline(debugSymbol, line)) {
if(!(string_finder(line, BLOCK))){
if (string_finder(line, CLASS)){
string_type = line;
split_line = split(string_type,' ');
string_type = split_line[6];
if((string_finder(string_type, SCCORE)) && (string_finder(string_type, "<"))){
string_type = replace_first_occurrence(string_type,",",">");
}
else if (string_finder(string_type, SCCORE)){