using namespace std;
using namespace clang;
-class StringDecl
+
+string clean_spaces(const string line) // remove backspaces
{
- public:
- StringDecl(){};
-
- string clean_spaces(const string line) // remove backspaces
- {
- unsigned i;
- string new_line = "";
- for(i = 0;i<line.length();i++)
- {
- if(!isspace(line[i])) new_line+=line[i];
- }
- //cout<<new_line;
- return new_line;
- }
- string cut_commentary(const string line) //cut commentary at the end of line
+ unsigned i;
+ string new_line = "";
+ for(i = 0;i<line.length();i++)
{
- unsigned i = 0;
- for(i = 0;i<line.length()-1;i++)
- {
- if(line[i]=='/' && line[i+1]=='/') return line.substr(0,i);
- if(line[i]=='/' && line[i+1]=='*') return line.substr(0,i);
- }
- return line;
+ if(!isspace(line[i])) new_line+=line[i];
}
+ //cout<<new_line;
+ return new_line;
+}
- string get_line_of_code(const string code) //return the line of code
+string cut_commentary(const string line) //cut commentary at the end of line
+{
+ unsigned i = 0;
+ for(i = 0;i<line.length()-1;i++)
{
- string ret;
- unsigned i;
- //cout<<code<<"\n\n";
- for(i = 0;i<code.length();i++)
- {
- if(code[i]=='\n'||code[i]=='{') break;
- }
- ret = code.substr(0,i);
- ret = clean_spaces(ret);
- return cut_commentary(ret);
- }
+ if(line[i]=='/' && line[i+1]=='/') return line.substr(0,i);
+ if(line[i]=='/' && line[i+1]=='*') return line.substr(0,i);
+ }
+ return line;
+}
- string get_return(const string code)
+string get_line_of_code(const string code) //return the line of code
+{
+ string ret;
+ unsigned i;
+ //cout<<code<<"\n\n";
+ for(i = 0;i<code.length();i++)
{
- string ret;
- unsigned i;
- for(i = 0;i<code.length();i++)
- {
- if(code[i]==' ') break;
- }
- return code.substr(0,i);
+ if(code[i]=='\n'||code[i]=='{') break;
}
+ ret = code.substr(0,i);
+ ret = clean_spaces(ret);
+ return cut_commentary(ret);
+}
- string cut_namespaces(string line) //cut namespaces from the name of the state
+string get_return(const string code)
+{
+ string ret;
+ unsigned i;
+ for(i = 0;i<code.length();i++)
{
- int i = line.rfind("::");
- if(i==-1) return line;
- return line.substr(i+2);
+ if(code[i]==' ') break;
}
+ return code.substr(0,i);
+}
+
+string cut_namespaces(string line) //cut namespaces from the name of the state
+{
+ int i = line.rfind("::");
+ if(i==-1) return line;
+ return line.substr(i+2);
+}
- bool is_derived(const string line) // return true if the struct or class is derived
+bool is_derived(const string line) // return true if the struct or class is derived
+{
+ unsigned i;
+ for(i = 0;i<line.length()-1;i++)
{
- unsigned i;
- for(i = 0;i<line.length()-1;i++)
+ if(line[i]==':')
{
- if(line[i]==':')
- {
- if(line[i+1]!=':') return true;
- else i+=1;
- }
+ if(line[i+1]!=':') return true;
+ else i+=1;
}
- return false;
}
+ return false;
+}
- string get_super_class(const string line) // get the super class of this declarations
+string get_super_class(const string line) // get the super class of this declarations
+{
+ unsigned i;
+ for(i = 0;i<line.length()-1;i++)
{
- unsigned i;
- for(i = 0;i<line.length()-1;i++)
+ if(line[i]==':')
{
- if(line[i]==':')
- {
- if(line[i+1]!=':') break;
- else i+=1;
- }
+ if(line[i+1]!=':') break;
+ else i+=1;
}
- return line.substr(i+1);
}
+ return line.substr(i+1);
+}
- string get_next_base(const string line) // get the super class of this declarations
+string get_next_base(const string line) // get the super class of this declarations
+{
+ unsigned i;
+ int brackets = 0;
+ for(i = 0;i<line.length()-1;i++)
{
- unsigned i;
- int brackets = 0;
- for(i = 0;i<line.length()-1;i++)
- {
- if(line[i]=='<') brackets+=1;
- if(line[i]=='>') brackets-=1;
- if(line[i]==',' && brackets == 0) break;
- }
- return line.substr(i+1);
- }
+ if(line[i]=='<') brackets+=1;
+ if(line[i]=='>') brackets-=1;
+ if(line[i]==',' && brackets == 0) break;
+ }
+ return line.substr(i+1);
+}
- string get_first_base(const string line) // get the super class of this declarations
+string get_first_base(const string line) // get the super class of this declarations
+{
+ unsigned i;
+ int brackets = 0;
+ for(i = 0;i<line.length()-1;i++)
{
- unsigned i;
- int brackets = 0;
- for(i = 0;i<line.length()-1;i++)
- {
- if(line[i]=='<') brackets+=1;
- if(line[i]=='>') brackets-=1;
- if(line[i]==',' && brackets == 0) break;
- }
- return line.substr(0,i);
- }
-
+ if(line[i]=='<') brackets+=1;
+ if(line[i]=='>') brackets-=1;
+ if(line[i]==',' && brackets == 0) break;
+ }
+ return line.substr(0,i);
+}
- bool is_state(const string line) // test if it is a state
+bool is_state(const string line) // test if it is a state
+{
+ if(cut_namespaces(line).compare(0,12,"simple_state")==0)
+ {
+ return true;
+ }
+ else
{
- if(cut_namespaces(line).compare(0,12,"simple_state")==0)
+ if(cut_namespaces(line).compare(0,5,"state")==0)
{
return true;
}
- else
- {
- if(cut_namespaces(line).compare(0,5,"state")==0)
- {
- return true;
- }
- return false;
- }
+ return false;
}
+}
- string cut_type(string line) // cut typedef from the beginning
+string cut_type(string line) // cut typedef from the beginning
+{
+ unsigned i;
+ for(i = 0;i<line.length();i++)
{
- unsigned i;
- for(i = 0;i<line.length();i++)
- {
- if(line[i]==' ') break;
- }
- return line.substr(i);
+ if(line[i]==' ') break;
}
+ return line.substr(i);
+}
- int count(const string line, const char c) //count all specified char in string
+int count(const string line, const char c) //count all specified char in string
+{
+ int number = 0;
+ for(unsigned i = 0;i<line.length();i++)
{
- int number = 0;
- for(unsigned i = 0;i<line.length();i++)
- {
- if(line[i]==c) number+=1;
- }
- return number;
+ if(line[i]==c) number+=1;
}
+ return number;
+}
- bool is_list(const string line) // is it a list?
+bool is_list(const string line) // is it a list?
+{
+ //cout<<line<<"\n";
+ int pos = 0;
+ for(unsigned i = 0; i<line.length();i++)
{
- //cout<<line<<"\n";
- int pos = 0;
- for(unsigned i = 0; i<line.length();i++)
- {
- if(line[i]=='<') break;
- if(line[i]==':' && line[i+1]==':') pos = i+2;
- }
- if(line.substr(pos).compare(0,4,"list")==0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if(line[i]=='<') break;
+ if(line[i]==':' && line[i+1]==':') pos = i+2;
+ }
+ if(line.substr(pos).compare(0,4,"list")==0)
+ {
+ return true;
}
-
- string get_inner_part(const string line) // get inner part of the list
+ else
{
- string str;
- unsigned i, pos = 0;
- for(i = 0;i<line.length();i++)
- {
- if(line[i]=='<') break;
- }
- str = line.substr(i+1);
- for(i = 0;i<str.length();i++)
- {
- if(str[i]=='<') pos+=1;
- if(str[i]=='>')
- {
- if(pos==0) break;
- else pos-=1;
- }
- }
- //cout<<str.substr(0,i);
- return str.substr(0,i);
+ return false;
}
+}
- bool test_model(const string line, const string model) // is it a transition
+string get_inner_part(const string line) // get inner part of the list
+{
+ string str;
+ unsigned i, pos = 0;
+ for(i = 0;i<line.length();i++)
{
- if(cut_namespaces(line).compare(0,model.length(),model)==0)
- {
- return true;
- }
- else
- {
- return false;
+ if(line[i]=='<') break;
+ }
+ str = line.substr(i+1);
+ for(i = 0;i<str.length();i++)
+ {
+ if(str[i]=='<') pos+=1;
+ if(str[i]=='>')
+ {
+ if(pos==0) break;
+ else pos-=1;
}
}
+ //cout<<str.substr(0,i);
+ return str.substr(0,i);
+}
- string get_params(string line) // get parameters of transition
+bool test_model(const string line, const string model) // is it a transition
+{
+ if(cut_namespaces(line).compare(0,model.length(),model)==0)
+ {
+ return true;
+ }
+ else
{
- int pos_front = line.find("<")+1;
- int pos_end = line.find(">");
- return line.substr(pos_front,pos_end-pos_front);
+ return false;
}
+}
- string find_states(const CXXRecordDecl *cRecDecl, std::string line) // test if the struct/class is the state (must be derived from simple_state)
- {
- string super_class = get_super_class(line), base, params;
- if(cRecDecl->getNumBases()>1)
+string get_params(string line) // get parameters of transition
+{
+ int pos_front = line.find("<")+1;
+ int pos_end = line.find(">");
+ return line.substr(pos_front,pos_end-pos_front);
+}
+
+string find_states(const CXXRecordDecl *cRecDecl, string line) // test if the struct/class is he state (must be derived from simple_state)
+{
+ string super_class = get_super_class(line), base, params;
+ if(cRecDecl->getNumBases()>1)
+ {
+ for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
{
- for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
- {
- if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
- else base = super_class;
- if(is_state(super_class))
- {
- params = get_params(super_class);
- }
- else
- {
- super_class = get_next_base(super_class);
- }
- }
- }
- else
- {
+ if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
+ else base = super_class;
if(is_state(super_class))
{
- //std::cout<<get_params(super_class);
params = get_params(super_class);
}
- else params = "";
+ else
+ {
+ super_class = get_next_base(super_class);
+ }
+ }
+ }
+ else
+ {
+ if(is_state(super_class))
+ {
+ //std::cout<<get_params(super_class);
+ params = get_params(super_class);
}
- return params;
+ else params = "";
}
+ return params;
+}
- string find_name_of_machine(const CXXRecordDecl *cRecDecl, std::string line) // find name of the state machine and the start state
- {
- std::string super_class = get_super_class(line), base, params;
- if(cRecDecl->getNumBases()>1)
+string find_name_of_machine(const CXXRecordDecl *cRecDecl, string line) // find name of the state machine and the start state
+{
+ string super_class = get_super_class(line), base, params;
+ if(cRecDecl->getNumBases()>1)
+ {
+ for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
{
- for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
+ if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
+ else base = super_class;
+ if(test_model(base,"state_machine"))
{
- if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
- else base = super_class;
- if(test_model(base,"state_machine"))
- {
- params = get_params(base);
- }
- else
- {
- super_class = get_next_base(super_class);
- }
+ params = get_params(base);
}
- }
- else
- {
- if(test_model(super_class,"state_machine"))
+ else
{
- //std::cout<<super_class;
- params = get_params(super_class);
- //std::cout<<params;
+ super_class = get_next_base(super_class);
}
}
- return params;
}
+ else
+ {
+ if(test_model(super_class,"state_machine"))
+ {
+ //std::cout<<super_class;
+ params = get_params(super_class);
+ //std::cout<<params;
+ }
+ }
+ return params;
+}
- string find_transitions (const string name_of_state, string line) // traverse all methods for finding declarations of transitions
- {
- string dest, params, base, trans;
- int num = 0;
-
- num = count(line,'<');
- if(num>1)
+string find_transitions (const string name_of_state, string line) // traverse all methods for finding declarations of transitions
+{
+ string dest, params, base, trans;
+ int num = count(line,'<');
+ if(num>1)
+ {
+ num-=1;
+ if(is_list(line))
{
- num-=1;
- if(is_list(line))
- {
- line = get_inner_part(line);
- }
+ line = get_inner_part(line);
}
- for(int j = 0;j<num;j++)
+ }
+ for(int j = 0;j<num;j++)
+ {
+ if(j!=num-1) base = get_first_base(line);
+ else base = line;
+ if(test_model(base,"transition"))
{
- if(j!=num-1) base = get_first_base(line);
- else base = line;
- if(test_model(base,"transition"))
- {
- dest = name_of_state;
- params = get_params(base);
- //cout<<params<<"\n";
- dest.append(",");
- dest.append(params);
- line = get_next_base(line);
- trans.append(dest);
- if(j+1!=num) trans.append(";");
- }
- else if(test_model(base,"custom_reaction"))
- {
- dest = ";";
- dest.append(name_of_state);
- params = get_params(base);
- //cout<<params<<"\n";
- dest.append(",");
- dest.append(params);
- line = get_next_base(line);
- trans.append(dest);
- if(j+1!=num) trans.append(";");
- }
- else
- {
- line = get_next_base(line);
- }
+ dest = name_of_state;
+ params = get_params(base);
+ //cout<<params<<"\n";
+ dest.append(",");
+ dest.append(params);
+ line = get_next_base(line);
+ trans.append(dest);
+ if(j+1!=num) trans.append(";");
+ }
+ else if(test_model(base,"custom_reaction"))
+ {
+ dest = ";";
+ dest.append(name_of_state);
+ params = get_params(base);
+ //cout<<params<<"\n";
+ dest.append(",");
+ dest.append(params);
+ line = get_next_base(line);
+ trans.append(dest);
+ if(j+1!=num) trans.append(";");
+ }
+ else
+ {
+ line = get_next_base(line);
}
- if(trans[trans.length()-1]==';') return trans.substr(0,trans.length()-1);
- else return trans;
}
- bool find_events(const CXXRecordDecl *cRecDecl, std::string line) // test if the decl is decl of event
- {
- std::string super_class = get_super_class(line), base, params;
- if(cRecDecl->getNumBases()>1)
+ if(trans[trans.length()-1]==';') return trans.substr(0,trans.length()-1);
+ else return trans;
+}
+
+bool find_events(const CXXRecordDecl *cRecDecl, string line) // test if the decl is decl of event
+{
+ string super_class = get_super_class(line), base, params;
+ if(cRecDecl->getNumBases()>1)
+ {
+ for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
{
- for(unsigned i = 0; i<cRecDecl->getNumBases();i++ )
+ if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
+ else base = super_class;
+ if(test_model(base,"event")) return true;
+ else
{
- if(i!=cRecDecl->getNumBases()-1) base = get_first_base(super_class);
- else base = super_class;
- if(test_model(base,"event")) return true;
- else
- {
- super_class = get_next_base(super_class);
- }
+ super_class = get_next_base(super_class);
}
}
- else
- {
- if(test_model(super_class,"event"))return true;
- }
- return false;
}
-};
+ else
+ {
+ if(test_model(super_class,"event"))return true;
+ }
+ return false;
+}
list<string> events;
string name_of_machine;
string name_of_start;
- StringDecl sd;
int nbrStates;
FullSourceLoc *fsloc;
public:
virtual void HandleTopLevelDecl(DeclGroupRef DGR)// traverse all top level declarations
{
SourceLocation loc;
- std::string line, output, event;
+ string line, output, event;
llvm::raw_string_ostream x(output);
for (DeclGroupRef::iterator i = DGR.begin(), e = DGR.end(); i != e; ++i)
{
}
void recursive_visit(const DeclContext *declCont) //recursively visit all decls hidden inside namespaces
{
- std::string line, output, event;
+ string line, output, event;
llvm::raw_string_ostream x(output);
SourceLocation loc;
for (DeclContext::decl_iterator i = declCont->decls_begin(), e = declCont->decls_end(); i != e; ++i)
string output, line, ret, trans, event;
llvm::raw_string_ostream x(output);
decl->print(x);
- line = sd.get_line_of_code(x.str());
+ line = get_line_of_code(x.str());
output = "";
- int pos, num;
- const TagDecl *tagDecl = dyn_cast<TagDecl>(decl);
+ int pos;
const NamedDecl *namedDecl = dyn_cast<NamedDecl>(decl);
- if(sd.is_derived(line))
+ if(is_derived(line))
{
const CXXRecordDecl *cRecDecl = dyn_cast<CXXRecordDecl>(decl);
- if(sd.find_events(cRecDecl, line))
+ if(find_events(cRecDecl, line))
{
events.push_back(namedDecl->getNameAsString());
cout<<"New event: "<<namedDecl->getNameAsString()<<"\n";
}
else if(name_of_machine == "")
{
- ret = sd.find_name_of_machine(cRecDecl, line);
+ ret = find_name_of_machine(cRecDecl, line);
if(!ret.empty())
{
pos = ret.find(",");
}
else
{
- ret = sd.find_states(cRecDecl, line);
+ ret = find_states(cRecDecl, line);
if(!ret.empty())
- {
- const DeclContext *declCont = tagDecl->castToDeclContext(tagDecl);
- //states.push_back(namedDecl->getNameAsString());
- std::cout << "New state: " << namedDecl->getNameAsString() << "\n";
- states.push_back(ret);
- output="";
- for (DeclContext::decl_iterator i = declCont->decls_begin(), e = declCont->decls_end(); i != e; ++i)
+ {
+ cout << "New state: " << namedDecl->getNameAsString() << "\n";
+ states.push_back(ret);
+ methods_in_class(decl,namedDecl->getNameAsString());
+ }
+ }
+ }
+ }
+
+ void methods_in_class(const Decl *decl, const string state)
+ {
+ string output, line, ret, trans, event;
+ llvm::raw_string_ostream x(output);
+ int pos, num;
+ const TagDecl *tagDecl = dyn_cast<TagDecl>(decl);
+ const DeclContext *declCont = tagDecl->castToDeclContext(tagDecl);
+ //states.push_back(namedDecl->getNameAsString());
+
+ output="";
+ for (DeclContext::decl_iterator i = declCont->decls_begin(), e = declCont->decls_end(); i != e; ++i)
+ {
+ if (i->getKind()==26)
+ {
+ i->print(x);
+ output = x.str();
+ line = clean_spaces(cut_type(output));
+ ret = find_transitions(state,line);
+ if(!ret.empty())
+ {
+ num = count(ret,';')+1;
+ for(int i = 0;i<num;i++)
{
- const Decl *decl = *i;
- if (decl->getKind()==26)
+ pos = ret.find(";");
+ if(pos == 0)
{
- decl->print(x);
- output = x.str();
- line = sd.clean_spaces(sd.cut_type(output));
- ret = sd.find_transitions(namedDecl->getNameAsString(),line);
- if(!ret.empty())
- {
- num = sd.count(ret,';')+1;
- for(int i = 0;i<num;i++)
- {
- pos = ret.find(";");
- if(pos == 0)
- {
- ret = ret.substr(1);
- pos = ret.find(";");
- if(pos==-1) cReactions.push_back(ret);
- else cReactions.push_back(ret.substr(0,pos));
- num-=1;
- }
- else
- {
- if(pos==-1) transitions.push_back(ret);
- else transitions.push_back(ret.substr(0,pos));
- }
- //cout<<ret<<"\n";
- if(i!=num-1) ret = ret.substr(pos+1);
- }
- output="";
- }
+ ret = ret.substr(1);
+ pos = ret.find(";");
+ if(pos==-1) cReactions.push_back(ret);
+ else cReactions.push_back(ret.substr(0,pos));
+ num-=1;
}
- if(decl->getKind()==35) method_decl(decl);
+ else
+ {
+ if(pos==-1) transitions.push_back(ret);
+ else transitions.push_back(ret.substr(0,pos));
+ }
+ //cout<<ret<<"\n";
+ if(i!=num-1) ret = ret.substr(pos+1);
}
+ output="";
}
}
+ if(i->getKind()==35) method_decl(decl);
}
}
+
void method_decl(const Decl *decl)
{
string output, line, event;
if(decl->hasBody())
{
decl->print(x);
- line = sd.get_return(x.str());
- if(sd.test_model(line,"result"))
+ line = get_return(x.str());
+ if(test_model(line,"result"))
{
const FunctionDecl *fDecl = dyn_cast<FunctionDecl>(decl);
const ParmVarDecl *pvd = fDecl->getParamDecl(0);
if(event[event.length()-1]=='&') event = event.substr(0,event.length()-2);
event = event.substr(event.rfind(" ")+1);
line = dyn_cast<NamedDecl>(decl)->getQualifiedNameAsString();
- line = sd.cut_namespaces(line.substr(0,line.rfind("::")));
+ line = cut_namespaces(line.substr(0,line.rfind("::")));
line.append(",");
line.append(event);
find_return_stmt(decl->getBody(),line);
cReactions.erase(i);
break;
}
- }
+ }
}
}
}
+
void find_return_stmt(Stmt *statemt,string event)
{
if(statemt->getStmtClass() == 99) test_stmt(dyn_cast<CaseStmt>(statemt)->getSubStmt(), event);
case 90 : find_return_stmt(dyn_cast<LabelStmt>(stmt)->getSubStmt(), event); //label
break;
case 98 : line = sman.getCharacterData(dyn_cast<ReturnStmt>(stmt)->getReturnLoc());
- line = sd.get_line_of_code(line).substr(6);
+ line = get_line_of_code(line).substr(6);
line = line.substr(0,line.find("("));
- if(sd.test_model(line,"transit"))
+ if(test_model(line,"transit"))
{
- param = sd.get_params(line);
+ param = get_params(line);
transitions.push_back(event.append(",").append(param));
}
break;
}
}
- void save_to_file(std::string output) // save all to the output file
+ void save_to_file(string output) // save all to the output file
{
nbrStates = states.size();
string state, str, context, ctx;
for(list<string>::iterator i = states.begin();i!=states.end();i++) // write all states in the context of the automaton
{
state = *i;
- cnt = sd.count(state,',');
+ cnt = count(state,',');
if(cnt==1)
{
pos1 = state.find(",");
- ctx = sd.cut_namespaces(state.substr(pos1+1));
+ ctx = cut_namespaces(state.substr(pos1+1));
//std::cout<<name_of_machine.length();
if(ctx.compare(0,context.length(),context)==0)
{
- filestr<<sd.cut_namespaces(state.substr(0,pos1))<<";\n";
+ filestr<<cut_namespaces(state.substr(0,pos1))<<";\n";
states.erase(i);
i--;
}
{
pos1 = state.find(",");
pos2 = state.rfind(",");
- ctx = sd.cut_namespaces(state.substr(pos1+1,pos2-pos1-1));
+ ctx = cut_namespaces(state.substr(pos1+1,pos2-pos1-1));
//std::cout<<ctx<<" "<<context<<"\n";
if(ctx.compare(0,context.length(),context)==0)
{
- filestr<<sd.cut_namespaces(state.substr(0,pos1))<<";\n";
+ filestr<<cut_namespaces(state.substr(0,pos1))<<";\n";
}
}
}
filestr<<"subgraph cluster"<<subs<<" {\n";
pos1 = state.find(",");
pos2 = state.rfind(",");
- context = sd.cut_namespaces(state.substr(0,pos1));
+ context = cut_namespaces(state.substr(0,pos1));
filestr<<"label=\""<<context<<"\";\n";
- filestr<<sd.cut_namespaces(state.substr(pos2+1))<<" [peripheries=2] ;\n";
+ filestr<<cut_namespaces(state.substr(pos2+1))<<" [peripheries=2] ;\n";
states.pop_front();
//std::cout<<states.size();
for(list<string>::iterator i = states.begin();i!=states.end();i++)
{
state = *i;
- cnt = sd.count(state,',');
+ cnt = count(state,',');
//std::cout<<state<<" \n";
if(cnt==1)
{
pos1 = state.find(",");
- ctx = sd.cut_namespaces(state.substr(pos1+1));
+ ctx = cut_namespaces(state.substr(pos1+1));
if(ctx.compare(0,context.length(),context)==0)
{
- filestr<<sd.cut_namespaces(state.substr(0,pos1))<<";\n";
+ filestr<<cut_namespaces(state.substr(0,pos1))<<";\n";
states.erase(i);
i--;
}
{
pos1 = state.find(",");
pos2 = state.rfind(",");
- ctx = sd.cut_namespaces(state.substr(pos1+1,pos2-pos1-1));
- if(ctx.compare(0,context.length(),context)==0) filestr<<sd.cut_namespaces(state.substr(0,pos1))<<";\n";
+ ctx = cut_namespaces(state.substr(pos1+1,pos2-pos1-1));
+ if(ctx.compare(0,context.length(),context)==0) filestr<<cut_namespaces(state.substr(0,pos1))<<";\n";
}
}
filestr<<"}\n";
{
state = *i;
pos1 = state.find(",");
- filestr<<sd.cut_namespaces(state.substr(0,pos1))<<"->";
+ filestr<<cut_namespaces(state.substr(0,pos1))<<"->";
pos2 = state.rfind(",");
- filestr<<sd.cut_namespaces(state.substr(pos2+1));
- filestr<<"[label=\""<<sd.cut_namespaces(state.substr(pos1+1,pos2-pos1-1))<<"\"];\n";
+ filestr<<cut_namespaces(state.substr(pos2+1));
+ filestr<<"[label=\""<<cut_namespaces(state.substr(pos1+1,pos2-pos1-1))<<"\"];\n";
}
filestr<<"}";
filestr.close();