aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cache.cpp71
-rw-r--r--src/filetarget.cpp5
-rw-r--r--src/viewerplain.cpp27
-rw-r--r--src/viewerplain.h4
4 files changed, 104 insertions, 3 deletions
diff --git a/src/cache.cpp b/src/cache.cpp
index 43e69dc..10971b1 100644
--- a/src/cache.cpp
+++ b/src/cache.cpp
@@ -1,5 +1,6 @@
1#include "cache.h" 1#include "cache.h"
2#include "serializer.h" 2#include "serializer.h"
3#include "staticstring.h"
3 4
4Cache::Cache() 5Cache::Cache()
5{ 6{
@@ -18,6 +19,32 @@ void Cache::serialize( class Serializer &ar )
18{ 19{
19 if( ar.isLoading() ) 20 if( ar.isLoading() )
20 { 21 {
22 int sCache, sData, sIndex;
23
24 ar >> sIndex;
25 StaticString *Index = new StaticString[sIndex];
26 for( int i = 0; i < sIndex; i++ )
27 {
28 ar >> Index[i];
29 }
30
31 ar >> sCache;
32 int nTmp;
33 for( int i = 0; i < sCache; i++ )
34 {
35 Entry *e = new Entry;
36 ar >> e->tCreated;
37 ar >> sData;
38 std::list<std::string> &lData = e->lData;
39 for( int j = 0; j < sData; j++ )
40 {
41 ar >> nTmp;
42 lData.push_back( Index[nTmp].getString() );
43 }
44 ar >> nTmp;
45 mCache[Index[nTmp].getString()] = e;
46 }
47 /*
21 int sCache, sData; 48 int sCache, sData;
22 ar >> sCache; 49 ar >> sCache;
23 std::string sTmp; 50 std::string sTmp;
@@ -36,9 +63,52 @@ void Cache::serialize( class Serializer &ar )
36 ar >> sTmp; 63 ar >> sTmp;
37 mCache[sTmp] = e; 64 mCache[sTmp] = e;
38 } 65 }
66 */
39 } 67 }
40 else 68 else
41 { 69 {
70 std::map<std::string, int> mIndex;
71 for( std::map<std::string, Entry *>::iterator i = mCache.begin();
72 i != mCache.end(); i++ )
73 {
74 mIndex[(*i).first] = 0;
75 std::list<std::string> &lData = (*i).second->lData;
76 for( std::list<std::string>::iterator j = lData.begin();
77 j != lData.end(); j++ )
78 {
79 mIndex[(*j)] = 0;
80 }
81 }
82
83 ar << mIndex.size();
84 int cnt = 0;
85 for( std::map<std::string, int>::iterator i = mIndex.begin();
86 i != mIndex.end(); i++ )
87 {
88 (*i).second = cnt;
89 cnt++;
90 std::string s = ((*i).first);
91 ar << s;
92 }
93
94 ar << mCache.size();
95 for( std::map<std::string, Entry *>::iterator i = mCache.begin();
96 i != mCache.end(); i++ )
97 {
98 ar << (*i).second->tCreated;
99 std::list<std::string> &lData = (*i).second->lData;
100 ar << lData.size();
101 for( std::list<std::string>::iterator j = lData.begin();
102 j != lData.end(); j++ )
103 {
104 ar << mIndex[(*j)];
105 }
106
107 ar << mIndex[(*i).first];
108 }
109
110
111 /*
42 ar << mCache.size(); 112 ar << mCache.size();
43 for( std::map<std::string, Entry *>::iterator i = mCache.begin(); 113 for( std::map<std::string, Entry *>::iterator i = mCache.begin();
44 i != mCache.end(); i++ ) 114 i != mCache.end(); i++ )
@@ -55,6 +125,7 @@ void Cache::serialize( class Serializer &ar )
55 std::string str = (*i).first; 125 std::string str = (*i).first;
56 ar << str; 126 ar << str;
57 } 127 }
128 */
58 } 129 }
59} 130}
60 131
diff --git a/src/filetarget.cpp b/src/filetarget.cpp
index 7a714a5..0d47e6f 100644
--- a/src/filetarget.cpp
+++ b/src/filetarget.cpp
@@ -95,10 +95,13 @@ void FileTarget::check( Builder &bld )
95 printf("No dependancies: %s\n", (*i)->getTarget() ); 95 printf("No dependancies: %s\n", (*i)->getTarget() );
96 continue; 96 continue;
97 } 97 }
98 time_t rebuild = target;
98 for( std::list<std::string>::iterator j = lReqs->begin(); 99 for( std::list<std::string>::iterator j = lReqs->begin();
99 j != lReqs->end(); j++ ) 100 j != lReqs->end(); j++ )
100 { 101 {
101 time_t srcfile = getTime( bld, *j ); 102 time_t srcfile = getTime( bld, *j );
103 if( srcfile < rebuild )
104 rebuild = srcfile;
102 if( srcfile > target ) 105 if( srcfile > target )
103 { 106 {
104 bld.view().beginExecute(); 107 bld.view().beginExecute();
@@ -114,7 +117,7 @@ void FileTarget::check( Builder &bld )
114 if( k == lReqs->end() ) 117 if( k == lReqs->end() )
115 { 118 {
116 bExtraReqs = true; 119 bExtraReqs = true;
117 bld.genRequiresFor( (*i)->getTarget(), srcfile ); 120 bld.genRequiresFor( (*i)->getTarget(), rebuild );
118 } 121 }
119 } 122 }
120 } 123 }
diff --git a/src/viewerplain.cpp b/src/viewerplain.cpp
index edc5ba8..5d95d19 100644
--- a/src/viewerplain.cpp
+++ b/src/viewerplain.cpp
@@ -12,22 +12,45 @@ ViewerPlain::~ViewerPlain()
12 12
13void ViewerPlain::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ) 13void ViewerPlain::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms )
14{ 14{
15 printf("--- %s ---\n", sName ); 15 sAction = sName;
16 bPrinted = false;
17}
18
19void ViewerPlain::printHead()
20{
21 if( bPrinted == false )
22 {
23 printf("--- %s ---\n", sAction.getString() );
24 bPrinted = true;
25 }
16} 26}
17 27
18void ViewerPlain::endTarget() 28void ViewerPlain::endTarget()
19{ 29{
20 printf("\n"); 30 if( bPrinted == true )
31 {
32 printf("\n");
33 }
34 else
35 {
36 printf("Nothing to be done for %s.\n", sAction.getString() );
37 }
21} 38}
22 39
23void ViewerPlain::beginPerform( Perform *pPerf ) 40void ViewerPlain::beginPerform( Perform *pPerf )
24{ 41{
25 sTarget = pPerf->getTarget(); 42 sTarget = pPerf->getTarget();
43}
44
45void ViewerPlain::beginExtraRequiresCheck( const char *sCommand )
46{
47 printHead();
26 printf(" check: %s\n", sTarget.getString() ); 48 printf(" check: %s\n", sTarget.getString() );
27} 49}
28 50
29void ViewerPlain::beginExecute() 51void ViewerPlain::beginExecute()
30{ 52{
53 printHead();
31 printf(" build: %s\n", sTarget.getString() ); 54 printf(" build: %s\n", sTarget.getString() );
32} 55}
33 56
diff --git a/src/viewerplain.h b/src/viewerplain.h
index 7b4b189..1ec2b64 100644
--- a/src/viewerplain.h
+++ b/src/viewerplain.h
@@ -16,9 +16,13 @@ public:
16 virtual void endTarget(); 16 virtual void endTarget();
17 17
18 virtual void beginPerform( Perform *pPerf ); 18 virtual void beginPerform( Perform *pPerf );
19 virtual void beginExtraRequiresCheck( const char *sCommand );
20 void printHead();
19 virtual void beginExecute(); 21 virtual void beginExecute();
20 22
21private: 23private:
24 class StaticString sAction;
25 bool bPrinted;
22 class StaticString sTarget; 26 class StaticString sTarget;
23 27
24}; 28};