Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Automaton.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2000 KOM/Darmstadt University of Technology
00003  *
00004  * This program is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License as published by the
00006  * Free Software Foundation; either version 2, or (at your option) any
00007  * later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00017  * USA.
00018  */
00019 #ifndef PARSER_AUTOMATON_H
00020 #define PARSER_AUTOMATON_H
00021 
00022 #include <iostream.h>
00023 
00024 #include "MNList.h"
00025 #include "MNArray.h"
00026 #include "dictionary.h"
00027 
00028 #include "V2States.h"
00029 
00030 class Action;
00031 class TargetState;
00032 class V1StateVector;
00033 class V2StateCollector;
00034 class StateTransitionArray;
00035 
00036 /***********************************************************************
00037  * StateTransitionPair
00038  ***********************************************************************/
00039 
00040 class StateTransitionPair
00041 {
00042     MNList<V2StateVector*> _vectors;
00043 public:
00044     StateTransitionPair( );
00045 
00046     void append( int dim_count, int* vector );
00047     void append( V2StateVector* v );
00048 
00049     MNList<V2StateVector*>& vectors();
00050 };
00051 
00052 /***********************************************************************
00053  * StateTransitionCollection
00054  ***********************************************************************/
00055 
00056 class StateTransitionCollection
00057     : public MNdictionary<V1Transition*,StateTransitionPair*>
00058 {
00059 public:
00060     virtual int compare(V1Transition *const & l, V1Transition *const & r) const;
00061 };
00062 
00063 /***********************************************************************
00064  * Automaton
00065  ***********************************************************************/
00066 
00067 class Automaton
00068 {
00069     bool        _sync_stop;
00070 
00071     const char* _user_code_header;
00072     const char* _user_header;
00073     const char* _user_class_elements;
00074     const char* _user_code;
00075     const char* _inherit_class;
00076     const char* _inherit_class_init;
00077     const char* _constructor_parameters;
00078     const char* _constructor_parameter_assignment;
00079     const char* _constructor_body;
00080     const char* _destructor_body;
00081     const char* _entertrans_code;
00082     const char* _enterstate_code;
00083 
00084     int         _user_code_header_line;
00085     int         _user_header_line;
00086     int         _user_class_elements_line;
00087     int         _user_code_line;
00088 
00089     V2StateCollector* _collector;
00090 
00091     char* _automaton_name;
00092     char* _automaton_class_name;
00093     char* _target_file_name;
00094     char* _source_file_name;
00095 
00096     // typedef MNList<V1Transition*>             TransitionList;
00097     // typedef MNArray2<V1Transition*>           TransitionArray;
00098 
00099     // typedef dictionary<int,TransitionList*> TransitionTable;
00100     // MNList<StateTransitionPair*> _transitionCollector;
00101     // TransitionTable              _ttable;
00102 
00103     // dictionary<int,int> _state_to_statename;
00104     // dictionary<int,int> _input_to_inputname;
00105     dictionary<int,SignalParameterList*> _inputname_to_input_definition;
00106 
00107     void dump_nextstate_macro_recurse( ostream& ostr, int dim, int maxd, int* vector );
00108     void dump_nextstate_macro( ostream& ostr, int del, StateTransitionArray* array );
00109     void dump_nextstate_impl( ostream& ostr, StateTransitionArray* array );
00110     void dump_statename_impl( ostream& ostr, StateTransitionArray* array );
00111     void dump_enterstate_impl( ostream& ostr );
00112     void dump_entertrans_impl( ostream& ostr );
00113     void dump_user_header ( ostream& );
00114     void dump_user_code_header ( ostream& );
00115     void dump_user_class_elements ( ostream& );
00116     void dump_state_enum( ostream&, StateTransitionArray* array );
00117     void dump_input_enum( ostream& );
00118     void dump_input_calls( ostream& ostr, int decl, StateTransitionArray* array );
00119     void dump_signal_calls( ostream& ostr, int decl, StateTransitionArray* array );
00120     void dump_signal_classes( ostream& ostr, int decl );
00121     void dump_constructor( ostream& ostr, int decl );
00122     void dump_user_code( ostream& ostr );
00123 public:
00124     Automaton();
00125     void setName ( const char* s );
00126 
00127     void setFilename ( int prefix );
00128     void setCodePrefix ( const char* prefix, int codeblockline );
00129     void setPrefix ( const char* prefix, int codeblockline );
00130     void setDeclare ( const char* declaration, int codeblockline );
00131     void setDefine ( const char* definition, int codeblockline );
00132     void setInherit ( int inherit_class );
00133     void setInherit ( int inherit_class, const char* inherit_class_init );
00134     void setInherit ( const char* inherit_class );
00135     void setInherit ( const char* inherit_class, const char* inherit_class_init );
00136     void setConstruct ( const char* parameters,
00137                         const char* assignment = NULL,
00138                         const char* body = NULL );
00139     void setDestruct ( const char* body );
00140     void setEnterstate ( const char* body );
00141     void setEntertrans ( const char* body );
00142     void setSyncStop ( );
00143     void inputDefinition ( int name, SignalParameterList* parameters );
00144 
00145     void respace ( ostream& ostr,
00146                    const char* str,
00147                    const char* input );
00148 
00149     void eval ( V2StateCollector* v2, StateTransitionArray* array );
00150 };
00151 
00152 extern Automaton automaton;
00153 
00154 #endif /* PARSER_AUTOMATON_H */
00155 

Generated on Sat Mar 23 18:58:40 2002 for Komssys-mkauto by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002