combine trees fix err not appearing
This commit is contained in:
@@ -101,7 +101,6 @@ namespace /* internal */
|
||||
{
|
||||
endwin();
|
||||
cerr << "Unexpected end of file\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -109,7 +108,6 @@ namespace /* internal */
|
||||
{
|
||||
endwin();
|
||||
cerr << "Line " << line << ": Unexpected '" << c << "'\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -119,7 +117,6 @@ namespace /* internal */
|
||||
cerr << "Line " << line << ": Expected " << what << " got ";
|
||||
cerr.write(instead.begin, instead.size());
|
||||
cerr << " instead\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -130,7 +127,6 @@ namespace /* internal */
|
||||
cerr << "Line " << line << ": Unexpected token '";
|
||||
cerr.write(t.begin, t.size());
|
||||
cerr << "'\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -140,7 +136,6 @@ namespace /* internal */
|
||||
cerr << "Line " << line << ": Illegal attribute '";
|
||||
cerr.write(attr.begin, attr.size());
|
||||
cerr << "'\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -149,7 +144,6 @@ namespace /* internal */
|
||||
/* endwin(); */
|
||||
/* cerr << "Line " << line << ": two parents are already defined, " */
|
||||
/* << extra_name << " is third\n"; */
|
||||
/* cerr.flush(); */
|
||||
/* exit(1); */
|
||||
/* } */
|
||||
|
||||
@@ -158,7 +152,6 @@ namespace /* internal */
|
||||
endwin();
|
||||
cerr << "Line " << line << ": '" << name << "' is undefined.\n"
|
||||
"Members need to be defined before they are used as relations\n";
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -169,7 +162,6 @@ namespace /* internal */
|
||||
<< "At most the index after a name can be the number of people with the "
|
||||
"same name already defined - 1, since the count starts from 0.\n"
|
||||
"In this case the max is " << max << '\n';
|
||||
cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
+8
-7
@@ -9,8 +9,6 @@
|
||||
using std::cout;
|
||||
using std::string;
|
||||
|
||||
static WINDOW* info_tab;
|
||||
|
||||
EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute)
|
||||
: year(Year)
|
||||
, month(Month)
|
||||
@@ -21,7 +19,7 @@ EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute)
|
||||
assert(month <= 12 && day <= 31 && hour <= 23 && minute <= 59 && "Invalid EventTime data");
|
||||
}
|
||||
|
||||
void EventTime::print() const
|
||||
void EventTime::print(WINDOW* info_tab) const
|
||||
{
|
||||
if (day != UNKNOWN_DATE)
|
||||
wprintw(info_tab, "%d", day);
|
||||
@@ -54,21 +52,24 @@ Person::Person(const char* aName, EventTime aBirth, Sex aSex, EventTime aDeath)
|
||||
|
||||
bool Person::operator==(const Person &other)const
|
||||
{
|
||||
return name == other.name; //&& sex == other.sex; //TODO && day == other.day || !day || !other.day) && (month == other.month || !month || !other.month) && (year == other.year || !year || !other.year);
|
||||
return sex == other.sex && name == other.name &&
|
||||
(birth.day == other.birth.day || birth.day == EventTime::UNKNOWN_DATE || other.birth.day == EventTime::UNKNOWN_DATE) &&
|
||||
(birth.month == other.birth.month || birth.month == EventTime::UNKNOWN_DATE || other.birth.month == EventTime::UNKNOWN_DATE) &&
|
||||
(birth.year == other.birth.year || birth.year == EventTime::UNKNOWN_DATE || other.birth.year == EventTime::UNKNOWN_DATE);
|
||||
}
|
||||
|
||||
void Person::displayInfo()const
|
||||
{
|
||||
info_tab = newwin(LINES, COLS, 0, 0);
|
||||
WINDOW* info_tab = newwin(LINES, COLS, 0, 0);
|
||||
|
||||
waddstr(info_tab, name.data());
|
||||
waddch(info_tab,'\n');
|
||||
|
||||
waddstr(info_tab, "Birth: ");
|
||||
birth.print();
|
||||
birth.print(info_tab);
|
||||
|
||||
waddstr(info_tab, "Death: ");
|
||||
death.print();
|
||||
death.print(info_tab);
|
||||
|
||||
mvwaddstr(info_tab, LINES-1, 0, "Press any key to return.");
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ struct EventTime
|
||||
enum: I8 { UNKNOWN_TIME=-1 };
|
||||
|
||||
EventTime(I16 Year=UNKNOWN_DATE, U8 Month=UNKNOWN_DATE, U16 Day=UNKNOWN_DATE, I8 Hour=UNKNOWN_TIME, I8 Minute=UNKNOWN_TIME);
|
||||
void print() const;
|
||||
void print(WINDOW*) const;
|
||||
|
||||
I16 year; //The year in relation to Chritst's birth - 1 (AD) is the year He was born, -1 (BC) is the previous year. There is no year 0
|
||||
U8 month;
|
||||
|
||||
+23
-7
@@ -14,22 +14,38 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
cout << "Usage: tft FILE...\n";
|
||||
cout << "Usage: tft FILES...\n";
|
||||
return 0;
|
||||
}
|
||||
if(!strcmp(argv[1], "--help"))
|
||||
{
|
||||
cout << "Usage: tft FILE...\n"
|
||||
<< "Display the family tree in each FILE\n";
|
||||
cout << "Usage: tft FILES...\n"
|
||||
<< "Display the combined family tree in the FILES\n";
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
Tree tree( parseTftFile(argv[1]) );
|
||||
/* bool negative = false; */
|
||||
|
||||
for(int i = 2; i < argc; ++i)
|
||||
{
|
||||
tree += parseTftFile(argv[i]);
|
||||
/* if( !strcmp(argv[i], "-") ) */
|
||||
/* { */
|
||||
/* negative = true; */
|
||||
/* } */
|
||||
/* else */
|
||||
/* { */
|
||||
/* if(negative) */
|
||||
/* tree -= parseTftFile(argv[i]); */
|
||||
/* else */
|
||||
/* tree += parseTftFile(argv[i]); */
|
||||
/* } */
|
||||
}
|
||||
|
||||
init();
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
parseTftFile(argv[i]).display();
|
||||
}
|
||||
tree.display();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,9 +61,6 @@ Tree& Tree::operator+=(const Tree& other)
|
||||
{
|
||||
if(newId[rel.id] >= initNum) /* not already in I */
|
||||
relations[idIn1].push_back( {newId[rel.id], rel.type} );
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,24 +6,6 @@
|
||||
#include <sys/mman.h>
|
||||
#include <iostream>
|
||||
|
||||
/* static void end() */
|
||||
/* { */
|
||||
/* printf("before end\n"); */
|
||||
/* fflush(stdout); */
|
||||
/* for(int i=0;i < 100;i) */
|
||||
/* { */
|
||||
/* printf("before end\n"); */
|
||||
/* fflush(stdout); */
|
||||
/* } */
|
||||
/* endwin(); */
|
||||
/* printf("done\n"); */
|
||||
/* fflush(stdout); */
|
||||
|
||||
/* std::cout <<"done\n"<<std::endl; */
|
||||
/* std::cout.flush(); */
|
||||
/* std::cerr.flush(); */
|
||||
/* } */
|
||||
|
||||
void init()
|
||||
{
|
||||
setlocale(LC_ALL, "en_US.UTF-8");
|
||||
@@ -62,7 +44,6 @@ fd_t openOrDie(const char* path)
|
||||
{
|
||||
endwin();
|
||||
std::cerr << "Can't open: " << path << '\n';
|
||||
std::cerr.flush();
|
||||
exit(1);
|
||||
}
|
||||
return file;
|
||||
|
||||
Reference in New Issue
Block a user