]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/blobdiff - src/visualizer.cpp
Update deffering event.
[boost-statechart-viewer.git] / src / visualizer.cpp
index 475682ba96e5544a3971fe61442537bf5d507819..1a0af5ac467f996dff2bedf4d5d3d34f29468bc8 100644 (file)
@@ -127,7 +127,7 @@ class FindStates : public ASTConsumer
        FullSourceLoc *fsloc; /** Full Source Location instance for holding Source Manager. */
        public:
 
-       list<string> getStates() /** Return list of states. */
+       list<string> getStates() /** Return list of states of the state machine. */
        {
                return states;
        }
@@ -242,6 +242,7 @@ class FindStates : public ASTConsumer
                llvm::raw_string_ostream x(output);
                decl->print(x);
                line = get_line_of_code(x.str());
+               
                output = "";
                int pos;
                const NamedDecl *namedDecl = dyn_cast<NamedDecl>(decl);
@@ -334,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<FunctionDecl>(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);
@@ -392,11 +393,16 @@ class FindStates : public ASTConsumer
                        case 98 :       line = sman.getCharacterData(dyn_cast<ReturnStmt>(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));
                                                        }
+                                                       if(get_model(line) == 7)
+                                                       {
+                                                               param = ",";
+                                                               transitions.push_back(param.append(event));
+                                                       }
                                                        break;
                        case 99 :       find_return_stmt(stmt, event);
                                                        break;
@@ -414,6 +420,13 @@ class FindStates : public ASTConsumer
   */
 int main(int argc, char **argv)
 { 
+       if(argc==1 || strncmp(argv[1],"-help",5)==0)
+       {
+               cout<<endl<<" Boost Statechart Viewer - help"<<endl;
+               cout<<"================================"<<endl;
+               cout<<"The program can be used almost the same way as a C compiler. You will typically need to specify locations for all header files except of the files stored in system folder(in Linux: /usr/...) using -I option. Of course you can specify the output filename (-o option). Program displays all diagnostic messages like compilers. If an error occurs the program stops."<<endl<<endl;
+               return 0;
+       }
        string inputFilename = "";
        string outputFilename = "graph.dot"; // initialize output Filename
        DiagnosticOptions dopts;