diff options
| -rw-r--r-- | build.conf | 2 | ||||
| -rw-r--r-- | src/action.h | 5 | ||||
| -rw-r--r-- | src/builder.cpp | 13 | ||||
| -rw-r--r-- | src/builder.h | 9 | ||||
| -rw-r--r-- | src/filetarget.cpp | 31 | ||||
| -rw-r--r-- | src/filetarget.h | 2 | ||||
| -rw-r--r-- | src/main.cpp | 5 | ||||
| -rw-r--r-- | src/performcmd.cpp | 3 | ||||
| -rw-r--r-- | src/viewer.cpp | 62 | ||||
| -rw-r--r-- | src/viewer.h | 33 | ||||
| -rw-r--r-- | src/viewerpercent.cpp | 58 | ||||
| -rw-r--r-- | src/viewerpercent.h | 30 | ||||
| -rw-r--r-- | src/viewerplain.cpp | 33 | ||||
| -rw-r--r-- | src/viewerplain.h | 26 |
14 files changed, 297 insertions, 15 deletions
| @@ -5,6 +5,8 @@ default action: check build | |||
| 5 | 5 | ||
| 6 | create file build from files in src using rule exe | 6 | create file build from files in src using rule exe |
| 7 | 7 | ||
| 8 | set CXXFLAGS += "-ggdb" | ||
| 9 | |||
| 8 | set CXXFLAGS += "-Ilibbu++/src" | 10 | set CXXFLAGS += "-Ilibbu++/src" |
| 9 | set LDFLAGS += "-Llibbu++ -lbu++" | 11 | set LDFLAGS += "-Llibbu++ -lbu++" |
| 10 | 12 | ||
diff --git a/src/action.h b/src/action.h index 7518ed2..ea92efa 100644 --- a/src/action.h +++ b/src/action.h | |||
| @@ -25,6 +25,11 @@ public: | |||
| 25 | return bDefault; | 25 | return bDefault; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | int getNumCommands() | ||
| 29 | { | ||
| 30 | return lCommand.size(); | ||
| 31 | } | ||
| 32 | |||
| 28 | void debug(); | 33 | void debug(); |
| 29 | 34 | ||
| 30 | void execute( class Builder &bld ); | 35 | void execute( class Builder &bld ); |
diff --git a/src/builder.cpp b/src/builder.cpp index c4f2d12..65ae0c2 100644 --- a/src/builder.cpp +++ b/src/builder.cpp | |||
| @@ -6,14 +6,16 @@ | |||
| 6 | #include "target.h" | 6 | #include "target.h" |
| 7 | #include "build.tab.h" | 7 | #include "build.tab.h" |
| 8 | #include "rule.h" | 8 | #include "rule.h" |
| 9 | #include "viewer.h" | ||
| 9 | 10 | ||
| 10 | subExceptionDef( BuildException ) | 11 | subExceptionDef( BuildException ) |
| 11 | 12 | ||
| 12 | Builder::Builder() : | 13 | Builder::Builder( Viewer &rView ) : |
| 13 | pDefaultAction( NULL ), | 14 | pDefaultAction( NULL ), |
| 14 | pLastAddedAction( NULL ), | 15 | pLastAddedAction( NULL ), |
| 15 | sTmp(""), | 16 | sTmp(""), |
| 16 | sContext("") | 17 | sContext(""), |
| 18 | rView( rView ) | ||
| 17 | { | 19 | { |
| 18 | } | 20 | } |
| 19 | 21 | ||
| @@ -44,7 +46,11 @@ void Builder::build( const char *sAct ) | |||
| 44 | pAct = mAction[sAct]; | 46 | pAct = mAction[sAct]; |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 49 | rView.beginAction( sAct, pAct->getNumCommands() ); | ||
| 50 | |||
| 47 | pAct->execute( *this ); | 51 | pAct->execute( *this ); |
| 52 | |||
| 53 | rView.endAction(); | ||
| 48 | } | 54 | } |
| 49 | 55 | ||
| 50 | void Builder::execute( Action *pAct ) | 56 | void Builder::execute( Action *pAct ) |
| @@ -318,6 +324,8 @@ void Builder::genRequiresFor( const char *sName ) | |||
| 318 | { | 324 | { |
| 319 | varmap *revars = regexVars( re ); | 325 | varmap *revars = regexVars( re ); |
| 320 | std::string s = varRepl( (*i).second.c_str(), "", revars ); | 326 | std::string s = varRepl( (*i).second.c_str(), "", revars ); |
| 327 | rView.beginExtraRequiresCheck( s.c_str() ); | ||
| 328 | rView.executeCmd( s.c_str() ); | ||
| 321 | FILE *fcmd = popen( s.c_str(), "r" ); | 329 | FILE *fcmd = popen( s.c_str(), "r" ); |
| 322 | std::string rhs; | 330 | std::string rhs; |
| 323 | bool bHeader = true; | 331 | bool bHeader = true; |
| @@ -366,6 +374,7 @@ void Builder::genRequiresFor( const char *sName ) | |||
| 366 | } | 374 | } |
| 367 | pclose( fcmd ); | 375 | pclose( fcmd ); |
| 368 | delete revars; | 376 | delete revars; |
| 377 | rView.endExtraRequiresCheck(); | ||
| 369 | } | 378 | } |
| 370 | } | 379 | } |
| 371 | } | 380 | } |
diff --git a/src/builder.h b/src/builder.h index 296b9d7..82a82c4 100644 --- a/src/builder.h +++ b/src/builder.h | |||
| @@ -16,6 +16,7 @@ class Action; | |||
| 16 | class Command; | 16 | class Command; |
| 17 | class Rule; | 17 | class Rule; |
| 18 | class Target; | 18 | class Target; |
| 19 | class Viewer; | ||
| 19 | 20 | ||
| 20 | #define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld ) | 21 | #define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld ) |
| 21 | YY_DECL; | 22 | YY_DECL; |
| @@ -31,7 +32,7 @@ class Builder | |||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | public: | 34 | public: |
| 34 | Builder(); | 35 | Builder( Viewer &rView ); |
| 35 | virtual ~Builder(); | 36 | virtual ~Builder(); |
| 36 | 37 | ||
| 37 | void load( const char *sFN ); | 38 | void load( const char *sFN ); |
| @@ -43,6 +44,10 @@ public: | |||
| 43 | 44 | ||
| 44 | std::string file; | 45 | std::string file; |
| 45 | 46 | ||
| 47 | Viewer &view() | ||
| 48 | { | ||
| 49 | return rView; | ||
| 50 | } | ||
| 46 | void add( Action *pAct ); | 51 | void add( Action *pAct ); |
| 47 | void add( Command *pCmd ); | 52 | void add( Command *pCmd ); |
| 48 | void add( Rule *pRule ); | 53 | void add( Rule *pRule ); |
| @@ -145,6 +150,8 @@ private: | |||
| 145 | StaticString sTmp; | 150 | StaticString sTmp; |
| 146 | 151 | ||
| 147 | bool bReqRegexp; | 152 | bool bReqRegexp; |
| 153 | |||
| 154 | Viewer &rView; | ||
| 148 | }; | 155 | }; |
| 149 | 156 | ||
| 150 | void cleanList( std::list<std::string> &lst ); | 157 | void cleanList( std::list<std::string> &lst ); |
diff --git a/src/filetarget.cpp b/src/filetarget.cpp index ca9a39f..e89cd5f 100644 --- a/src/filetarget.cpp +++ b/src/filetarget.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "rule.h" | 5 | #include "rule.h" |
| 6 | #include "filetarget.h" | 6 | #include "filetarget.h" |
| 7 | #include "builder.h" // for BuildException | 7 | #include "builder.h" // for BuildException |
| 8 | #include "viewer.h" | ||
| 8 | 9 | ||
| 9 | FileTarget::FileTarget( const char *sName ) : | 10 | FileTarget::FileTarget( const char *sName ) : |
| 10 | Target( sName ) | 11 | Target( sName ) |
| @@ -67,25 +68,27 @@ void FileTarget::addInputDir( const char *sDir ) | |||
| 67 | closedir( dir ); | 68 | closedir( dir ); |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | int nNew, nCache; | 71 | //int nNew, nCache; |
| 71 | 72 | ||
| 72 | void FileTarget::check( Builder &bld ) | 73 | void FileTarget::check( Builder &bld ) |
| 73 | { | 74 | { |
| 74 | printf("--- %s ---\n", getName() ); | 75 | //nNew = nCache = 0; |
| 75 | nNew = nCache = 0; | ||
| 76 | Rule *pRule = bld.getRule( sRule ); | 76 | Rule *pRule = bld.getRule( sRule ); |
| 77 | 77 | ||
| 78 | std::list<Perform *> perf; | 78 | std::list<Perform *> perf; |
| 79 | std::list<std::string> tmp = pRule->execute( bld, lInput, perf, getName() ); | 79 | std::list<std::string> tmp = pRule->execute( bld, lInput, perf, getName() ); |
| 80 | lOutput.insert( lOutput.end(), tmp.begin(), tmp.end() ); | 80 | lOutput.insert( lOutput.end(), tmp.begin(), tmp.end() ); |
| 81 | |||
| 82 | bld.view().beginTarget( getName(), "file", "check", lOutput.size() ); | ||
| 81 | 83 | ||
| 82 | bld.processRequires( lOutput ); | 84 | bld.processRequires( lOutput ); |
| 83 | 85 | ||
| 84 | for( std::list<Perform *>::iterator i = perf.begin(); | 86 | for( std::list<Perform *>::iterator i = perf.begin(); |
| 85 | i != perf.end(); i++ ) | 87 | i != perf.end(); i++ ) |
| 86 | { | 88 | { |
| 89 | bld.view().beginPerform( *i ); | ||
| 87 | bool bExtraReqs = false; | 90 | bool bExtraReqs = false; |
| 88 | time_t target = getTime( std::string((*i)->getTarget()) ); | 91 | time_t target = getTime( bld, std::string((*i)->getTarget()) ); |
| 89 | std::list<std::string> *lReqs = bld.getRequires( (*i)->getTarget() ); | 92 | std::list<std::string> *lReqs = bld.getRequires( (*i)->getTarget() ); |
| 90 | if( lReqs == NULL ) | 93 | if( lReqs == NULL ) |
| 91 | { | 94 | { |
| @@ -95,10 +98,12 @@ void FileTarget::check( Builder &bld ) | |||
| 95 | for( std::list<std::string>::iterator j = lReqs->begin(); | 98 | for( std::list<std::string>::iterator j = lReqs->begin(); |
| 96 | j != lReqs->end(); j++ ) | 99 | j != lReqs->end(); j++ ) |
| 97 | { | 100 | { |
| 98 | if( getTime( *j ) > target ) | 101 | if( getTime( bld, *j ) > target ) |
| 99 | { | 102 | { |
| 103 | bld.view().beginExecute(); | ||
| 100 | (*i)->execute( bld ); | 104 | (*i)->execute( bld ); |
| 101 | updateTime( (*i)->getTarget() ); | 105 | updateTime( (*i)->getTarget() ); |
| 106 | bld.view().endExecute(); | ||
| 102 | break; | 107 | break; |
| 103 | } | 108 | } |
| 104 | if( bExtraReqs == false ) | 109 | if( bExtraReqs == false ) |
| @@ -112,9 +117,12 @@ void FileTarget::check( Builder &bld ) | |||
| 112 | } | 117 | } |
| 113 | } | 118 | } |
| 114 | } | 119 | } |
| 120 | bld.view().endPerform(); | ||
| 115 | } | 121 | } |
| 116 | 122 | ||
| 117 | printf("Cache hits %d, %d new (%f%%)\n", nCache, nNew, nCache/ (double)(nNew+nCache)*100.0 ); | 123 | //printf("Cache hits %d, %d new (%f%%)\n", nCache, nNew, nCache/ (double)(nNew+nCache)*100.0 ); |
| 124 | |||
| 125 | bld.view().endTarget(); | ||
| 118 | } | 126 | } |
| 119 | 127 | ||
| 120 | void FileTarget::clean( Builder &bld ) | 128 | void FileTarget::clean( Builder &bld ) |
| @@ -132,21 +140,26 @@ void FileTarget::clean( Builder &bld ) | |||
| 132 | } | 140 | } |
| 133 | } | 141 | } |
| 134 | 142 | ||
| 135 | time_t FileTarget::getTime( std::string str ) | 143 | time_t FileTarget::getTime( Builder &bld, std::string str ) |
| 136 | { | 144 | { |
| 137 | std::map<std::string, time_t>::iterator i = mTimes.find( str ); | 145 | std::map<std::string, time_t>::iterator i = mTimes.find( str ); |
| 138 | if( i != mTimes.end() ) | 146 | if( i != mTimes.end() ) |
| 139 | { | 147 | { |
| 140 | nCache++; | 148 | //nCache++; |
| 149 | bld.view().beginRequiresCheck( true, str.c_str() ); | ||
| 150 | bld.view().endRequiresCheck(); | ||
| 141 | return (*i).second; | 151 | return (*i).second; |
| 142 | } | 152 | } |
| 143 | 153 | ||
| 154 | bld.view().beginRequiresCheck( false, str.c_str() ); | ||
| 144 | struct stat st; | 155 | struct stat st; |
| 145 | stat( str.c_str(), &st ); | 156 | stat( str.c_str(), &st ); |
| 146 | 157 | ||
| 147 | mTimes[str] = st.st_mtime; | 158 | mTimes[str] = st.st_mtime; |
| 148 | 159 | ||
| 149 | nNew++; | 160 | //nNew++; |
| 161 | |||
| 162 | bld.view().endRequiresCheck(); | ||
| 150 | 163 | ||
| 151 | return st.st_mtime; | 164 | return st.st_mtime; |
| 152 | } | 165 | } |
diff --git a/src/filetarget.h b/src/filetarget.h index 856e854..c78c2fd 100644 --- a/src/filetarget.h +++ b/src/filetarget.h | |||
| @@ -21,7 +21,7 @@ public: | |||
| 21 | virtual void check( class Builder &bld ); | 21 | virtual void check( class Builder &bld ); |
| 22 | virtual void clean( class Builder &bld ); | 22 | virtual void clean( class Builder &bld ); |
| 23 | 23 | ||
| 24 | time_t getTime( std::string str ); | 24 | time_t getTime( class Builder &bld, std::string str ); |
| 25 | void updateTime( std::string str ); | 25 | void updateTime( std::string str ); |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
diff --git a/src/main.cpp b/src/main.cpp index ebfb745..132fb18 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -1,8 +1,11 @@ | |||
| 1 | #include "builder.h" | 1 | #include "builder.h" |
| 2 | #include "viewerplain.h" | ||
| 3 | #include "viewerpercent.h" | ||
| 2 | 4 | ||
| 3 | int main( int argc, char *argv[] ) | 5 | int main( int argc, char *argv[] ) |
| 4 | { | 6 | { |
| 5 | Builder bld; | 7 | ViewerPercent p; |
| 8 | Builder bld( p ); | ||
| 6 | 9 | ||
| 7 | bld.load("build.conf"); | 10 | bld.load("build.conf"); |
| 8 | 11 | ||
diff --git a/src/performcmd.cpp b/src/performcmd.cpp index d9b7977..8eafc66 100644 --- a/src/performcmd.cpp +++ b/src/performcmd.cpp | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "performcmd.h" | 1 | #include "performcmd.h" |
| 2 | #include "builder.h" | 2 | #include "builder.h" |
| 3 | #include "viewer.h" | ||
| 3 | 4 | ||
| 4 | PerformCmd::PerformCmd( const char *sCmd, const char *sTarget ) : | 5 | PerformCmd::PerformCmd( const char *sCmd, const char *sTarget ) : |
| 5 | Perform( sTarget ), | 6 | Perform( sTarget ), |
| @@ -13,7 +14,7 @@ PerformCmd::~PerformCmd() | |||
| 13 | 14 | ||
| 14 | void PerformCmd::execute( class Builder &bld ) | 15 | void PerformCmd::execute( class Builder &bld ) |
| 15 | { | 16 | { |
| 16 | printf("%s\n", sCommand.getString() ); | 17 | bld.view().executeCmd( sCommand ); |
| 17 | int ret; | 18 | int ret; |
| 18 | if( (ret = system( sCommand.getString() )) != 0 ) | 19 | if( (ret = system( sCommand.getString() )) != 0 ) |
| 19 | { | 20 | { |
diff --git a/src/viewer.cpp b/src/viewer.cpp new file mode 100644 index 0000000..ed6abfb --- /dev/null +++ b/src/viewer.cpp | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #include "viewer.h" | ||
| 2 | |||
| 3 | Viewer::Viewer() | ||
| 4 | { | ||
| 5 | } | ||
| 6 | |||
| 7 | Viewer::~Viewer() | ||
| 8 | { | ||
| 9 | } | ||
| 10 | |||
| 11 | void Viewer::beginAction( const char *sName, int nCommands ) | ||
| 12 | { | ||
| 13 | } | ||
| 14 | |||
| 15 | void Viewer::endAction() | ||
| 16 | { | ||
| 17 | } | ||
| 18 | |||
| 19 | void Viewer::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ) | ||
| 20 | { | ||
| 21 | } | ||
| 22 | |||
| 23 | void Viewer::endTarget() | ||
| 24 | { | ||
| 25 | } | ||
| 26 | |||
| 27 | void Viewer::beginPerform( Perform *pPerf ) | ||
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | void Viewer::beginRequiresCheck( bool bCached, const char *sName ) | ||
| 32 | { | ||
| 33 | } | ||
| 34 | |||
| 35 | void Viewer::endRequiresCheck() | ||
| 36 | { | ||
| 37 | } | ||
| 38 | |||
| 39 | void Viewer::beginExtraRequiresCheck( const char *sCommand ) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 43 | void Viewer::endExtraRequiresCheck() | ||
| 44 | { | ||
| 45 | } | ||
| 46 | |||
| 47 | void Viewer::beginExecute() | ||
| 48 | { | ||
| 49 | } | ||
| 50 | |||
| 51 | void Viewer::executeCmd( const char *sCmd ) | ||
| 52 | { | ||
| 53 | } | ||
| 54 | |||
| 55 | void Viewer::endExecute() | ||
| 56 | { | ||
| 57 | } | ||
| 58 | |||
| 59 | void Viewer::endPerform() | ||
| 60 | { | ||
| 61 | } | ||
| 62 | |||
diff --git a/src/viewer.h b/src/viewer.h new file mode 100644 index 0000000..8f2a595 --- /dev/null +++ b/src/viewer.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef VIEWER_H | ||
| 2 | #define VIEWER_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | class Perform; | ||
| 7 | |||
| 8 | class Viewer | ||
| 9 | { | ||
| 10 | public: | ||
| 11 | Viewer(); | ||
| 12 | virtual ~Viewer(); | ||
| 13 | |||
| 14 | virtual void beginAction( const char *sName, int nCommands ); | ||
| 15 | virtual void endAction(); | ||
| 16 | virtual void beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ); | ||
| 17 | virtual void endTarget(); | ||
| 18 | |||
| 19 | virtual void beginPerform( Perform *pPerf ); | ||
| 20 | virtual void beginRequiresCheck( bool bCached, const char *sName ); | ||
| 21 | virtual void endRequiresCheck(); | ||
| 22 | virtual void beginExtraRequiresCheck( const char *sCommand ); | ||
| 23 | virtual void endExtraRequiresCheck(); | ||
| 24 | virtual void beginExecute(); | ||
| 25 | virtual void executeCmd( const char *sCmd ); | ||
| 26 | virtual void endExecute(); | ||
| 27 | virtual void endPerform(); | ||
| 28 | |||
| 29 | private: | ||
| 30 | |||
| 31 | }; | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/src/viewerpercent.cpp b/src/viewerpercent.cpp new file mode 100644 index 0000000..0b0344b --- /dev/null +++ b/src/viewerpercent.cpp | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #include "viewerpercent.h" | ||
| 2 | #include "perform.h" | ||
| 3 | |||
| 4 | ViewerPercent::ViewerPercent() : | ||
| 5 | nWidth( 25 ) | ||
| 6 | { | ||
| 7 | } | ||
| 8 | |||
| 9 | ViewerPercent::~ViewerPercent() | ||
| 10 | { | ||
| 11 | } | ||
| 12 | |||
| 13 | void ViewerPercent::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ) | ||
| 14 | { | ||
| 15 | printf("--- %s ---\n", sName ); | ||
| 16 | nMax = nPerforms; | ||
| 17 | nCount = 0; | ||
| 18 | nLastLen = 0; | ||
| 19 | } | ||
| 20 | |||
| 21 | void ViewerPercent::endTarget() | ||
| 22 | { | ||
| 23 | printf("\n\n"); | ||
| 24 | } | ||
| 25 | |||
| 26 | void ViewerPercent::beginPerform( Perform *pPerf ) | ||
| 27 | { | ||
| 28 | sTarget = pPerf->getTarget(); | ||
| 29 | } | ||
| 30 | |||
| 31 | void ViewerPercent::beginExecute() | ||
| 32 | { | ||
| 33 | } | ||
| 34 | |||
| 35 | void ViewerPercent::endPerform() | ||
| 36 | { | ||
| 37 | nCount++; | ||
| 38 | |||
| 39 | int nPer = (nCount*nWidth)/nMax; | ||
| 40 | fputc( '[', stdout ); | ||
| 41 | for( int j = 0; j < nPer; j++ ) | ||
| 42 | fputc('=', stdout ); | ||
| 43 | for( int j = nPer; j < nWidth; j++ ) | ||
| 44 | fputc(' ', stdout ); | ||
| 45 | //fputc(']', stdout ); | ||
| 46 | |||
| 47 | printf("] %s", sTarget.getString() ); | ||
| 48 | |||
| 49 | int diff = nLastLen-sTarget; | ||
| 50 | for( int j = 0; j < diff; j++ ) | ||
| 51 | fputc(' ', stdout ); | ||
| 52 | |||
| 53 | nLastLen = sTarget; | ||
| 54 | |||
| 55 | fputc('\r', stdout ); | ||
| 56 | fflush( stdout ); | ||
| 57 | } | ||
| 58 | |||
diff --git a/src/viewerpercent.h b/src/viewerpercent.h new file mode 100644 index 0000000..d575940 --- /dev/null +++ b/src/viewerpercent.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #ifndef VIEWER_PERCENT_H | ||
| 2 | #define VIEWER_PERCENT_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #include "viewer.h" | ||
| 7 | #include "staticstring.h" | ||
| 8 | |||
| 9 | class ViewerPercent : public Viewer | ||
| 10 | { | ||
| 11 | public: | ||
| 12 | ViewerPercent(); | ||
| 13 | virtual ~ViewerPercent(); | ||
| 14 | |||
| 15 | virtual void beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ); | ||
| 16 | virtual void endTarget(); | ||
| 17 | |||
| 18 | virtual void beginPerform( Perform *pPerf ); | ||
| 19 | virtual void beginExecute(); | ||
| 20 | virtual void endPerform(); | ||
| 21 | |||
| 22 | private: | ||
| 23 | class StaticString sTarget; | ||
| 24 | int nLastLen; | ||
| 25 | int nWidth; | ||
| 26 | int nMax; | ||
| 27 | int nCount; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #endif | ||
diff --git a/src/viewerplain.cpp b/src/viewerplain.cpp new file mode 100644 index 0000000..edc5ba8 --- /dev/null +++ b/src/viewerplain.cpp | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include "viewerplain.h" | ||
| 3 | #include "perform.h" | ||
| 4 | |||
| 5 | ViewerPlain::ViewerPlain() | ||
| 6 | { | ||
| 7 | } | ||
| 8 | |||
| 9 | ViewerPlain::~ViewerPlain() | ||
| 10 | { | ||
| 11 | } | ||
| 12 | |||
| 13 | void ViewerPlain::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ) | ||
| 14 | { | ||
| 15 | printf("--- %s ---\n", sName ); | ||
| 16 | } | ||
| 17 | |||
| 18 | void ViewerPlain::endTarget() | ||
| 19 | { | ||
| 20 | printf("\n"); | ||
| 21 | } | ||
| 22 | |||
| 23 | void ViewerPlain::beginPerform( Perform *pPerf ) | ||
| 24 | { | ||
| 25 | sTarget = pPerf->getTarget(); | ||
| 26 | printf(" check: %s\n", sTarget.getString() ); | ||
| 27 | } | ||
| 28 | |||
| 29 | void ViewerPlain::beginExecute() | ||
| 30 | { | ||
| 31 | printf(" build: %s\n", sTarget.getString() ); | ||
| 32 | } | ||
| 33 | |||
diff --git a/src/viewerplain.h b/src/viewerplain.h new file mode 100644 index 0000000..7b4b189 --- /dev/null +++ b/src/viewerplain.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #ifndef VIEWER_PLAIN_H | ||
| 2 | #define VIEWER_PLAIN_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #include "viewer.h" | ||
| 7 | #include "staticstring.h" | ||
| 8 | |||
| 9 | class ViewerPlain : public Viewer | ||
| 10 | { | ||
| 11 | public: | ||
| 12 | ViewerPlain(); | ||
| 13 | virtual ~ViewerPlain(); | ||
| 14 | |||
| 15 | virtual void beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ); | ||
| 16 | virtual void endTarget(); | ||
| 17 | |||
| 18 | virtual void beginPerform( Perform *pPerf ); | ||
| 19 | virtual void beginExecute(); | ||
| 20 | |||
| 21 | private: | ||
| 22 | class StaticString sTarget; | ||
| 23 | |||
| 24 | }; | ||
| 25 | |||
| 26 | #endif | ||
