diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-09-21 16:11:02 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-09-21 16:11:02 +0000 |
commit | 23e4ce8f1b211b388be7533b684dabab193be587 (patch) | |
tree | 04ad3fe02e8ac59e9f2b0c488293baf316e502dd /src | |
parent | 6aedf75408f0a8fa50edf9457b00f413227ec2d8 (diff) | |
download | build-23e4ce8f1b211b388be7533b684dabab193be587.tar.gz build-23e4ce8f1b211b388be7533b684dabab193be587.tar.bz2 build-23e4ce8f1b211b388be7533b684dabab193be587.tar.xz build-23e4ce8f1b211b388be7533b684dabab193be587.zip |
The plain view now effectively uses command stacks, the results are pretty
cool looking.
Diffstat (limited to '')
-rw-r--r-- | src/viewerplain.cpp | 35 | ||||
-rw-r--r-- | src/viewerplain.h | 14 |
2 files changed, 38 insertions, 11 deletions
diff --git a/src/viewerplain.cpp b/src/viewerplain.cpp index d65c59d..9037a40 100644 --- a/src/viewerplain.cpp +++ b/src/viewerplain.cpp | |||
@@ -5,7 +5,6 @@ | |||
5 | PluginInterface2( plain, ViewerPlain, Viewer, "Mike Buland", 0, 1 ); | 5 | PluginInterface2( plain, ViewerPlain, Viewer, "Mike Buland", 0, 1 ); |
6 | 6 | ||
7 | ViewerPlain::ViewerPlain() : | 7 | ViewerPlain::ViewerPlain() : |
8 | bCmdClean( true ), | ||
9 | bRunClean( true ) | 8 | bRunClean( true ) |
10 | { | 9 | { |
11 | } | 10 | } |
@@ -16,29 +15,50 @@ ViewerPlain::~ViewerPlain() | |||
16 | 15 | ||
17 | void ViewerPlain::beginCommand( Action::eAction nAct, const std::string &sTarget ) | 16 | void ViewerPlain::beginCommand( Action::eAction nAct, const std::string &sTarget ) |
18 | { | 17 | { |
19 | bCmdClean = true; | 18 | Cmd cmd; |
20 | this->sTarget = sTarget; | 19 | if( sCmd.empty() ) |
20 | cmd.nLevel = 0; | ||
21 | else | ||
22 | cmd.nLevel = sCmd.front().nLevel+1; | ||
23 | |||
24 | cmd.bCmdClean = true; | ||
25 | cmd.sTarget = sTarget; | ||
26 | |||
27 | sCmd.push_front( cmd ); | ||
21 | } | 28 | } |
22 | 29 | ||
23 | void ViewerPlain::endCommand() | 30 | void ViewerPlain::endCommand() |
24 | { | 31 | { |
25 | if( bCmdClean == false ) | 32 | if( sCmd.front().bCmdClean == false ) |
26 | printf("\n"); | 33 | printf("\n"); |
34 | sCmd.pop_front(); | ||
35 | } | ||
36 | |||
37 | void ViewerPlain::indent() | ||
38 | { | ||
39 | if( sCmd.empty() ) return; | ||
40 | int jmax = sCmd.front().nLevel; | ||
41 | for( int j = 0; j < jmax; j++ ) | ||
42 | { | ||
43 | printf(" "); | ||
44 | } | ||
27 | } | 45 | } |
28 | 46 | ||
29 | void ViewerPlain::printHead() | 47 | void ViewerPlain::printHead() |
30 | { | 48 | { |
31 | if( bCmdClean == true ) | 49 | if( sCmd.front().bCmdClean == true ) |
32 | { | 50 | { |
33 | bRunClean = false; | 51 | bRunClean = false; |
34 | bCmdClean = false; | 52 | sCmd.front().bCmdClean = false; |
35 | printf("--- %s ---\n", sTarget.c_str() ); | 53 | indent(); |
54 | printf("--- %s ---\n", sCmd.front().sTarget.c_str() ); | ||
36 | } | 55 | } |
37 | } | 56 | } |
38 | 57 | ||
39 | void ViewerPlain::beginRequiresCheck( bool bCached, const std::string &sName ) | 58 | void ViewerPlain::beginRequiresCheck( bool bCached, const std::string &sName ) |
40 | { | 59 | { |
41 | printHead(); | 60 | printHead(); |
61 | indent(); | ||
42 | printf(" deps: %s\n", sName.c_str() ); | 62 | printf(" deps: %s\n", sName.c_str() ); |
43 | } | 63 | } |
44 | 64 | ||
@@ -49,6 +69,7 @@ void ViewerPlain::endRequiresCheck() | |||
49 | void ViewerPlain::beginPerform( Perform *pPerform ) | 69 | void ViewerPlain::beginPerform( Perform *pPerform ) |
50 | { | 70 | { |
51 | printHead(); | 71 | printHead(); |
72 | indent(); | ||
52 | printf(" %8s: %s\n", pPerform->getRule().c_str(), pPerform->getTarget().c_str() ); | 73 | printf(" %8s: %s\n", pPerform->getRule().c_str(), pPerform->getTarget().c_str() ); |
53 | } | 74 | } |
54 | 75 | ||
diff --git a/src/viewerplain.h b/src/viewerplain.h index 76fecc5..118ae80 100644 --- a/src/viewerplain.h +++ b/src/viewerplain.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define VIEWER_PLAIN_H | 2 | #define VIEWER_PLAIN_H |
3 | 3 | ||
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | 5 | #include <list> | |
6 | #include "viewer.h" | 6 | #include "viewer.h" |
7 | 7 | ||
8 | class ViewerPlain : public Viewer | 8 | class ViewerPlain : public Viewer |
@@ -22,12 +22,18 @@ public: | |||
22 | virtual void endAction(); | 22 | virtual void endAction(); |
23 | 23 | ||
24 | void printHead(); | 24 | void printHead(); |
25 | void indent(); | ||
25 | 26 | ||
26 | private: | 27 | private: |
27 | bool bCmdClean; | ||
28 | bool bRunClean; | 28 | bool bRunClean; |
29 | std::string sTarget; | 29 | typedef struct |
30 | 30 | { | |
31 | int nLevel; | ||
32 | bool bCmdClean; | ||
33 | std::string sTarget; | ||
34 | } Cmd; | ||
35 | typedef std::list<Cmd> CmdStack; | ||
36 | CmdStack sCmd; | ||
31 | }; | 37 | }; |
32 | 38 | ||
33 | #endif | 39 | #endif |