diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-08-02 08:04:19 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-08-02 08:04:19 +0000 |
commit | 4ab0bf24ac9634a12a4a518edecae1d42fa331d9 (patch) | |
tree | 75b386895c987bd6f8575140d8c6aa48318ece96 /src/viewerpercent.cpp | |
parent | 062fcfb96c56ecfb69b8c3162ced65b63e863752 (diff) | |
download | build-4ab0bf24ac9634a12a4a518edecae1d42fa331d9.tar.gz build-4ab0bf24ac9634a12a4a518edecae1d42fa331d9.tar.bz2 build-4ab0bf24ac9634a12a4a518edecae1d42fa331d9.tar.xz build-4ab0bf24ac9634a12a4a518edecae1d42fa331d9.zip |
Fixed a few minor bugs and added the new viewer system, it allows you to add new
front ends that will display what build is doing in any way you want. cool!
So far we have plain and percent, verbose and make are coming, make should be
really easy, just print out the commands and nothing else.
Diffstat (limited to 'src/viewerpercent.cpp')
-rw-r--r-- | src/viewerpercent.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
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 | |||