fix and update readme
This commit is contained in:
+10
-13
@@ -1,24 +1,24 @@
|
||||
tft - Terminal Family Tree
|
||||
|
||||
tft can create and display family trees on the terminal.
|
||||
tft is an ncurses program that can create and display family trees on the terminal.
|
||||
|
||||
|
||||
HOW TO CREATE:
|
||||
Trees are created using the tft file format, for example this tft file:
|
||||
|
||||
# This is a comment
|
||||
Adam, M # Adam is a male
|
||||
Adam
|
||||
|
||||
Eve, F
|
||||
Eve, F # Eve is female
|
||||
s: Adam # Eve's spouse is Adam
|
||||
|
||||
Cain, M
|
||||
Cain
|
||||
p: Adam, Eve # Cain's parents are Adam and Eve
|
||||
|
||||
Abel, M
|
||||
Abel
|
||||
p: - # Abel's parents are the same as the last person's (Cain)
|
||||
|
||||
Seth, M
|
||||
Seth
|
||||
p: -
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ DEPENDENCIES:
|
||||
ncursesw development library (libncursesw5-dev on Debian/Ubuntu)
|
||||
|
||||
HOW TO INSTALL:
|
||||
Make sure you satisfy the dependencies and have permissons and execute:
|
||||
Make sure you satisfy the dependencies and execute:
|
||||
git clone https://gitlab.com/venelin98/tft.git
|
||||
cd tft
|
||||
./install.sh
|
||||
sudo ./install.sh
|
||||
|
||||
|
||||
HOW TO USE:
|
||||
@@ -60,11 +60,8 @@ HOW TO USE:
|
||||
- - show first names only
|
||||
|
||||
TFT FORMAT:
|
||||
- All spaces are ignored e.g.: Adam 0 and Adam0 are equivalent
|
||||
- '_' in names is converted to ' '
|
||||
- Number at the end of a name is used to disambiguate when multiple people have identical names e.g.:
|
||||
Adam0 is the first added Adam, Adam1 is the second added Adam
|
||||
- Must end with a newline
|
||||
- A number after a name is used to disambiguate when multiple people have identical names e.g.:
|
||||
"Adam 0" is the first added Adam, "Adam 1" is the second added Adam
|
||||
|
||||
QUESTIONS AND FEEDBACK:
|
||||
venelin98@abv.bg
|
||||
|
||||
+18
-6
@@ -22,6 +22,13 @@ namespace /* internal */
|
||||
: data(new char[len])
|
||||
, end(data + len)
|
||||
{}
|
||||
alloced(const alloced&) = delete;
|
||||
alloced(alloced&& other)
|
||||
: data(other.data)
|
||||
, end(other.end)
|
||||
{
|
||||
const_cast<char*&>(other.data) = nullptr;
|
||||
}
|
||||
~alloced()
|
||||
{
|
||||
delete[] data;
|
||||
@@ -42,6 +49,11 @@ namespace /* internal */
|
||||
struct token
|
||||
{
|
||||
token(const char* b, const char* e);
|
||||
explicit token(TokenType t)
|
||||
: type(t)
|
||||
{
|
||||
}
|
||||
|
||||
U32 size() const
|
||||
{
|
||||
return end - begin;
|
||||
@@ -512,13 +524,13 @@ namespace /* internal */
|
||||
return res;
|
||||
}
|
||||
|
||||
vector<token> tokenize(alloced file)
|
||||
vector<token> tokenize(const char* data_begin, const char* data_end)
|
||||
{
|
||||
vector<token> tokens;
|
||||
tokens.reserve(256);
|
||||
char* token_begin = file.data;
|
||||
const char* token_begin = data_begin;
|
||||
|
||||
for(char* it = file.data; it < end_data_; ++it)
|
||||
for(const char* it = data_begin; it < data_end; ++it)
|
||||
{
|
||||
switch(*it)
|
||||
{
|
||||
@@ -545,8 +557,8 @@ namespace /* internal */
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
/* tokens.emplace_back(nullptr, nullptr); */
|
||||
/* tokens.back().type = NEW_LINE; */
|
||||
tokens.emplace_back(NEW_LINE);
|
||||
tokens.emplace_back(NEW_LINE);
|
||||
return tokens;
|
||||
}
|
||||
}
|
||||
@@ -561,7 +573,7 @@ Tree parseTftFile(const char* path)
|
||||
|
||||
MappedFile mapedfile = mapfile(file);
|
||||
alloced preprocessed = removeComments(mapedfile);
|
||||
vector<token> tokens = tokenize(preprocessed);
|
||||
vector<token> tokens = tokenize(preprocessed.data, end_data_);
|
||||
|
||||
state_neutral(tokens);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user