From 2d66324cb2241a7894b9ee18cfd4fb9b4189c78a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 29 Jun 2008 15:05:46 -0400 Subject: [PATCH 01/19] - Added " ago" to the info report task age. --- src/task.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/task.cpp b/src/task.cpp index da33b5858..ff23146fc 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -952,7 +952,7 @@ void handleInfo (const TDB& tdb, T& task, Config& conf) formatTimeDeltaDays (age, (time_t) (now - dt)); } - table.addCell (row, 1, entry + " (" + age + ")"); + table.addCell (row, 1, entry + " (" + age + " ago)"); } } From 06d595d9447931e0fa25f29c883f0acd07484c6f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 4 Jul 2008 17:18:01 -0400 Subject: [PATCH 02/19] - Date class now supports relative dates for construction (tomorrow, friday, eoy ...) - Added unit tests for Date enhancements - Added unit tests for duration recognition - Task parsing now supports due: using relative dates - Task parsing now supports recur: and until: attributes - Task parsing now support private attributes base: and range: --- ideas.txt | 2 +- src/Date.cpp | 143 ++++++++++++++++++++- src/Date.h | 9 +- src/parse.cpp | 13 +- src/task.h | 3 + src/tests/.gitignore | 1 + src/tests/Makefile | 5 +- src/tests/date.t.cpp | 265 +++++++++++++++++++++++++++------------ src/tests/duration.t.cpp | 45 +++++++ src/tests/t.t.cpp | 7 +- src/util.cpp | 16 +++ 11 files changed, 421 insertions(+), 88 deletions(-) create mode 100644 src/tests/duration.t.cpp diff --git a/ideas.txt b/ideas.txt index afeaad490..7c95de408 100644 --- a/ideas.txt +++ b/ideas.txt @@ -22,7 +22,7 @@ Test Suite Recurrence + new T::status recurring (stored as R) - - new user-specifiable attributes - recur: [until:] + + new user-specifiable attributes - recur: [until:] - duration: daily, day, 1d Nd diff --git a/src/Date.cpp b/src/Date.cpp index cd535e231..d386fb081 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -63,6 +63,10 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */) int day = 0; int year = 0; + // Before parsing according to "format", perhaps this is a relative date? + if (isRelativeDate (mdy)) + return; + unsigned int i = 0; // Index into mdy. for (unsigned int f = 0; f < format.length (); ++f) @@ -184,7 +188,7 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */) t.tm_mon = month - 1; t.tm_year = year - 1900; - mT = mktime (&t); + mT = mktime (&t); } //////////////////////////////////////////////////////////////////////////////// @@ -357,6 +361,22 @@ int Date::dayOfWeek () const return t->tm_wday; } +//////////////////////////////////////////////////////////////////////////////// +int Date::dayOfWeek (const std::string& input) +{ + std::string in = lowerCase (input); + + if (in == "sunday") return 0; + if (in == "monday") return 1; + if (in == "tuesday") return 2; + if (in == "wednesday") return 3; + if (in == "thursday") return 4; + if (in == "friday") return 5; + if (in == "saturday") return 6; + + return -1; +} + //////////////////////////////////////////////////////////////////////////////// int Date::month () const { @@ -414,6 +434,36 @@ bool Date::operator>= (const Date& rhs) return mT >= rhs.mT; } +//////////////////////////////////////////////////////////////////////////////// +bool Date::sameDay (const Date& rhs) +{ + if (this->year () == rhs.year () && + this->month () == rhs.month () && + this->day () == rhs.day ()) + return true; + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// +bool Date::sameMonth (const Date& rhs) +{ + if (this->year () == rhs.year () && + this->month () == rhs.month ()) + return true; + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// +bool Date::sameYear (const Date& rhs) +{ + if (this->year () == rhs.year ()) + return true; + + return false; +} + //////////////////////////////////////////////////////////////////////////////// Date Date::operator+ (const int delta) { @@ -441,3 +491,94 @@ time_t Date::operator- (const Date& rhs) } //////////////////////////////////////////////////////////////////////////////// +// If the input string looks like a relative date, determine that date, set mT +// and return true. +// +// What is a relative date? All of the following should be recognizable, and +// converted to an absolute date: +// wednesday +// fri +// 23rd +// today +// tomorrow +// yesterday +// eow (end of week) +// eom (end of month) +// eoy (end of year) +bool Date::isRelativeDate (const std::string& input) +{ + std::string in (lowerCase (input)); + + std::vector supported; + supported.push_back ("monday"); + supported.push_back ("tuesday"); + supported.push_back ("wednesday"); + supported.push_back ("thursday"); + supported.push_back ("friday"); + supported.push_back ("saturday"); + supported.push_back ("sunday"); + supported.push_back ("today"); + supported.push_back ("tomorrow"); + supported.push_back ("yesterday"); + supported.push_back ("eow"); + supported.push_back ("eom"); + supported.push_back ("eoy"); + + std::vector matches; + if (autoComplete (in, supported, matches) == 1) + { + std::string found = matches[0]; + Date today; + + // If day name. + int dow; + if ((dow = Date::dayOfWeek (found)) != -1 || + found == "eow") + { + if (found == "eow") + dow = 5; + + if (today.dayOfWeek () >= dow) + today += (dow - today.dayOfWeek () + 7) * 86400; + else + today += (dow - today.dayOfWeek ()) * 86400; + + mT = today.mT; + return true; + } + else if (found == "today") + { + mT = today.mT; + return true; + } + else if (found == "tomorrow") + { + mT = today.mT + 86400; + return true; + } + else if (found == "yesterday") + { + mT = today.mT - 86400; + return true; + } + else if (found == "eom") + { + Date then (today.month (), + daysInMonth (today.month (), today.year ()), + today.year ()); + mT = then.mT; + return true; + } + else if (found == "eoy") + { + Date then (12, 31, today.year ()); + mT = then.mT; + return true; + } +// \d|\d\d|\d\d\d|\d\d\d\d st|nd|rd|th + } + + return false; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Date.h b/src/Date.h index 8f83f956a..ad3f659e0 100644 --- a/src/Date.h +++ b/src/Date.h @@ -52,11 +52,12 @@ public: static std::string monthName (int); static void dayName (int, std::string&); static std::string dayName (int); - int dayOfWeek () const; + static int dayOfWeek (const std::string&); int month () const; int day () const; int year () const; + int dayOfWeek () const; bool operator== (const Date&); bool operator!= (const Date&); @@ -64,6 +65,9 @@ public: bool operator> (const Date&); bool operator<= (const Date&); bool operator>= (const Date&); + bool sameDay (const Date&); + bool sameMonth (const Date&); + bool sameYear (const Date&); Date operator+ (const int); Date& operator+= (const int); @@ -71,6 +75,9 @@ public: time_t operator- (const Date&); +private: + bool isRelativeDate (const std::string&); + protected: time_t mT; }; diff --git a/src/parse.cpp b/src/parse.cpp index 36a972e3c..f69e8a8dc 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -241,9 +241,12 @@ static bool validAttribute ( return validPriority (value); } + // Some attributes are intended to be private. else if (name == "entry" || name == "start" || - name == "end") + name == "end" || + name == "base" || + name == "range") throw std::string ("\"") + name + "\" is not an attribute you may modify directly."; @@ -321,8 +324,7 @@ static bool validSubstitution ( //////////////////////////////////////////////////////////////////////////////// bool validDuration (const std::string& input) { - // TODO - return false; + return convertDuration (input) != 0 ? true : false; } //////////////////////////////////////////////////////////////////////////////// @@ -379,7 +381,10 @@ void parse ( std::string value = arg.substr (colon + 1, std::string::npos); if (validAttribute (name, value, conf)) - task.setAttribute (name, value); + { + if (name != "recur" || validDuration (value)) + task.setAttribute (name, value); + } } // Substitution of description text. diff --git a/src/task.h b/src/task.h index 549333330..c278e75ac 100644 --- a/src/task.h +++ b/src/task.h @@ -31,6 +31,7 @@ #include #include "Config.h" #include "Table.h" +#include "Date.h" #include "color.h" #include "TDB.h" #include "T.h" @@ -106,6 +107,8 @@ void formatTimeDeltaDays (std::string&, time_t); std::string formatSeconds (time_t); const std::string uuid (); const char* optionalBlankLine (Config&); +int convertDuration (const std::string&); +Date convertRelativeDate (const std::string&); // rules.cpp void initializeColorRules (Config&); diff --git a/src/tests/.gitignore b/src/tests/.gitignore index d77228426..1445bb223 100644 --- a/src/tests/.gitignore +++ b/src/tests/.gitignore @@ -1,6 +1,7 @@ t.t tdb.t date.t +duration.t pending.data completed.data diff --git a/src/tests/Makefile b/src/tests/Makefile index 7ea7453ca..c6c3ac3d8 100644 --- a/src/tests/Makefile +++ b/src/tests/Makefile @@ -1,4 +1,4 @@ -PROJECT = t.t tdb.t date.t +PROJECT = t.t tdb.t date.t duration.t CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti LFLAGS = -L/usr/local/lib OBJECTS = ../TDB.o ../T.o ../parse.o ../text.o ../Date.o ../util.o ../Config.o @@ -26,3 +26,6 @@ tdb.t: tdb.t.o $(OBJECTS) test.o date.t: date.t.o $(OBJECTS) test.o g++ date.t.o $(OBJECTS) test.o $(LFLAGS) -o date.t +duration.t: duration.t.o $(OBJECTS) test.o + g++ duration.t.o $(OBJECTS) test.o $(LFLAGS) -o duration.t + diff --git a/src/tests/date.t.cpp b/src/tests/date.t.cpp index e602c5b10..a28c2d6d5 100644 --- a/src/tests/date.t.cpp +++ b/src/tests/date.t.cpp @@ -9,104 +9,211 @@ //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - plan (63); + plan (97); - Date now; - Date yesterday; - yesterday -= 1; + try + { + Date now; + Date yesterday; + yesterday -= 1; - ok (yesterday <= now, "yesterday <= now"); - ok (yesterday < now, "yesterday < now"); - notok (yesterday == now, "!(yesterday == now)"); - ok (yesterday != now, "yesterday != now"); - ok (now >= yesterday, "now >= yesterday"); - ok (now > yesterday, "now > yesterday"); + ok (yesterday <= now, "yesterday <= now"); + ok (yesterday < now, "yesterday < now"); + notok (yesterday == now, "!(yesterday == now)"); + ok (yesterday != now, "yesterday != now"); + ok (now >= yesterday, "now >= yesterday"); + ok (now > yesterday, "now > yesterday"); - ok (Date::valid (2, 29, 2008), "valid: 2/29/2008"); - notok (Date::valid (2, 29, 2007), "invalid: 2/29/2007"); + // Loose comparisons. + Date left ("7/4/2008"); + Date comp1 ("7/4/2008"); + ok (left.sameDay (comp1), "7/4/2008 is on the same day as 7/4/2008"); + ok (left.sameMonth (comp1), "7/4/2008 is in the same month as 7/4/2008"); + ok (left.sameYear (comp1), "7/4/2008 is in the same year as 7/4/2008"); - ok (Date::leapYear (2008), "2008 is a leap year"); - notok (Date::leapYear (2007), "2007 is not a leap year"); - ok (Date::leapYear (2000), "2000 is a leap year"); - ok (Date::leapYear (1900), "1900 is a leap year"); + Date comp2 ("7/5/2008"); + notok (left.sameDay (comp2), "7/4/2008 is not on the same day as 7/5/2008"); + ok (left.sameMonth (comp2), "7/4/2008 is in the same month as 7/5/2008"); + ok (left.sameYear (comp2), "7/4/2008 is in the same year as 7/5/2008"); - is (Date::daysInMonth (2, 2008), 29, "29 days in February 2008"); - is (Date::daysInMonth (2, 2007), 28, "28 days in February 2007"); + Date comp3 ("8/4/2008"); + notok (left.sameDay (comp3), "7/4/2008 is not on the same day as 8/4/2008"); + notok (left.sameMonth (comp3), "7/4/2008 is not in the same month as 8/4/2008"); + ok (left.sameYear (comp3), "7/4/2008 is in the same year as 8/4/2008"); - is (Date::monthName (1), "January", "1 = January"); - is (Date::monthName (2), "February", "2 = February"); - is (Date::monthName (3), "March", "3 = March"); - is (Date::monthName (4), "April", "4 = April"); - is (Date::monthName (5), "May", "5 = May"); - is (Date::monthName (6), "June", "6 = June"); - is (Date::monthName (7), "July", "7 = July"); - is (Date::monthName (8), "August", "8 = August"); - is (Date::monthName (9), "September", "9 = September"); - is (Date::monthName (10), "October", "10 = October"); - is (Date::monthName (11), "November", "11 = November"); - is (Date::monthName (12), "December", "12 = December"); + Date comp4 ("7/4/2009"); + notok (left.sameDay (comp4), "7/4/2008 is not on the same day as 7/4/2009"); + notok (left.sameMonth (comp4), "7/4/2008 is not in the same month as 7/4/2009"); + notok (left.sameYear (comp4), "7/4/2008 is not in the same year as 7/4/2009"); - is (Date::dayName (0), "Sunday", "0 == Sunday"); - is (Date::dayName (1), "Monday", "1 == Monday"); - is (Date::dayName (2), "Tuesday", "2 == Tuesday"); - is (Date::dayName (3), "Wednesday", "3 == Wednesday"); - is (Date::dayName (4), "Thursday", "4 == Thursday"); - is (Date::dayName (5), "Friday", "5 == Friday"); - is (Date::dayName (6), "Saturday", "6 == Saturday"); + // Validity. + ok (Date::valid (2, 29, 2008), "valid: 2/29/2008"); + notok (Date::valid (2, 29, 2007), "invalid: 2/29/2007"); - Date happyNewYear (1, 1, 2008); - is (happyNewYear.dayOfWeek (), 2, "1/1/2008 == Tuesday"); - is (happyNewYear.month (), 1, "1/1/2008 == January"); - is (happyNewYear.day (), 1, "1/1/2008 == 1"); - is (happyNewYear.year (), 2008, "1/1/2008 == 2008"); + // Leap year. + ok (Date::leapYear (2008), "2008 is a leap year"); + notok (Date::leapYear (2007), "2007 is not a leap year"); + ok (Date::leapYear (2000), "2000 is a leap year"); + ok (Date::leapYear (1900), "1900 is a leap year"); - is (now - yesterday, 1, "today - yesterday == 1"); + // Days in month. + is (Date::daysInMonth (2, 2008), 29, "29 days in February 2008"); + is (Date::daysInMonth (2, 2007), 28, "28 days in February 2007"); - is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008"); + // Names. + is (Date::monthName (1), "January", "1 = January"); + is (Date::monthName (2), "February", "2 = February"); + is (Date::monthName (3), "March", "3 = March"); + is (Date::monthName (4), "April", "4 = April"); + is (Date::monthName (5), "May", "5 = May"); + is (Date::monthName (6), "June", "6 = June"); + is (Date::monthName (7), "July", "7 = July"); + is (Date::monthName (8), "August", "8 = August"); + is (Date::monthName (9), "September", "9 = September"); + is (Date::monthName (10), "October", "10 = October"); + is (Date::monthName (11), "November", "11 = November"); + is (Date::monthName (12), "December", "12 = December"); - int m, d, y; - happyNewYear.toMDY (m, d, y); - is (m, 1, "1/1/2008 == January"); - is (d, 1, "1/1/2008 == 1"); - is (y, 2008, "1/1/2008 == 2008"); + is (Date::dayName (0), "Sunday", "0 == Sunday"); + is (Date::dayName (1), "Monday", "1 == Monday"); + is (Date::dayName (2), "Tuesday", "2 == Tuesday"); + is (Date::dayName (3), "Wednesday", "3 == Wednesday"); + is (Date::dayName (4), "Thursday", "4 == Thursday"); + is (Date::dayName (5), "Friday", "5 == Friday"); + is (Date::dayName (6), "Saturday", "6 == Saturday"); - Date epoch (9, 8, 2001); - ok ((int)epoch.toEpoch () < 1000000000, "9/8/2001 < 1,000,000,000"); - epoch += 86400; - ok ((int)epoch.toEpoch () > 1000000000, "9/9/2001 > 1,000,000,000"); + is (Date::dayOfWeek ("SUNDAY"), 0, "SUNDAY == 0"); + is (Date::dayOfWeek ("sunday"), 0, "sunday == 0"); + is (Date::dayOfWeek ("Sunday"), 0, "Sunday == 0"); + is (Date::dayOfWeek ("Monday"), 1, "Monday == 1"); + is (Date::dayOfWeek ("Tuesday"), 2, "Tuesday == 2"); + is (Date::dayOfWeek ("Wednesday"), 3, "Wednesday == 3"); + is (Date::dayOfWeek ("Thursday"), 4, "Thursday == 4"); + is (Date::dayOfWeek ("Friday"), 5, "Friday == 5"); + is (Date::dayOfWeek ("Saturday"), 6, "Saturday == 6"); - Date fromEpoch (epoch.toEpoch ()); - is (fromEpoch.toString (), epoch.toString (), "ctor (time_t)"); + Date happyNewYear (1, 1, 2008); + is (happyNewYear.dayOfWeek (), 2, "1/1/2008 == Tuesday"); + is (happyNewYear.month (), 1, "1/1/2008 == January"); + is (happyNewYear.day (), 1, "1/1/2008 == 1"); + is (happyNewYear.year (), 2008, "1/1/2008 == 2008"); - Date fromString1 ("1/1/2008"); - is (fromString1.month (), 1, "ctor (std::string) -> m"); - is (fromString1.day (), 1, "ctor (std::string) -> d"); - is (fromString1.year (), 2008, "ctor (std::string) -> y"); + is (now - yesterday, 1, "today - yesterday == 1"); - Date fromString2 ("1/1/2008", "m/d/Y"); - is (fromString2.month (), 1, "ctor (std::string) -> m"); - is (fromString2.day (), 1, "ctor (std::string) -> d"); - is (fromString2.year (), 2008, "ctor (std::string) -> y"); + is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008"); - Date fromString3 ("20080101", "YMD"); - is (fromString3.month (), 1, "ctor (std::string) -> m"); - is (fromString3.day (), 1, "ctor (std::string) -> d"); - is (fromString3.year (), 2008, "ctor (std::string) -> y"); + int m, d, y; + happyNewYear.toMDY (m, d, y); + is (m, 1, "1/1/2008 == January"); + is (d, 1, "1/1/2008 == 1"); + is (y, 2008, "1/1/2008 == 2008"); - Date fromString4 ("12/31/2007"); - is (fromString4.month (), 12, "ctor (std::string) -> m"); - is (fromString4.day (), 31, "ctor (std::string) -> d"); - is (fromString4.year (), 2007, "ctor (std::string) -> y"); + Date epoch (9, 8, 2001); + ok ((int)epoch.toEpoch () < 1000000000, "9/8/2001 < 1,000,000,000"); + epoch += 86400; + ok ((int)epoch.toEpoch () > 1000000000, "9/9/2001 > 1,000,000,000"); - Date fromString5 ("12/31/2007", "m/d/Y"); - is (fromString5.month (), 12, "ctor (std::string) -> m"); - is (fromString5.day (), 31, "ctor (std::string) -> d"); - is (fromString5.year (), 2007, "ctor (std::string) -> y"); + Date fromEpoch (epoch.toEpoch ()); + is (fromEpoch.toString (), epoch.toString (), "ctor (time_t)"); + + // Date parsing. + Date fromString1 ("1/1/2008"); + is (fromString1.month (), 1, "ctor (std::string) -> m"); + is (fromString1.day (), 1, "ctor (std::string) -> d"); + is (fromString1.year (), 2008, "ctor (std::string) -> y"); + + Date fromString2 ("1/1/2008", "m/d/Y"); + is (fromString2.month (), 1, "ctor (std::string) -> m"); + is (fromString2.day (), 1, "ctor (std::string) -> d"); + is (fromString2.year (), 2008, "ctor (std::string) -> y"); + + Date fromString3 ("20080101", "YMD"); + is (fromString3.month (), 1, "ctor (std::string) -> m"); + is (fromString3.day (), 1, "ctor (std::string) -> d"); + is (fromString3.year (), 2008, "ctor (std::string) -> y"); + + Date fromString4 ("12/31/2007"); + is (fromString4.month (), 12, "ctor (std::string) -> m"); + is (fromString4.day (), 31, "ctor (std::string) -> d"); + is (fromString4.year (), 2007, "ctor (std::string) -> y"); + + Date fromString5 ("12/31/2007", "m/d/Y"); + is (fromString5.month (), 12, "ctor (std::string) -> m"); + is (fromString5.day (), 31, "ctor (std::string) -> d"); + is (fromString5.year (), 2007, "ctor (std::string) -> y"); + + Date fromString6 ("20071231", "YMD"); + is (fromString6.month (), 12, "ctor (std::string) -> m"); + is (fromString6.day (), 31, "ctor (std::string) -> d"); + is (fromString6.year (), 2007, "ctor (std::string) -> y"); + + // Relative dates. + Date r1 ("today"); + ok (r1.sameDay (now), "today = now"); + + Date r2 ("tomorrow"); + ok (r2.sameDay (now + 86400), "tomorrow = now + 1d"); + + Date r3 ("yesterday"); + ok (r3.sameDay (now - 86400), "yesterday = now - 1d"); + + Date r4 ("sunday"); + if (now.dayOfWeek () <= 0) + ok (r4.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next sunday"); + else + ok (r4.sameDay (now + (r4.dayOfWeek () - now.dayOfWeek ()) * 86400), "next sunday"); + + Date r5 ("monday"); + if (now.dayOfWeek () <= 1) + ok (r5.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next monday"); + else + ok (r5.sameDay (now + (r5.dayOfWeek () - now.dayOfWeek ()) * 86400), "next monday"); + + Date r6 ("tuesday"); + if (now.dayOfWeek () <= 2) + ok (r6.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next tuesday"); + else + ok (r6.sameDay (now + (r6.dayOfWeek () - now.dayOfWeek ()) * 86400), "next tuesday"); + + Date r7 ("wednesday"); + if (now.dayOfWeek () <= 3) + ok (r7.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next wednesday"); + else + ok (r7.sameDay (now + (r7.dayOfWeek () - now.dayOfWeek ()) * 86400), "next wednesday"); + + Date r8 ("thursday"); + if (now.dayOfWeek () <= 4) + ok (r8.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next thursday"); + else + ok (r8.sameDay (now + (r8.dayOfWeek () - now.dayOfWeek ()) * 86400), "next thursday"); + + Date r9 ("friday"); + if (now.dayOfWeek () <= 5) + ok (r9.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next friday"); + else + ok (r9.sameDay (now + (r9.dayOfWeek () - now.dayOfWeek ()) * 86400), "next friday"); + + Date r10 ("saturday"); + if (now.dayOfWeek () <= 6) + ok (r10.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next saturday"); + else + ok (r10.sameDay (now + (r10.dayOfWeek () - now.dayOfWeek ()) * 86400), "next saturday"); + + Date r11 ("eow"); + ok (r11 < now + (8 * 86400), "eow < 7 days away"); + + Date r12 ("eom"); + ok (r12.sameMonth (now), "eom in same month as now"); + + Date r13 ("eoy"); + ok (r13.sameYear (now), "eoy in same year as now"); + } + + catch (std::string& e) + { + std::cout << e << std::endl; + } - Date fromString6 ("20071231", "YMD"); - is (fromString6.month (), 12, "ctor (std::string) -> m"); - is (fromString6.day (), 31, "ctor (std::string) -> d"); - is (fromString6.year (), 2007, "ctor (std::string) -> y"); return 0; } diff --git a/src/tests/duration.t.cpp b/src/tests/duration.t.cpp new file mode 100644 index 000000000..df959e47a --- /dev/null +++ b/src/tests/duration.t.cpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright 2005 - 2008, Paul Beckingham. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include <../task.h> + +//////////////////////////////////////////////////////////////////////////////// +// daily, day, d, Nd +// weekly, w, Nw, sennight, biweekly, fortnight +// monthly, m, bimonthly, Nm, semimonthly +// 1st 2nd 3rd 4th .. 31st +// quarterly, q, Nq +// biannual, biyearly, annual, semiannual, yearly, y, Na, Ny +int main (int argc, char** argv) +{ + plan (19); + + is (convertDuration ("daily"), 1, "duration daily = 1"); + is (convertDuration ("day"), 1, "duration day = 1"); + is (convertDuration ("d"), 0, "duration d = 1"); + is (convertDuration ("0d"), 0, "duration 0d = 0"); + is (convertDuration ("1d"), 1, "duration 1d = 1"); + is (convertDuration ("7d"), 7, "duration 7d = 7"); + is (convertDuration ("10d"), 10, "duration 10d = 10"); + is (convertDuration ("100d"), 100, "duration 100d = 100"); + + is (convertDuration ("weekly"), 7, "duration weekly = 7"); + is (convertDuration ("sennight"), 7, "duration sennight = 7"); + is (convertDuration ("biweekly"), 14, "duration biweekly = 14"); + is (convertDuration ("fortnight"), 14, "duration fortnight = 14"); + is (convertDuration ("week"), 7, "duration week = 7"); + is (convertDuration ("w"), 7, "duration w = 7"); + is (convertDuration ("0w"), 0, "duration 0w = 0"); + is (convertDuration ("1w"), 7, "duration 1w = 7"); + is (convertDuration ("7w"), 49, "duration 7w = 49"); + is (convertDuration ("10w"), 70, "duration 10w = 70"); + is (convertDuration ("100w"), 700, "duration 100w = 700"); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/tests/t.t.cpp b/src/tests/t.t.cpp index 86a847f58..f8d38e23b 100644 --- a/src/tests/t.t.cpp +++ b/src/tests/t.t.cpp @@ -31,7 +31,7 @@ //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - plan (4); + plan (5); T t; std::string s = t.compose (); @@ -48,6 +48,11 @@ int main (int argc, char** argv) is (s[37], 'X', "T::setStatus (deleted)"); diag (s); + t.setStatus (T::recurring); + s = t.compose (); + is (s[37], 'r', "T::setStatus (recurring)"); + diag (s); + // Round trip test. std::string sample = "00000000-0000-0000-0000-000000000000 - [] [] Sample"; T t2; diff --git a/src/util.cpp b/src/util.cpp index a908d3aa2..0449599cf 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "Date.h" #include "Table.h" #include "task.h" #include "../auto.h" @@ -236,3 +237,18 @@ const std::string uuid () #endif //////////////////////////////////////////////////////////////////////////////// +// Recognize the following constructs, and return the number of days represented +int convertDuration (const std::string& input) +{ + // TODO + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// +Date convertRelativeDate (const std::string& input) +{ + // TODO + return Date (); +} + +//////////////////////////////////////////////////////////////////////////////// From 42d164863aaab08c456322a11268fe98bd32bb50 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 4 Jul 2008 17:25:36 -0400 Subject: [PATCH 03/19] - Removed transient .deps files. --- src/.deps/Config.Po | 408 ------------------------------------------- src/.deps/Date.Po | 392 ----------------------------------------- src/.deps/T.Po | 390 ----------------------------------------- src/.deps/TDB.Po | 406 ------------------------------------------ src/.deps/Table.Po | 397 ----------------------------------------- src/.deps/color.Po | 278 ----------------------------- src/.deps/parse.Po | 393 ----------------------------------------- src/.deps/rules.Po | 392 ----------------------------------------- src/.deps/task.Po | 417 -------------------------------------------- src/.deps/text.Po | 390 ----------------------------------------- src/.deps/util.Po | 395 ----------------------------------------- 11 files changed, 4258 deletions(-) delete mode 100644 src/.deps/Config.Po delete mode 100644 src/.deps/Date.Po delete mode 100644 src/.deps/T.Po delete mode 100644 src/.deps/TDB.Po delete mode 100644 src/.deps/Table.Po delete mode 100644 src/.deps/color.Po delete mode 100644 src/.deps/parse.Po delete mode 100644 src/.deps/rules.Po delete mode 100644 src/.deps/task.Po delete mode 100644 src/.deps/text.Po delete mode 100644 src/.deps/util.Po diff --git a/src/.deps/Config.Po b/src/.deps/Config.Po deleted file mode 100644 index 8f26220b1..000000000 --- a/src/.deps/Config.Po +++ /dev/null @@ -1,408 +0,0 @@ -Config.o Config.o: Config.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/fstream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h \ - /usr/include/c++/4.0.0/bits/fstream.tcc /usr/include/c++/4.0.0/sstream \ - /usr/include/c++/4.0.0/bits/sstream.tcc /usr/include/sys/types.h \ - /usr/include/sys/stat.h /usr/include/pwd.h task.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h Config.h Table.h color.h \ - Grid.h color.h TDB.h T.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/fstream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h: - -/usr/include/c++/4.0.0/bits/fstream.tcc: - -/usr/include/c++/4.0.0/sstream: - -/usr/include/c++/4.0.0/bits/sstream.tcc: - -/usr/include/sys/types.h: - -/usr/include/sys/stat.h: - -/usr/include/pwd.h: - -task.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: diff --git a/src/.deps/Date.Po b/src/.deps/Date.Po deleted file mode 100644 index 75b15ba13..000000000 --- a/src/.deps/Date.Po +++ /dev/null @@ -1,392 +0,0 @@ -Date.o Date.o: Date.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc task.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h /usr/include/sys/types.h \ - Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h Date.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -task.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/sys/types.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: - -Date.h: diff --git a/src/.deps/T.Po b/src/.deps/T.Po deleted file mode 100644 index 740329d24..000000000 --- a/src/.deps/T.Po +++ /dev/null @@ -1,390 +0,0 @@ -T.o T.o: T.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc task.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h /usr/include/sys/types.h \ - Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -task.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/sys/types.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: diff --git a/src/.deps/TDB.Po b/src/.deps/TDB.Po deleted file mode 100644 index 8994a7862..000000000 --- a/src/.deps/TDB.Po +++ /dev/null @@ -1,406 +0,0 @@ -TDB.o TDB.o: TDB.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/fstream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h \ - /usr/include/c++/4.0.0/bits/fstream.tcc /usr/include/sys/file.h \ - /usr/include/sys/types.h /usr/include/sys/fcntl.h \ - /usr/include/sys/queue.h task.h /usr/include/c++/4.0.0/vector \ - /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h Config.h Table.h color.h \ - Grid.h color.h TDB.h T.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/fstream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h: - -/usr/include/c++/4.0.0/bits/fstream.tcc: - -/usr/include/sys/file.h: - -/usr/include/sys/types.h: - -/usr/include/sys/fcntl.h: - -/usr/include/sys/queue.h: - -task.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: diff --git a/src/.deps/Table.Po b/src/.deps/Table.Po deleted file mode 100644 index 2b5b7b131..000000000 --- a/src/.deps/Table.Po +++ /dev/null @@ -1,397 +0,0 @@ -Table.o Table.o: Table.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc Table.h \ - /usr/include/c++/4.0.0/map /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc color.h Grid.h Date.h task.h \ - /usr/include/sys/types.h Config.h Table.h color.h TDB.h T.h T.h \ - ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -Table.h: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -color.h: - -Grid.h: - -Date.h: - -task.h: - -/usr/include/sys/types.h: - -Config.h: - -Table.h: - -color.h: - -TDB.h: - -T.h: - -T.h: - -../auto.h: diff --git a/src/.deps/color.Po b/src/.deps/color.Po deleted file mode 100644 index 3ecbe44e8..000000000 --- a/src/.deps/color.Po +++ /dev/null @@ -1,278 +0,0 @@ -color.o color.o: color.cpp /usr/include/c++/4.0.0/string \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/cstring /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/_types.h /usr/include/sys/_types.h \ - /usr/include/sys/cdefs.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ - /usr/include/machine/signal.h /usr/include/i386/signal.h \ - /usr/include/i386/_structs.h /usr/include/sys/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/unistd.h \ - /usr/include/sys/unistd.h /usr/include/sys/select.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc color.h - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/sys/cdefs.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -color.h: diff --git a/src/.deps/parse.Po b/src/.deps/parse.Po deleted file mode 100644 index fd9b0e3b6..000000000 --- a/src/.deps/parse.Po +++ /dev/null @@ -1,393 +0,0 @@ -parse.o parse.o: parse.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/vector \ - /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h Date.h task.h \ - /usr/include/sys/types.h Config.h Table.h color.h Grid.h color.h TDB.h \ - T.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -Date.h: - -task.h: - -/usr/include/sys/types.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: diff --git a/src/.deps/rules.Po b/src/.deps/rules.Po deleted file mode 100644 index 88fe3569a..000000000 --- a/src/.deps/rules.Po +++ /dev/null @@ -1,392 +0,0 @@ -rules.o rules.o: rules.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc Config.h \ - /usr/include/c++/4.0.0/map /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc Table.h color.h Grid.h Date.h \ - T.h task.h /usr/include/sys/types.h color.h TDB.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -Config.h: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -Table.h: - -color.h: - -Grid.h: - -Date.h: - -T.h: - -task.h: - -/usr/include/sys/types.h: - -color.h: - -TDB.h: - -../auto.h: diff --git a/src/.deps/task.Po b/src/.deps/task.Po deleted file mode 100644 index 9c1333ba5..000000000 --- a/src/.deps/task.Po +++ /dev/null @@ -1,417 +0,0 @@ -task.o task.o: task.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/iomanip \ - /usr/include/c++/4.0.0/functional /usr/include/c++/4.0.0/fstream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h \ - /usr/include/c++/4.0.0/bits/fstream.tcc /usr/include/sys/types.h \ - /usr/include/pwd.h Config.h /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h \ - /usr/include/c++/4.0.0/vector /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc Date.h Table.h color.h Grid.h \ - TDB.h T.h task.h color.h ../auto.h /usr/include/ncurses.h \ - /usr/include/ncurses_dll.h /usr/include/unctrl.h /usr/include/curses.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/iomanip: - -/usr/include/c++/4.0.0/functional: - -/usr/include/c++/4.0.0/fstream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/basic_file.h: - -/usr/include/c++/4.0.0/bits/fstream.tcc: - -/usr/include/sys/types.h: - -/usr/include/pwd.h: - -Config.h: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -Date.h: - -Table.h: - -color.h: - -Grid.h: - -TDB.h: - -T.h: - -task.h: - -color.h: - -../auto.h: - -/usr/include/ncurses.h: - -/usr/include/ncurses_dll.h: - -/usr/include/unctrl.h: - -/usr/include/curses.h: diff --git a/src/.deps/text.Po b/src/.deps/text.Po deleted file mode 100644 index e45dc678c..000000000 --- a/src/.deps/text.Po +++ /dev/null @@ -1,390 +0,0 @@ -text.o text.o: text.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/vector \ - /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc task.h \ - /usr/include/c++/4.0.0/map /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h /usr/include/sys/types.h \ - Config.h Table.h color.h Grid.h color.h TDB.h T.h ../auto.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -task.h: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -/usr/include/sys/types.h: - -Config.h: - -Table.h: - -color.h: - -Grid.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: diff --git a/src/.deps/util.Po b/src/.deps/util.Po deleted file mode 100644 index 3fb44d97b..000000000 --- a/src/.deps/util.Po +++ /dev/null @@ -1,395 +0,0 @@ -util.o util.o: util.cpp /usr/include/c++/4.0.0/iostream \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h \ - /usr/include/c++/4.0.0/ostream /usr/include/c++/4.0.0/ios \ - /usr/include/c++/4.0.0/iosfwd \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h \ - /usr/include/c++/4.0.0/clocale /usr/include/locale.h \ - /usr/include/_locale.h /usr/include/sys/cdefs.h /usr/include/_types.h \ - /usr/include/sys/_types.h /usr/include/machine/_types.h \ - /usr/include/i386/_types.h /usr/include/c++/4.0.0/cstring \ - /usr/include/c++/4.0.0/cstddef \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h \ - /usr/include/string.h /usr/include/c++/4.0.0/cstdio \ - /usr/include/stdio.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/pthread_impl.h /usr/include/sched.h \ - /usr/include/time.h /usr/include/_structs.h /usr/include/sys/_structs.h \ - /usr/include/unistd.h /usr/include/sys/unistd.h \ - /usr/include/sys/select.h /usr/include/sys/appleapiopts.h \ - /usr/include/sys/_select.h /usr/include/c++/4.0.0/cctype \ - /usr/include/ctype.h /usr/include/runetype.h \ - /usr/include/c++/4.0.0/bits/stringfwd.h \ - /usr/include/c++/4.0.0/bits/postypes.h /usr/include/c++/4.0.0/cwchar \ - /usr/include/c++/4.0.0/ctime /usr/include/wchar.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h \ - /usr/include/_wctype.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h \ - /usr/include/c++/4.0.0/bits/functexcept.h \ - /usr/include/c++/4.0.0/exception_defines.h \ - /usr/include/c++/4.0.0/exception \ - /usr/include/c++/4.0.0/bits/char_traits.h \ - /usr/include/c++/4.0.0/bits/stl_algobase.h \ - /usr/include/c++/4.0.0/climits \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h \ - /usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h \ - /usr/include/limits.h /usr/include/machine/limits.h \ - /usr/include/i386/limits.h /usr/include/i386/_limits.h \ - /usr/include/sys/syslimits.h /usr/include/c++/4.0.0/cstdlib \ - /usr/include/stdlib.h /usr/include/available.h /usr/include/sys/wait.h \ - /usr/include/sys/signal.h /usr/include/machine/signal.h \ - /usr/include/i386/signal.h /usr/include/i386/_structs.h \ - /usr/include/machine/_structs.h /usr/include/mach/i386/_structs.h \ - /usr/include/sys/resource.h /usr/include/machine/endian.h \ - /usr/include/i386/endian.h /usr/include/sys/_endian.h \ - /usr/include/libkern/_OSByteOrder.h \ - /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ - /usr/include/machine/types.h /usr/include/i386/types.h \ - /usr/include/c++/4.0.0/bits/stl_pair.h \ - /usr/include/c++/4.0.0/bits/cpp_type_traits.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.0.0/bits/concept_check.h \ - /usr/include/c++/4.0.0/bits/stl_iterator.h \ - /usr/include/c++/4.0.0/debug/debug.h /usr/include/c++/4.0.0/cassert \ - /usr/include/assert.h /usr/include/c++/4.0.0/bits/localefwd.h \ - /usr/include/c++/4.0.0/bits/ios_base.h \ - /usr/include/c++/4.0.0/bits/atomicity.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h \ - /usr/include/c++/4.0.0/bits/locale_classes.h \ - /usr/include/c++/4.0.0/string /usr/include/c++/4.0.0/memory \ - /usr/include/c++/4.0.0/bits/allocator.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h \ - /usr/include/c++/4.0.0/ext/new_allocator.h /usr/include/c++/4.0.0/new \ - /usr/include/c++/4.0.0/bits/stl_construct.h \ - /usr/include/c++/4.0.0/bits/stl_uninitialized.h \ - /usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.0.0/limits \ - /usr/include/c++/4.0.0/bits/stl_function.h \ - /usr/include/c++/4.0.0/bits/basic_string.h \ - /usr/include/c++/4.0.0/algorithm /usr/include/c++/4.0.0/bits/stl_algo.h \ - /usr/include/c++/4.0.0/bits/stl_heap.h \ - /usr/include/c++/4.0.0/bits/stl_tempbuf.h \ - /usr/include/c++/4.0.0/bits/basic_string.tcc \ - /usr/include/c++/4.0.0/streambuf \ - /usr/include/c++/4.0.0/bits/streambuf.tcc \ - /usr/include/c++/4.0.0/bits/basic_ios.h \ - /usr/include/c++/4.0.0/bits/streambuf_iterator.h \ - /usr/include/c++/4.0.0/bits/locale_facets.h \ - /usr/include/c++/4.0.0/cwctype /usr/include/wctype.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h \ - /usr/include/c++/4.0.0/bits/codecvt.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h \ - /usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h \ - /usr/include/c++/4.0.0/bits/basic_ios.tcc \ - /usr/include/c++/4.0.0/bits/ostream.tcc /usr/include/c++/4.0.0/locale \ - /usr/include/c++/4.0.0/bits/locale_facets.tcc \ - /usr/include/c++/4.0.0/typeinfo /usr/include/c++/4.0.0/istream \ - /usr/include/c++/4.0.0/bits/istream.tcc /usr/include/c++/4.0.0/vector \ - /usr/include/c++/4.0.0/bits/stl_vector.h \ - /usr/include/c++/4.0.0/bits/stl_bvector.h \ - /usr/include/c++/4.0.0/bits/vector.tcc /usr/include/sys/types.h \ - /usr/include/sys/time.h Table.h /usr/include/c++/4.0.0/map \ - /usr/include/c++/4.0.0/bits/stl_tree.h \ - /usr/include/c++/4.0.0/bits/stl_map.h \ - /usr/include/c++/4.0.0/bits/stl_multimap.h color.h Grid.h task.h \ - Config.h color.h TDB.h T.h ../auto.h /usr/include/uuid/uuid.h - -/usr/include/c++/4.0.0/iostream: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/os_defines.h: - -/usr/include/c++/4.0.0/ostream: - -/usr/include/c++/4.0.0/ios: - -/usr/include/c++/4.0.0/iosfwd: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h: - -/usr/include/c++/4.0.0/clocale: - -/usr/include/locale.h: - -/usr/include/_locale.h: - -/usr/include/sys/cdefs.h: - -/usr/include/_types.h: - -/usr/include/sys/_types.h: - -/usr/include/machine/_types.h: - -/usr/include/i386/_types.h: - -/usr/include/c++/4.0.0/cstring: - -/usr/include/c++/4.0.0/cstddef: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stddef.h: - -/usr/include/string.h: - -/usr/include/c++/4.0.0/cstdio: - -/usr/include/stdio.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/pthread_impl.h: - -/usr/include/sched.h: - -/usr/include/time.h: - -/usr/include/_structs.h: - -/usr/include/sys/_structs.h: - -/usr/include/unistd.h: - -/usr/include/sys/unistd.h: - -/usr/include/sys/select.h: - -/usr/include/sys/appleapiopts.h: - -/usr/include/sys/_select.h: - -/usr/include/c++/4.0.0/cctype: - -/usr/include/ctype.h: - -/usr/include/runetype.h: - -/usr/include/c++/4.0.0/bits/stringfwd.h: - -/usr/include/c++/4.0.0/bits/postypes.h: - -/usr/include/c++/4.0.0/cwchar: - -/usr/include/c++/4.0.0/ctime: - -/usr/include/wchar.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdarg.h: - -/usr/include/_wctype.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/stdint.h: - -/usr/include/c++/4.0.0/bits/functexcept.h: - -/usr/include/c++/4.0.0/exception_defines.h: - -/usr/include/c++/4.0.0/exception: - -/usr/include/c++/4.0.0/bits/char_traits.h: - -/usr/include/c++/4.0.0/bits/stl_algobase.h: - -/usr/include/c++/4.0.0/climits: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/limits.h: - -/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/machine/limits.h: - -/usr/include/i386/limits.h: - -/usr/include/i386/_limits.h: - -/usr/include/sys/syslimits.h: - -/usr/include/c++/4.0.0/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/available.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/signal.h: - -/usr/include/machine/signal.h: - -/usr/include/i386/signal.h: - -/usr/include/i386/_structs.h: - -/usr/include/machine/_structs.h: - -/usr/include/mach/i386/_structs.h: - -/usr/include/sys/resource.h: - -/usr/include/machine/endian.h: - -/usr/include/i386/endian.h: - -/usr/include/sys/_endian.h: - -/usr/include/libkern/_OSByteOrder.h: - -/usr/include/libkern/i386/_OSByteOrder.h: - -/usr/include/alloca.h: - -/usr/include/machine/types.h: - -/usr/include/i386/types.h: - -/usr/include/c++/4.0.0/bits/stl_pair.h: - -/usr/include/c++/4.0.0/bits/cpp_type_traits.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.0.0/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.0.0/bits/concept_check.h: - -/usr/include/c++/4.0.0/bits/stl_iterator.h: - -/usr/include/c++/4.0.0/debug/debug.h: - -/usr/include/c++/4.0.0/cassert: - -/usr/include/assert.h: - -/usr/include/c++/4.0.0/bits/localefwd.h: - -/usr/include/c++/4.0.0/bits/ios_base.h: - -/usr/include/c++/4.0.0/bits/atomicity.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/atomic_word.h: - -/usr/include/c++/4.0.0/bits/locale_classes.h: - -/usr/include/c++/4.0.0/string: - -/usr/include/c++/4.0.0/memory: - -/usr/include/c++/4.0.0/bits/allocator.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++allocator.h: - -/usr/include/c++/4.0.0/ext/new_allocator.h: - -/usr/include/c++/4.0.0/new: - -/usr/include/c++/4.0.0/bits/stl_construct.h: - -/usr/include/c++/4.0.0/bits/stl_uninitialized.h: - -/usr/include/c++/4.0.0/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.0.0/limits: - -/usr/include/c++/4.0.0/bits/stl_function.h: - -/usr/include/c++/4.0.0/bits/basic_string.h: - -/usr/include/c++/4.0.0/algorithm: - -/usr/include/c++/4.0.0/bits/stl_algo.h: - -/usr/include/c++/4.0.0/bits/stl_heap.h: - -/usr/include/c++/4.0.0/bits/stl_tempbuf.h: - -/usr/include/c++/4.0.0/bits/basic_string.tcc: - -/usr/include/c++/4.0.0/streambuf: - -/usr/include/c++/4.0.0/bits/streambuf.tcc: - -/usr/include/c++/4.0.0/bits/basic_ios.h: - -/usr/include/c++/4.0.0/bits/streambuf_iterator.h: - -/usr/include/c++/4.0.0/bits/locale_facets.h: - -/usr/include/c++/4.0.0/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_base.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/ctype_inline.h: - -/usr/include/c++/4.0.0/bits/codecvt.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/time_members.h: - -/usr/include/c++/4.0.0/i686-apple-darwin9/bits/messages_members.h: - -/usr/include/c++/4.0.0/bits/basic_ios.tcc: - -/usr/include/c++/4.0.0/bits/ostream.tcc: - -/usr/include/c++/4.0.0/locale: - -/usr/include/c++/4.0.0/bits/locale_facets.tcc: - -/usr/include/c++/4.0.0/typeinfo: - -/usr/include/c++/4.0.0/istream: - -/usr/include/c++/4.0.0/bits/istream.tcc: - -/usr/include/c++/4.0.0/vector: - -/usr/include/c++/4.0.0/bits/stl_vector.h: - -/usr/include/c++/4.0.0/bits/stl_bvector.h: - -/usr/include/c++/4.0.0/bits/vector.tcc: - -/usr/include/sys/types.h: - -/usr/include/sys/time.h: - -Table.h: - -/usr/include/c++/4.0.0/map: - -/usr/include/c++/4.0.0/bits/stl_tree.h: - -/usr/include/c++/4.0.0/bits/stl_map.h: - -/usr/include/c++/4.0.0/bits/stl_multimap.h: - -color.h: - -Grid.h: - -task.h: - -Config.h: - -color.h: - -TDB.h: - -T.h: - -../auto.h: - -/usr/include/uuid/uuid.h: From 0d3a93ea2095e399cbb5eb82a93a551752df9d64 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 4 Jul 2008 18:06:44 -0400 Subject: [PATCH 04/19] - Added support for ordinal relative dates, like "23rd". --- ChangeLog | 1 + html/task.html | 2 ++ src/Date.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++-- src/tests/date.t.cpp | 3 ++- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c91e2779c..6bf96b6f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ represents a feature release, and the Z represents a patch. + Added averages to the "task history" report + Added ability to override ~/.taskrc with rc: + Added bar chart history report "task ghistory" + + Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...) + Bug: Fixed where Esc[0m sequences were being emitted for no good reason + Bug: Fixed underlined table headers when color is turned off diff --git a/html/task.html b/html/task.html index fdac75d58..096fce4fa 100644 --- a/html/task.html +++ b/html/task.html @@ -54,6 +54,8 @@
  • Added bar chart history report "task ghistory"
  • Added support for rc:<file> to allow override of the default ~/.taskrc file +
  • Added support for relative due: dates, such as "tomorrow", "friday", + "23rd", "eom"
  • Fixed bug where Esc[0m sequences were being emitted for no good reason
  • Fixed bug where table headers are underlined when color is turned off diff --git a/src/Date.cpp b/src/Date.cpp index d386fb081..0ac8ea7ab 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -508,6 +508,7 @@ time_t Date::operator- (const Date& rhs) bool Date::isRelativeDate (const std::string& input) { std::string in (lowerCase (input)); + Date today; std::vector supported; supported.push_back ("monday"); @@ -528,7 +529,6 @@ bool Date::isRelativeDate (const std::string& input) if (autoComplete (in, supported, matches) == 1) { std::string found = matches[0]; - Date today; // If day name. int dow; @@ -575,7 +575,64 @@ bool Date::isRelativeDate (const std::string& input) mT = then.mT; return true; } -// \d|\d\d|\d\d\d|\d\d\d\d st|nd|rd|th + } + + // Support "21st" to indicate the next date that is the 21st day. + else if (input.length () <= 4 && + isdigit (input[0])) + { + int number; + std::string ordinal; + + if (isdigit (input[1])) + { + number = ::atoi (input.substr (0, 2).c_str ()); + ordinal = lowerCase (input.substr (2, std::string::npos)); + } + else + { + number = ::atoi (input.substr (0, 2).c_str ()); + ordinal = lowerCase (input.substr (1, std::string::npos)); + } + + // Sanity check. + if (number <= 31) + { + if (ordinal == "st" || + ordinal == "nd" || + ordinal == "rd" || + ordinal == "th") + { + int m = today.month (); + int d = today.day (); + int y = today.year (); + + // If it is this month. + if (d < number && + number <= Date::daysInMonth (m, y)) + { + Date then (m, number, y); + mT = then.mT; + return true; + } + + do + { + m++; + + if (m > 12) + { + m = 1; + y++; + } + } + while (number > Date::daysInMonth (m, y)); + + Date then (m, number, y); + mT = then.mT; + return true; + } + } } return false; diff --git a/src/tests/date.t.cpp b/src/tests/date.t.cpp index a28c2d6d5..623d089b5 100644 --- a/src/tests/date.t.cpp +++ b/src/tests/date.t.cpp @@ -211,7 +211,8 @@ int main (int argc, char** argv) catch (std::string& e) { - std::cout << e << std::endl; + fail ("Exception thrown."); + diag (e); } return 0; From ef7ff555357ca3bec3c3f8249848874b13893924 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 4 Jul 2008 19:57:21 -0400 Subject: [PATCH 05/19] - Supports durations like weekly, semiannual, daily ... --- src/task.h | 2 +- src/tests/duration.t.cpp | 14 ++++---- src/util.cpp | 77 +++++++++++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 17 deletions(-) diff --git a/src/task.h b/src/task.h index c278e75ac..937c940ed 100644 --- a/src/task.h +++ b/src/task.h @@ -108,7 +108,7 @@ std::string formatSeconds (time_t); const std::string uuid (); const char* optionalBlankLine (Config&); int convertDuration (const std::string&); -Date convertRelativeDate (const std::string&); +int addDuration (const Date&, const std::string&); // rules.cpp void initializeColorRules (Config&); diff --git a/src/tests/duration.t.cpp b/src/tests/duration.t.cpp index df959e47a..e91d35d15 100644 --- a/src/tests/duration.t.cpp +++ b/src/tests/duration.t.cpp @@ -8,19 +8,18 @@ #include <../task.h> //////////////////////////////////////////////////////////////////////////////// -// daily, day, d, Nd -// weekly, w, Nw, sennight, biweekly, fortnight -// monthly, m, bimonthly, Nm, semimonthly +// daily, day, Nd +// weekly, Nw, sennight, biweekly, fortnight +// monthly, bimonthly, Nm, semimonthly // 1st 2nd 3rd 4th .. 31st -// quarterly, q, Nq -// biannual, biyearly, annual, semiannual, yearly, y, Na, Ny +// quarterly, Nq +// biannual, biyearly, annual, semiannual, yearly, Ny int main (int argc, char** argv) { - plan (19); + plan (17); is (convertDuration ("daily"), 1, "duration daily = 1"); is (convertDuration ("day"), 1, "duration day = 1"); - is (convertDuration ("d"), 0, "duration d = 1"); is (convertDuration ("0d"), 0, "duration 0d = 0"); is (convertDuration ("1d"), 1, "duration 1d = 1"); is (convertDuration ("7d"), 7, "duration 7d = 7"); @@ -32,7 +31,6 @@ int main (int argc, char** argv) is (convertDuration ("biweekly"), 14, "duration biweekly = 14"); is (convertDuration ("fortnight"), 14, "duration fortnight = 14"); is (convertDuration ("week"), 7, "duration week = 7"); - is (convertDuration ("w"), 7, "duration w = 7"); is (convertDuration ("0w"), 0, "duration 0w = 0"); is (convertDuration ("1w"), 7, "duration 1w = 7"); is (convertDuration ("7w"), 49, "duration 7w = 49"); diff --git a/src/util.cpp b/src/util.cpp index 0449599cf..d8b94a894 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -240,15 +240,76 @@ const std::string uuid () // Recognize the following constructs, and return the number of days represented int convertDuration (const std::string& input) { - // TODO + std::string in (lowerCase (input)); + Date today; + + std::vector supported; + supported.push_back ("daily"); + supported.push_back ("day"); + supported.push_back ("weekly"); + supported.push_back ("sennight"); + supported.push_back ("biweekly"); + supported.push_back ("fortnight"); + supported.push_back ("monthly"); + supported.push_back ("bimonthly"); + supported.push_back ("semimonthly"); + supported.push_back ("quarterly"); + supported.push_back ("biannual"); + supported.push_back ("biyearly"); + supported.push_back ("annual"); + supported.push_back ("semiannual"); + supported.push_back ("yearly"); + + std::vector matches; + if (autoComplete (in, supported, matches) == 1) + { + std::string found = matches[0]; + + if (found == "daily" || found == "day") return 1; + else if (found == "weekly" || found == "sennight") return 7; + else if (found == "biweekly" || found == "fortnight") return 14; + else if (found == "semimonthly") return 15; + else if (found == "monthly") return 30; + else if (found == "bimonthly") return 61; + else if (found == "quarterly") return 91; + else if (found == "semiannual") return 183; + else if (found == "yearly" || found == "annual") return 365; + else if (found == "biannual" || found == "biyearly") return 730; + } + + // Support \d+ d|w|m|q|y + + else + { + // Verify all digits followed by d, w, m, q, or y. + int length = input.length (); + for (unsigned int i = 0; i < length; ++i) + { + if (! isdigit (input[i]) && + i == length - 1) + { + int number = ::atoi (input.substr (0, i).c_str ()); + char ordinal = input[length - 1]; + + switch (input[length - 1]) + { + case 'd': return number * 1; break; + case 'w': return number * 7; break; + case 'm': return number * 30; break; + case 'q': return number * 91; break; + case 'y': return number * 365; break; + } + } + } + } + + return 0; // Error. +} + +//////////////////////////////////////////////////////////////////////////////// +int addDuration (const Date& base, const std::string& offset) +{ return 0; } //////////////////////////////////////////////////////////////////////////////// -Date convertRelativeDate (const std::string& input) -{ - // TODO - return Date (); -} - -//////////////////////////////////////////////////////////////////////////////// From 72c7afe1a13965704d4b55d66c413dca66bf0a71 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Jul 2008 01:22:22 -0400 Subject: [PATCH 06/19] - Fixed relative day tests. --- src/tests/date.t.cpp | 42 +++++++++++++++++++++--------------------- src/util.cpp | 7 +++---- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/tests/date.t.cpp b/src/tests/date.t.cpp index 623d089b5..d6bc79e79 100644 --- a/src/tests/date.t.cpp +++ b/src/tests/date.t.cpp @@ -158,46 +158,46 @@ int main (int argc, char** argv) ok (r3.sameDay (now - 86400), "yesterday = now - 1d"); Date r4 ("sunday"); - if (now.dayOfWeek () <= 0) - ok (r4.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next sunday"); + if (now.dayOfWeek () >= 0) + ok (r4.sameDay (now + (0 - now.dayOfWeek () + 7) * 86400), "next sunday"); else - ok (r4.sameDay (now + (r4.dayOfWeek () - now.dayOfWeek ()) * 86400), "next sunday"); + ok (r4.sameDay (now + (0 - now.dayOfWeek ()) * 86400), "next sunday");; Date r5 ("monday"); - if (now.dayOfWeek () <= 1) - ok (r5.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next monday"); + if (now.dayOfWeek () >= 1) + ok (r5.sameDay (now + (1 - now.dayOfWeek () + 7) * 86400), "next monday"); else - ok (r5.sameDay (now + (r5.dayOfWeek () - now.dayOfWeek ()) * 86400), "next monday"); + ok (r5.sameDay (now + (1 - now.dayOfWeek ()) * 86400), "next monday");; Date r6 ("tuesday"); - if (now.dayOfWeek () <= 2) - ok (r6.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next tuesday"); + if (now.dayOfWeek () >= 2) + ok (r6.sameDay (now + (2 - now.dayOfWeek () + 7) * 86400), "next tuesday"); else - ok (r6.sameDay (now + (r6.dayOfWeek () - now.dayOfWeek ()) * 86400), "next tuesday"); + ok (r6.sameDay (now + (2 - now.dayOfWeek ()) * 86400), "next tuesday");; Date r7 ("wednesday"); - if (now.dayOfWeek () <= 3) - ok (r7.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next wednesday"); + if (now.dayOfWeek () >= 3) + ok (r7.sameDay (now + (3 - now.dayOfWeek () + 7) * 86400), "next wednesday"); else - ok (r7.sameDay (now + (r7.dayOfWeek () - now.dayOfWeek ()) * 86400), "next wednesday"); + ok (r7.sameDay (now + (3 - now.dayOfWeek ()) * 86400), "next wednesday");; Date r8 ("thursday"); - if (now.dayOfWeek () <= 4) - ok (r8.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next thursday"); + if (now.dayOfWeek () >= 4) + ok (r8.sameDay (now + (4 - now.dayOfWeek () + 7) * 86400), "next thursday"); else - ok (r8.sameDay (now + (r8.dayOfWeek () - now.dayOfWeek ()) * 86400), "next thursday"); + ok (r8.sameDay (now + (4 - now.dayOfWeek ()) * 86400), "next thursday");; Date r9 ("friday"); - if (now.dayOfWeek () <= 5) - ok (r9.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next friday"); + if (now.dayOfWeek () >= 5) + ok (r9.sameDay (now + (5 - now.dayOfWeek () + 7) * 86400), "next friday"); else - ok (r9.sameDay (now + (r9.dayOfWeek () - now.dayOfWeek ()) * 86400), "next friday"); + ok (r9.sameDay (now + (5 - now.dayOfWeek ()) * 86400), "next friday");; Date r10 ("saturday"); - if (now.dayOfWeek () <= 6) - ok (r10.sameDay (now + (7 - now.dayOfWeek ()) * 86499), "next saturday"); + if (now.dayOfWeek () >= 6) + ok (r10.sameDay (now + (6 - now.dayOfWeek () + 7) * 86400), "next saturday"); else - ok (r10.sameDay (now + (r10.dayOfWeek () - now.dayOfWeek ()) * 86400), "next saturday"); + ok (r10.sameDay (now + (6 - now.dayOfWeek ()) * 86400), "next saturday");; Date r11 ("eow"); ok (r11 < now + (8 * 86400), "eow < 7 days away"); diff --git a/src/util.cpp b/src/util.cpp index d8b94a894..31d153b44 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -265,15 +265,15 @@ int convertDuration (const std::string& input) { std::string found = matches[0]; - if (found == "daily" || found == "day") return 1; - else if (found == "weekly" || found == "sennight") return 7; + if (found == "daily" || found == "day") return 1; + else if (found == "weekly" || found == "sennight") return 7; else if (found == "biweekly" || found == "fortnight") return 14; else if (found == "semimonthly") return 15; else if (found == "monthly") return 30; else if (found == "bimonthly") return 61; else if (found == "quarterly") return 91; else if (found == "semiannual") return 183; - else if (found == "yearly" || found == "annual") return 365; + else if (found == "yearly" || found == "annual") return 365; else if (found == "biannual" || found == "biyearly") return 730; } @@ -289,7 +289,6 @@ int convertDuration (const std::string& input) i == length - 1) { int number = ::atoi (input.substr (0, i).c_str ()); - char ordinal = input[length - 1]; switch (input[length - 1]) { From 6c7ad2b398ee1f2ce6ee1ce3ea4695a24c65d315 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Jul 2008 02:02:10 -0400 Subject: [PATCH 07/19] - Added error checking for "recur" without "due" - Added error checking for "until" without "recur" - Added status setting for "task add" regarding T::recurring --- src/TDB.cpp | 4 ++-- src/parse.cpp | 10 ++++++++-- src/rules.cpp | 2 +- src/task.cpp | 15 +++++++++++++++ src/task.h | 1 + src/util.cpp | 2 +- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/TDB.cpp b/src/TDB.cpp index 890c94144..d80067644 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -239,7 +239,6 @@ bool TDB::completeT (const T& t) const bool TDB::addT (const T& t) const { T task (t); - std::vector tags; task.getTags (tags); @@ -254,7 +253,8 @@ bool TDB::addT (const T& t) const } } - if (task.getStatus () == T::pending) + if (task.getStatus () == T::pending || + task.getStatus () == T::recurring) return writePending (task); return writeCompleted (task); diff --git a/src/parse.cpp b/src/parse.cpp index f69e8a8dc..0de8a0dbf 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -381,10 +381,8 @@ void parse ( std::string value = arg.substr (colon + 1, std::string::npos); if (validAttribute (name, value, conf)) - { if (name != "recur" || validDuration (value)) task.setAttribute (name, value); - } } // Substitution of description text. @@ -408,6 +406,14 @@ void parse ( } } + if (task.getAttribute ("recur") != "" && + task.getAttribute ("due") == "") + throw std::string ("You cannot specify a recurring task without a due date."); + + if (task.getAttribute ("until") != "" && + task.getAttribute ("recur") == "") + throw std::string ("You cannot specify an until date for a non-recurring task."); + if (validDescription (descCandidate)) task.setDescription (descCandidate); } diff --git a/src/rules.cpp b/src/rules.cpp index 6f2657692..4d9ccabe2 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -83,7 +83,7 @@ void initializeColorRules (Config& conf) void autoColorize (T& task, Text::color& fg, Text::color& bg) { // Note: fg, bg already contain colors specifically assigned via command. - // TODO These rules form a hierarchy - the last rule is king. + // Note: These rules form a hierarchy - the last rule is king. // Colorization of the tagged. if (gsFg["color.tagged"] != Text::nocolor || diff --git a/src/task.cpp b/src/task.cpp index a7541541b..dc023209f 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -403,6 +403,9 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) sprintf (entryTime, "%u", (unsigned int) time (NULL)); task.setAttribute ("entry", entryTime); + if (task.getAttribute ("recur") != "") + decorateRecurringTask (task); + if (task.getDescription () == "") throw std::string ("Cannot add a blank task."); @@ -3356,3 +3359,15 @@ void nag (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// +void decorateRecurringTask (T& task) +{ + if (task.getAttribute ("due") != "" && + task.getAttribute ("recur") != "") + { + task.setAttribute ("base", task.getAttribute ("due")); + + // TODO Create "range". + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.h b/src/task.h index 937c940ed..6d529ed50 100644 --- a/src/task.h +++ b/src/task.h @@ -87,6 +87,7 @@ void handleModify (const TDB&, T&, Config&); void handleColor (Config&); void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); void nag (const TDB&, T&, Config&); +void decorateRecurringTask (T&); // util.cpp bool confirm (const std::string&); diff --git a/src/util.cpp b/src/util.cpp index 31d153b44..877f4791a 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -282,7 +282,7 @@ int convertDuration (const std::string& input) else { // Verify all digits followed by d, w, m, q, or y. - int length = input.length (); + unsigned int length = input.length (); for (unsigned int i = 0; i < length; ++i) { if (! isdigit (input[i]) && From 188b9f36f2f29b85b210be2041815e9d3573f0f1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Jul 2008 02:13:45 -0400 Subject: [PATCH 08/19] - Doc snapshot --- README | 5 +++-- ideas.txt | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README b/README index 09a3e1ddd..a7de2f111 100644 --- a/README +++ b/README @@ -3,12 +3,13 @@ Thank you for taking a look at task. Task is a GTD utility featuring: - Robust C++ implementation - Tags - Colorful, tabular output - - Reports + - Reports, graphs - Lots of commands - Low-level API - Abbreviations for all commands, options - Multi-user file locking - Clean architecture allowing quick addition of new features + - Recurring tasks It is intended that features, mainly in the form of reports will be added frequently, with best practices and useful reports evolving from usage patterns. @@ -33,7 +34,7 @@ Task is based on ideas presented in the todo.sh script, found on: http://todotxt.org -Task has a few more features than todo.sh, but fundamentally, they are both +Task has many more features than todo.sh, but fundamentally, they are both working toward the same goals, which is to help you follow basic Getting Things Done (GTD) principles. diff --git a/ideas.txt b/ideas.txt index 7c95de408..261044c07 100644 --- a/ideas.txt +++ b/ideas.txt @@ -16,14 +16,14 @@ User-Defined Reports ID UUID Project Priority Entry Start Due Active Tags Description Test Suite - allow .taskrc override - debug=on to cause all cout to be csv - regression tests for every bug, command, feature + - allow .taskrc override + - debug=on to cause all cout to be csv + - regression tests for every bug, command, feature Recurrence + new T::status recurring (stored as R) + new user-specifiable attributes - recur: [until:] - - duration: + + duration: daily, day, 1d Nd weekly, 1w @@ -37,9 +37,9 @@ Recurrence biannual, biyearly annual, yearly, 1y Na, Ny - - recur: without due: => Error - - until: without recur: => Error - - New file format (version 3): supports status R, recur:, until:, base:, range: + + recur: without due: => Error + + until: without recur: => Error + + New file format: supports status R, recur:, until:, base:, range: - on TDB.gc, adjust base: and compress range: for T::status == recurring - all recurring tasks are removed from lists by T::*pendingT, and a synthetic addendum is generated @@ -67,3 +67,4 @@ Recurrence 5 Friday 7/13/2008 (not shown) 6 Friday 7/20/2008 (not shown) 7 Friday 7/27/2008 (not shown) + From e85d36cea03d82fb87c69e3ec3b3eb2e74ad5542 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Jul 2008 16:49:41 -0400 Subject: [PATCH 09/19] - Fixed bug whereby adding a new task with "task add asdfsd pri:" resulted in gibberish values in the priority field. --- AUTHORS | 1 + ChangeLog | 1 + html/task.html | 1 + src/parse.cpp | 6 ++---- src/task.cpp | 8 ++++++++ src/task.h | 1 + src/text.cpp | 11 +++++++++++ 7 files changed, 25 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index c6ba5e50f..37f5c411b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,4 +12,5 @@ With thanks to: Thomas Engel Nishiishii galvanizd + H. İbrahim Güngör diff --git a/ChangeLog b/ChangeLog index 6bf96b6f5..bafdb26d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ represents a feature release, and the Z represents a patch. + Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...) + Bug: Fixed where Esc[0m sequences were being emitted for no good reason + Bug: Fixed underlined table headers when color is turned off + + Bug: Adding a blank priority resulted in an assigned garbage value ------ reality ----------------------------------- diff --git a/html/task.html b/html/task.html index 096fce4fa..0b3bfe31f 100644 --- a/html/task.html +++ b/html/task.html @@ -58,6 +58,7 @@ "23rd", "eom"
  • Fixed bug where Esc[0m sequences were being emitted for no good reason
  • Fixed bug where table headers are underlined when color is turned off +
  • Fixed bug where adding a blank priority resulted in an assigned garbage value

    diff --git a/src/parse.cpp b/src/parse.cpp index 0de8a0dbf..0f88e0c29 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -235,9 +235,7 @@ static bool validAttribute ( else if (name == "priority") { - for (std::string::iterator i = value.begin (); i != value.end (); ++i) - *i = ::toupper (*i); - + value = upperCase (value); return validPriority (value); } @@ -248,7 +246,7 @@ static bool validAttribute ( name == "base" || name == "range") throw std::string ("\"") + - name + + name + "\" is not an attribute you may modify directly."; return true; diff --git a/src/task.cpp b/src/task.cpp index dc023209f..ee0a9e218 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -403,6 +403,14 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) sprintf (entryTime, "%u", (unsigned int) time (NULL)); task.setAttribute ("entry", entryTime); + std::map atts; + task.getAttributes (atts); + foreach (i, atts) + { + if (i->second == "") + task.removeAttribute (i->first); + } + if (task.getAttribute ("recur") != "") decorateRecurringTask (task); diff --git a/src/task.h b/src/task.h index 6d529ed50..b2a8754e4 100644 --- a/src/task.h +++ b/src/task.h @@ -102,6 +102,7 @@ void split (std::vector&, const std::string&, const std::string&); void join (std::string&, const std::string&, const std::vector&); std::string commify (const std::string&); std::string lowerCase (const std::string&); +std::string upperCase (const std::string&); void delay (float); int autoComplete (const std::string&, const std::vector&, std::vector&); void formatTimeDeltaDays (std::string&, time_t); diff --git a/src/text.cpp b/src/text.cpp index 50a497cb9..066d84f86 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -285,6 +285,17 @@ std::string lowerCase (const std::string& input) return output; } +//////////////////////////////////////////////////////////////////////////////// +std::string upperCase (const std::string& input) +{ + std::string output = input; + for (int i = 0; i < (int) input.length (); ++i) + if (::isupper (input[i])) + output[i] = ::toupper (input[i]); + + return output; +} + //////////////////////////////////////////////////////////////////////////////// const char* optionalBlankLine (Config& conf) { From 2181041c8c3d371c55a290f9130587bd427b30b1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 01:04:27 -0400 Subject: [PATCH 10/19] - Filtering now on all reports. --- src/task.cpp | 29 ++++++++++++++++++++++++++++- src/task.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/task.cpp b/src/task.cpp index ee0a9e218..f3ade83cf 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -528,7 +528,7 @@ void handleList (const TDB& tdb, T& task, Config& conf) // Get the pending tasks. std::vector tasks; - tdb.pendingT (tasks); + tdb.allPendingT (tasks); initializeColorRules (conf); @@ -575,9 +575,12 @@ void handleList (const TDB& tdb, T& task, Config& conf) table.setDateFormat (conf.get ("dateformat", "m/d/Y")); filter (tasks, task); + checkRecurring (tasks); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); + if (refTask.getStatus () != T::pending) + continue; // Now format the matching task. bool imminent = false; @@ -1235,6 +1238,7 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) std::map allProjects; std::vector pending; tdb.pendingT (pending); + filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { T task (pending[i]); @@ -1243,6 +1247,7 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) std::vector completed; tdb.completedT (completed); + filter (completed, task); for (unsigned int i = 0; i < completed.size (); ++i) { T task (completed[i]); @@ -1399,6 +1404,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf) // Load all pending. std::vector pending; tdb.allPendingT (pending); + filter (pending, task); // Restrict to matching subset. std::vector matching; @@ -1420,6 +1426,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf) // Get the pending tasks. std::vector tasks; tdb.pendingT (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -1568,6 +1575,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf) // Scan the pending tasks. std::vector pending; tdb.allPendingT (pending); + filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { T task (pending[i]); @@ -1605,6 +1613,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf) // Scan the completed tasks. std::vector completed; tdb.allCompletedT (completed); + filter (completed, task); for (unsigned int i = 0; i < completed.size (); ++i) { T task (completed[i]); @@ -1758,6 +1767,7 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) // Scan the pending tasks. std::vector pending; tdb.allPendingT (pending); + filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { T task (pending[i]); @@ -1795,6 +1805,7 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) // Scan the completed tasks. std::vector completed; tdb.allCompletedT (completed); + filter (completed, task); for (unsigned int i = 0; i < completed.size (); ++i) { T task (completed[i]); @@ -2153,6 +2164,7 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf) // Load all the pending tasks. std::vector pending; tdb.pendingT (pending); + filter (pending, task); // Find the oldest pending due date. Date oldest; @@ -2732,6 +2744,7 @@ void handleReportStats (const TDB& tdb, T& task, Config& conf) // Get all the tasks. std::vector tasks; tdb.allT (tasks); + filter (tasks, task); Date now; time_t earliest = time (NULL); @@ -3379,3 +3392,17 @@ void decorateRecurringTask (T& task) } //////////////////////////////////////////////////////////////////////////////// +void checkRecurring (std::vector & tasks) +{ + std::vector ::iterator it; + for (it = tasks.begin (); it != tasks.end (); ++it) + { + if (it->getStatus () == T::recurring) + { + + + } + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.h b/src/task.h index b2a8754e4..c557c397e 100644 --- a/src/task.h +++ b/src/task.h @@ -88,6 +88,7 @@ void handleColor (Config&); void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); void nag (const TDB&, T&, Config&); void decorateRecurringTask (T&); +void checkRecurring (std::vector &); // util.cpp bool confirm (const std::string&); From 97b120de679ecac65322aae4ba4667e2b58ddf6c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 01:05:28 -0400 Subject: [PATCH 11/19] - Doc snapshot --- ChangeLog | 1 + html/task.html | 1 + 2 files changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index bafdb26d1..903944bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ represents a feature release, and the Z represents a patch. + Added averages to the "task history" report + Added ability to override ~/.taskrc with rc: + Added bar chart history report "task ghistory" + + Added task filtering on all reports + Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...) + Bug: Fixed where Esc[0m sequences were being emitted for no good reason + Bug: Fixed underlined table headers when color is turned off diff --git a/html/task.html b/html/task.html index 0b3bfe31f..de6803809 100644 --- a/html/task.html +++ b/html/task.html @@ -56,6 +56,7 @@ ~/.taskrc file

  • Added support for relative due: dates, such as "tomorrow", "friday", "23rd", "eom" +
  • Added support for task filtering on all reports
  • Fixed bug where Esc[0m sequences were being emitted for no good reason
  • Fixed bug where table headers are underlined when color is turned off
  • Fixed bug where adding a blank priority resulted in an assigned garbage value From 79f6ef075e1cebdc8a4f5a9ec91733e516cdaf10 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 01:48:48 -0400 Subject: [PATCH 12/19] - Supports ::isatty call to shut off color, ncurses when stdout is not to a tty --- ChangeLog | 1 + html/task.html | 1 + src/task.cpp | 146 ++++++++++++++++++++++++++++++++++++------------- src/task.h | 1 + 4 files changed, 111 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 903944bda..48030c34b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ represents a feature release, and the Z represents a patch. + Added ability to override ~/.taskrc with rc: + Added bar chart history report "task ghistory" + Added task filtering on all reports + + Automatically shuts off color, curses when output is not a tty + Supports relative due: dates (tomorrow, wednesday, 23rd, eom ...) + Bug: Fixed where Esc[0m sequences were being emitted for no good reason + Bug: Fixed underlined table headers when color is turned off diff --git a/html/task.html b/html/task.html index de6803809..56b0e2c7a 100644 --- a/html/task.html +++ b/html/task.html @@ -57,6 +57,7 @@
  • Added support for relative due: dates, such as "tomorrow", "friday", "23rd", "eom"
  • Added support for task filtering on all reports +
  • Automatically shuts off color, ncurses when output is not to a tty
  • Fixed bug where Esc[0m sequences were being emitted for no good reason
  • Fixed bug where table headers are underlined when color is turned off
  • Fixed bug where adding a blank priority resulted in an assigned garbage value diff --git a/src/task.cpp b/src/task.cpp index f3ade83cf..373ba0557 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -275,6 +276,13 @@ int main (int argc, char** argv) Config conf; loadConfFile (argc, argv, conf); + // When redirecting output to a file, do not use color, curses. + if (!isatty (fileno (stdout))) + { + conf.set ("curses", "off"); + conf.set ("color", "off"); + } + TDB tdb; tdb.dataDirectory (conf.get ("data.location")); @@ -585,16 +593,19 @@ void handleList (const TDB& tdb, T& task, Config& conf) // Now format the matching task. bool imminent = false; bool overdue = false; - Date now; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string active; @@ -605,6 +616,7 @@ void handleList (const TDB& tdb, T& task, Config& conf) std::string created = refTask.getAttribute ("entry"); if (created.length ()) { + Date now; Date dt (::atoi (created.c_str ())); formatTimeDeltaDays (age, (time_t) (now - dt)); } @@ -711,16 +723,19 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) // Now format the matching task. bool imminent = false; bool overdue = false; - Date now; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string active; @@ -731,6 +746,7 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) std::string created = refTask.getAttribute ("entry"); if (created.length ()) { + Date now; Date dt (::atoi (created.c_str ())); formatTimeDeltaDays (age, (time_t) (now - dt)); } @@ -1165,12 +1181,16 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string age; @@ -1475,20 +1495,24 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf) foreach (i, matching) { T refTask (pending[*i]); + Date now; // Now format the matching task. bool imminent = false; bool overdue = false; - Date now; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string active; @@ -1932,8 +1956,8 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) else { std::string aBar = ""; while (aBar.length () < addedBar) aBar += "+"; - std::string cBar = ""; while (cBar.length () < completedBar) cBar += "+"; - std::string dBar = ""; while (dBar.length () < deletedBar) dBar += "+"; + std::string cBar = ""; while (cBar.length () < completedBar) cBar += "X"; + std::string dBar = ""; while (dBar.length () < deletedBar) dBar += "-"; bar = aBar + cBar + dBar; } @@ -2301,18 +2325,22 @@ void handleReportActive (const TDB& tdb, T& task, Config& conf) T refTask (tasks[i]); if (refTask.getAttribute ("start") != "") { + Date now; bool imminent = false; bool overdue = false; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - Date now; - overdue = dt < now ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } // All criteria match, so add refTask to the output table. @@ -2529,20 +2557,24 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf) for (unsigned int i = 0; i < min (quantity, tasks.size ()); ++i) { T refTask (tasks[i]); + Date now; // Now format the matching task. bool imminent = false; bool overdue = false; - Date now; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string active; @@ -2669,20 +2701,24 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf) for (int i = total - 1; i >= max (0, total - quantity); --i) { T refTask (tasks[i]); + Date now; // Now format the matching task. bool imminent = false; bool overdue = false; - Date now; std::string due = refTask.getAttribute ("due"); if (due.length ()) { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + Date dt (::atoi (due.c_str ())); due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; } std::string active; @@ -3386,12 +3422,35 @@ void decorateRecurringTask (T& task) task.getAttribute ("recur") != "") { task.setAttribute ("base", task.getAttribute ("due")); - - // TODO Create "range". } } //////////////////////////////////////////////////////////////////////////////// +// Determines whether a task is overdue. Returns +// 0 = not due at all +// 1 = imminent +// 2 = overdue +int getDueState (const std::string& due) +{ + if (due.length ()) + { + Date dt (::atoi (due.c_str ())); + Date now; + + if (dt < now) + return 2; + + Date nextweek = now + 7 * 86400; + if (dt < nextweek) + return 1; + } + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// +// Scan for recurring tasks, and generate any necessary instances of those +// tasks. void checkRecurring (std::vector & tasks) { std::vector ::iterator it; @@ -3399,7 +3458,18 @@ void checkRecurring (std::vector & tasks) { if (it->getStatus () == T::recurring) { + // This task is recurring. While it remains hidden from view, it spawns + // child tasks automatically, here, that are regular tasks, except they + // have a "parent" attribute that contains the UUID of the original. + // Generate a list of child tasks. + std::vector children; + std::vector ::iterator them; + for (them = tasks.begin (); them != tasks.end (); ++them) + if (them->getAttribute ("parent") != "") + children.push_back (*them); + + // TODO Determine if any new child tasks need to be generated. } } diff --git a/src/task.h b/src/task.h index c557c397e..e0f30aacb 100644 --- a/src/task.h +++ b/src/task.h @@ -111,6 +111,7 @@ std::string formatSeconds (time_t); const std::string uuid (); const char* optionalBlankLine (Config&); int convertDuration (const std::string&); +int getDueState (const std::string&); int addDuration (const Date&, const std::string&); // rules.cpp From 1712ad2cde671f77f91630b70d93742896cd0210 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 02:01:51 -0400 Subject: [PATCH 13/19] - "task delete" now properly supports recurring tasks. --- src/task.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/task.cpp b/src/task.cpp index 373ba0557..099bb150f 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -2943,7 +2943,29 @@ void handleVersion (Config& conf) void handleDelete (const TDB& tdb, T& task, Config& conf) { if (conf.get ("confirmation") != "yes" || confirm ("Permanently delete task?")) - tdb.deleteT (task); + { + // Check for the more complex case of a recurring task. + std::string parent = task.getAttribute ("parent"); + + // If this is a recurring task, get confirmation to delete them all. + if (parent != "" && + confirm ("This is a recurring task. Do you want to delete all pending recurrences of this same task?")) + { + // Scan all pending tasks for siblings of this task, and the parent + // itself, and delete them. + std::vector all; + tdb.allPendingT (all); + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + if (it->getAttribute ("parent") == parent || + it->getUUID () == parent) + tdb.deleteT (*it); + } + + // No confirmation, just delete the one. + else + tdb.deleteT (task); + } else std::cout << "Task not deleted." << std::endl; } From b1aaab0a8eb299797c3ebfb5763a8012c68e4576 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 02:03:39 -0400 Subject: [PATCH 14/19] - "task stats" now supports recurring tasks. --- src/task.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/task.cpp b/src/task.cpp index 099bb150f..5153d35c4 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -2790,6 +2790,7 @@ void handleReportStats (const TDB& tdb, T& task, Config& conf) int pendingT = 0; int completedT = 0; int taggedT = 0; + int recurringT = 0; float daysPending = 0.0; int descLength = 0; @@ -2800,6 +2801,7 @@ void handleReportStats (const TDB& tdb, T& task, Config& conf) if (it->getStatus () == T::deleted) ++deletedT; if (it->getStatus () == T::pending) ++pendingT; if (it->getStatus () == T::completed) ++completedT; + if (it->getStatus () == T::recurring) ++recurringT; time_t entry = ::atoi (it->getAttribute ("entry").c_str ()); if (entry < earliest) earliest = entry; @@ -2822,6 +2824,7 @@ void handleReportStats (const TDB& tdb, T& task, Config& conf) } std::cout << "Pending " << pendingT << std::endl + << "Recurring " << recurringT << std::endl << "Completed " << completedT << std::endl << "Deleted " << deletedT << std::endl << "Total " << totalT << std::endl; From 947e65c1e2961cdf22f5807c27c87e8692b798e5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 02:47:29 -0400 Subject: [PATCH 15/19] - Inserted recurring task checks at appropriate points. --- src/parse.cpp | 6 +-- src/task.cpp | 104 ++++++++++++++++++++++++++++++-------------------- src/task.h | 1 - 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/src/parse.cpp b/src/parse.cpp index 0f88e0c29..4f01d1fd1 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -109,8 +109,6 @@ static const char* attributes[] = "end", "recur", "until", - "base", - "range", "", }; @@ -242,9 +240,7 @@ static bool validAttribute ( // Some attributes are intended to be private. else if (name == "entry" || name == "start" || - name == "end" || - name == "base" || - name == "range") + name == "end") throw std::string ("\"") + name + "\" is not an attribute you may modify directly."; diff --git a/src/task.cpp b/src/task.cpp index 5153d35c4..d6308375c 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -419,8 +419,12 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) task.removeAttribute (i->first); } - if (task.getAttribute ("recur") != "") - decorateRecurringTask (task); + // Recurring tasks get a special status. + if (task.getAttribute ("due") != "" && + task.getAttribute ("recur") != "") + { + task.setStatus (T::recurring); + } if (task.getDescription () == "") throw std::string ("Cannot add a blank task."); @@ -532,11 +536,12 @@ void handleList (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get the pending tasks. + tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); + checkRecurring (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -582,8 +587,6 @@ void handleList (const TDB& tdb, T& task, Config& conf) table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - filter (tasks, task); - checkRecurring (tasks); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -678,11 +681,12 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get the pending tasks. + tdb.gc (); std::vector tasks; - tdb.pendingT (tasks); + tdb.allPendingT (tasks); + checkRecurring (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -715,7 +719,6 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) table.sortOn (1, Table::ascendingCharacter); // Iterate over each task, and apply selection criteria. - filter (tasks, task); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -804,11 +807,11 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get the pending tasks. + tdb.gc (); std::vector tasks; tdb.completedT (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -838,7 +841,6 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf) table.sortOn (0, Table::ascendingDate); // Iterate over each task, and apply selection criteria. - filter (tasks, task); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -931,6 +933,7 @@ void handleInfo (const TDB& tdb, T& task, Config& conf) table.addCell (row, 1, ( refTask.getStatus () == T::pending ? "Pending" : refTask.getStatus () == T::completed ? "Completed" : refTask.getStatus () == T::deleted ? "Deleted" + : refTask.getStatus () == T::recurring ? "Recurring" : "")); row = table.addRow (); @@ -951,6 +954,17 @@ void handleInfo (const TDB& tdb, T& task, Config& conf) table.addCell (row, 1, refTask.getAttribute ("priority")); } + if (refTask.getStatus () == T::recurring) + { + row = table.addRow (); + table.addCell (row, 0, "Recurrence"); + table.addCell (row, 1, refTask.getAttribute ("recur")); + + row = table.addRow (); + table.addCell (row, 0, "Recur until"); + table.addCell (row, 1, refTask.getAttribute ("until")); + } + // due (colored) bool imminent = false; bool overdue = false; @@ -1096,11 +1110,12 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get all the tasks. + tdb.gc (); std::vector tasks; - tdb.pendingT (tasks); + tdb.allPendingT (tasks); + checkRecurring (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -1154,7 +1169,6 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) table.sortOn (1, Table::ascendingCharacter); // Iterate over each task, and apply selection criteria. - filter (tasks, task); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -1255,9 +1269,11 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) void handleReportSummary (const TDB& tdb, T& task, Config& conf) { // Generate unique list of project names. + tdb.gc (); std::map allProjects; std::vector pending; - tdb.pendingT (pending); + tdb.allPendingT (pending); + checkRecurring (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -1266,7 +1282,7 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) } std::vector completed; - tdb.completedT (completed); + tdb.allCompletedT (completed); filter (completed, task); for (unsigned int i = 0; i < completed.size (); ++i) { @@ -1294,7 +1310,8 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) { T task (pending[i]); std::string project = task.getAttribute ("project"); - ++countPending[project]; + if (task.getStatus () == T::pending) + ++countPending[project]; time_t entry = ::atoi (task.getAttribute ("entry").c_str ()); if (entry) @@ -1422,8 +1439,10 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) void handleReportNext (const TDB& tdb, T& task, Config& conf) { // Load all pending. + tdb.gc (); std::vector pending; tdb.allPendingT (pending); + checkRecurring (pending); filter (pending, task); // Restrict to matching subset. @@ -1597,8 +1616,10 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf) std::map deletedGroup; // Scan the pending tasks. + tdb.gc (); std::vector pending; tdb.allPendingT (pending); + checkRecurring (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -1789,8 +1810,10 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) std::map deletedGroup; // Scan the pending tasks. + tdb.gc (); std::vector pending; tdb.allPendingT (pending); + checkRecurring (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -2186,8 +2209,10 @@ std::string renderMonths ( void handleReportCalendar (const TDB& tdb, T& task, Config& conf) { // Load all the pending tasks. + tdb.gc (); std::vector pending; - tdb.pendingT (pending); + tdb.allPendingT (pending); + checkRecurring (pending); filter (pending, task); // Find the oldest pending due date. @@ -2281,8 +2306,10 @@ void handleReportActive (const TDB& tdb, T& task, Config& conf) #endif // Get all the tasks. + tdb.gc (); std::vector tasks; tdb.pendingT (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -2319,7 +2346,6 @@ void handleReportActive (const TDB& tdb, T& task, Config& conf) table.sortOn (1, Table::ascendingCharacter); // Iterate over each task, and apply selection criteria. - filter (tasks, task); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -2398,6 +2424,7 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf) // Get all the tasks. std::vector tasks; tdb.pendingT (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -2436,7 +2463,6 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf) Date now; // Iterate over each task, and apply selection criteria. - filter (tasks, task); for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); @@ -2502,11 +2528,12 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get the pending tasks. + tdb.gc (); std::vector tasks; - tdb.pendingT (tasks); + tdb.allPendingT (tasks); + checkRecurring (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -2553,7 +2580,6 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf) table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - filter (tasks, task); for (unsigned int i = 0; i < min (quantity, tasks.size ()); ++i) { T refTask (tasks[i]); @@ -2645,11 +2671,12 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf) } #endif - tdb.gc (); - // Get the pending tasks. + tdb.gc (); std::vector tasks; - tdb.pendingT (tasks); + tdb.allPendingT (tasks); + checkRecurring (tasks); + filter (tasks, task); initializeColorRules (conf); @@ -2696,7 +2723,6 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf) table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - filter (tasks, task); int total = tasks.size (); for (int i = total - 1; i >= max (0, total - quantity); --i) { @@ -3440,16 +3466,6 @@ void nag (const TDB& tdb, T& task, Config& conf) } } -//////////////////////////////////////////////////////////////////////////////// -void decorateRecurringTask (T& task) -{ - if (task.getAttribute ("due") != "" && - task.getAttribute ("recur") != "") - { - task.setAttribute ("base", task.getAttribute ("due")); - } -} - //////////////////////////////////////////////////////////////////////////////// // Determines whether a task is overdue. Returns // 0 = not due at all @@ -3478,6 +3494,8 @@ int getDueState (const std::string& due) // tasks. void checkRecurring (std::vector & tasks) { + std::vector modified; + std::vector ::iterator it; for (it = tasks.begin (); it != tasks.end (); ++it) { @@ -3497,7 +3515,11 @@ void checkRecurring (std::vector & tasks) // TODO Determine if any new child tasks need to be generated. } + else + modified.push_back (*it); } + + tasks = modified; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.h b/src/task.h index e0f30aacb..fe730a4fe 100644 --- a/src/task.h +++ b/src/task.h @@ -87,7 +87,6 @@ void handleModify (const TDB&, T&, Config&); void handleColor (Config&); void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); void nag (const TDB&, T&, Config&); -void decorateRecurringTask (T&); void checkRecurring (std::vector &); // util.cpp From 17152d8a4660d77f0b8c9425ba31d42fe757510e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 03:04:54 -0400 Subject: [PATCH 16/19] - Renamed checkRecurring -> handleRecurrence --- src/task.cpp | 27 +++++++++++++++------------ src/task.h | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/task.cpp b/src/task.cpp index d6308375c..d68c9f521 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -540,7 +540,7 @@ void handleList (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); - checkRecurring (tasks); + handleRecurrence (tasks); filter (tasks, task); initializeColorRules (conf); @@ -685,7 +685,7 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); - checkRecurring (tasks); + handleRecurrence (tasks); filter (tasks, task); initializeColorRules (conf); @@ -1114,7 +1114,7 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); - checkRecurring (tasks); + handleRecurrence (tasks); filter (tasks, task); initializeColorRules (conf); @@ -1273,7 +1273,7 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) std::map allProjects; std::vector pending; tdb.allPendingT (pending); - checkRecurring (pending); + handleRecurrence (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -1442,7 +1442,7 @@ void handleReportNext (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector pending; tdb.allPendingT (pending); - checkRecurring (pending); + handleRecurrence (pending); filter (pending, task); // Restrict to matching subset. @@ -1619,7 +1619,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector pending; tdb.allPendingT (pending); - checkRecurring (pending); + handleRecurrence (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -1813,7 +1813,7 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector pending; tdb.allPendingT (pending); - checkRecurring (pending); + handleRecurrence (pending); filter (pending, task); for (unsigned int i = 0; i < pending.size (); ++i) { @@ -2002,6 +2002,7 @@ void handleReportGHistory (const TDB& tdb, T& task, Config& conf) << Text::colorize (Text::black, Text::on_yellow, "completed") << ", " << Text::colorize (Text::black, Text::on_red, "deleted") + << optionalBlankLine (conf) << std::endl; else std::cout << "Legend: + added, X completed, - deleted" << std::endl; @@ -2212,7 +2213,7 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector pending; tdb.allPendingT (pending); - checkRecurring (pending); + handleRecurrence (pending); filter (pending, task); // Find the oldest pending due date. @@ -2532,7 +2533,7 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); - checkRecurring (tasks); + handleRecurrence (tasks); filter (tasks, task); initializeColorRules (conf); @@ -2675,7 +2676,7 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf) tdb.gc (); std::vector tasks; tdb.allPendingT (tasks); - checkRecurring (tasks); + handleRecurrence (tasks); filter (tasks, task); initializeColorRules (conf); @@ -3492,7 +3493,7 @@ int getDueState (const std::string& due) //////////////////////////////////////////////////////////////////////////////// // Scan for recurring tasks, and generate any necessary instances of those // tasks. -void checkRecurring (std::vector & tasks) +void handleRecurrence (std::vector & tasks) { std::vector modified; @@ -3512,8 +3513,10 @@ void checkRecurring (std::vector & tasks) if (them->getAttribute ("parent") != "") children.push_back (*them); - // TODO Determine if any new child tasks need to be generated. + // TODO Determine if any new child tasks need to be generated, and do it. + // TODO if before "until" date, or "until" missing + // TODO Iterate from "due", incrementing by "recur" } else modified.push_back (*it); diff --git a/src/task.h b/src/task.h index fe730a4fe..494689292 100644 --- a/src/task.h +++ b/src/task.h @@ -87,7 +87,7 @@ void handleModify (const TDB&, T&, Config&); void handleColor (Config&); void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); void nag (const TDB&, T&, Config&); -void checkRecurring (std::vector &); +void handleRecurrence (std::vector &); // util.cpp bool confirm (const std::string&); From 0e611eda19512cd5d90c0273ee9a15871a952903 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 6 Jul 2008 17:02:10 -0400 Subject: [PATCH 17/19] - Disabled undelete for deleted recurring tasks, because it is too difficult to know what to restore. --- src/task.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/task.cpp b/src/task.cpp index d68c9f521..fe73dca1a 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -1073,6 +1073,12 @@ void handleUndelete (const TDB& tdb, T& task, Config& conf) { if (it->getStatus () == T::deleted) { + if (it->getAttribute ("recur") != "") + { + std::cout << "Task does not support 'undelete' for recurring tasks." << std::endl; + return; + } + T restored (*it); restored.setStatus (T::pending); restored.removeAttribute ("end"); From ba342eeeb6a3c98064434d5231a16fc91f45a7a5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 8 Jul 2008 01:40:07 -0400 Subject: [PATCH 18/19] - Recurring faintly working without (the very necessary) mask attribute --- src/Makefile.am | 2 +- src/T.cpp | 3 +- src/TDB.cpp | 3 +- src/command.cpp | 589 +++++++++ src/parse.cpp | 11 +- src/report.cpp | 2623 ++++++++++++++++++++++++++++++++++++++ src/task.cpp | 3217 ++--------------------------------------------- src/task.h | 33 +- src/util.cpp | 12 +- 9 files changed, 3352 insertions(+), 3141 deletions(-) create mode 100644 src/command.cpp create mode 100644 src/report.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 64586d1c7..eae651e2b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ bin_PROGRAMS = task -task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h +task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp command.cpp report.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h AM_CPPFLAGS = -Wall -pedantic -ggdb3 -fno-rtti diff --git a/src/T.cpp b/src/T.cpp index 815b39c28..8ccb6c362 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -424,7 +424,8 @@ void T::parse (const std::string& line) mStatus = line[37] == '+' ? completed : line[37] == 'X' ? deleted - : pending; + : line[37] == 'r' ? recurring + : pending; size_t openTagBracket = line.find ("["); size_t closeTagBracket = line.find ("]", openTagBracket); diff --git a/src/TDB.cpp b/src/TDB.cpp index d80067644..fc5e8e786 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -468,7 +468,8 @@ int TDB::gc () const for (it = all.begin (); it != all.end (); ++it) { // Some tasks stay in the pending file. - if (it->getStatus () == T::pending) + if (it->getStatus () == T::pending || + it->getStatus () == T::recurring) pending.push_back (*it); // Others are transferred to the completed file. diff --git a/src/command.cpp b/src/command.cpp new file mode 100644 index 000000000..edea54777 --- /dev/null +++ b/src/command.cpp @@ -0,0 +1,589 @@ +//////////////////////////////////////////////////////////////////////////////// +// task - a command line task list manager. +// +// Copyright 2006 - 2008, Paul Beckingham. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Config.h" +#include "Date.h" +#include "Table.h" +#include "TDB.h" +#include "T.h" +#include "task.h" + +#ifdef HAVE_LIBNCURSES +#include +#endif + +//////////////////////////////////////////////////////////////////////////////// +void handleAdd (const TDB& tdb, T& task, Config& conf) +{ + char entryTime[16]; + sprintf (entryTime, "%u", (unsigned int) time (NULL)); + task.setAttribute ("entry", entryTime); + + std::map atts; + task.getAttributes (atts); + foreach (i, atts) + { + if (i->second == "") + task.removeAttribute (i->first); + } + + // Recurring tasks get a special status. + if (task.getAttribute ("due") != "" && + task.getAttribute ("recur") != "") + { + task.setStatus (T::recurring); + task.setAttribute ("mask", ""); + } + + if (task.getDescription () == "") + throw std::string ("Cannot add a blank task."); + + if (!tdb.addT (task)) + throw std::string ("Could not create new task."); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleProjects (const TDB& tdb, T& task, Config& conf) +{ + // Get all the tasks, including deleted ones. + std::vector tasks; + tdb.pendingT (tasks); + + // Scan all the tasks for their project name, building a map using project + // names as keys. + std::map unique; + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T task (tasks[i]); + unique[task.getAttribute ("project")] += 1; + } + + if (unique.size ()) + { + // Render a list of project names from the map. + Table table; + table.addColumn ("Project"); + table.addColumn ("Tasks"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + + table.setColumnJustification (1, Table::right); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + foreach (i, unique) + { + int row = table.addRow (); + table.addCell (row, 0, i->first); + table.addCell (row, 1, i->second); + } + + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << unique.size () + << (unique.size () == 1 ? " project" : " projects") + << std::endl; + } + else + std::cout << "No projects." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleTags (const TDB& tdb, T& task, Config& conf) +{ + // Get all the tasks. + std::vector tasks; + tdb.pendingT (tasks); + + // Scan all the tasks for their project name, building a map using project + // names as keys. + std::map unique; + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T task (tasks[i]); + + std::vector tags; + task.getTags (tags); + + for (unsigned int t = 0; t < tags.size (); ++t) + unique[tags[t]] = ""; + } + + // Render a list of tag names from the map. + std::cout << optionalBlankLine (conf); + foreach (i, unique) + std::cout << i->first << std::endl; + + if (unique.size ()) + std::cout << optionalBlankLine (conf) + << unique.size () + << (unique.size () == 1 ? " tag" : " tags") + << std::endl; + else + std::cout << "No tags." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// If a task is deleted, but is still in the pending file, then it may be +// undeleted simply by changing it's status. +void handleUndelete (const TDB& tdb, T& task, Config& conf) +{ + std::vector all; + tdb.allPendingT (all); + + int id = task.getId (); + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + if (it->getId () == id) + { + if (it->getStatus () == T::deleted) + { + if (it->getAttribute ("recur") != "") + { + std::cout << "Task does not support 'undelete' for recurring tasks." << std::endl; + return; + } + + T restored (*it); + restored.setStatus (T::pending); + restored.removeAttribute ("end"); + tdb.modifyT (restored); + + std::cout << "Task " << id << " successfully undeleted." << std::endl; + return; + } + else + { + std::cout << "Task " << id << " is not deleted - therefore cannot undelete." << std::endl; + return; + } + } + } + + std::cout << "Task " << id + << " not found - tasks can only be reliably undeleted if the undelete" << std::endl + << "command is run immediately after the errant delete command." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleVersion (Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("Config variable"); + table.addColumn ("Value"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::flexible); + table.setColumnJustification (0, Table::left); + table.setColumnJustification (1, Table::left); + table.sortOn (0, Table::ascendingCharacter); + + std::vector all; + conf.all (all); + foreach (i, all) + { + std::string value = conf.get (*i); + if (value != "") + { + int row = table.addRow (); + table.addCell (row, 0, *i); + table.addCell (row, 1, value); + } + } + + std::cout << "Copyright (C) 2006 - 2008, P. Beckingham." + << std::endl + << PACKAGE + << " " + << VERSION + << std::endl + << std::endl + << "Task comes with ABSOLUTELY NO WARRANTY; for details read the COPYING file" + << std::endl + << "included. This is free software, and you are welcome to redistribute it" + << std::endl + << "under certain conditions; again, see the COPYING file for details." + << std::endl + << std::endl + << table.render () + << std::endl; + + // Verify installation. This is mentioned in the documentation as the way to + // ensure everything is properly installed. + + if (all.size () == 0) + std::cout << "Configuration error: .taskrc contains no entries" + << std::endl; + else + { + if (conf.get ("data.location") == "") + std::cout << "Configuration error: data.location not specified in .taskrc " + "file." + << std::endl; + + if (access (conf.get ("data.location").c_str (), X_OK)) + std::cout << "Configuration error: data.location contains a directory name" + " that doesn't exist, or is unreadable." + << std::endl; + } +} + +//////////////////////////////////////////////////////////////////////////////// +void handleDelete (const TDB& tdb, T& task, Config& conf) +{ + if (conf.get ("confirmation") != "yes" || confirm ("Permanently delete task?")) + { + // Check for the more complex case of a recurring task. If this is a + // recurring task, get confirmation to delete them all. + std::string parent = task.getAttribute ("parent"); + if (parent != "") + { + if (confirm ("This is a recurring task. Do you want to delete all pending recurrences of this same task?")) + { + // Scan all pending tasks for siblings of this task, and the parent + // itself, and delete them. + std::vector all; + tdb.allPendingT (all); + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + if (it->getAttribute ("parent") == parent || + it->getUUID () == parent) + tdb.deleteT (*it); + + return; + } + else + { + // TODO Update mask in parent. + } + } + + // No confirmation, just delete the one. + tdb.deleteT (task); + } + else + std::cout << "Task not deleted." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleStart (const TDB& tdb, T& task, Config& conf) +{ + std::vector all; + tdb.pendingT (all); + + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + if (it->getId () == task.getId ()) + { + T original (*it); + + if (original.getAttribute ("start") == "") + { + char startTime[16]; + sprintf (startTime, "%u", (unsigned int) time (NULL)); + original.setAttribute ("start", startTime); + + original.setId (task.getId ()); + tdb.modifyT (original); + + nag (tdb, task, conf); + return; + } + else + std::cout << "Task " << task.getId () << " already started." << std::endl; + } + } + + throw std::string ("Task not found."); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleDone (const TDB& tdb, T& task, Config& conf) +{ + if (!tdb.completeT (task)) + throw std::string ("Could not mark task as completed."); + + // TODO Now updates mask in parent. + + nag (tdb, task, conf); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleExport (const TDB& tdb, T& task, Config& conf) +{ + // Use the description as a file name, then clobber the description so the + // file name isn't used for filtering. + std::string file = trim (task.getDescription ()); + task.setDescription (""); + + if (file.length () > 0) + { + std::ofstream out (file.c_str ()); + if (out.good ()) + { + out << "'id'," + << "'status'," + << "'tags'," + << "'entry'," + << "'start'," + << "'due'," + << "'end'," + << "'project'," + << "'priority'," + << "'fg'," + << "'bg'," + << "'description'" + << "\n"; + + std::vector all; + tdb.allT (all); + filter (all, task); + foreach (t, all) + { + out << t->composeCSV ().c_str (); + } + out.close (); + } + else + throw std::string ("Could not write to export file."); + } + else + throw std::string ("You must specify a file to write to."); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleModify (const TDB& tdb, T& task, Config& conf) +{ + std::vector all; + tdb.pendingT (all); + + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + if (it->getId () == task.getId ()) + { + T original (*it); + + // A non-zero value forces a file write. + int changes = 0; + + // Apply a new description, if any. + if (task.getDescription () != "") + { + original.setDescription (task.getDescription ()); + ++changes; + } + + // Apply or remove tags, if any. + std::vector tags; + task.getTags (tags); + for (unsigned int i = 0; i < tags.size (); ++i) + { + if (tags[i][0] == '+') + original.addTag (tags[i].substr (1, std::string::npos)); + else + original.addTag (tags[i]); + + ++changes; + } + + task.getRemoveTags (tags); + for (unsigned int i = 0; i < tags.size (); ++i) + { + if (tags[i][0] == '-') + original.removeTag (tags[i].substr (1, std::string::npos)); + else + original.removeTag (tags[i]); + + ++changes; + } + + // Apply or remove attributes, if any. + std::map attributes; + task.getAttributes (attributes); + foreach (i, attributes) + { + if (i->second == "") + original.removeAttribute (i->first); + else + original.setAttribute (i->first, i->second); + + ++changes; + } + + std::string from; + std::string to; + task.getSubstitution (from, to); + if (from != "") + { + std::string description = original.getDescription (); + size_t pattern = description.find (from); + if (pattern != std::string::npos) + { + description = description.substr (0, pattern) + + to + + description.substr (pattern + from.length (), std::string::npos); + original.setDescription (description); + ++changes; + } + } + + if (changes) + { + original.setId (task.getId ()); + tdb.modifyT (original); + } + + return; + } + } + + throw std::string ("Task not found."); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleColor (Config& conf) +{ + if (conf.get ("color", true)) + { + std::cout << optionalBlankLine (conf) << "Foreground" << std::endl + << " " + << Text::colorize (Text::bold, Text::nocolor, "bold") << " " + << Text::colorize (Text::underline, Text::nocolor, "underline") << " " + << Text::colorize (Text::bold_underline, Text::nocolor, "bold_underline") << std::endl + + << " " << Text::colorize (Text::black, Text::nocolor, "black") << " " + << Text::colorize (Text::bold_black, Text::nocolor, "bold_black") << " " + << Text::colorize (Text::underline_black, Text::nocolor, "underline_black") << " " + << Text::colorize (Text::bold_underline_black, Text::nocolor, "bold_underline_black") << std::endl + + << " " << Text::colorize (Text::red, Text::nocolor, "red") << " " + << Text::colorize (Text::bold_red, Text::nocolor, "bold_red") << " " + << Text::colorize (Text::underline_red, Text::nocolor, "underline_red") << " " + << Text::colorize (Text::bold_underline_red, Text::nocolor, "bold_underline_red") << std::endl + + << " " << Text::colorize (Text::green, Text::nocolor, "green") << " " + << Text::colorize (Text::bold_green, Text::nocolor, "bold_green") << " " + << Text::colorize (Text::underline_green, Text::nocolor, "underline_green") << " " + << Text::colorize (Text::bold_underline_green, Text::nocolor, "bold_underline_green") << std::endl + + << " " << Text::colorize (Text::yellow, Text::nocolor, "yellow") << " " + << Text::colorize (Text::bold_yellow, Text::nocolor, "bold_yellow") << " " + << Text::colorize (Text::underline_yellow, Text::nocolor, "underline_yellow") << " " + << Text::colorize (Text::bold_underline_yellow, Text::nocolor, "bold_underline_yellow") << std::endl + + << " " << Text::colorize (Text::blue, Text::nocolor, "blue") << " " + << Text::colorize (Text::bold_blue, Text::nocolor, "bold_blue") << " " + << Text::colorize (Text::underline_blue, Text::nocolor, "underline_blue") << " " + << Text::colorize (Text::bold_underline_blue, Text::nocolor, "bold_underline_blue") << std::endl + + << " " << Text::colorize (Text::magenta, Text::nocolor, "magenta") << " " + << Text::colorize (Text::bold_magenta, Text::nocolor, "bold_magenta") << " " + << Text::colorize (Text::underline_magenta, Text::nocolor, "underline_magenta") << " " + << Text::colorize (Text::bold_underline_magenta, Text::nocolor, "bold_underline_magenta") << std::endl + + << " " << Text::colorize (Text::cyan, Text::nocolor, "cyan") << " " + << Text::colorize (Text::bold_cyan, Text::nocolor, "bold_cyan") << " " + << Text::colorize (Text::underline_cyan, Text::nocolor, "underline_cyan") << " " + << Text::colorize (Text::bold_underline_cyan, Text::nocolor, "bold_underline_cyan") << std::endl + + << " " << Text::colorize (Text::white, Text::nocolor, "white") << " " + << Text::colorize (Text::bold_white, Text::nocolor, "bold_white") << " " + << Text::colorize (Text::underline_white, Text::nocolor, "underline_white") << " " + << Text::colorize (Text::bold_underline_white, Text::nocolor, "bold_underline_white") << std::endl + + << std::endl << "Background" << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " " + << Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " " + << Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " " + << Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " " + << Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " " + << Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " " + << Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " " + << Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " " + << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl + + << optionalBlankLine (conf); + } + else + { + std::cout << "Color is currently turned off in your .taskrc file." << std::endl; + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/parse.cpp b/src/parse.cpp index 4f01d1fd1..2506fb9fd 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -109,6 +109,7 @@ static const char* attributes[] = "end", "recur", "until", + "mask", "", }; @@ -231,6 +232,9 @@ static bool validAttribute ( else if (name == "due" && value != "") validDate (value, conf); + else if (name == "until" && value != "") + validDate (value, conf); + else if (name == "priority") { value = upperCase (value); @@ -240,7 +244,8 @@ static bool validAttribute ( // Some attributes are intended to be private. else if (name == "entry" || name == "start" || - name == "end") + name == "end" || + name == "mask") throw std::string ("\"") + name + "\" is not an attribute you may modify directly."; @@ -316,9 +321,9 @@ static bool validSubstitution ( } //////////////////////////////////////////////////////////////////////////////// -bool validDuration (const std::string& input) +bool validDuration (std::string& input) { - return convertDuration (input) != 0 ? true : false; + return (convertDuration (input) != 0) ? true : false; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/report.cpp b/src/report.cpp new file mode 100644 index 000000000..0362e8458 --- /dev/null +++ b/src/report.cpp @@ -0,0 +1,2623 @@ +//////////////////////////////////////////////////////////////////////////////// +// task - a command line task list manager. +// +// Copyright 2006 - 2008, Paul Beckingham. +// All rights reserved. +// +// This program is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// this program; if not, write to the +// +// Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, +// Boston, MA +// 02110-1301 +// USA +// +//////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Config.h" +#include "Date.h" +#include "Table.h" +#include "TDB.h" +#include "T.h" +#include "task.h" + +#ifdef HAVE_LIBNCURSES +#include +#endif + +//////////////////////////////////////////////////////////////////////////////// +void filter (std::vector& all, T& task) +{ + std::vector filtered; + + // Split any description specified into words. + std::vector descWords; + split (descWords, lowerCase (task.getDescription ()), ' '); + + // Get all the tags to match against. + std::vector tagList; + task.getTags (tagList); + + // Get all the attributes to match against. + std::map attrList; + task.getAttributes (attrList); + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < all.size (); ++i) + { + T refTask (all[i]); + + // Apply description filter. + std::string desc = lowerCase (refTask.getDescription ()); + unsigned int matches = 0; + for (unsigned int w = 0; w < descWords.size (); ++w) + if (desc.find (descWords[w]) != std::string::npos) + ++matches; + + if (matches == descWords.size ()) + { + // Apply attribute filter. + matches = 0; + foreach (a, attrList) + if (a->first == "project") + { + if (a->second.length () <= refTask.getAttribute (a->first).length ()) + if (a->second == refTask.getAttribute (a->first).substr (0, a->second.length ())) + ++matches; + } + else if (a->second == refTask.getAttribute (a->first)) + ++matches; + + if (matches == attrList.size ()) + { + // Apply tag filter. + matches = 0; + for (unsigned int t = 0; t < tagList.size (); ++t) + if (refTask.hasTag (tagList[t])) + ++matches; + + if (matches == tagList.size ()) + filtered.push_back (refTask); + } + } + } + + all = filtered; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. +void handleList (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get the pending tasks. + tdb.gc (); + std::vector tasks; + tdb.allPendingT (tasks); + handleRecurrence (tdb, tasks); + filter (tasks, task); + + initializeColorRules (conf); + + bool showAge = conf.get ("showage", true); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Active"); + if (showAge) table.addColumn ("Age"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + if (showAge) table.setColumnUnderline (6); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::minimum); + if (showAge) table.setColumnWidth (5, Table::minimum); + table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + if (showAge) table.setColumnJustification (5, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + if (refTask.getStatus () != T::pending) + continue; + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string active; + if (refTask.getAttribute ("start") != "") + active = "*"; + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date now; + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, active); + if (showAge) table.addCell (row, 5, age); + table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. Show a narrow +// list that works better on mobile devices. +void handleSmallList (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get the pending tasks. + tdb.gc (); + std::vector tasks; + tdb.allPendingT (tasks); + handleRecurrence (tdb, tasks); + filter (tasks, task); + + initializeColorRules (conf); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::left); + + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string active; + if (refTask.getAttribute ("start") != "") + active = "*"; + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date now; + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. +void handleCompleted (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get the pending tasks. + tdb.gc (); + std::vector tasks; + tdb.completedT (tasks); + filter (tasks, task); + + initializeColorRules (conf); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("Done"); + table.addColumn ("Project"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (1, Table::left); + table.setColumnJustification (2, Table::left); + + table.sortOn (0, Table::ascendingDate); + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + + // Now format the matching task. + Date end (::atoi (refTask.getAttribute ("end").c_str ())); + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + + table.addCell (row, 0, end.toString (conf.get ("dateformat", "m/d/Y"))); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Display all information for the given task. +void handleInfo (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get all the tasks. + std::vector tasks; + tdb.allPendingT (tasks); + + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + table.addColumn ("Name"); + table.addColumn ("Value"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + + table.setColumnJustification (0, Table::left); + table.setColumnJustification (1, Table::left); + + // Find the task. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + + if (refTask.getId () == task.getId ()) + { + Date now; + + int row = table.addRow (); + table.addCell (row, 0, "ID"); + table.addCell (row, 1, refTask.getId ()); + + row = table.addRow (); + table.addCell (row, 0, "Status"); + table.addCell (row, 1, ( refTask.getStatus () == T::pending ? "Pending" + : refTask.getStatus () == T::completed ? "Completed" + : refTask.getStatus () == T::deleted ? "Deleted" + : refTask.getStatus () == T::recurring ? "Recurring" + : "")); + + row = table.addRow (); + table.addCell (row, 0, "Description"); + table.addCell (row, 1, refTask.getDescription ()); + + if (refTask.getAttribute ("project") != "") + { + row = table.addRow (); + table.addCell (row, 0, "Project"); + table.addCell (row, 1, refTask.getAttribute ("project")); + } + + if (refTask.getAttribute ("priority") != "") + { + row = table.addRow (); + table.addCell (row, 0, "Priority"); + table.addCell (row, 1, refTask.getAttribute ("priority")); + } + + if (refTask.getStatus () == T::recurring) + { + row = table.addRow (); + table.addCell (row, 0, "Recurrence"); + table.addCell (row, 1, refTask.getAttribute ("recur")); + + row = table.addRow (); + table.addCell (row, 0, "Recur until"); + table.addCell (row, 1, refTask.getAttribute ("until")); + } + + // due (colored) + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due != "") + { + row = table.addRow (); + table.addCell (row, 0, "Due"); + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + table.addCell (row, 1, due); + + if (due.length ()) + { + overdue = (dt < now) ? true : false; + Date nextweek = now + 7 * 86400; + imminent = dt < nextweek ? true : false; + + if (conf.get ("color", true)) + { + if (overdue) + table.setCellFg (row, 1, Text::red); + else if (imminent) + table.setCellFg (row, 1, Text::yellow); + } + } + } + + // start + if (refTask.getAttribute ("start") != "") + { + row = table.addRow (); + table.addCell (row, 0, "Start"); + Date dt (::atoi (refTask.getAttribute ("start").c_str ())); + table.addCell (row, 1, dt.toString (conf.get ("dateformat", "m/d/Y"))); + } + + // end + if (refTask.getAttribute ("end") != "") + { + row = table.addRow (); + table.addCell (row, 0, "End"); + Date dt (::atoi (refTask.getAttribute ("end").c_str ())); + table.addCell (row, 1, dt.toString (conf.get ("dateformat", "m/d/Y"))); + } + + // tags ... + std::vector tags; + refTask.getTags (tags); + if (tags.size ()) + { + std::string allTags; + join (allTags, " ", tags); + + row = table.addRow (); + table.addCell (row, 0, "Tags"); + table.addCell (row, 1, allTags); + } + + row = table.addRow (); + table.addCell (row, 0, "UUID"); + table.addCell (row, 1, refTask.getUUID ()); + + row = table.addRow (); + table.addCell (row, 0, "Entered"); + Date dt (::atoi (refTask.getAttribute ("entry").c_str ())); + std::string entry = dt.toString (conf.get ("dateformat", "m/d/Y")); + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + table.addCell (row, 1, entry + " (" + age + ")"); + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. +void handleLongList (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get all the tasks. + tdb.gc (); + std::vector tasks; + tdb.allPendingT (tasks); + handleRecurrence (tdb, tasks); + filter (tasks, task); + + initializeColorRules (conf); + + bool showAge = conf.get ("showage", true); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Entry"); + table.addColumn ("Start"); + table.addColumn ("Due"); + if (showAge) table.addColumn ("Age"); + table.addColumn ("Tags"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + table.setColumnUnderline (6); + table.setColumnUnderline (7); + if (showAge) table.setColumnUnderline (8); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::minimum); + table.setColumnWidth (5, Table::minimum); + if (showAge) table.setColumnWidth (6, Table::minimum); + table.setColumnWidth ((showAge ? 7 : 6), Table::minimum); + table.setColumnWidth ((showAge ? 8 : 7), Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + table.setColumnJustification (4, Table::right); + table.setColumnJustification (5, Table::right); + if (showAge) table.setColumnJustification (6, Table::right); + + table.sortOn (5, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + + Date now; + + std::string started = refTask.getAttribute ("start"); + if (started.length ()) + { + Date dt (::atoi (started.c_str ())); + started = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string entered = refTask.getAttribute ("entry"); + if (entered.length ()) + { + Date dt (::atoi (entered.c_str ())); + entered = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // Make a list of tags. + std::string tags; + std::vector all; + refTask.getTags (all); + join (tags, " ", all); + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, entered); + table.addCell (row, 4, started); + table.addCell (row, 5, due); + if (showAge) table.addCell (row, 6, age); + table.addCell (row, (showAge ? 7 : 6), tags); + table.addCell (row, (showAge ? 8 : 7), refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Project Tasks Avg Age Status +// A 12 13d XXXXXXXX------ +// B 109 3d 12h XX------------ +void handleReportSummary (const TDB& tdb, T& task, Config& conf) +{ + // Generate unique list of project names. + tdb.gc (); + std::map allProjects; + std::vector pending; + tdb.allPendingT (pending); + handleRecurrence (tdb, pending); + filter (pending, task); + for (unsigned int i = 0; i < pending.size (); ++i) + { + T task (pending[i]); + allProjects[task.getAttribute ("project")] = false; + } + + std::vector completed; + tdb.allCompletedT (completed); + filter (completed, task); + for (unsigned int i = 0; i < completed.size (); ++i) + { + T task (completed[i]); + allProjects[task.getAttribute ("project")] = false; + } + + // Initialize counts, sum. + std::map countPending; + std::map countCompleted; + std::map sumEntry; + std::map counter; + time_t now = time (NULL); + + foreach (i, allProjects) + { + countPending [i->first] = 0; + countCompleted [i->first] = 0; + sumEntry [i->first] = 0.0; + counter [i->first] = 0; + } + + // Count the pending tasks. + for (unsigned int i = 0; i < pending.size (); ++i) + { + T task (pending[i]); + std::string project = task.getAttribute ("project"); + if (task.getStatus () == T::pending) + ++countPending[project]; + + time_t entry = ::atoi (task.getAttribute ("entry").c_str ()); + if (entry) + { + sumEntry[project] = sumEntry[project] + (double) (now - entry); + ++counter[project]; + } + } + + // Count the completed tasks. + for (unsigned int i = 0; i < completed.size (); ++i) + { + T task (completed[i]); + std::string project = task.getAttribute ("project"); + countCompleted[project] = countCompleted[project] + 1; + ++counter[project]; + + time_t entry = ::atoi (task.getAttribute ("entry").c_str ()); + time_t end = ::atoi (task.getAttribute ("end").c_str ()); + if (entry && end) + sumEntry[project] = sumEntry[project] + (double) (end - entry); + } + + // Create a table for output. + Table table; + table.addColumn ("Project"); + table.addColumn ("Remaining"); + table.addColumn ("Avg age"); + table.addColumn ("Complete"); + table.addColumn ("0% 100%"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + } + + table.setColumnJustification (1, Table::right); + table.setColumnJustification (2, Table::right); + table.setColumnJustification (3, Table::right); + + table.sortOn (0, Table::ascendingCharacter); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + int barWidth = 30; + foreach (i, allProjects) + { + if (countPending[i->first] > 0) + { + int row = table.addRow (); + table.addCell (row, 0, (i->first == "" ? "(none)" : i->first)); + table.addCell (row, 1, countPending[i->first]); + if (counter[i->first]) + { + std::string age; + formatTimeDeltaDays (age, (time_t) (sumEntry[i->first] / counter[i->first])); + table.addCell (row, 2, age); + } + + int c = countCompleted[i->first]; + int p = countPending[i->first]; + int completedBar = (c * barWidth) / (c + p); + + std::string bar; + if (conf.get ("color", true)) + { + bar = "\033[42m"; + for (int b = 0; b < completedBar; ++b) + bar += " "; + + bar += "\033[40m"; + for (int b = 0; b < barWidth - completedBar; ++b) + bar += " "; + + bar += "\033[0m"; + } + else + { + for (int b = 0; b < completedBar; ++b) + bar += "="; + + for (int b = 0; b < barWidth - completedBar; ++b) + bar += " "; + } + table.addCell (row, 4, bar); + + char percent[12]; + sprintf (percent, "%d%%", 100 * c / (c + p)); + table.addCell (row, 3, percent); + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " project" : " projects") + << std::endl; + else + std::cout << "No projects." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// A summary of the most important pending tasks. +// +// For every project, pull important tasks to present as an 'immediate' task +// list. This hides the overwhelming quantity of other tasks. +// +// Present at most three tasks for every project. Select the tasks using +// these criteria: +// - due:< 1wk, pri:* +// - due:*, pri:H +// - pri:H +// - due:*, pri:M +// - pri:M +// - due:*, pri:L +// - pri:L +// - due:*, pri:* <-- everything else +// +// Make the "three" tasks a configurable number +// +void handleReportNext (const TDB& tdb, T& task, Config& conf) +{ + // Load all pending. + tdb.gc (); + std::vector pending; + tdb.allPendingT (pending); + handleRecurrence (tdb, pending); + filter (pending, task); + + // Restrict to matching subset. + std::vector matching; + gatherNextTasks (tdb, task, conf, pending, matching); + + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + tdb.gc (); + + // Get the pending tasks. + std::vector tasks; + tdb.pendingT (tasks); + filter (tasks, task); + + initializeColorRules (conf); + + bool showAge = conf.get ("showage", true); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Active"); + if (showAge) table.addColumn ("Age"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + if (showAge) table.setColumnUnderline (6); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::minimum); + if (showAge) table.setColumnWidth (5, Table::minimum); + table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + if (showAge) table.setColumnJustification (5, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + // Iterate over each task, and apply selection criteria. + foreach (i, matching) + { + T refTask (pending[*i]); + Date now; + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string active; + if (refTask.getAttribute ("start") != "") + active = "*"; + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, active); + if (showAge) table.addCell (row, 5, age); + table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Year Month Added Completed Deleted +// 2006 November 87 63 14 +// 2006 December 21 6 1 +time_t monthlyEpoch (const std::string& date) +{ + // Convert any date in epoch form to m/d/y, then convert back + // to epoch form for the date m/1/y. + if (date.length ()) + { + Date d1 (::atoi (date.c_str ())); + int m, d, y; + d1.toMDY (m, d, y); + Date d2 (m, 1, y); + time_t epoch; + d2.toEpoch (epoch); + return epoch; + } + + return 0; +} + +void handleReportHistory (const TDB& tdb, T& task, Config& conf) +{ + std::map groups; + std::map addedGroup; + std::map completedGroup; + std::map deletedGroup; + + // Scan the pending tasks. + tdb.gc (); + std::vector pending; + tdb.allPendingT (pending); + handleRecurrence (tdb, pending); + filter (pending, task); + for (unsigned int i = 0; i < pending.size (); ++i) + { + T task (pending[i]); + time_t epoch = monthlyEpoch (task.getAttribute ("entry")); + if (epoch) + { + groups[epoch] = 0; + + if (addedGroup.find (epoch) != addedGroup.end ()) + addedGroup[epoch] = addedGroup[epoch] + 1; + else + addedGroup[epoch] = 1; + + if (task.getStatus () == T::deleted) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (deletedGroup.find (epoch) != deletedGroup.end ()) + deletedGroup[epoch] = deletedGroup[epoch] + 1; + else + deletedGroup[epoch] = 1; + } + else if (task.getStatus () == T::completed) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (completedGroup.find (epoch) != completedGroup.end ()) + completedGroup[epoch] = completedGroup[epoch] + 1; + else + completedGroup[epoch] = 1; + } + } + } + + // Scan the completed tasks. + std::vector completed; + tdb.allCompletedT (completed); + filter (completed, task); + for (unsigned int i = 0; i < completed.size (); ++i) + { + T task (completed[i]); + time_t epoch = monthlyEpoch (task.getAttribute ("entry")); + if (epoch) + { + groups[epoch] = 0; + + if (addedGroup.find (epoch) != addedGroup.end ()) + addedGroup[epoch] = addedGroup[epoch] + 1; + else + addedGroup[epoch] = 1; + + epoch = monthlyEpoch (task.getAttribute ("end")); + if (task.getStatus () == T::deleted) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (deletedGroup.find (epoch) != deletedGroup.end ()) + deletedGroup[epoch] = deletedGroup[epoch] + 1; + else + deletedGroup[epoch] = 1; + } + else if (task.getStatus () == T::completed) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + if (completedGroup.find (epoch) != completedGroup.end ()) + completedGroup[epoch] = completedGroup[epoch] + 1; + else + completedGroup[epoch] = 1; + } + } + } + + // Now build the table. + Table table; + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("Year"); + table.addColumn ("Month"); + table.addColumn ("Added"); + table.addColumn ("Completed"); + table.addColumn ("Deleted"); + table.addColumn ("Net"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + } + + table.setColumnJustification (2, Table::right); + table.setColumnJustification (3, Table::right); + table.setColumnJustification (4, Table::right); + table.setColumnJustification (5, Table::right); + + int totalAdded = 0; + int totalCompleted = 0; + int totalDeleted = 0; + + int priorYear = 0; + int row = 0; + foreach (i, groups) + { + row = table.addRow (); + + totalAdded += addedGroup[i->first]; + totalCompleted += completedGroup[i->first]; + totalDeleted += deletedGroup[i->first]; + + Date dt (i->first); + int m, d, y; + dt.toMDY (m, d, y); + + if (y != priorYear) + { + table.addCell (row, 0, y); + priorYear = y; + } + table.addCell (row, 1, Date::monthName(m)); + + int net = 0; + + if (addedGroup.find (i->first) != addedGroup.end ()) + { + table.addCell (row, 2, addedGroup[i->first]); + net +=addedGroup[i->first]; + } + + if (completedGroup.find (i->first) != completedGroup.end ()) + { + table.addCell (row, 3, completedGroup[i->first]); + net -= completedGroup[i->first]; + } + + if (deletedGroup.find (i->first) != deletedGroup.end ()) + { + table.addCell (row, 4, deletedGroup[i->first]); + net -= deletedGroup[i->first]; + } + + table.addCell (row, 5, net); + if (conf.get ("color", true) && net) + table.setCellFg (row, 5, net > 0 ? Text::red: Text::green); + } + + if (table.rowCount ()) + { + table.addRow (); + row = table.addRow (); + + table.addCell (row, 1, "Average"); + if (conf.get ("color", true)) table.setRowFg (row, Text::bold); + table.addCell (row, 2, totalAdded / (table.rowCount () - 2)); + table.addCell (row, 3, totalCompleted / (table.rowCount () - 2)); + table.addCell (row, 4, totalDeleted / (table.rowCount () - 2)); + table.addCell (row, 5, (totalAdded - totalCompleted - totalDeleted) / (table.rowCount () - 2)); + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << std::endl; + else + std::cout << "No tasks." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleReportGHistory (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + int widthOfBar = width - 15; // strlen ("2008 September ") + + std::map groups; + std::map addedGroup; + std::map completedGroup; + std::map deletedGroup; + + // Scan the pending tasks. + tdb.gc (); + std::vector pending; + tdb.allPendingT (pending); + handleRecurrence (tdb, pending); + filter (pending, task); + for (unsigned int i = 0; i < pending.size (); ++i) + { + T task (pending[i]); + time_t epoch = monthlyEpoch (task.getAttribute ("entry")); + if (epoch) + { + groups[epoch] = 0; + + if (addedGroup.find (epoch) != addedGroup.end ()) + addedGroup[epoch] = addedGroup[epoch] + 1; + else + addedGroup[epoch] = 1; + + if (task.getStatus () == T::deleted) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (deletedGroup.find (epoch) != deletedGroup.end ()) + deletedGroup[epoch] = deletedGroup[epoch] + 1; + else + deletedGroup[epoch] = 1; + } + else if (task.getStatus () == T::completed) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (completedGroup.find (epoch) != completedGroup.end ()) + completedGroup[epoch] = completedGroup[epoch] + 1; + else + completedGroup[epoch] = 1; + } + } + } + + // Scan the completed tasks. + std::vector completed; + tdb.allCompletedT (completed); + filter (completed, task); + for (unsigned int i = 0; i < completed.size (); ++i) + { + T task (completed[i]); + time_t epoch = monthlyEpoch (task.getAttribute ("entry")); + if (epoch) + { + groups[epoch] = 0; + + if (addedGroup.find (epoch) != addedGroup.end ()) + addedGroup[epoch] = addedGroup[epoch] + 1; + else + addedGroup[epoch] = 1; + + epoch = monthlyEpoch (task.getAttribute ("end")); + if (task.getStatus () == T::deleted) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + + if (deletedGroup.find (epoch) != deletedGroup.end ()) + deletedGroup[epoch] = deletedGroup[epoch] + 1; + else + deletedGroup[epoch] = 1; + } + else if (task.getStatus () == T::completed) + { + epoch = monthlyEpoch (task.getAttribute ("end")); + if (completedGroup.find (epoch) != completedGroup.end ()) + completedGroup[epoch] = completedGroup[epoch] + 1; + else + completedGroup[epoch] = 1; + } + } + } + + // Now build the table. + Table table; + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("Year"); + table.addColumn ("Month"); + table.addColumn ("Added/Completed/Deleted"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + + // Determine the longest line. + int maxLine = 0; + foreach (i, groups) + { + int line = addedGroup[i->first] + completedGroup[i->first] + deletedGroup[i->first]; + + if (line > maxLine) + maxLine = line; + } + + if (maxLine > 0) + { + int totalAdded = 0; + int totalCompleted = 0; + int totalDeleted = 0; + + int priorYear = 0; + int row = 0; + foreach (i, groups) + { + row = table.addRow (); + + totalAdded += addedGroup[i->first]; + totalCompleted += completedGroup[i->first]; + totalDeleted += deletedGroup[i->first]; + + Date dt (i->first); + int m, d, y; + dt.toMDY (m, d, y); + + if (y != priorYear) + { + table.addCell (row, 0, y); + priorYear = y; + } + table.addCell (row, 1, Date::monthName(m)); + + unsigned int addedBar = (widthOfBar * addedGroup[i->first]) / maxLine; + unsigned int completedBar = (widthOfBar * completedGroup[i->first]) / maxLine; + unsigned int deletedBar = (widthOfBar * deletedGroup[i->first]) / maxLine; + + std::string bar; + if (conf.get ("color", true)) + { + char number[24]; + std::string aBar = ""; + if (addedGroup[i->first]) + { + sprintf (number, "%d", addedGroup[i->first]); + aBar = number; + while (aBar.length () < addedBar) + aBar = " " + aBar; + } + + std::string cBar = ""; + if (completedGroup[i->first]) + { + sprintf (number, "%d", completedGroup[i->first]); + cBar = number; + while (cBar.length () < completedBar) + cBar = " " + cBar; + } + + std::string dBar = ""; + if (deletedGroup[i->first]) + { + sprintf (number, "%d", deletedGroup[i->first]); + dBar = number; + while (dBar.length () < deletedBar) + dBar = " " + dBar; + } + + bar = Text::colorize (Text::black, Text::on_red, aBar); + bar += Text::colorize (Text::black, Text::on_green, cBar); + bar += Text::colorize (Text::black, Text::on_yellow, dBar); + } + else + { + std::string aBar = ""; while (aBar.length () < addedBar) aBar += "+"; + std::string cBar = ""; while (cBar.length () < completedBar) cBar += "X"; + std::string dBar = ""; while (dBar.length () < deletedBar) dBar += "-"; + + bar = aBar + cBar + dBar; + } + + table.addCell (row, 2, bar); + } + } + + if (table.rowCount ()) + { + std::cout << optionalBlankLine (conf) + << table.render () + << std::endl; + + if (conf.get ("color", true)) + std::cout << "Legend: " + << Text::colorize (Text::black, Text::on_red, "added") + << ", " + << Text::colorize (Text::black, Text::on_green, "completed") + << ", " + << Text::colorize (Text::black, Text::on_yellow, "deleted") + << optionalBlankLine (conf) + << std::endl; + else + std::cout << "Legend: + added, X completed, - deleted" << std::endl; + } + else + std::cout << "No tasks." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// A summary of the command usage. Not useful to users, but used to display +// usage statistics for feedback. +// +// 2006-12-04 19:59:43 "task list" +// +void handleReportUsage (const TDB& tdb, T& task, Config& conf) +{ + if (conf.get ("command.logging") == "on") + { + std::map usage; + std::vector all; + tdb.logRead (all); + for (unsigned int i = 0; i < all.size (); ++i) + { + // 0123456789012345678901 + // v 21 + // 2006-12-04 19:59:43 "task list" + std::string command = all[i].substr (21, all[i].length () - 22); + + // Parse as a command line. + std::vector args; + split (args, command, " "); + + try + { + T task; + std::string commandName; + parse (args, commandName, task, conf); + + usage[commandName]++; + } + + // Deliberately ignore errors from parsing the command log, as there may + // be commands from a prior version of task in there, which were + // abbreviated, and are now ambiguous. + catch (...) {} + } + + // Now render the table. + Table table; + table.addColumn ("Command"); + table.addColumn ("Frequency"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + + table.setColumnJustification (1, Table::right); + table.sortOn (1, Table::descendingNumeric); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + foreach (i, usage) + { + int row = table.addRow (); + table.addCell (row, 0, (i->first == "" ? "(modify)" : i->first)); + table.addCell (row, 1, i->second); + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << std::endl; + else + std::cout << "No usage." << std::endl; + } + else + std::cout << "Command logging is not enabled, so no history has been kept." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +std::string renderMonths ( + int firstMonth, + int firstYear, + const Date& today, + std::vector & all, + Config& conf) +{ + Table table; + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + int monthsPerLine = (conf.get ("monthsperline", 1)); + + // Build table for the number of months to be displayed. + for (int i = 0 ; i < (monthsPerLine * 8); i += 8) + { + table.addColumn (" "); + table.addColumn ("Su"); + table.addColumn ("Mo"); + table.addColumn ("Tu"); + table.addColumn ("We"); + table.addColumn ("Th"); + table.addColumn ("Fr"); + table.addColumn ("Sa"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (i + 1); + table.setColumnUnderline (i + 2); + table.setColumnUnderline (i + 3); + table.setColumnUnderline (i + 4); + table.setColumnUnderline (i + 5); + table.setColumnUnderline (i + 6); + table.setColumnUnderline (i + 7); + } + + table.setColumnJustification (i + 0, Table::right); + table.setColumnJustification (i + 1, Table::right); + table.setColumnJustification (i + 2, Table::right); + table.setColumnJustification (i + 3, Table::right); + table.setColumnJustification (i + 4, Table::right); + table.setColumnJustification (i + 5, Table::right); + table.setColumnJustification (i + 6, Table::right); + table.setColumnJustification (i + 7, Table::right); + } + + // At most, we need 6 rows. + table.addRow (); + table.addRow (); + table.addRow (); + table.addRow (); + table.addRow (); + table.addRow (); + + // Set number of days per month, months to render, and years to render. + std::vector years; + std::vector months; + std::vector daysInMonth; + int thisYear = firstYear; + int thisMonth = firstMonth; + for (int i = 0 ; i < monthsPerLine ; i++) + { + if (thisMonth < 13) + { + years.push_back (thisYear); + } + else + { + thisMonth -= 12; + years.push_back (++thisYear); + } + months.push_back (thisMonth); + daysInMonth.push_back (Date::daysInMonth (thisMonth++, thisYear)); + } + + int row = 0; + + // Loop through months to be added on this line. + for (int c = 0; c < monthsPerLine ; c++) + { + // Reset row counter for subsequent months + if (c != 0) + row = 0; + + // Loop through days in month and add to table. + for (int d = 1; d <= daysInMonth.at (c); ++d) + { + Date temp (months.at (c), d, years.at (c)); + int dow = temp.dayOfWeek (); + int thisCol = dow + 1 + (8 * c); + + table.addCell (row, thisCol, d); + + if (conf.get ("color", true) && + today.day () == d && + today.month () == months.at (c) && + today.year () == years.at (c)) + table.setCellFg (row, thisCol, Text::cyan); + + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + Date due (::atoi (it->getAttribute ("due").c_str ())); + + if (conf.get ("color", true) && + due.day () == d && + due.month () == months.at (c) && + due.year () == years.at (c)) + { + table.setCellFg (row, thisCol, Text::black); + table.setCellBg (row, thisCol, due < today ? Text::on_red : Text::on_yellow); + } + } + + // Check for end of week, and... + if (dow == 6 && d < daysInMonth.at (c)) + row++; + } + } + + return table.render (); +} + +//////////////////////////////////////////////////////////////////////////////// +void handleReportCalendar (const TDB& tdb, T& task, Config& conf) +{ + // Load all the pending tasks. + tdb.gc (); + std::vector pending; + tdb.allPendingT (pending); + handleRecurrence (tdb, pending); + filter (pending, task); + + // Find the oldest pending due date. + Date oldest; + Date newest; + std::vector ::iterator it; + for (it = pending.begin (); it != pending.end (); ++it) + { + if (it->getAttribute ("due") != "") + { + Date d (::atoi (it->getAttribute ("due").c_str ())); + + if (d < oldest) oldest = d; + if (d > newest) newest = d; + } + } + + // Iterate from oldest due month, year to newest month, year. + Date today; + int mFrom = oldest.month (); + int yFrom = oldest.year (); + + int mTo = newest.month (); + int yTo = newest.year (); + + std::cout << std::endl; + std::string output; + + int monthsPerLine = (conf.get ("monthsperline", 1)); + + while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo)) + { + int nextM = mFrom; + int nextY = yFrom; + + // Print month headers (cheating on the width settings, yes) + for (int i = 0 ; i < monthsPerLine ; i++) + { + std::string month = Date::monthName (nextM); + std::cout << month + << " " + << std::setw(23 // one month's output width + - month.length ()// month name length + - 1)// spacer character + << std::left + << nextY; + + if (++nextM > 12) + { + nextM = 1; + nextY++; + } + } + + std::cout << std::endl + << optionalBlankLine (conf) + << renderMonths (mFrom, yFrom, today, pending, conf) + << std::endl; + + mFrom += monthsPerLine; + if (mFrom > 12) + { + mFrom -= 12; + ++yFrom; + } + } + + std::cout << "Legend: " + << Text::colorize (Text::cyan, Text::nocolor, "today") + << ", " + << Text::colorize (Text::black, Text::on_yellow, "due") + << ", " + << Text::colorize (Text::black, Text::on_red, "overdue") + << "." + << optionalBlankLine (conf) + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleReportActive (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get all the tasks. + tdb.gc (); + std::vector tasks; + tdb.pendingT (tasks); + filter (tasks, task); + + initializeColorRules (conf); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + if (refTask.getAttribute ("start") != "") + { + Date now; + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No active tasks." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +void handleReportOverdue (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get all the tasks. + std::vector tasks; + tdb.pendingT (tasks); + filter (tasks, task); + + initializeColorRules (conf); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + Date now; + + // Iterate over each task, and apply selection criteria. + for (unsigned int i = 0; i < tasks.size (); ++i) + { + T refTask (tasks[i]); + std::string due; + if ((due = refTask.getAttribute ("due")) != "") + { + if (due.length ()) + { + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + + // If overdue. + if (dt < now) + { + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + table.setCellFg (row, 3, Text::red); + } + } + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No overdue tasks." << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. +void handleReportOldest (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get the pending tasks. + tdb.gc (); + std::vector tasks; + tdb.allPendingT (tasks); + handleRecurrence (tdb, tasks); + filter (tasks, task); + + initializeColorRules (conf); + + bool showAge = conf.get ("showage", true); + unsigned int quantity = conf.get ("oldest", 10); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Active"); + if (showAge) table.addColumn ("Age"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + if (showAge) table.setColumnUnderline (6); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::minimum); + if (showAge) table.setColumnWidth (5, Table::minimum); + table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + if (showAge) table.setColumnJustification (5, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + for (unsigned int i = 0; i < min (quantity, tasks.size ()); ++i) + { + T refTask (tasks[i]); + Date now; + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string active; + if (refTask.getAttribute ("start") != "") + active = "*"; + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, active); + if (showAge) table.addCell (row, 5, age); + table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + +//////////////////////////////////////////////////////////////////////////////// +// Successively apply filters based on the task object built from the command +// line. Tasks that match all the specified criteria are listed. +void handleReportNewest (const TDB& tdb, T& task, Config& conf) +{ + // Determine window size, and set table accordingly. + int width = conf.get ("defaultwidth", 80); +#ifdef HAVE_LIBNCURSES + if (conf.get ("curses", true)) + { + WINDOW* w = initscr (); + width = w->_maxx + 1; + endwin (); + } +#endif + + // Get the pending tasks. + tdb.gc (); + std::vector tasks; + tdb.allPendingT (tasks); + handleRecurrence (tdb, tasks); + filter (tasks, task); + + initializeColorRules (conf); + + bool showAge = conf.get ("showage", true); + int quantity = conf.get ("newest", 10); + + // Create a table for output. + Table table; + table.setTableWidth (width); + table.addColumn ("ID"); + table.addColumn ("Project"); + table.addColumn ("Pri"); + table.addColumn ("Due"); + table.addColumn ("Active"); + if (showAge) table.addColumn ("Age"); + table.addColumn ("Description"); + + if (conf.get ("color", true)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); + if (showAge) table.setColumnUnderline (6); + } + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::minimum); + table.setColumnWidth (2, Table::minimum); + table.setColumnWidth (3, Table::minimum); + table.setColumnWidth (4, Table::minimum); + if (showAge) table.setColumnWidth (5, Table::minimum); + table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); + + table.setColumnJustification (0, Table::right); + table.setColumnJustification (3, Table::right); + if (showAge) table.setColumnJustification (5, Table::right); + + table.sortOn (3, Table::ascendingDate); + table.sortOn (2, Table::descendingPriority); + table.sortOn (1, Table::ascendingCharacter); + + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + int total = tasks.size (); + for (int i = total - 1; i >= max (0, total - quantity); --i) + { + T refTask (tasks[i]); + Date now; + + // Now format the matching task. + bool imminent = false; + bool overdue = false; + std::string due = refTask.getAttribute ("due"); + if (due.length ()) + { + switch (getDueState (due)) + { + case 2: overdue = true; break; + case 1: imminent = true; break; + case 0: + default: break; + } + + Date dt (::atoi (due.c_str ())); + due = dt.toString (conf.get ("dateformat", "m/d/Y")); + } + + std::string active; + if (refTask.getAttribute ("start") != "") + active = "*"; + + std::string age; + std::string created = refTask.getAttribute ("entry"); + if (created.length ()) + { + Date dt (::atoi (created.c_str ())); + formatTimeDeltaDays (age, (time_t) (now - dt)); + } + + // All criteria match, so add refTask to the output table. + int row = table.addRow (); + table.addCell (row, 0, refTask.getId ()); + table.addCell (row, 1, refTask.getAttribute ("project")); + table.addCell (row, 2, refTask.getAttribute ("priority")); + table.addCell (row, 3, due); + table.addCell (row, 4, active); + if (showAge) table.addCell (row, 5, age); + table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); + + if (conf.get ("color", true)) + { + Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); + Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); + autoColorize (refTask, fg, bg); + table.setRowFg (row, fg); + table.setRowBg (row, bg); + + if (fg == Text::nocolor) + { + if (overdue) + table.setCellFg (row, 3, Text::red); + else if (imminent) + table.setCellFg (row, 3, Text::yellow); + } + } + } + + if (table.rowCount ()) + std::cout << optionalBlankLine (conf) + << table.render () + << optionalBlankLine (conf) + << table.rowCount () + << (table.rowCount () == 1 ? " task" : " tasks") + << std::endl; + else + std::cout << "No matches." + << std::endl; +} + + +//////////////////////////////////////////////////////////////////////////////// +void handleReportStats (const TDB& tdb, T& task, Config& conf) +{ + // Get all the tasks. + std::vector tasks; + tdb.allT (tasks); + filter (tasks, task); + + Date now; + time_t earliest = time (NULL); + time_t latest = 1; + int totalT = 0; + int deletedT = 0; + int pendingT = 0; + int completedT = 0; + int taggedT = 0; + int recurringT = 0; + float daysPending = 0.0; + int descLength = 0; + + std::vector ::iterator it; + for (it = tasks.begin (); it != tasks.end (); ++it) + { + ++totalT; + if (it->getStatus () == T::deleted) ++deletedT; + if (it->getStatus () == T::pending) ++pendingT; + if (it->getStatus () == T::completed) ++completedT; + if (it->getStatus () == T::recurring) ++recurringT; + + time_t entry = ::atoi (it->getAttribute ("entry").c_str ()); + if (entry < earliest) earliest = entry; + if (entry > latest) latest = entry; + + if (it->getStatus () == T::completed) + { + time_t end = ::atoi (it->getAttribute ("end").c_str ()); + daysPending += (end - entry) / 86400.0; + } + + if (it->getStatus () == T::pending) + daysPending += (now - entry) / 86400.0; + + descLength += it->getDescription ().length (); + + std::vector tags; + it->getTags (tags); + if (tags.size ()) ++taggedT; + } + + std::cout << "Pending " << pendingT << std::endl + << "Recurring " << recurringT << std::endl + << "Completed " << completedT << std::endl + << "Deleted " << deletedT << std::endl + << "Total " << totalT << std::endl; + + if (tasks.size ()) + { + Date e (earliest); + std::cout << "Oldest task " << e.toString (conf.get ("dateformat", "m/d/Y")) << std::endl; + Date l (latest); + std::cout << "Newest task " << l.toString (conf.get ("dateformat", "m/d/Y")) << std::endl; + std::cout << "Task used for " << formatSeconds (latest - earliest) << std::endl; + } + + if (totalT) + std::cout << "Task added every " << formatSeconds ((latest - earliest) / totalT) << std::endl; + + if (completedT) + std::cout << "Task completed every " << formatSeconds ((latest - earliest) / completedT) << std::endl; + + if (deletedT) + std::cout << "Task deleted every " << formatSeconds ((latest - earliest) / deletedT) << std::endl; + + if (pendingT || completedT) + std::cout << "Average time pending " + << formatSeconds ((int) ((daysPending / (pendingT + completedT)) * 86400)) + << std::endl; + + if (totalT) + { + std::cout << "Average desc length " << (int) (descLength / totalT) << " characters" << std::endl; + std::cout << "Tasks tagged " << std::setprecision (3) << (100.0 * taggedT / totalT) << "%" << std::endl; + } +} + +//////////////////////////////////////////////////////////////////////////////// +void gatherNextTasks ( + const TDB& tdb, + T& task, + Config& conf, + std::vector & pending, + std::vector & all) +{ + // For counting tasks by project. + std::map countByProject; + std::map matching; + + Date now; + + // How many items per project? Default 3. + int limit = conf.get ("next", 3); + + // due:< 1wk, pri:* + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string due = pending[i].getAttribute ("due"); + if (due != "") + { + Date d (::atoi (due.c_str ())); + if (d < now + (7 * 24 * 60 * 60)) // if due:< 1wk + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + } + + // due:*, pri:H + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string due = pending[i].getAttribute ("due"); + if (due != "") + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "H") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + } + + // pri:H + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "H") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + + // due:*, pri:M + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string due = pending[i].getAttribute ("due"); + if (due != "") + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "M") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + } + + // pri:M + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "M") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + + // due:*, pri:L + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string due = pending[i].getAttribute ("due"); + if (due != "") + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "L") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + } + + // pri:L + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "L") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + + // due:, pri: + for (unsigned int i = 0; i < pending.size (); ++i) + { + if (pending[i].getStatus () == T::pending) + { + std::string due = pending[i].getAttribute ("due"); + if (due == "") + { + std::string priority = pending[i].getAttribute ("priority"); + if (priority == "") + { + std::string project = pending[i].getAttribute ("project"); + if (countByProject[project] < limit && matching.find (i) == matching.end ()) + { + ++countByProject[project]; + matching[i] = true; + } + } + } + } + } + + // Convert map to vector. + foreach (i, matching) + all.push_back (i->first); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.cpp b/src/task.cpp index fe73dca1a..b324daa56 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -344,3113 +344,6 @@ int main (int argc, char** argv) return 0; } -//////////////////////////////////////////////////////////////////////////////// -static void filter (std::vector& all, T& task) -{ - std::vector filtered; - - // Split any description specified into words. - std::vector descWords; - split (descWords, lowerCase (task.getDescription ()), ' '); - - // Get all the tags to match against. - std::vector tagList; - task.getTags (tagList); - - // Get all the attributes to match against. - std::map attrList; - task.getAttributes (attrList); - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < all.size (); ++i) - { - T refTask (all[i]); - - // Apply description filter. - std::string desc = lowerCase (refTask.getDescription ()); - unsigned int matches = 0; - for (unsigned int w = 0; w < descWords.size (); ++w) - if (desc.find (descWords[w]) != std::string::npos) - ++matches; - - if (matches == descWords.size ()) - { - // Apply attribute filter. - matches = 0; - foreach (a, attrList) - if (a->first == "project") - { - if (a->second.length () <= refTask.getAttribute (a->first).length ()) - if (a->second == refTask.getAttribute (a->first).substr (0, a->second.length ())) - ++matches; - } - else if (a->second == refTask.getAttribute (a->first)) - ++matches; - - if (matches == attrList.size ()) - { - // Apply tag filter. - matches = 0; - for (unsigned int t = 0; t < tagList.size (); ++t) - if (refTask.hasTag (tagList[t])) - ++matches; - - if (matches == tagList.size ()) - filtered.push_back (refTask); - } - } - } - - all = filtered; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleAdd (const TDB& tdb, T& task, Config& conf) -{ - char entryTime[16]; - sprintf (entryTime, "%u", (unsigned int) time (NULL)); - task.setAttribute ("entry", entryTime); - - std::map atts; - task.getAttributes (atts); - foreach (i, atts) - { - if (i->second == "") - task.removeAttribute (i->first); - } - - // Recurring tasks get a special status. - if (task.getAttribute ("due") != "" && - task.getAttribute ("recur") != "") - { - task.setStatus (T::recurring); - } - - if (task.getDescription () == "") - throw std::string ("Cannot add a blank task."); - - if (!tdb.addT (task)) - throw std::string ("Could not create new task."); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleProjects (const TDB& tdb, T& task, Config& conf) -{ - // Get all the tasks, including deleted ones. - std::vector tasks; - tdb.pendingT (tasks); - - // Scan all the tasks for their project name, building a map using project - // names as keys. - std::map unique; - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T task (tasks[i]); - unique[task.getAttribute ("project")] += 1; - } - - if (unique.size ()) - { - // Render a list of project names from the map. - Table table; - table.addColumn ("Project"); - table.addColumn ("Tasks"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - - table.setColumnJustification (1, Table::right); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - foreach (i, unique) - { - int row = table.addRow (); - table.addCell (row, 0, i->first); - table.addCell (row, 1, i->second); - } - - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << unique.size () - << (unique.size () == 1 ? " project" : " projects") - << std::endl; - } - else - std::cout << "No projects." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleTags (const TDB& tdb, T& task, Config& conf) -{ - // Get all the tasks. - std::vector tasks; - tdb.pendingT (tasks); - - // Scan all the tasks for their project name, building a map using project - // names as keys. - std::map unique; - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T task (tasks[i]); - - std::vector tags; - task.getTags (tags); - - for (unsigned int t = 0; t < tags.size (); ++t) - unique[tags[t]] = ""; - } - - // Render a list of tag names from the map. - std::cout << optionalBlankLine (conf); - foreach (i, unique) - std::cout << i->first << std::endl; - - if (unique.size ()) - std::cout << optionalBlankLine (conf) - << unique.size () - << (unique.size () == 1 ? " tag" : " tags") - << std::endl; - else - std::cout << "No tags." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. -void handleList (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get the pending tasks. - tdb.gc (); - std::vector tasks; - tdb.allPendingT (tasks); - handleRecurrence (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - bool showAge = conf.get ("showage", true); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Active"); - if (showAge) table.addColumn ("Age"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - if (showAge) table.setColumnUnderline (6); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::minimum); - if (showAge) table.setColumnWidth (5, Table::minimum); - table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - if (showAge) table.setColumnJustification (5, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - if (refTask.getStatus () != T::pending) - continue; - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string active; - if (refTask.getAttribute ("start") != "") - active = "*"; - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date now; - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, active); - if (showAge) table.addCell (row, 5, age); - table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. Show a narrow -// list that works better on mobile devices. -void handleSmallList (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get the pending tasks. - tdb.gc (); - std::vector tasks; - tdb.allPendingT (tasks); - handleRecurrence (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::left); - - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string active; - if (refTask.getAttribute ("start") != "") - active = "*"; - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date now; - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. -void handleCompleted (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get the pending tasks. - tdb.gc (); - std::vector tasks; - tdb.completedT (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("Done"); - table.addColumn ("Project"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (1, Table::left); - table.setColumnJustification (2, Table::left); - - table.sortOn (0, Table::ascendingDate); - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - - // Now format the matching task. - Date end (::atoi (refTask.getAttribute ("end").c_str ())); - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - - table.addCell (row, 0, end.toString (conf.get ("dateformat", "m/d/Y"))); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Display all information for the given task. -void handleInfo (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get all the tasks. - std::vector tasks; - tdb.allPendingT (tasks); - - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - table.addColumn ("Name"); - table.addColumn ("Value"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - - table.setColumnJustification (0, Table::left); - table.setColumnJustification (1, Table::left); - - // Find the task. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - - if (refTask.getId () == task.getId ()) - { - Date now; - - int row = table.addRow (); - table.addCell (row, 0, "ID"); - table.addCell (row, 1, refTask.getId ()); - - row = table.addRow (); - table.addCell (row, 0, "Status"); - table.addCell (row, 1, ( refTask.getStatus () == T::pending ? "Pending" - : refTask.getStatus () == T::completed ? "Completed" - : refTask.getStatus () == T::deleted ? "Deleted" - : refTask.getStatus () == T::recurring ? "Recurring" - : "")); - - row = table.addRow (); - table.addCell (row, 0, "Description"); - table.addCell (row, 1, refTask.getDescription ()); - - if (refTask.getAttribute ("project") != "") - { - row = table.addRow (); - table.addCell (row, 0, "Project"); - table.addCell (row, 1, refTask.getAttribute ("project")); - } - - if (refTask.getAttribute ("priority") != "") - { - row = table.addRow (); - table.addCell (row, 0, "Priority"); - table.addCell (row, 1, refTask.getAttribute ("priority")); - } - - if (refTask.getStatus () == T::recurring) - { - row = table.addRow (); - table.addCell (row, 0, "Recurrence"); - table.addCell (row, 1, refTask.getAttribute ("recur")); - - row = table.addRow (); - table.addCell (row, 0, "Recur until"); - table.addCell (row, 1, refTask.getAttribute ("until")); - } - - // due (colored) - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due != "") - { - row = table.addRow (); - table.addCell (row, 0, "Due"); - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - table.addCell (row, 1, due); - - if (due.length ()) - { - overdue = (dt < now) ? true : false; - Date nextweek = now + 7 * 86400; - imminent = dt < nextweek ? true : false; - - if (conf.get ("color", true)) - { - if (overdue) - table.setCellFg (row, 1, Text::red); - else if (imminent) - table.setCellFg (row, 1, Text::yellow); - } - } - } - - // start - if (refTask.getAttribute ("start") != "") - { - row = table.addRow (); - table.addCell (row, 0, "Start"); - Date dt (::atoi (refTask.getAttribute ("start").c_str ())); - table.addCell (row, 1, dt.toString (conf.get ("dateformat", "m/d/Y"))); - } - - // end - if (refTask.getAttribute ("end") != "") - { - row = table.addRow (); - table.addCell (row, 0, "End"); - Date dt (::atoi (refTask.getAttribute ("end").c_str ())); - table.addCell (row, 1, dt.toString (conf.get ("dateformat", "m/d/Y"))); - } - - // tags ... - std::vector tags; - refTask.getTags (tags); - if (tags.size ()) - { - std::string allTags; - join (allTags, " ", tags); - - row = table.addRow (); - table.addCell (row, 0, "Tags"); - table.addCell (row, 1, allTags); - } - - row = table.addRow (); - table.addCell (row, 0, "UUID"); - table.addCell (row, 1, refTask.getUUID ()); - - row = table.addRow (); - table.addCell (row, 0, "Entered"); - Date dt (::atoi (refTask.getAttribute ("entry").c_str ())); - std::string entry = dt.toString (conf.get ("dateformat", "m/d/Y")); - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - table.addCell (row, 1, entry + " (" + age + ")"); - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// If a task is deleted, but is still in the pending file, then it may be -// undeleted simply by changing it's status. -void handleUndelete (const TDB& tdb, T& task, Config& conf) -{ - std::vector all; - tdb.allPendingT (all); - - int id = task.getId (); - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - { - if (it->getId () == id) - { - if (it->getStatus () == T::deleted) - { - if (it->getAttribute ("recur") != "") - { - std::cout << "Task does not support 'undelete' for recurring tasks." << std::endl; - return; - } - - T restored (*it); - restored.setStatus (T::pending); - restored.removeAttribute ("end"); - tdb.modifyT (restored); - - std::cout << "Task " << id << " successfully undeleted." << std::endl; - return; - } - else - { - std::cout << "Task " << id << " is not deleted - therefore cannot undelete." << std::endl; - return; - } - } - } - - std::cout << "Task " << id - << " not found - tasks can only be reliably undeleted if the undelete" << std::endl - << "command is run immediately after the errant delete command." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. -void handleLongList (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get all the tasks. - tdb.gc (); - std::vector tasks; - tdb.allPendingT (tasks); - handleRecurrence (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - bool showAge = conf.get ("showage", true); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Entry"); - table.addColumn ("Start"); - table.addColumn ("Due"); - if (showAge) table.addColumn ("Age"); - table.addColumn ("Tags"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - table.setColumnUnderline (6); - table.setColumnUnderline (7); - if (showAge) table.setColumnUnderline (8); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::minimum); - table.setColumnWidth (5, Table::minimum); - if (showAge) table.setColumnWidth (6, Table::minimum); - table.setColumnWidth ((showAge ? 7 : 6), Table::minimum); - table.setColumnWidth ((showAge ? 8 : 7), Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - table.setColumnJustification (4, Table::right); - table.setColumnJustification (5, Table::right); - if (showAge) table.setColumnJustification (6, Table::right); - - table.sortOn (5, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - - Date now; - - std::string started = refTask.getAttribute ("start"); - if (started.length ()) - { - Date dt (::atoi (started.c_str ())); - started = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string entered = refTask.getAttribute ("entry"); - if (entered.length ()) - { - Date dt (::atoi (entered.c_str ())); - entered = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // Make a list of tags. - std::string tags; - std::vector all; - refTask.getTags (all); - join (tags, " ", all); - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, entered); - table.addCell (row, 4, started); - table.addCell (row, 5, due); - if (showAge) table.addCell (row, 6, age); - table.addCell (row, (showAge ? 7 : 6), tags); - table.addCell (row, (showAge ? 8 : 7), refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Project Tasks Avg Age Status -// A 12 13d XXXXXXXX------ -// B 109 3d 12h XX------------ -void handleReportSummary (const TDB& tdb, T& task, Config& conf) -{ - // Generate unique list of project names. - tdb.gc (); - std::map allProjects; - std::vector pending; - tdb.allPendingT (pending); - handleRecurrence (pending); - filter (pending, task); - for (unsigned int i = 0; i < pending.size (); ++i) - { - T task (pending[i]); - allProjects[task.getAttribute ("project")] = false; - } - - std::vector completed; - tdb.allCompletedT (completed); - filter (completed, task); - for (unsigned int i = 0; i < completed.size (); ++i) - { - T task (completed[i]); - allProjects[task.getAttribute ("project")] = false; - } - - // Initialize counts, sum. - std::map countPending; - std::map countCompleted; - std::map sumEntry; - std::map counter; - time_t now = time (NULL); - - foreach (i, allProjects) - { - countPending [i->first] = 0; - countCompleted [i->first] = 0; - sumEntry [i->first] = 0.0; - counter [i->first] = 0; - } - - // Count the pending tasks. - for (unsigned int i = 0; i < pending.size (); ++i) - { - T task (pending[i]); - std::string project = task.getAttribute ("project"); - if (task.getStatus () == T::pending) - ++countPending[project]; - - time_t entry = ::atoi (task.getAttribute ("entry").c_str ()); - if (entry) - { - sumEntry[project] = sumEntry[project] + (double) (now - entry); - ++counter[project]; - } - } - - // Count the completed tasks. - for (unsigned int i = 0; i < completed.size (); ++i) - { - T task (completed[i]); - std::string project = task.getAttribute ("project"); - countCompleted[project] = countCompleted[project] + 1; - ++counter[project]; - - time_t entry = ::atoi (task.getAttribute ("entry").c_str ()); - time_t end = ::atoi (task.getAttribute ("end").c_str ()); - if (entry && end) - sumEntry[project] = sumEntry[project] + (double) (end - entry); - } - - // Create a table for output. - Table table; - table.addColumn ("Project"); - table.addColumn ("Remaining"); - table.addColumn ("Avg age"); - table.addColumn ("Complete"); - table.addColumn ("0% 100%"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - } - - table.setColumnJustification (1, Table::right); - table.setColumnJustification (2, Table::right); - table.setColumnJustification (3, Table::right); - - table.sortOn (0, Table::ascendingCharacter); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - int barWidth = 30; - foreach (i, allProjects) - { - if (countPending[i->first] > 0) - { - int row = table.addRow (); - table.addCell (row, 0, (i->first == "" ? "(none)" : i->first)); - table.addCell (row, 1, countPending[i->first]); - if (counter[i->first]) - { - std::string age; - formatTimeDeltaDays (age, (time_t) (sumEntry[i->first] / counter[i->first])); - table.addCell (row, 2, age); - } - - int c = countCompleted[i->first]; - int p = countPending[i->first]; - int completedBar = (c * barWidth) / (c + p); - - std::string bar; - if (conf.get ("color", true)) - { - bar = "\033[42m"; - for (int b = 0; b < completedBar; ++b) - bar += " "; - - bar += "\033[40m"; - for (int b = 0; b < barWidth - completedBar; ++b) - bar += " "; - - bar += "\033[0m"; - } - else - { - for (int b = 0; b < completedBar; ++b) - bar += "="; - - for (int b = 0; b < barWidth - completedBar; ++b) - bar += " "; - } - table.addCell (row, 4, bar); - - char percent[12]; - sprintf (percent, "%d%%", 100 * c / (c + p)); - table.addCell (row, 3, percent); - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " project" : " projects") - << std::endl; - else - std::cout << "No projects." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// A summary of the most important pending tasks. -// -// For every project, pull important tasks to present as an 'immediate' task -// list. This hides the overwhelming quantity of other tasks. -// -// Present at most three tasks for every project. Select the tasks using -// these criteria: -// - due:< 1wk, pri:* -// - due:*, pri:H -// - pri:H -// - due:*, pri:M -// - pri:M -// - due:*, pri:L -// - pri:L -// - due:*, pri:* <-- everything else -// -// Make the "three" tasks a configurable number -// -void handleReportNext (const TDB& tdb, T& task, Config& conf) -{ - // Load all pending. - tdb.gc (); - std::vector pending; - tdb.allPendingT (pending); - handleRecurrence (pending); - filter (pending, task); - - // Restrict to matching subset. - std::vector matching; - gatherNextTasks (tdb, task, conf, pending, matching); - - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - tdb.gc (); - - // Get the pending tasks. - std::vector tasks; - tdb.pendingT (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - bool showAge = conf.get ("showage", true); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Active"); - if (showAge) table.addColumn ("Age"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - if (showAge) table.setColumnUnderline (6); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::minimum); - if (showAge) table.setColumnWidth (5, Table::minimum); - table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - if (showAge) table.setColumnJustification (5, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - // Iterate over each task, and apply selection criteria. - foreach (i, matching) - { - T refTask (pending[*i]); - Date now; - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string active; - if (refTask.getAttribute ("start") != "") - active = "*"; - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, active); - if (showAge) table.addCell (row, 5, age); - table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Year Month Added Completed Deleted -// 2006 November 87 63 14 -// 2006 December 21 6 1 -time_t monthlyEpoch (const std::string& date) -{ - // Convert any date in epoch form to m/d/y, then convert back - // to epoch form for the date m/1/y. - if (date.length ()) - { - Date d1 (::atoi (date.c_str ())); - int m, d, y; - d1.toMDY (m, d, y); - Date d2 (m, 1, y); - time_t epoch; - d2.toEpoch (epoch); - return epoch; - } - - return 0; -} - -void handleReportHistory (const TDB& tdb, T& task, Config& conf) -{ - std::map groups; - std::map addedGroup; - std::map completedGroup; - std::map deletedGroup; - - // Scan the pending tasks. - tdb.gc (); - std::vector pending; - tdb.allPendingT (pending); - handleRecurrence (pending); - filter (pending, task); - for (unsigned int i = 0; i < pending.size (); ++i) - { - T task (pending[i]); - time_t epoch = monthlyEpoch (task.getAttribute ("entry")); - if (epoch) - { - groups[epoch] = 0; - - if (addedGroup.find (epoch) != addedGroup.end ()) - addedGroup[epoch] = addedGroup[epoch] + 1; - else - addedGroup[epoch] = 1; - - if (task.getStatus () == T::deleted) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (deletedGroup.find (epoch) != deletedGroup.end ()) - deletedGroup[epoch] = deletedGroup[epoch] + 1; - else - deletedGroup[epoch] = 1; - } - else if (task.getStatus () == T::completed) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (completedGroup.find (epoch) != completedGroup.end ()) - completedGroup[epoch] = completedGroup[epoch] + 1; - else - completedGroup[epoch] = 1; - } - } - } - - // Scan the completed tasks. - std::vector completed; - tdb.allCompletedT (completed); - filter (completed, task); - for (unsigned int i = 0; i < completed.size (); ++i) - { - T task (completed[i]); - time_t epoch = monthlyEpoch (task.getAttribute ("entry")); - if (epoch) - { - groups[epoch] = 0; - - if (addedGroup.find (epoch) != addedGroup.end ()) - addedGroup[epoch] = addedGroup[epoch] + 1; - else - addedGroup[epoch] = 1; - - epoch = monthlyEpoch (task.getAttribute ("end")); - if (task.getStatus () == T::deleted) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (deletedGroup.find (epoch) != deletedGroup.end ()) - deletedGroup[epoch] = deletedGroup[epoch] + 1; - else - deletedGroup[epoch] = 1; - } - else if (task.getStatus () == T::completed) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - if (completedGroup.find (epoch) != completedGroup.end ()) - completedGroup[epoch] = completedGroup[epoch] + 1; - else - completedGroup[epoch] = 1; - } - } - } - - // Now build the table. - Table table; - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("Year"); - table.addColumn ("Month"); - table.addColumn ("Added"); - table.addColumn ("Completed"); - table.addColumn ("Deleted"); - table.addColumn ("Net"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - } - - table.setColumnJustification (2, Table::right); - table.setColumnJustification (3, Table::right); - table.setColumnJustification (4, Table::right); - table.setColumnJustification (5, Table::right); - - int totalAdded = 0; - int totalCompleted = 0; - int totalDeleted = 0; - - int priorYear = 0; - int row = 0; - foreach (i, groups) - { - row = table.addRow (); - - totalAdded += addedGroup[i->first]; - totalCompleted += completedGroup[i->first]; - totalDeleted += deletedGroup[i->first]; - - Date dt (i->first); - int m, d, y; - dt.toMDY (m, d, y); - - if (y != priorYear) - { - table.addCell (row, 0, y); - priorYear = y; - } - table.addCell (row, 1, Date::monthName(m)); - - int net = 0; - - if (addedGroup.find (i->first) != addedGroup.end ()) - { - table.addCell (row, 2, addedGroup[i->first]); - net +=addedGroup[i->first]; - } - - if (completedGroup.find (i->first) != completedGroup.end ()) - { - table.addCell (row, 3, completedGroup[i->first]); - net -= completedGroup[i->first]; - } - - if (deletedGroup.find (i->first) != deletedGroup.end ()) - { - table.addCell (row, 4, deletedGroup[i->first]); - net -= deletedGroup[i->first]; - } - - table.addCell (row, 5, net); - if (conf.get ("color", true) && net) - table.setCellFg (row, 5, net > 0 ? Text::red: Text::green); - } - - if (table.rowCount ()) - { - table.addRow (); - row = table.addRow (); - - table.addCell (row, 1, "Average"); - if (conf.get ("color", true)) table.setRowFg (row, Text::bold); - table.addCell (row, 2, totalAdded / (table.rowCount () - 2)); - table.addCell (row, 3, totalCompleted / (table.rowCount () - 2)); - table.addCell (row, 4, totalDeleted / (table.rowCount () - 2)); - table.addCell (row, 5, (totalAdded - totalCompleted - totalDeleted) / (table.rowCount () - 2)); - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << std::endl; - else - std::cout << "No tasks." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleReportGHistory (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - int widthOfBar = width - 15; // strlen ("2008 September ") - - std::map groups; - std::map addedGroup; - std::map completedGroup; - std::map deletedGroup; - - // Scan the pending tasks. - tdb.gc (); - std::vector pending; - tdb.allPendingT (pending); - handleRecurrence (pending); - filter (pending, task); - for (unsigned int i = 0; i < pending.size (); ++i) - { - T task (pending[i]); - time_t epoch = monthlyEpoch (task.getAttribute ("entry")); - if (epoch) - { - groups[epoch] = 0; - - if (addedGroup.find (epoch) != addedGroup.end ()) - addedGroup[epoch] = addedGroup[epoch] + 1; - else - addedGroup[epoch] = 1; - - if (task.getStatus () == T::deleted) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (deletedGroup.find (epoch) != deletedGroup.end ()) - deletedGroup[epoch] = deletedGroup[epoch] + 1; - else - deletedGroup[epoch] = 1; - } - else if (task.getStatus () == T::completed) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (completedGroup.find (epoch) != completedGroup.end ()) - completedGroup[epoch] = completedGroup[epoch] + 1; - else - completedGroup[epoch] = 1; - } - } - } - - // Scan the completed tasks. - std::vector completed; - tdb.allCompletedT (completed); - filter (completed, task); - for (unsigned int i = 0; i < completed.size (); ++i) - { - T task (completed[i]); - time_t epoch = monthlyEpoch (task.getAttribute ("entry")); - if (epoch) - { - groups[epoch] = 0; - - if (addedGroup.find (epoch) != addedGroup.end ()) - addedGroup[epoch] = addedGroup[epoch] + 1; - else - addedGroup[epoch] = 1; - - epoch = monthlyEpoch (task.getAttribute ("end")); - if (task.getStatus () == T::deleted) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - - if (deletedGroup.find (epoch) != deletedGroup.end ()) - deletedGroup[epoch] = deletedGroup[epoch] + 1; - else - deletedGroup[epoch] = 1; - } - else if (task.getStatus () == T::completed) - { - epoch = monthlyEpoch (task.getAttribute ("end")); - if (completedGroup.find (epoch) != completedGroup.end ()) - completedGroup[epoch] = completedGroup[epoch] + 1; - else - completedGroup[epoch] = 1; - } - } - } - - // Now build the table. - Table table; - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("Year"); - table.addColumn ("Month"); - table.addColumn ("Added/Completed/Deleted"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - - // Determine the longest line. - int maxLine = 0; - foreach (i, groups) - { - int line = addedGroup[i->first] + completedGroup[i->first] + deletedGroup[i->first]; - - if (line > maxLine) - maxLine = line; - } - - if (maxLine > 0) - { - int totalAdded = 0; - int totalCompleted = 0; - int totalDeleted = 0; - - int priorYear = 0; - int row = 0; - foreach (i, groups) - { - row = table.addRow (); - - totalAdded += addedGroup[i->first]; - totalCompleted += completedGroup[i->first]; - totalDeleted += deletedGroup[i->first]; - - Date dt (i->first); - int m, d, y; - dt.toMDY (m, d, y); - - if (y != priorYear) - { - table.addCell (row, 0, y); - priorYear = y; - } - table.addCell (row, 1, Date::monthName(m)); - - unsigned int addedBar = (widthOfBar * addedGroup[i->first]) / maxLine; - unsigned int completedBar = (widthOfBar * completedGroup[i->first]) / maxLine; - unsigned int deletedBar = (widthOfBar * deletedGroup[i->first]) / maxLine; - - std::string bar; - if (conf.get ("color", true)) - { - char number[24]; - std::string aBar = ""; - if (addedGroup[i->first]) - { - sprintf (number, "%d", addedGroup[i->first]); - aBar = number; - while (aBar.length () < addedBar) - aBar = " " + aBar; - } - - std::string cBar = ""; - if (completedGroup[i->first]) - { - sprintf (number, "%d", completedGroup[i->first]); - cBar = number; - while (cBar.length () < completedBar) - cBar = " " + cBar; - } - - std::string dBar = ""; - if (deletedGroup[i->first]) - { - sprintf (number, "%d", deletedGroup[i->first]); - dBar = number; - while (dBar.length () < deletedBar) - dBar = " " + dBar; - } - - bar = Text::colorize (Text::black, Text::on_green, aBar); - bar += Text::colorize (Text::black, Text::on_yellow, cBar); - bar += Text::colorize (Text::black, Text::on_red, dBar); - } - else - { - std::string aBar = ""; while (aBar.length () < addedBar) aBar += "+"; - std::string cBar = ""; while (cBar.length () < completedBar) cBar += "X"; - std::string dBar = ""; while (dBar.length () < deletedBar) dBar += "-"; - - bar = aBar + cBar + dBar; - } - - table.addCell (row, 2, bar); - } - } - - if (table.rowCount ()) - { - std::cout << optionalBlankLine (conf) - << table.render () - << std::endl; - - if (conf.get ("color", true)) - std::cout << "Legend: " - << Text::colorize (Text::black, Text::on_green, "added") - << ", " - << Text::colorize (Text::black, Text::on_yellow, "completed") - << ", " - << Text::colorize (Text::black, Text::on_red, "deleted") - << optionalBlankLine (conf) - << std::endl; - else - std::cout << "Legend: + added, X completed, - deleted" << std::endl; - } - else - std::cout << "No tasks." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// A summary of the command usage. Not useful to users, but used to display -// usage statistics for feedback. -// -// 2006-12-04 19:59:43 "task list" -// -void handleReportUsage (const TDB& tdb, T& task, Config& conf) -{ - if (conf.get ("command.logging") == "on") - { - std::map usage; - std::vector all; - tdb.logRead (all); - for (unsigned int i = 0; i < all.size (); ++i) - { - // 0123456789012345678901 - // v 21 - // 2006-12-04 19:59:43 "task list" - std::string command = all[i].substr (21, all[i].length () - 22); - - // Parse as a command line. - std::vector args; - split (args, command, " "); - - try - { - T task; - std::string commandName; - parse (args, commandName, task, conf); - - usage[commandName]++; - } - - // Deliberately ignore errors from parsing the command log, as there may - // be commands from a prior version of task in there, which were - // abbreviated, and are now ambiguous. - catch (...) {} - } - - // Now render the table. - Table table; - table.addColumn ("Command"); - table.addColumn ("Frequency"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - - table.setColumnJustification (1, Table::right); - table.sortOn (1, Table::descendingNumeric); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - foreach (i, usage) - { - int row = table.addRow (); - table.addCell (row, 0, (i->first == "" ? "(modify)" : i->first)); - table.addCell (row, 1, i->second); - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << std::endl; - else - std::cout << "No usage." << std::endl; - } - else - std::cout << "Command logging is not enabled, so no history has been kept." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string renderMonths ( - int firstMonth, - int firstYear, - const Date& today, - std::vector & all, - Config& conf) -{ - Table table; - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - int monthsPerLine = (conf.get ("monthsperline", 1)); - - // Build table for the number of months to be displayed. - for (int i = 0 ; i < (monthsPerLine * 8); i += 8) - { - table.addColumn (" "); - table.addColumn ("Su"); - table.addColumn ("Mo"); - table.addColumn ("Tu"); - table.addColumn ("We"); - table.addColumn ("Th"); - table.addColumn ("Fr"); - table.addColumn ("Sa"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (i + 1); - table.setColumnUnderline (i + 2); - table.setColumnUnderline (i + 3); - table.setColumnUnderline (i + 4); - table.setColumnUnderline (i + 5); - table.setColumnUnderline (i + 6); - table.setColumnUnderline (i + 7); - } - - table.setColumnJustification (i + 0, Table::right); - table.setColumnJustification (i + 1, Table::right); - table.setColumnJustification (i + 2, Table::right); - table.setColumnJustification (i + 3, Table::right); - table.setColumnJustification (i + 4, Table::right); - table.setColumnJustification (i + 5, Table::right); - table.setColumnJustification (i + 6, Table::right); - table.setColumnJustification (i + 7, Table::right); - } - - // At most, we need 6 rows. - table.addRow (); - table.addRow (); - table.addRow (); - table.addRow (); - table.addRow (); - table.addRow (); - - // Set number of days per month, months to render, and years to render. - std::vector years; - std::vector months; - std::vector daysInMonth; - int thisYear = firstYear; - int thisMonth = firstMonth; - for (int i = 0 ; i < monthsPerLine ; i++) - { - if (thisMonth < 13) - { - years.push_back (thisYear); - } - else - { - thisMonth -= 12; - years.push_back (++thisYear); - } - months.push_back (thisMonth); - daysInMonth.push_back (Date::daysInMonth (thisMonth++, thisYear)); - } - - int row = 0; - - // Loop through months to be added on this line. - for (int c = 0; c < monthsPerLine ; c++) - { - // Reset row counter for subsequent months - if (c != 0) - row = 0; - - // Loop through days in month and add to table. - for (int d = 1; d <= daysInMonth.at (c); ++d) - { - Date temp (months.at (c), d, years.at (c)); - int dow = temp.dayOfWeek (); - int thisCol = dow + 1 + (8 * c); - - table.addCell (row, thisCol, d); - - if (conf.get ("color", true) && - today.day () == d && - today.month () == months.at (c) && - today.year () == years.at (c)) - table.setCellFg (row, thisCol, Text::cyan); - - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - { - Date due (::atoi (it->getAttribute ("due").c_str ())); - - if (conf.get ("color", true) && - due.day () == d && - due.month () == months.at (c) && - due.year () == years.at (c)) - { - table.setCellFg (row, thisCol, Text::black); - table.setCellBg (row, thisCol, due < today ? Text::on_red : Text::on_yellow); - } - } - - // Check for end of week, and... - if (dow == 6 && d < daysInMonth.at (c)) - row++; - } - } - - return table.render (); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleReportCalendar (const TDB& tdb, T& task, Config& conf) -{ - // Load all the pending tasks. - tdb.gc (); - std::vector pending; - tdb.allPendingT (pending); - handleRecurrence (pending); - filter (pending, task); - - // Find the oldest pending due date. - Date oldest; - Date newest; - std::vector ::iterator it; - for (it = pending.begin (); it != pending.end (); ++it) - { - if (it->getAttribute ("due") != "") - { - Date d (::atoi (it->getAttribute ("due").c_str ())); - - if (d < oldest) oldest = d; - if (d > newest) newest = d; - } - } - - // Iterate from oldest due month, year to newest month, year. - Date today; - int mFrom = oldest.month (); - int yFrom = oldest.year (); - - int mTo = newest.month (); - int yTo = newest.year (); - - std::cout << std::endl; - std::string output; - - int monthsPerLine = (conf.get ("monthsperline", 1)); - - while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo)) - { - int nextM = mFrom; - int nextY = yFrom; - - // Print month headers (cheating on the width settings, yes) - for (int i = 0 ; i < monthsPerLine ; i++) - { - std::string month = Date::monthName (nextM); - std::cout << month - << " " - << std::setw(23 // one month's output width - - month.length ()// month name length - - 1)// spacer character - << std::left - << nextY; - - if (++nextM > 12) - { - nextM = 1; - nextY++; - } - } - - std::cout << std::endl - << optionalBlankLine (conf) - << renderMonths (mFrom, yFrom, today, pending, conf) - << std::endl; - - mFrom += monthsPerLine; - if (mFrom > 12) - { - mFrom -= 12; - ++yFrom; - } - } - - std::cout << "Legend: " - << Text::colorize (Text::cyan, Text::nocolor, "today") - << ", " - << Text::colorize (Text::black, Text::on_yellow, "due") - << ", " - << Text::colorize (Text::black, Text::on_red, "overdue") - << "." - << optionalBlankLine (conf) - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleReportActive (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get all the tasks. - tdb.gc (); - std::vector tasks; - tdb.pendingT (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - if (refTask.getAttribute ("start") != "") - { - Date now; - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No active tasks." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleReportOverdue (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get all the tasks. - std::vector tasks; - tdb.pendingT (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - Date now; - - // Iterate over each task, and apply selection criteria. - for (unsigned int i = 0; i < tasks.size (); ++i) - { - T refTask (tasks[i]); - std::string due; - if ((due = refTask.getAttribute ("due")) != "") - { - if (due.length ()) - { - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - - // If overdue. - if (dt < now) - { - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - table.setCellFg (row, 3, Text::red); - } - } - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No overdue tasks." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. -void handleReportOldest (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get the pending tasks. - tdb.gc (); - std::vector tasks; - tdb.allPendingT (tasks); - handleRecurrence (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - bool showAge = conf.get ("showage", true); - unsigned int quantity = conf.get ("oldest", 10); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Active"); - if (showAge) table.addColumn ("Age"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - if (showAge) table.setColumnUnderline (6); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::minimum); - if (showAge) table.setColumnWidth (5, Table::minimum); - table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - if (showAge) table.setColumnJustification (5, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - for (unsigned int i = 0; i < min (quantity, tasks.size ()); ++i) - { - T refTask (tasks[i]); - Date now; - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string active; - if (refTask.getAttribute ("start") != "") - active = "*"; - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, active); - if (showAge) table.addCell (row, 5, age); - table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -// Successively apply filters based on the task object built from the command -// line. Tasks that match all the specified criteria are listed. -void handleReportNewest (const TDB& tdb, T& task, Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Get the pending tasks. - tdb.gc (); - std::vector tasks; - tdb.allPendingT (tasks); - handleRecurrence (tasks); - filter (tasks, task); - - initializeColorRules (conf); - - bool showAge = conf.get ("showage", true); - int quantity = conf.get ("newest", 10); - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.addColumn ("ID"); - table.addColumn ("Project"); - table.addColumn ("Pri"); - table.addColumn ("Due"); - table.addColumn ("Active"); - if (showAge) table.addColumn ("Age"); - table.addColumn ("Description"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - table.setColumnUnderline (2); - table.setColumnUnderline (3); - table.setColumnUnderline (4); - table.setColumnUnderline (5); - if (showAge) table.setColumnUnderline (6); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::minimum); - table.setColumnWidth (2, Table::minimum); - table.setColumnWidth (3, Table::minimum); - table.setColumnWidth (4, Table::minimum); - if (showAge) table.setColumnWidth (5, Table::minimum); - table.setColumnWidth ((showAge ? 6 : 5), Table::flexible); - - table.setColumnJustification (0, Table::right); - table.setColumnJustification (3, Table::right); - if (showAge) table.setColumnJustification (5, Table::right); - - table.sortOn (3, Table::ascendingDate); - table.sortOn (2, Table::descendingPriority); - table.sortOn (1, Table::ascendingCharacter); - - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - int total = tasks.size (); - for (int i = total - 1; i >= max (0, total - quantity); --i) - { - T refTask (tasks[i]); - Date now; - - // Now format the matching task. - bool imminent = false; - bool overdue = false; - std::string due = refTask.getAttribute ("due"); - if (due.length ()) - { - switch (getDueState (due)) - { - case 2: overdue = true; break; - case 1: imminent = true; break; - case 0: - default: break; - } - - Date dt (::atoi (due.c_str ())); - due = dt.toString (conf.get ("dateformat", "m/d/Y")); - } - - std::string active; - if (refTask.getAttribute ("start") != "") - active = "*"; - - std::string age; - std::string created = refTask.getAttribute ("entry"); - if (created.length ()) - { - Date dt (::atoi (created.c_str ())); - formatTimeDeltaDays (age, (time_t) (now - dt)); - } - - // All criteria match, so add refTask to the output table. - int row = table.addRow (); - table.addCell (row, 0, refTask.getId ()); - table.addCell (row, 1, refTask.getAttribute ("project")); - table.addCell (row, 2, refTask.getAttribute ("priority")); - table.addCell (row, 3, due); - table.addCell (row, 4, active); - if (showAge) table.addCell (row, 5, age); - table.addCell (row, (showAge ? 6 : 5), refTask.getDescription ()); - - if (conf.get ("color", true)) - { - Text::color fg = Text::colorCode (refTask.getAttribute ("fg")); - Text::color bg = Text::colorCode (refTask.getAttribute ("bg")); - autoColorize (refTask, fg, bg); - table.setRowFg (row, fg); - table.setRowBg (row, bg); - - if (fg == Text::nocolor) - { - if (overdue) - table.setCellFg (row, 3, Text::red); - else if (imminent) - table.setCellFg (row, 3, Text::yellow); - } - } - } - - if (table.rowCount ()) - std::cout << optionalBlankLine (conf) - << table.render () - << optionalBlankLine (conf) - << table.rowCount () - << (table.rowCount () == 1 ? " task" : " tasks") - << std::endl; - else - std::cout << "No matches." - << std::endl; -} - - -//////////////////////////////////////////////////////////////////////////////// -void handleReportStats (const TDB& tdb, T& task, Config& conf) -{ - // Get all the tasks. - std::vector tasks; - tdb.allT (tasks); - filter (tasks, task); - - Date now; - time_t earliest = time (NULL); - time_t latest = 1; - int totalT = 0; - int deletedT = 0; - int pendingT = 0; - int completedT = 0; - int taggedT = 0; - int recurringT = 0; - float daysPending = 0.0; - int descLength = 0; - - std::vector ::iterator it; - for (it = tasks.begin (); it != tasks.end (); ++it) - { - ++totalT; - if (it->getStatus () == T::deleted) ++deletedT; - if (it->getStatus () == T::pending) ++pendingT; - if (it->getStatus () == T::completed) ++completedT; - if (it->getStatus () == T::recurring) ++recurringT; - - time_t entry = ::atoi (it->getAttribute ("entry").c_str ()); - if (entry < earliest) earliest = entry; - if (entry > latest) latest = entry; - - if (it->getStatus () == T::completed) - { - time_t end = ::atoi (it->getAttribute ("end").c_str ()); - daysPending += (end - entry) / 86400.0; - } - - if (it->getStatus () == T::pending) - daysPending += (now - entry) / 86400.0; - - descLength += it->getDescription ().length (); - - std::vector tags; - it->getTags (tags); - if (tags.size ()) ++taggedT; - } - - std::cout << "Pending " << pendingT << std::endl - << "Recurring " << recurringT << std::endl - << "Completed " << completedT << std::endl - << "Deleted " << deletedT << std::endl - << "Total " << totalT << std::endl; - - if (tasks.size ()) - { - Date e (earliest); - std::cout << "Oldest task " << e.toString (conf.get ("dateformat", "m/d/Y")) << std::endl; - Date l (latest); - std::cout << "Newest task " << l.toString (conf.get ("dateformat", "m/d/Y")) << std::endl; - std::cout << "Task used for " << formatSeconds (latest - earliest) << std::endl; - } - - if (totalT) - std::cout << "Task added every " << formatSeconds ((latest - earliest) / totalT) << std::endl; - - if (completedT) - std::cout << "Task completed every " << formatSeconds ((latest - earliest) / completedT) << std::endl; - - if (deletedT) - std::cout << "Task deleted every " << formatSeconds ((latest - earliest) / deletedT) << std::endl; - - if (pendingT || completedT) - std::cout << "Average time pending " - << formatSeconds ((int) ((daysPending / (pendingT + completedT)) * 86400)) - << std::endl; - - if (totalT) - { - std::cout << "Average desc length " << (int) (descLength / totalT) << " characters" << std::endl; - std::cout << "Tasks tagged " << std::setprecision (3) << (100.0 * taggedT / totalT) << "%" << std::endl; - } -} - -//////////////////////////////////////////////////////////////////////////////// -void handleVersion (Config& conf) -{ - // Determine window size, and set table accordingly. - int width = conf.get ("defaultwidth", 80); -#ifdef HAVE_LIBNCURSES - if (conf.get ("curses", true)) - { - WINDOW* w = initscr (); - width = w->_maxx + 1; - endwin (); - } -#endif - - // Create a table for output. - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - table.addColumn ("Config variable"); - table.addColumn ("Value"); - - if (conf.get ("color", true)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::flexible); - table.setColumnJustification (0, Table::left); - table.setColumnJustification (1, Table::left); - table.sortOn (0, Table::ascendingCharacter); - - std::vector all; - conf.all (all); - foreach (i, all) - { - std::string value = conf.get (*i); - if (value != "") - { - int row = table.addRow (); - table.addCell (row, 0, *i); - table.addCell (row, 1, value); - } - } - - std::cout << "Copyright (C) 2006 - 2008, P. Beckingham." - << std::endl - << PACKAGE - << " " - << VERSION - << std::endl - << std::endl - << "Task comes with ABSOLUTELY NO WARRANTY; for details read the COPYING file" - << std::endl - << "included. This is free software, and you are welcome to redistribute it" - << std::endl - << "under certain conditions; again, see the COPYING file for details." - << std::endl - << std::endl - << table.render () - << std::endl; - - // Verify installation. This is mentioned in the documentation as the way to - // ensure everything is properly installed. - - if (all.size () == 0) - std::cout << "Configuration error: .taskrc contains no entries" - << std::endl; - else - { - if (conf.get ("data.location") == "") - std::cout << "Configuration error: data.location not specified in .taskrc " - "file." - << std::endl; - - if (access (conf.get ("data.location").c_str (), X_OK)) - std::cout << "Configuration error: data.location contains a directory name" - " that doesn't exist, or is unreadable." - << std::endl; - } -} - -//////////////////////////////////////////////////////////////////////////////// -void handleDelete (const TDB& tdb, T& task, Config& conf) -{ - if (conf.get ("confirmation") != "yes" || confirm ("Permanently delete task?")) - { - // Check for the more complex case of a recurring task. - std::string parent = task.getAttribute ("parent"); - - // If this is a recurring task, get confirmation to delete them all. - if (parent != "" && - confirm ("This is a recurring task. Do you want to delete all pending recurrences of this same task?")) - { - // Scan all pending tasks for siblings of this task, and the parent - // itself, and delete them. - std::vector all; - tdb.allPendingT (all); - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - if (it->getAttribute ("parent") == parent || - it->getUUID () == parent) - tdb.deleteT (*it); - } - - // No confirmation, just delete the one. - else - tdb.deleteT (task); - } - else - std::cout << "Task not deleted." << std::endl; -} - -//////////////////////////////////////////////////////////////////////////////// -void handleStart (const TDB& tdb, T& task, Config& conf) -{ - std::vector all; - tdb.pendingT (all); - - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - { - if (it->getId () == task.getId ()) - { - T original (*it); - - if (original.getAttribute ("start") == "") - { - char startTime[16]; - sprintf (startTime, "%u", (unsigned int) time (NULL)); - original.setAttribute ("start", startTime); - - original.setId (task.getId ()); - tdb.modifyT (original); - - nag (tdb, task, conf); - return; - } - else - std::cout << "Task " << task.getId () << " already started." << std::endl; - } - } - - throw std::string ("Task not found."); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleDone (const TDB& tdb, T& task, Config& conf) -{ - if (!tdb.completeT (task)) - throw std::string ("Could not mark task as completed."); - - nag (tdb, task, conf); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleExport (const TDB& tdb, T& task, Config& conf) -{ - // Use the description as a file name, then clobber the description so the - // file name isn't used for filtering. - std::string file = trim (task.getDescription ()); - task.setDescription (""); - - if (file.length () > 0) - { - std::ofstream out (file.c_str ()); - if (out.good ()) - { - out << "'id'," - << "'status'," - << "'tags'," - << "'entry'," - << "'start'," - << "'due'," - << "'end'," - << "'project'," - << "'priority'," - << "'fg'," - << "'bg'," - << "'description'" - << "\n"; - - std::vector all; - tdb.allT (all); - filter (all, task); - foreach (t, all) - { - out << t->composeCSV ().c_str (); - } - out.close (); - } - else - throw std::string ("Could not write to export file."); - } - else - throw std::string ("You must specify a file to write to."); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleModify (const TDB& tdb, T& task, Config& conf) -{ - std::vector all; - tdb.pendingT (all); - - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - { - if (it->getId () == task.getId ()) - { - T original (*it); - - // A non-zero value forces a file write. - int changes = 0; - - // Apply a new description, if any. - if (task.getDescription () != "") - { - original.setDescription (task.getDescription ()); - ++changes; - } - - // Apply or remove tags, if any. - std::vector tags; - task.getTags (tags); - for (unsigned int i = 0; i < tags.size (); ++i) - { - if (tags[i][0] == '+') - original.addTag (tags[i].substr (1, std::string::npos)); - else - original.addTag (tags[i]); - - ++changes; - } - - task.getRemoveTags (tags); - for (unsigned int i = 0; i < tags.size (); ++i) - { - if (tags[i][0] == '-') - original.removeTag (tags[i].substr (1, std::string::npos)); - else - original.removeTag (tags[i]); - - ++changes; - } - - // Apply or remove attributes, if any. - std::map attributes; - task.getAttributes (attributes); - foreach (i, attributes) - { - if (i->second == "") - original.removeAttribute (i->first); - else - original.setAttribute (i->first, i->second); - - ++changes; - } - - std::string from; - std::string to; - task.getSubstitution (from, to); - if (from != "") - { - std::string description = original.getDescription (); - size_t pattern = description.find (from); - if (pattern != std::string::npos) - { - description = description.substr (0, pattern) + - to + - description.substr (pattern + from.length (), std::string::npos); - original.setDescription (description); - ++changes; - } - } - - if (changes) - { - original.setId (task.getId ()); - tdb.modifyT (original); - } - - return; - } - } - - throw std::string ("Task not found."); -} - -//////////////////////////////////////////////////////////////////////////////// -void handleColor (Config& conf) -{ - if (conf.get ("color", true)) - { - std::cout << optionalBlankLine (conf) << "Foreground" << std::endl - << " " - << Text::colorize (Text::bold, Text::nocolor, "bold") << " " - << Text::colorize (Text::underline, Text::nocolor, "underline") << " " - << Text::colorize (Text::bold_underline, Text::nocolor, "bold_underline") << std::endl - - << " " << Text::colorize (Text::black, Text::nocolor, "black") << " " - << Text::colorize (Text::bold_black, Text::nocolor, "bold_black") << " " - << Text::colorize (Text::underline_black, Text::nocolor, "underline_black") << " " - << Text::colorize (Text::bold_underline_black, Text::nocolor, "bold_underline_black") << std::endl - - << " " << Text::colorize (Text::red, Text::nocolor, "red") << " " - << Text::colorize (Text::bold_red, Text::nocolor, "bold_red") << " " - << Text::colorize (Text::underline_red, Text::nocolor, "underline_red") << " " - << Text::colorize (Text::bold_underline_red, Text::nocolor, "bold_underline_red") << std::endl - - << " " << Text::colorize (Text::green, Text::nocolor, "green") << " " - << Text::colorize (Text::bold_green, Text::nocolor, "bold_green") << " " - << Text::colorize (Text::underline_green, Text::nocolor, "underline_green") << " " - << Text::colorize (Text::bold_underline_green, Text::nocolor, "bold_underline_green") << std::endl - - << " " << Text::colorize (Text::yellow, Text::nocolor, "yellow") << " " - << Text::colorize (Text::bold_yellow, Text::nocolor, "bold_yellow") << " " - << Text::colorize (Text::underline_yellow, Text::nocolor, "underline_yellow") << " " - << Text::colorize (Text::bold_underline_yellow, Text::nocolor, "bold_underline_yellow") << std::endl - - << " " << Text::colorize (Text::blue, Text::nocolor, "blue") << " " - << Text::colorize (Text::bold_blue, Text::nocolor, "bold_blue") << " " - << Text::colorize (Text::underline_blue, Text::nocolor, "underline_blue") << " " - << Text::colorize (Text::bold_underline_blue, Text::nocolor, "bold_underline_blue") << std::endl - - << " " << Text::colorize (Text::magenta, Text::nocolor, "magenta") << " " - << Text::colorize (Text::bold_magenta, Text::nocolor, "bold_magenta") << " " - << Text::colorize (Text::underline_magenta, Text::nocolor, "underline_magenta") << " " - << Text::colorize (Text::bold_underline_magenta, Text::nocolor, "bold_underline_magenta") << std::endl - - << " " << Text::colorize (Text::cyan, Text::nocolor, "cyan") << " " - << Text::colorize (Text::bold_cyan, Text::nocolor, "bold_cyan") << " " - << Text::colorize (Text::underline_cyan, Text::nocolor, "underline_cyan") << " " - << Text::colorize (Text::bold_underline_cyan, Text::nocolor, "bold_underline_cyan") << std::endl - - << " " << Text::colorize (Text::white, Text::nocolor, "white") << " " - << Text::colorize (Text::bold_white, Text::nocolor, "bold_white") << " " - << Text::colorize (Text::underline_white, Text::nocolor, "underline_white") << " " - << Text::colorize (Text::bold_underline_white, Text::nocolor, "bold_underline_white") << std::endl - - << std::endl << "Background" << std::endl - << " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " " - << Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " " - << Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " " - << Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " " - << Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " " - << Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " " - << Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " " - << Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl - - << " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " " - << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl - - << optionalBlankLine (conf); - } - else - { - std::cout << "Color is currently turned off in your .taskrc file." << std::endl; - } -} - -//////////////////////////////////////////////////////////////////////////////// -void gatherNextTasks ( - const TDB& tdb, - T& task, - Config& conf, - std::vector & pending, - std::vector & all) -{ - // For counting tasks by project. - std::map countByProject; - std::map matching; - - Date now; - - // How many items per project? Default 3. - int limit = conf.get ("next", 3); - - // due:< 1wk, pri:* - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string due = pending[i].getAttribute ("due"); - if (due != "") - { - Date d (::atoi (due.c_str ())); - if (d < now + (7 * 24 * 60 * 60)) // if due:< 1wk - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - } - - // due:*, pri:H - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string due = pending[i].getAttribute ("due"); - if (due != "") - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "H") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - } - - // pri:H - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "H") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - - // due:*, pri:M - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string due = pending[i].getAttribute ("due"); - if (due != "") - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "M") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - } - - // pri:M - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "M") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - - // due:*, pri:L - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string due = pending[i].getAttribute ("due"); - if (due != "") - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "L") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - } - - // pri:L - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "L") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - - // due:, pri: - for (unsigned int i = 0; i < pending.size (); ++i) - { - if (pending[i].getStatus () == T::pending) - { - std::string due = pending[i].getAttribute ("due"); - if (due == "") - { - std::string priority = pending[i].getAttribute ("priority"); - if (priority == "") - { - std::string project = pending[i].getAttribute ("project"); - if (countByProject[project] < limit && matching.find (i) == matching.end ()) - { - ++countByProject[project]; - matching[i] = true; - } - } - } - } - } - - // Convert map to vector. - foreach (i, matching) - all.push_back (i->first); -} - //////////////////////////////////////////////////////////////////////////////// void nag (const TDB& tdb, T& task, Config& conf) { @@ -3499,15 +392,19 @@ int getDueState (const std::string& due) //////////////////////////////////////////////////////////////////////////////// // Scan for recurring tasks, and generate any necessary instances of those // tasks. -void handleRecurrence (std::vector & tasks) +void handleRecurrence (const TDB& tdb, std::vector & tasks) { std::vector modified; + Date now; + std::cout << "# handleRecurrence" << std::endl; std::vector ::iterator it; for (it = tasks.begin (); it != tasks.end (); ++it) { if (it->getStatus () == T::recurring) { + std::cout << "# found recurring task " << it->getUUID () << std::endl; + // This task is recurring. While it remains hidden from view, it spawns // child tasks automatically, here, that are regular tasks, except they // have a "parent" attribute that contains the UUID of the original. @@ -3516,13 +413,71 @@ void handleRecurrence (std::vector & tasks) std::vector children; std::vector ::iterator them; for (them = tasks.begin (); them != tasks.end (); ++them) - if (them->getAttribute ("parent") != "") + if (them->getAttribute ("parent") == it->getUUID ()) children.push_back (*them); - // TODO Determine if any new child tasks need to be generated, and do it. + // Determine due date, recur period and until date. + Date due (atoi (it->getAttribute ("due").c_str ())); + std::cout << "# due=" << due.toString () << std::endl; + std::string recur = it->getAttribute ("recur"); + std::cout << "# recur=" << recur << std::endl; - // TODO if before "until" date, or "until" missing - // TODO Iterate from "due", incrementing by "recur" + bool specificEnd = false; + Date until; + if (it->getAttribute ("until") != "") + { + until = Date (atoi (it->getAttribute ("until").c_str ())); + specificEnd = true; + } + + std::cout << "# specficEnd=" << (specificEnd ? "true" : "false") << std::endl; + if (specificEnd) + std::cout << "# until=" << until.toString () << std::endl; + + for (Date i = due; ; i = getNextRecurrence (i, recur)) + { + std::cout << "# i=" << i.toString () << std::endl; + if (specificEnd && i > until) + break; + + // Look to see if there is a gap at date "i" by scanning children. + bool foundChild = false; + std::vector ::iterator cit; + for (cit = children.begin (); cit != children.end (); ++cit) + { + if (atoi (cit->getAttribute ("due").c_str ()) == i.toEpoch ()) + { + foundChild = true; + break; + } + } + +// TODO A gap may be filled by a completed task. Oh crap. + + // There is a gap, so insert a task. + if (!foundChild) + { + std::cout << "# found a gap at i=" << i.toString () << std::endl; + T rec (*it); // Clone the parent. + + char dueDate[16]; + sprintf (dueDate, "%u", (unsigned int) i.toEpoch ()); + rec.setAttribute ("due", dueDate); + rec.setAttribute ("parent", it->getUUID ()); + rec.setStatus (T::pending); + + std::cout << "# adding to modified" << std::endl; + modified.push_back (rec); + std::cout << "# adding to pending" << std::endl; + tdb.addT (rec); + } + + if (i > now) + { + std::cout << "# already 1 instance into the future, stopping" << std::endl; + break; + } + } } else modified.push_back (*it); @@ -3532,3 +487,41 @@ void handleRecurrence (std::vector & tasks) } //////////////////////////////////////////////////////////////////////////////// +Date getNextRecurrence (Date& current, std::string& period) +{ + int days = convertDuration (period); + + // Some periods are difficult, because they can be vague. + if (period == "monthly" || + (isdigit (period[0]) && period[period.length () - 1] == 'm')) + { + int m = current.month (); + int d = current.day (); + int y = current.year (); + + if (++m == 13) m = 1; + while (! Date::valid (m, d, y)) + --d; + + std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + if (period == "bimonthly" || + period == "semimonthly" || + period == "quarterly" || + period == "biannual" || + period == "biyearly" || + period == "semiannual" || + (isdigit (period[0]) && ( + period[period.length () - 1] == 'm' || + period[period.length () - 1] == 'q'))) + { + // TODO lots of work here... + } + + // If the period is an 'easy' one, add it to current, and we're done. + return current + (days * 86400); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.h b/src/task.h index 494689292..69ad75932 100644 --- a/src/task.h +++ b/src/task.h @@ -58,12 +58,29 @@ void parse (std::vector &, std::string&, T&, Config&); bool validDate (std::string&, Config&); // task.cpp +void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); +void nag (const TDB&, T&, Config&); +int getDueState (const std::string&); +void handleRecurrence (const TDB&, std::vector &); +Date getNextRecurrence (Date&, std::string&); + +// command.cpp void handleAdd (const TDB&, T&, Config&); void handleProjects (const TDB&, T&, Config&); void handleTags (const TDB&, T&, Config&); +void handleUndelete (const TDB&, T&, Config&); +void handleVersion (Config&); +void handleExport (const TDB&, T&, Config&); +void handleDelete (const TDB&, T&, Config&); +void handleStart (const TDB&, T&, Config&); +void handleDone (const TDB&, T&, Config&); +void handleModify (const TDB&, T&, Config&); +void handleColor (Config&); + +// report.cpp +void filter (std::vector&, T&); void handleList (const TDB&, T&, Config&); void handleInfo (const TDB&, T&, Config&); -void handleUndelete (const TDB&, T&, Config&); void handleLongList (const TDB&, T&, Config&); void handleSmallList (const TDB&, T&, Config&); void handleCompleted (const TDB&, T&, Config&); @@ -78,16 +95,6 @@ void handleReportOverdue (const TDB&, T&, Config&); void handleReportStats (const TDB&, T&, Config&); void handleReportOldest (const TDB&, T&, Config&); void handleReportNewest (const TDB&, T&, Config&); -void handleVersion (Config&); -void handleExport (const TDB&, T&, Config&); -void handleDelete (const TDB&, T&, Config&); -void handleStart (const TDB&, T&, Config&); -void handleDone (const TDB&, T&, Config&); -void handleModify (const TDB&, T&, Config&); -void handleColor (Config&); -void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); -void nag (const TDB&, T&, Config&); -void handleRecurrence (std::vector &); // util.cpp bool confirm (const std::string&); @@ -109,9 +116,7 @@ void formatTimeDeltaDays (std::string&, time_t); std::string formatSeconds (time_t); const std::string uuid (); const char* optionalBlankLine (Config&); -int convertDuration (const std::string&); -int getDueState (const std::string&); -int addDuration (const Date&, const std::string&); +int convertDuration (std::string&); // rules.cpp void initializeColorRules (Config&); diff --git a/src/util.cpp b/src/util.cpp index 877f4791a..edc02b62d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -238,9 +238,9 @@ const std::string uuid () //////////////////////////////////////////////////////////////////////////////// // Recognize the following constructs, and return the number of days represented -int convertDuration (const std::string& input) +int convertDuration (std::string& input) { - std::string in (lowerCase (input)); + input = lowerCase (input); Date today; std::vector supported; @@ -261,7 +261,7 @@ int convertDuration (const std::string& input) supported.push_back ("yearly"); std::vector matches; - if (autoComplete (in, supported, matches) == 1) + if (autoComplete (input, supported, matches) == 1) { std::string found = matches[0]; @@ -306,9 +306,3 @@ int convertDuration (const std::string& input) } //////////////////////////////////////////////////////////////////////////////// -int addDuration (const Date& base, const std::string& offset) -{ - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// From 6f7b9b7d424e155441ef63d7e468a7cb8c8b5f62 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 9 Jul 2008 03:26:44 -0400 Subject: [PATCH 19/19] - Recurring tasks! --- AUTHORS | 2 + ChangeLog | 1 + html/task.html | 1 + src/Makefile.in | 8 +- src/T.cpp | 2 +- src/T.h | 2 +- src/TDB.cpp | 31 +++-- src/TDB.h | 18 +-- src/command.cpp | 85 +++++++----- src/report.cpp | 45 ++++--- src/task.cpp | 334 +++++++++++++++++++++++++++++++++++------------- src/task.h | 52 ++++---- src/util.cpp | 2 - 13 files changed, 395 insertions(+), 188 deletions(-) diff --git a/AUTHORS b/AUTHORS index 37f5c411b..ffcf9c092 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,4 +13,6 @@ With thanks to: Nishiishii galvanizd H. İbrahim Güngör + Stas Antons + Andy Lester diff --git a/ChangeLog b/ChangeLog index 48030c34b..9b6c016a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ represents a feature release, and the Z represents a patch. 1.4.0 () + + New recurring tasks feature + "task undelete" can now undelete erroneously deleted tasks, provided no reports have been run (and therefore TDB::gc run) + Added averages to the "task history" report diff --git a/html/task.html b/html/task.html index 56b0e2c7a..2aed7bb4d 100644 --- a/html/task.html +++ b/html/task.html @@ -48,6 +48,7 @@

      +
    • Added new recurring tasks feature
    • Added "task undelete" feature to restore a (very) recently deleted task
    • Added averages to the "task history" report diff --git a/src/Makefile.in b/src/Makefile.in index 0fb7bc68a..120185c41 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -45,8 +45,8 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_task_OBJECTS = Config.$(OBJEXT) Date.$(OBJEXT) T.$(OBJEXT) \ TDB.$(OBJEXT) Table.$(OBJEXT) Grid.$(OBJEXT) color.$(OBJEXT) \ - parse.$(OBJEXT) task.$(OBJEXT) util.$(OBJEXT) text.$(OBJEXT) \ - rules.$(OBJEXT) + parse.$(OBJEXT) task.$(OBJEXT) command.$(OBJEXT) \ + report.$(OBJEXT) util.$(OBJEXT) text.$(OBJEXT) rules.$(OBJEXT) task_OBJECTS = $(am_task_OBJECTS) task_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ @@ -154,7 +154,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h +task_SOURCES = Config.cpp Date.cpp T.cpp TDB.cpp Table.cpp Grid.cpp color.cpp parse.cpp task.cpp command.cpp report.cpp util.cpp text.cpp rules.cpp Config.h Date.h T.h TDB.h Table.h Grid.h color.h task.h AM_CPPFLAGS = -Wall -pedantic -ggdb3 -fno-rtti all: all-am @@ -229,7 +229,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TDB.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Table.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/report.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text.Po@am__quote@ diff --git a/src/T.cpp b/src/T.cpp index 8ccb6c362..8a9c7fdc7 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -450,7 +450,7 @@ void T::parse (const std::string& line) { std::vector pair; split (pair, pairs[i], ':'); - if (pair[1] != "") + if (pair.size () == 2) mAttributes[pair[0]] = pair[1]; } diff --git a/src/T.h b/src/T.h index 58b7cc169..cb8ffb4a3 100644 --- a/src/T.h +++ b/src/T.h @@ -32,7 +32,7 @@ #include // Length of longest line. -#define T_LINE_MAX 8192 +#define T_LINE_MAX 32768 class T { diff --git a/src/TDB.cpp b/src/TDB.cpp index fc5e8e786..b2f5afd3d 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -38,6 +38,7 @@ TDB::TDB () : mPendingFile ("") , mCompletedFile ("") , mLogFile ("") +, mId (1) { } @@ -67,7 +68,7 @@ void TDB::dataDirectory (const std::string& directory) //////////////////////////////////////////////////////////////////////////////// // Combine allPendingT with allCompletedT. // Note: this method is O(N1) + O(N2), where N2 is not bounded. -bool TDB::allT (std::vector & all) const +bool TDB::allT (std::vector & all) { all.clear (); @@ -95,20 +96,20 @@ bool TDB::allT (std::vector & all) const //////////////////////////////////////////////////////////////////////////////// // Only accesses to the pending file result in Tasks that have assigned ids. -bool TDB::pendingT (std::vector & all) const +bool TDB::pendingT (std::vector & all) { all.clear (); std::vector lines; if (readLockedFile (mPendingFile, lines)) { - int id = 1; + mId = 1; std::vector ::iterator it; for (it = lines.begin (); it != lines.end (); ++it) { T t (*it); - t.setId (id++); + t.setId (mId++); if (t.getStatus () == T::pending) all.push_back (t); } @@ -121,20 +122,20 @@ bool TDB::pendingT (std::vector & all) const //////////////////////////////////////////////////////////////////////////////// // Only accesses to the pending file result in Tasks that have assigned ids. -bool TDB::allPendingT (std::vector & all) const +bool TDB::allPendingT (std::vector & all) { all.clear (); std::vector lines; if (readLockedFile (mPendingFile, lines)) { - int id = 1; + mId = 1; std::vector ::iterator it; for (it = lines.begin (); it != lines.end (); ++it) { T t (*it); - t.setId (id++); + t.setId (mId++); all.push_back (t); } @@ -188,7 +189,7 @@ bool TDB::allCompletedT (std::vector & all) const } //////////////////////////////////////////////////////////////////////////////// -bool TDB::deleteT (const T& t) const +bool TDB::deleteT (const T& t) { T task (t); @@ -212,7 +213,7 @@ bool TDB::deleteT (const T& t) const } //////////////////////////////////////////////////////////////////////////////// -bool TDB::completeT (const T& t) const +bool TDB::completeT (const T& t) { T task (t); @@ -261,7 +262,7 @@ bool TDB::addT (const T& t) const } //////////////////////////////////////////////////////////////////////////////// -bool TDB::modifyT (const T& t) const +bool TDB::modifyT (const T& t) { T modified (t); @@ -348,7 +349,7 @@ bool TDB::lock (FILE* file) const } //////////////////////////////////////////////////////////////////////////////// -bool TDB::overwritePending (std::vector & all) const +bool TDB::overwritePending (std::vector & all) { // Write a single task to the pending file FILE* out; @@ -453,7 +454,7 @@ bool TDB::readLockedFile ( } //////////////////////////////////////////////////////////////////////////////// -int TDB::gc () const +int TDB::gc () { int count = 0; @@ -486,4 +487,10 @@ int TDB::gc () const } //////////////////////////////////////////////////////////////////////////////// +int TDB::nextId () +{ + return mId++; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB.h b/src/TDB.h index d8c022c8b..ccdeea788 100644 --- a/src/TDB.h +++ b/src/TDB.h @@ -38,22 +38,23 @@ public: ~TDB (); void dataDirectory (const std::string&); - bool allT (std::vector &) const; - bool pendingT (std::vector &) const; - bool allPendingT (std::vector &) const; + bool allT (std::vector &); + bool pendingT (std::vector &); + bool allPendingT (std::vector &); bool completedT (std::vector &) const; bool allCompletedT (std::vector &) const; - bool deleteT (const T&) const; - bool completeT (const T&) const; + bool deleteT (const T&); + bool completeT (const T&); bool addT (const T&) const; - bool modifyT (const T&) const; + bool modifyT (const T&); bool logRead (std::vector &) const; bool logCommand (int, char**) const; - int gc () const; + int gc (); + int nextId (); private: bool lock (FILE*) const; - bool overwritePending (std::vector &) const; + bool overwritePending (std::vector &); bool writePending (const T&) const; bool writeCompleted (const T&) const; bool readLockedFile (const std::string&, std::vector &) const; @@ -62,6 +63,7 @@ private: std::string mPendingFile; std::string mCompletedFile; std::string mLogFile; + int mId; }; #endif diff --git a/src/command.cpp b/src/command.cpp index edea54777..d92e35c22 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -55,10 +55,8 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) std::map atts; task.getAttributes (atts); foreach (i, atts) - { if (i->second == "") task.removeAttribute (i->first); - } // Recurring tasks get a special status. if (task.getAttribute ("due") != "" && @@ -76,7 +74,7 @@ void handleAdd (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleProjects (const TDB& tdb, T& task, Config& conf) +void handleProjects (TDB& tdb, T& task, Config& conf) { // Get all the tasks, including deleted ones. std::vector tasks; @@ -127,7 +125,7 @@ void handleProjects (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleTags (const TDB& tdb, T& task, Config& conf) +void handleTags (TDB& tdb, T& task, Config& conf) { // Get all the tasks. std::vector tasks; @@ -165,7 +163,7 @@ void handleTags (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // If a task is deleted, but is still in the pending file, then it may be // undeleted simply by changing it's status. -void handleUndelete (const TDB& tdb, T& task, Config& conf) +void handleUndelete (TDB& tdb, T& task, Config& conf) { std::vector all; tdb.allPendingT (all); @@ -289,44 +287,54 @@ void handleVersion (Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleDelete (const TDB& tdb, T& task, Config& conf) +void handleDelete (TDB& tdb, T& task, Config& conf) { if (conf.get ("confirmation") != "yes" || confirm ("Permanently delete task?")) { - // Check for the more complex case of a recurring task. If this is a - // recurring task, get confirmation to delete them all. - std::string parent = task.getAttribute ("parent"); - if (parent != "") + std::vector all; + tdb.allPendingT (all); + foreach (t, all) { - if (confirm ("This is a recurring task. Do you want to delete all pending recurrences of this same task?")) + if (t->getId () == task.getId ()) { - // Scan all pending tasks for siblings of this task, and the parent - // itself, and delete them. - std::vector all; - tdb.allPendingT (all); - std::vector ::iterator it; - for (it = all.begin (); it != all.end (); ++it) - if (it->getAttribute ("parent") == parent || - it->getUUID () == parent) - tdb.deleteT (*it); + // Check for the more complex case of a recurring task. If this is a + // recurring task, get confirmation to delete them all. + std::string parent = t->getAttribute ("parent"); + if (parent != "") + { + if (confirm ("This is a recurring task. Do you want to delete all pending recurrences of this same task?")) + { + // Scan all pending tasks for siblings of this task, and the parent + // itself, and delete them. + foreach (sibling, all) + if (sibling->getAttribute ("parent") == parent || + sibling->getUUID () == parent) + tdb.deleteT (*sibling); - return; - } - else - { - // TODO Update mask in parent. + return; + } + else + { + // Update mask in parent. + t->setStatus (T::deleted); + updateRecurrenceMask (tdb, all, *t); + tdb.deleteT (*t); + return; + } + } + else + tdb.deleteT (*t); + + break; // No point continuing the loop. } } - - // No confirmation, just delete the one. - tdb.deleteT (task); } else std::cout << "Task not deleted." << std::endl; } //////////////////////////////////////////////////////////////////////////////// -void handleStart (const TDB& tdb, T& task, Config& conf) +void handleStart (TDB& tdb, T& task, Config& conf) { std::vector all; tdb.pendingT (all); @@ -359,18 +367,29 @@ void handleStart (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleDone (const TDB& tdb, T& task, Config& conf) +void handleDone (TDB& tdb, T& task, Config& conf) { if (!tdb.completeT (task)) throw std::string ("Could not mark task as completed."); - // TODO Now updates mask in parent. + // Now update mask in parent. + std::vector all; + tdb.allPendingT (all); + foreach (t, all) + { + if (t->getId () == task.getId ()) + { + t->setStatus (T::completed); + updateRecurrenceMask (tdb, all, *t); + break; + } + } nag (tdb, task, conf); } //////////////////////////////////////////////////////////////////////////////// -void handleExport (const TDB& tdb, T& task, Config& conf) +void handleExport (TDB& tdb, T& task, Config& conf) { // Use the description as a file name, then clobber the description so the // file name isn't used for filtering. @@ -413,7 +432,7 @@ void handleExport (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleModify (const TDB& tdb, T& task, Config& conf) +void handleModify (TDB& tdb, T& task, Config& conf) { std::vector all; tdb.pendingT (all); diff --git a/src/report.cpp b/src/report.cpp index 0362e8458..2ff369410 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -108,7 +108,7 @@ void filter (std::vector& all, T& task) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -void handleList (const TDB& tdb, T& task, Config& conf) +void handleList (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -253,7 +253,7 @@ void handleList (const TDB& tdb, T& task, Config& conf) // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. Show a narrow // list that works better on mobile devices. -void handleSmallList (const TDB& tdb, T& task, Config& conf) +void handleSmallList (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -379,7 +379,7 @@ void handleSmallList (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -void handleCompleted (const TDB& tdb, T& task, Config& conf) +void handleCompleted (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -464,7 +464,7 @@ void handleCompleted (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // Display all information for the given task. -void handleInfo (const TDB& tdb, T& task, Config& conf) +void handleInfo (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -548,6 +548,21 @@ void handleInfo (const TDB& tdb, T& task, Config& conf) row = table.addRow (); table.addCell (row, 0, "Recur until"); table.addCell (row, 1, refTask.getAttribute ("until")); + + row = table.addRow (); + table.addCell (row, 0, "Mask"); + table.addCell (row, 1, refTask.getAttribute ("mask")); + } + + if (refTask.getAttribute ("parent") != "") + { + row = table.addRow (); + table.addCell (row, 0, "Parent task"); + table.addCell (row, 1, refTask.getAttribute ("parent")); + + row = table.addRow (); + table.addCell (row, 0, "Mask Index"); + table.addCell (row, 1, refTask.getAttribute ("imask")); } // due (colored) @@ -645,7 +660,7 @@ void handleInfo (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -void handleLongList (const TDB& tdb, T& task, Config& conf) +void handleLongList (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -814,7 +829,7 @@ void handleLongList (const TDB& tdb, T& task, Config& conf) // Project Tasks Avg Age Status // A 12 13d XXXXXXXX------ // B 109 3d 12h XX------------ -void handleReportSummary (const TDB& tdb, T& task, Config& conf) +void handleReportSummary (TDB& tdb, T& task, Config& conf) { // Generate unique list of project names. tdb.gc (); @@ -984,7 +999,7 @@ void handleReportSummary (const TDB& tdb, T& task, Config& conf) // // Make the "three" tasks a configurable number // -void handleReportNext (const TDB& tdb, T& task, Config& conf) +void handleReportNext (TDB& tdb, T& task, Config& conf) { // Load all pending. tdb.gc (); @@ -1156,7 +1171,7 @@ time_t monthlyEpoch (const std::string& date) return 0; } -void handleReportHistory (const TDB& tdb, T& task, Config& conf) +void handleReportHistory (TDB& tdb, T& task, Config& conf) { std::map groups; std::map addedGroup; @@ -1338,7 +1353,7 @@ void handleReportHistory (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleReportGHistory (const TDB& tdb, T& task, Config& conf) +void handleReportGHistory (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -1755,7 +1770,7 @@ std::string renderMonths ( } //////////////////////////////////////////////////////////////////////////////// -void handleReportCalendar (const TDB& tdb, T& task, Config& conf) +void handleReportCalendar (TDB& tdb, T& task, Config& conf) { // Load all the pending tasks. tdb.gc (); @@ -1841,7 +1856,7 @@ void handleReportCalendar (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleReportActive (const TDB& tdb, T& task, Config& conf) +void handleReportActive (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -1957,7 +1972,7 @@ void handleReportActive (const TDB& tdb, T& task, Config& conf) } //////////////////////////////////////////////////////////////////////////////// -void handleReportOverdue (const TDB& tdb, T& task, Config& conf) +void handleReportOverdue (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -2064,7 +2079,7 @@ void handleReportOverdue (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -void handleReportOldest (const TDB& tdb, T& task, Config& conf) +void handleReportOldest (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -2207,7 +2222,7 @@ void handleReportOldest (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -void handleReportNewest (const TDB& tdb, T& task, Config& conf) +void handleReportNewest (TDB& tdb, T& task, Config& conf) { // Determine window size, and set table accordingly. int width = conf.get ("defaultwidth", 80); @@ -2350,7 +2365,7 @@ void handleReportNewest (const TDB& tdb, T& task, Config& conf) //////////////////////////////////////////////////////////////////////////////// -void handleReportStats (const TDB& tdb, T& task, Config& conf) +void handleReportStats (TDB& tdb, T& task, Config& conf) { // Get all the tasks. std::vector tasks; diff --git a/src/task.cpp b/src/task.cpp index b324daa56..13e3999ca 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -345,7 +345,7 @@ int main (int argc, char** argv) } //////////////////////////////////////////////////////////////////////////////// -void nag (const TDB& tdb, T& task, Config& conf) +void nag (TDB& tdb, T& task, Config& conf) { std::string nagMessage = conf.get ("nag", std::string ("")); if (nagMessage != "") @@ -390,138 +390,296 @@ int getDueState (const std::string& due) } //////////////////////////////////////////////////////////////////////////////// -// Scan for recurring tasks, and generate any necessary instances of those -// tasks. -void handleRecurrence (const TDB& tdb, std::vector & tasks) +// Scans all tasks, and for any recurring tasks, determines whether any new +// child tasks need to be generated to fill gaps. +void handleRecurrence (TDB& tdb, std::vector & tasks) { std::vector modified; - Date now; - std::cout << "# handleRecurrence" << std::endl; - std::vector ::iterator it; - for (it = tasks.begin (); it != tasks.end (); ++it) + // Look at all tasks and find any recurring ones. + foreach (t, tasks) { - if (it->getStatus () == T::recurring) + if (t->getStatus () == T::recurring) { - std::cout << "# found recurring task " << it->getUUID () << std::endl; +// std::cout << "# found recurring task " << t->getUUID () << std::endl; - // This task is recurring. While it remains hidden from view, it spawns - // child tasks automatically, here, that are regular tasks, except they - // have a "parent" attribute that contains the UUID of the original. + // Generate a list of due dates for this recurring task, regardless of + // the mask. + std::vector due; + generateDueDates (*t, due); - // Generate a list of child tasks. - std::vector children; - std::vector ::iterator them; - for (them = tasks.begin (); them != tasks.end (); ++them) - if (them->getAttribute ("parent") == it->getUUID ()) - children.push_back (*them); + // Get the mask from the parent task. + std::string mask = t->getAttribute ("mask"); +// std::cout << "# mask=" << mask << std::endl; - // Determine due date, recur period and until date. - Date due (atoi (it->getAttribute ("due").c_str ())); - std::cout << "# due=" << due.toString () << std::endl; - std::string recur = it->getAttribute ("recur"); - std::cout << "# recur=" << recur << std::endl; - - bool specificEnd = false; - Date until; - if (it->getAttribute ("until") != "") + // Iterate over the due dates, and check each against the mask. + bool changed = false; + unsigned int i = 0; + foreach (d, due) { - until = Date (atoi (it->getAttribute ("until").c_str ())); - specificEnd = true; - } +// std::cout << "# need: " << d->toString () << std::endl; - std::cout << "# specficEnd=" << (specificEnd ? "true" : "false") << std::endl; - if (specificEnd) - std::cout << "# until=" << until.toString () << std::endl; - - for (Date i = due; ; i = getNextRecurrence (i, recur)) - { - std::cout << "# i=" << i.toString () << std::endl; - if (specificEnd && i > until) - break; - - // Look to see if there is a gap at date "i" by scanning children. - bool foundChild = false; - std::vector ::iterator cit; - for (cit = children.begin (); cit != children.end (); ++cit) + if (mask.length () <= i) { - if (atoi (cit->getAttribute ("due").c_str ()) == i.toEpoch ()) - { - foundChild = true; - break; - } - } + mask += '-'; + changed = true; -// TODO A gap may be filled by a completed task. Oh crap. - - // There is a gap, so insert a task. - if (!foundChild) - { - std::cout << "# found a gap at i=" << i.toString () << std::endl; - T rec (*it); // Clone the parent. + T rec (*t); // Clone the parent. + rec.setId (tdb.nextId ()); // Assign a unique id. + rec.setUUID (uuid ()); // New UUID. + rec.setStatus (T::pending); // Shiny. + rec.setAttribute ("parent", t->getUUID ()); // Remember mom. char dueDate[16]; - sprintf (dueDate, "%u", (unsigned int) i.toEpoch ()); - rec.setAttribute ("due", dueDate); - rec.setAttribute ("parent", it->getUUID ()); - rec.setStatus (T::pending); + sprintf (dueDate, "%u", (unsigned int) d->toEpoch ()); + rec.setAttribute ("due", dueDate); // Store generated due date. - std::cout << "# adding to modified" << std::endl; + char indexMask[12]; + sprintf (indexMask, "%u", (unsigned int) i); + rec.setAttribute ("imask", indexMask); // Store index into mask. + + // Add the new task to the vector, for immediate use. +// std::cout << "# adding to modified" << std::endl; modified.push_back (rec); - std::cout << "# adding to pending" << std::endl; + + // Add the new task to the DB. +// std::cout << "# adding to pending" << std::endl; tdb.addT (rec); } - if (i > now) - { - std::cout << "# already 1 instance into the future, stopping" << std::endl; - break; - } + ++i; + } + + // Only modify the parent if necessary. + if (changed) + { +// std::cout << "# modifying parent with mask=" << mask << std::endl; + t->setAttribute ("mask", mask); + tdb.modifyT (*t); } } else - modified.push_back (*it); + modified.push_back (*t); } tasks = modified; } +//////////////////////////////////////////////////////////////////////////////// +// Determine a start date (due), an optional end date (until), and an increment +// period (recur). Then generate a set of corresponding dates. +void generateDueDates (T& parent, std::vector & allDue) +{ + // Determine due date, recur period and until date. + Date due (atoi (parent.getAttribute ("due").c_str ())); +// std::cout << "# due=" << due.toString () << std::endl; + std::string recur = parent.getAttribute ("recur"); +// std::cout << "# recur=" << recur << std::endl; + + bool specificEnd = false; + Date until; + if (parent.getAttribute ("until") != "") + { + until = Date (atoi (parent.getAttribute ("until").c_str ())); + specificEnd = true; + } + +// std::cout << "# specficEnd=" << (specificEnd ? "true" : "false") << std::endl; +// if (specificEnd) +// std::cout << "# until=" << until.toString () << std::endl; + + Date now; + for (Date i = due; ; i = getNextRecurrence (i, recur)) + { + allDue.push_back (i); + +// std::cout << "# i=" << i.toString () << std::endl; + if (specificEnd && i > until) + break; + + if (i > now) +// { +// std::cout << "# already 1 instance into the future, stopping" << std::endl; + break; +// } + } +} + //////////////////////////////////////////////////////////////////////////////// Date getNextRecurrence (Date& current, std::string& period) { - int days = convertDuration (period); + int m = current.month (); + int d = current.day (); + int y = current.year (); // Some periods are difficult, because they can be vague. - if (period == "monthly" || - (isdigit (period[0]) && period[period.length () - 1] == 'm')) + if (period == "monthly") { - int m = current.month (); - int d = current.day (); - int y = current.year (); + if (++m > 12) + { + m -= 12; + ++y; + } - if (++m == 13) m = 1; while (! Date::valid (m, d, y)) --d; - std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; return Date (m, d, y); } - if (period == "bimonthly" || - period == "semimonthly" || - period == "quarterly" || - period == "biannual" || - period == "biyearly" || - period == "semiannual" || - (isdigit (period[0]) && ( - period[period.length () - 1] == 'm' || - period[period.length () - 1] == 'q'))) + if (isdigit (period[0]) && period[period.length () - 1] == 'm') { - // TODO lots of work here... + std::string numeric = period.substr (0, period.length () - 1); + int increment = atoi (numeric.c_str ()); + + m += increment; + while (m > 12) + { + m -= 12; + ++y; + } + + while (! Date::valid (m, d, y)) + --d; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + else if (period == "quarterly") + { + m += 3; + if (m > 12) + { + m -= 12; + ++y; + } + + while (! Date::valid (m, d, y)) + --d; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + else if (isdigit (period[0]) && period[period.length () - 1] == 'q') + { + std::string numeric = period.substr (0, period.length () - 1); + int increment = atoi (numeric.c_str ()); + + m += 3 * increment; + while (m > 12) + { + m -= 12; + ++y; + } + + while (! Date::valid (m, d, y)) + --d; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + else if (period == "semiannual") + { + m += 6; + if (m > 12) + { + m -= 12; + ++y; + } + + while (! Date::valid (m, d, y)) + --d; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + else if (period == "bimonthly") + { + m += 2; + if (m > 12) + { + m -= 12; + ++y; + } + + while (! Date::valid (m, d, y)) + --d; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); + } + + else if (period == "biannual" || + period == "biyearly") + { + y += 2; + +// std::cout << "# next " << current.toString () << " + " << period << " = " << m << "/" << d << "/" << y << std::endl; + return Date (m, d, y); } // If the period is an 'easy' one, add it to current, and we're done. + int days = convertDuration (period); return current + (days * 86400); } //////////////////////////////////////////////////////////////////////////////// +// When the status of a recurring child task changes, the parent task must +// update it's mask. +void updateRecurrenceMask ( + TDB& tdb, + std::vector & all, + T& task) +{ + std::string parent = task.getAttribute ("parent"); +// std::cout << "# updateRecurrenceMask of " << parent << std::endl; + if (parent != "") + { + std::vector ::iterator it; + for (it = all.begin (); it != all.end (); ++it) + { + if (it->getUUID () == parent) + { +// std::cout << "# located parent task" << std::endl; + unsigned int index = atoi (task.getAttribute ("imask").c_str ()); +// std::cout << "# child imask=" << index << std::endl; + std::string mask = it->getAttribute ("mask"); +// std::cout << "# parent mask=" << mask << std::endl; + if (mask.length () > index) + { + mask[index] = (task.getStatus () == T::pending) ? '-' + : (task.getStatus () == T::completed) ? '+' + : (task.getStatus () == T::deleted) ? 'X' + : '?'; + +// std::cout << "# setting parent mask to=" << mask << std::endl; + it->setAttribute ("mask", mask); +// std::cout << "# tdb.modifyT (parent)" << std::endl; + tdb.modifyT (*it); + } + else + { +// std::cout << "# mask of insufficient length" << std::endl; +// std::cout << "# should never occur" << std::endl; + std::string mask; + for (unsigned int i = 0; i < index; ++i) + mask += "?"; + + mask += (task.getStatus () == T::pending) ? '-' + : (task.getStatus () == T::completed) ? '+' + : (task.getStatus () == T::deleted) ? 'X' + : '?'; + } + + return; // No point continuing the loop. + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/task.h b/src/task.h index 69ad75932..e6467fd54 100644 --- a/src/task.h +++ b/src/task.h @@ -59,42 +59,44 @@ bool validDate (std::string&, Config&); // task.cpp void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); -void nag (const TDB&, T&, Config&); +void nag (TDB&, T&, Config&); int getDueState (const std::string&); -void handleRecurrence (const TDB&, std::vector &); +void handleRecurrence (TDB&, std::vector &); +void generateDueDates (T&, std::vector &); Date getNextRecurrence (Date&, std::string&); +void updateRecurrenceMask (TDB&, std::vector &, T&); // command.cpp void handleAdd (const TDB&, T&, Config&); -void handleProjects (const TDB&, T&, Config&); -void handleTags (const TDB&, T&, Config&); -void handleUndelete (const TDB&, T&, Config&); +void handleProjects (TDB&, T&, Config&); +void handleTags (TDB&, T&, Config&); +void handleUndelete (TDB&, T&, Config&); void handleVersion (Config&); -void handleExport (const TDB&, T&, Config&); -void handleDelete (const TDB&, T&, Config&); -void handleStart (const TDB&, T&, Config&); -void handleDone (const TDB&, T&, Config&); -void handleModify (const TDB&, T&, Config&); +void handleExport (TDB&, T&, Config&); +void handleDelete (TDB&, T&, Config&); +void handleStart (TDB&, T&, Config&); +void handleDone (TDB&, T&, Config&); +void handleModify (TDB&, T&, Config&); void handleColor (Config&); // report.cpp void filter (std::vector&, T&); -void handleList (const TDB&, T&, Config&); -void handleInfo (const TDB&, T&, Config&); -void handleLongList (const TDB&, T&, Config&); -void handleSmallList (const TDB&, T&, Config&); -void handleCompleted (const TDB&, T&, Config&); -void handleReportSummary (const TDB&, T&, Config&); -void handleReportNext (const TDB&, T&, Config&); -void handleReportHistory (const TDB&, T&, Config&); -void handleReportGHistory (const TDB&, T&, Config&); +void handleList (TDB&, T&, Config&); +void handleInfo (TDB&, T&, Config&); +void handleLongList (TDB&, T&, Config&); +void handleSmallList (TDB&, T&, Config&); +void handleCompleted (TDB&, T&, Config&); +void handleReportSummary (TDB&, T&, Config&); +void handleReportNext (TDB&, T&, Config&); +void handleReportHistory (TDB&, T&, Config&); +void handleReportGHistory (TDB&, T&, Config&); void handleReportUsage (const TDB&, T&, Config&); -void handleReportCalendar (const TDB&, T&, Config&); -void handleReportActive (const TDB&, T&, Config&); -void handleReportOverdue (const TDB&, T&, Config&); -void handleReportStats (const TDB&, T&, Config&); -void handleReportOldest (const TDB&, T&, Config&); -void handleReportNewest (const TDB&, T&, Config&); +void handleReportCalendar (TDB&, T&, Config&); +void handleReportActive (TDB&, T&, Config&); +void handleReportOverdue (TDB&, T&, Config&); +void handleReportStats (TDB&, T&, Config&); +void handleReportOldest (TDB&, T&, Config&); +void handleReportNewest (TDB&, T&, Config&); // util.cpp bool confirm (const std::string&); diff --git a/src/util.cpp b/src/util.cpp index edc02b62d..99ed46752 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -252,7 +252,6 @@ int convertDuration (std::string& input) supported.push_back ("fortnight"); supported.push_back ("monthly"); supported.push_back ("bimonthly"); - supported.push_back ("semimonthly"); supported.push_back ("quarterly"); supported.push_back ("biannual"); supported.push_back ("biyearly"); @@ -268,7 +267,6 @@ int convertDuration (std::string& input) if (found == "daily" || found == "day") return 1; else if (found == "weekly" || found == "sennight") return 7; else if (found == "biweekly" || found == "fortnight") return 14; - else if (found == "semimonthly") return 15; else if (found == "monthly") return 30; else if (found == "bimonthly") return 61; else if (found == "quarterly") return 91;