From 10e7c3f79895fa5b2b821eeb944cc20e021c486c Mon Sep 17 00:00:00 2001 From: petr000 Date: Sun, 18 Sep 2011 16:32:37 +0200 Subject: [PATCH] Add simple support for deffering events (not written as custom_reaction). In transition table these reactions are shown this way (deffered). Transition table is now able to show multiple reactions for one event in one state. Each of the possibilities is printed in one row. --- src/iooper.h | 70 ++++++++++++++++++++++++++++++++++++---------- src/stringoper.h | 58 ++++++++++++++++++-------------------- src/visualizer.cpp | 6 ++-- 3 files changed, 85 insertions(+), 49 deletions(-) diff --git a/src/iooper.h b/src/iooper.h index 4ce3658..8565a92 100644 --- a/src/iooper.h +++ b/src/iooper.h @@ -172,8 +172,7 @@ class IO_operations { pos1 = state.find(","); pos2 = state.substr(pos1+1).find(",")+pos1+1; - ctx = cut_namespaces(state.substr(pos1+1,pos2-pos1-1)); - cout<"; - pos2 = params.rfind(","); - dest = cut_namespaces(params.substr(pos2+1)); - filestr<"; + pos2 = params.rfind(","); + dest = cut_namespaces(params.substr(pos2+1)); + filestr<1) + { + str = table[j*cols+i]; + for(int k = 1; k0) + { + cout<1) + { + table[i*cols+j] = str.substr(str.find(",")+1); + multiline = 1; + } + else table[i*cols+j]=""; + + } + else + { + cout<getNumBases()-1) base = get_first_base(super_class); else base = super_class; - if(test_model(base,"state_machine")) + if(get_model(base)==3) { params = get_params(base); } @@ -308,7 +319,7 @@ string find_name_of_machine(const CXXRecordDecl *cRecDecl, string line) /** Find } else { - if(test_model(super_class,"state_machine")) + if(get_model(super_class)==3) { params = get_params(super_class); } @@ -332,33 +343,18 @@ string find_transitions (const string name_of_state, string line) /** Traverse a { 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<10) { - dest = ";"; + if(get_model(base)==12) dest = ";"; + else if (get_model(base) == 13) dest = ","; dest.append(name_of_state); params = get_params(base); - //cout<getNumBases()-1) base = get_first_base(super_class); else base = super_class; - if(test_model(base,"event")) return true; + if(get_model(base)==1) return true; else { super_class = get_next_base(super_class); @@ -382,7 +378,7 @@ bool find_events(const CXXRecordDecl *cRecDecl, string line) /** This function p } else { - if(test_model(super_class,"event"))return true; + if(get_model(super_class)==1)return true; } return false; } diff --git a/src/visualizer.cpp b/src/visualizer.cpp index 0a03489..b920127 100644 --- a/src/visualizer.cpp +++ b/src/visualizer.cpp @@ -335,11 +335,11 @@ class FindStates : public ASTConsumer { decl->print(x); line = get_return(x.str()); - if(test_model(line,"result")) + if(get_model(line)==5) { const FunctionDecl *fDecl = dyn_cast(decl); const ParmVarDecl *pvd = fDecl->getParamDecl(0); - QualType qt = pvd->getOriginalType(); + QualType qt = pvd->getOriginalType(); event = qt.getAsString(); if(event[event.length()-1]=='&') event = event.substr(0,event.length()-2); event = event.substr(event.rfind(" ")+1); @@ -393,7 +393,7 @@ class FindStates : public ASTConsumer case 98 : line = sman.getCharacterData(dyn_cast(stmt)->getReturnLoc()); line = get_line_of_code(line).substr(6); line = line.substr(0,line.find("(")); - if(test_model(line,"transit")) + if(get_model(line)==6) { param = get_params(line); transitions.push_back(event.append(",").append(param)); -- 2.39.2