Starting rework on this project

Starting with refactoring a bunch of stuff, then moving on to the
roadmap. Might make a small planner for this as well.
master
Ruben Dahl 2023-07-30 19:28:18 +02:00
parent 56578fcba7
commit 89715d1e59
3 changed files with 342 additions and 328 deletions

@ -1 +1 @@
Subproject commit 048b26ca2bc63728de46ac2bfd5f3ce907b98fb1 Subproject commit fe9589cc829d69534f7b9db526e3088807469196

View File

@ -1,377 +1,385 @@
#include "ceev.h" #include "ceev.h"
static int usage() { static int usage() {
std::cout << "Usage:"; std::cout << "Usage:";
std::cout << "\n\t"; std::cout << "\n\t";
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
<< bright_green("options") << ">\n"; << bright_green("options") << ">\n";
std::cout << "\n"; std::cout << "\n";
std::cout << "Run `" << GET_PROGRAM_NAME() << bright_green(" --help") std::cout << "Run `" << GET_PROGRAM_NAME() << bright_green(" --help")
<< "' for more information.\n" << "' for more information.\n"
<< std::endl; << std::endl;
return 1; return 1;
} }
static int show_help() { static int show_help() {
std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <" std::cout << GET_PROGRAM_NAME() << " [" << cyan("command") << "] <"
<< bright_green("options") << ">\n"; << bright_green("options") << ">\n";
std::cout << "\n"; std::cout << "\n";
std::cout << "Usage:"; std::cout << "Usage:";
// ceev init // ceev init
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" init ") << "<" std::cout << GET_PROGRAM_NAME() << cyan(" init ") << "<"
<< bright_green("--force") << ">\n"; << bright_green("--force") << ">\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Creates the CeeV file system. Can only be used "; std::cout << "Creates the CeeV file system. Can only be used ";
std::cout << "if the current folder is empty,"; std::cout << "if the current folder is empty,";
std::cout << "\n\t\tor when run with `" << bright_green("--force") << "'"; std::cout << "\n\t\tor when run with `" << bright_green("--force") << "'";
// ceev build // ceev build
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" build") << "\n"; std::cout << GET_PROGRAM_NAME() << cyan(" build") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Not yet implemented"; std::cout << "Not yet implemented";
// ceev run // ceev run
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" run") << "\n"; std::cout << GET_PROGRAM_NAME() << cyan(" run") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Not yet implemented"; std::cout << "Not yet implemented";
// ceev clean // ceev clean
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" clean") << "\n"; std::cout << GET_PROGRAM_NAME() << cyan(" clean") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Not yet implemented"; std::cout << "Not yet implemented";
// ceev devel // ceev devel
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" devel ") << "<" std::cout << GET_PROGRAM_NAME() << cyan(" devel ") << "<"
<< bright_green("--help") << ">\n"; << bright_green("--help") << ">\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Supplementary command for development information"; std::cout << "Supplementary command for development information";
// ceev --help // ceev --help
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" --help") << "/" << cyan("-h") std::cout << GET_PROGRAM_NAME() << cyan(" --help") << "/" << cyan("-h")
<< "\n"; << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "This help page."; std::cout << "This help page.";
// ceev --version // ceev --version
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" --version") << "/" << cyan("-v") std::cout << GET_PROGRAM_NAME() << cyan(" --version") << "/" << cyan("-v")
<< "\n"; << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Get the current version."; std::cout << "Get the current version.";
// ceev --build // ceev --build
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << cyan(" --build") << "/" << cyan("-B") std::cout << GET_PROGRAM_NAME() << cyan(" --build") << "/" << cyan("-B")
<< "\n"; << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Get the current build information."; std::cout << "Get the current build information.";
std::cout << std::endl; std::cout << std::endl;
return 0; return 0;
} }
int buildinfo() { static int buildinfo() {
std::cout << "CeeV build " << bright_cyan(bold(GIT_COMMIT_HASH)) << "\n"; std::cout << "CeeV build " << bright_cyan(bold(GIT_COMMIT_HASH)) << "\n";
std::cout << "Commit date: " << bright_cyan(bold(GIT_COMMIT_DATE)) << "\n"; std::cout << "Commit date: " << bright_cyan(bold(GIT_COMMIT_DATE)) << "\n";
std::cout << "Commited by: " << bright_cyan(bold(GIT_COMMIT_AUTHOR)) std::cout << "Commited by: " << bright_cyan(bold(GIT_COMMIT_AUTHOR))
<< "\n\n"; << "\n\n";
std::cout << "Commit message:\n"; std::cout << "Commit message:\n";
std::cout << bright_cyan(bold(GIT_COMMIT_MSG)) << std::endl; std::cout << bright_cyan(bold(GIT_COMMIT_MSG)) << std::endl;
return 0; return 0;
} }
static int show_version() { static int show_version() {
char buf[6]; char buf[6];
std::memcpy(buf, &__ceev_version[std::strlen(__ceev_version) - 5], 6); std::memcpy(buf, &__ceev_version[std::strlen(__ceev_version) - 5], 6);
if (!std::strcmp(buf, "devel")) if (!std::strcmp(buf, "devel"))
std::cout << "CeeV version " << __ceev_version << " (Build " std::cout << "CeeV version " << __ceev_version << " (Build "
<< GIT_COMMIT_HASH << ")" << '\n'; << GIT_COMMIT_HASH << ")" << '\n';
else else
std::cout << "CeeV version " << __ceev_version << '\n'; std::cout << "CeeV version " << __ceev_version << '\n';
return 0; return 0;
} }
bool replace(std::string& str, const std::string& from, const std::string& to) { bool replace(std::string& str, const std::string& from, const std::string& to) {
size_t start_pos = str.find(from); size_t start_pos = str.find(from);
if(start_pos == std::string::npos) if (start_pos == std::string::npos)
return false; return false;
str.replace(start_pos, from.length(), to); str.replace(start_pos, from.length(), to);
return true; return true;
} }
static std::string query_author() {
std::string author;
std::cout << "Author: ";
std::getline(std::cin, author);
return author;
}
struct config_data get_config(bool ignore_err = false) { struct config_data get_config(bool ignore_err = false) {
fs::path config_path = fs::current_path(); fs::path config_path = fs::current_path();
std::string line; std::string line;
struct config_data data; struct config_data data;
std::ifstream config(config_path / ".ceev" / CONFIG_FILENAME); std::ifstream config(config_path / ".ceev" / CONFIG_FILENAME);
if (!config) { if (!config) {
if (!ignore_err) { if (!ignore_err) {
std::cerr << bg_red(bold("ERROR")) << ": Could not open config\n"; std::cerr << bg_red(bold("ERROR")) << ": Could not open config\n";
std::cerr << "Run `ceev init' to create a new project." << std::endl; std::cerr << "Run `ceev init' to create a new project."
<< std::endl;
}
return data;
} }
while (std::getline(config, line)) {
std::istringstream iss(line);
std::string key;
if (!std::getline(iss, key, '='))
continue;
std::string value;
if (!std::getline(iss, value))
continue;
if (key == "name")
data.name = value;
if (key == "version")
data.version = value;
if (key == "author")
data.author = value;
if (key == "email")
data.email = value;
}
config.close();
return data; return data;
}
while (std::getline(config, line)) {
std::istringstream iss(line);
std::string key;
if (!std::getline(iss, key, '='))
continue;
std::string value;
if (!std::getline(iss, value))
continue;
if (key == "name")
data.name = value;
if (key == "version")
data.version = value;
if (key == "author")
data.author = value;
if (key == "email")
data.email = value;
}
config.close();
return data;
} }
int create_fs(std::deque<std::string> args) { int create_fs(std::deque<std::string> args) {
fs::path cwd = fs::current_path(); fs::path cwd = fs::current_path();
if (!fs::is_empty(cwd) && if (!fs::is_empty(cwd) &&
((!args.empty() && args[0] != "--force") || args.empty())) { ((!args.empty() && args[0] != "--force") || args.empty())) {
std::cerr << bg_red(bold("ERROR")) << ": Folder not empty.\n" std::cerr << bg_red(bold("ERROR")) << ": Folder not empty.\n"
<< "Run the command with `--force' to run anyways" << std::endl; << "Run the command with `--force' to run anyways"
return 1; << std::endl;
} return 1;
fs::create_directory(cwd / ".ceev", cwd); }
fs::create_directory(cwd / "src", cwd); fs::create_directory(cwd / ".ceev", cwd);
std::ofstream config(cwd / ".ceev/" / CONFIG_FILENAME); fs::create_directory(cwd / "src", cwd);
std::string directory = std::ofstream config(cwd / ".ceev/" / CONFIG_FILENAME);
cwd.string().substr(cwd.parent_path().string().length() + 1); std::string directory =
std::cout << "Initializing project...\n"; cwd.string().substr(cwd.parent_path().string().length() + 1);
std::cout << "You can change this information later by editing .ceev/" std::cout << "Initializing project...\n";
<< CONFIG_FILENAME << "\n"; std::cout << "You can change this information later by editing .ceev/"
std::string project_name; << CONFIG_FILENAME << "\n";
std::cout << "Project name [" << directory << "]: "; std::string project_name;
std::getline(std::cin, project_name); std::cout << "Project name [" << directory << "]: ";
if (project_name == "") std::getline(std::cin, project_name);
project_name = directory; if (project_name == "")
config << "name=" << project_name << '\n'; project_name = directory;
std::string version; config << "name=" << project_name << '\n';
std::cout << "Version [0.0.1]: "; std::string version;
std::getline(std::cin, version); std::cout << "Version [0.0.1]: ";
if (version == "") std::getline(std::cin, version);
version = "0.0.1"; if (version == "")
config << "version=" << version << '\n'; version = "0.0.1";
std::string author = query_author(); config << "version=" << version << '\n';
if (author == "") { std::string author, author_email;
std::cerr << bg_red(bold("ERROR")) << ": Author cannot be empty.\n"; std::string host = "";
author = query_author(); std::cout << "Author: ";
} std::getline(std::cin, author);
config << "author=" << author << '\n'; config << "author=" << author << '\n';
std::string email; char* login = (char*)malloc(sizeof(char*) * 100);
while (author.find(' ') != std::string::npos) getlogin_r(login, 100);
replace(author, " ", "."); author_email = std::string(login);
std::cout << "Email [" << author << "@example.org]: "; free(login);
std::getline(std::cin, email); char* hostname = (char*)malloc(sizeof(char*) * 100);
if (email == "") gethostname(hostname, 100);
email = author + "@example.org"; host = std::string(hostname);
config << "email=" << email << '\n'; free(hostname);
config.close(); std::string email;
return 0; std::cout << "Email [" << author_email << "@" << host << "]: ";
std::getline(std::cin, email);
if (email == "")
email = author_email + "@" + host;
config << "email=" << email << '\n';
config.close();
return 0;
} }
int build_project(std::deque<std::string> args) { int build_project(std::deque<std::string> args) {
std::cout << TODO << ": Function is not made yet.\n"; NYI;
std::cout << "Building project..." << std::endl; std::cout << "Building project..." << std::endl;
return 0; return 0;
} }
int run_project(std::deque<std::string> args) { int run_project(std::deque<std::string> args) {
struct config_data data = get_config(); struct config_data data = get_config();
std::cout << "Name: " << data.name << '\n'; std::cout << "Name: " << data.name << '\n';
std::cout << "Version: " << data.version << '\n'; std::cout << "Version: " << data.version << '\n';
std::cout << "Author: " << data.author << '\n'; std::cout << "Author: " << data.author << '\n';
std::cout << "Email: " << data.email << '\n'; std::cout << "Email: " << data.email << '\n';
std::cout << "Running project..." << std::endl; std::cout << "Running project..." << std::endl;
return devel_sdl2(args); return devel_sdl2(args);
} }
int clean_project(std::deque<std::string> args) { int clean_project(std::deque<std::string> args) {
std::cout << TODO << ": Function is not made yet.\n"; NYI;
std::cout << "Cleaning project..." << std::endl; std::cout << "Cleaning project..." << std::endl;
return 0; return 0;
} }
int devel(std::deque<std::string> args) { int devel(std::deque<std::string> args) {
if (args.empty()) { if (args.empty()) {
std::cout << bg_red(bold("ERROR")) << ": No subcommands given." std::cout << bg_red(bold("ERROR")) << ": No subcommands given."
<< std::endl;
devel_help();
return 1;
}
std::string a1 = args[0];
args.pop_front();
if (a1 == "roadmap")
return devel_roadmap();
if (a1 == "sdl2")
return devel_sdl2(args);
if (a1 == "lang")
return devel_lang(args);
std::string kw;
if (a1.substr(0, 2) == "--") {
kw = a1.substr(2);
if (kw == "help")
return devel_help();
}
if (a1.substr(0, 1) == "-") {
kw = a1.substr(1);
if (kw == "h")
return devel_help();
}
std::cerr << bg_red(bold("ERROR")) << ": Unknown command `"
<< bright_magenta(a1) << "'\n"
<< std::endl; << std::endl;
devel_help(); devel_help();
return 1; return 1;
}
std::string a1 = args[0];
args.pop_front();
if (a1 == "roadmap")
return devel_roadmap();
if (a1 == "sdl2")
return devel_sdl2(args);
if (a1 == "lang")
return devel_lang(args);
std::string kw;
if (a1.substr(0, 2) == "--") {
kw = a1.substr(2);
if (kw == "help")
return devel_help();
}
if (a1.substr(0, 1) == "-") {
kw = a1.substr(1);
if (kw == "h")
return devel_help();
}
std::cerr << bg_red(bold("ERROR")) << ": Unknown command `"
<< bright_magenta(a1) << "'\n"
<< std::endl;
devel_help();
return 1;
} }
int devel_help() { int devel_help() {
std::cout << "Usage:"; std::cout << "Usage:";
// ceev devel roadmap // ceev devel roadmap
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("roadmap") << "\n"; std::cout << GET_PROGRAM_NAME() << " devel " << cyan("roadmap") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Get the current roadmap."; std::cout << "Get the current roadmap.";
// ceev devel sdl2 // ceev devel sdl2
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << " devel " << cyan("sdl2") << " <" std::cout << GET_PROGRAM_NAME() << " devel " << cyan("sdl2") << " <"
<< bright_green("--use-defaults") << "/" << bright_green("-D") << bright_green("--use-defaults") << "/" << bright_green("-D")
<< ">\n"; << ">\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "Tests of SDL2"; std::cout << "Tests of SDL2";
// ceev devel --help // ceev devel --help
std::cout << "\n*\t"; std::cout << "\n*\t";
std::cout << GET_PROGRAM_NAME() << " devel " << bright_green("--help") << "/" std::cout << GET_PROGRAM_NAME() << " devel " << bright_green("--help")
<< bright_green("-h") << "\n"; << "/" << bright_green("-h") << "\n";
std::cout << "\t\t"; std::cout << "\t\t";
std::cout << "This help page."; std::cout << "This help page.";
std::cout << std::endl; std::cout << std::endl;
return 0; return 0;
} }
int devel_roadmap() { int devel_roadmap() {
std::cout << "CeeV roadmap:\n"; std::cout << "CeeV roadmap:\n";
std::cout << "* " << HALTED << ":\tGet a working SDL prototype.\n"; std::cout << "* " << HALTED << ":\tGet a working SDL prototype.\n";
std::cout << "* " << INPROG << ":\tMake a language parser.\n"; std::cout << "* " << INPROG << ":\tMake a language parser.\n";
std::cout << "* " << TODO << " :\tMake a language compiler.\n"; std::cout << "* " << TODO << " :\tMake a language compiler.\n";
std::cout << "* " << TODO << " :\tTest the language.\n"; std::cout << "* " << TODO << " :\tTest the language.\n";
std::cout << "* " << STATUS << ":\t"; std::cout << "* " << STATUS << ":\t";
std::cout << "The beginning work on the language has begun." << std::endl; std::cout << "The beginning work on the language has begun." << std::endl;
return 0; return 0;
} }
int devel_sdl2(std::deque<std::string> args) { int devel_sdl2(std::deque<std::string> args) {
struct config_data data; struct config_data data;
if (!args.empty() && (args[0] == "--use-defaults" || args[0] == "-D")) { if (!args.empty() && (args[0] == "--use-defaults" || args[0] == "-D")) {
data.name = "CeeV"; data.name = "CeeV";
data.version = __ceev_version; data.version = __ceev_version;
data.author = "User"; data.author = "User";
data.email = "user@example.org"; data.email = "user@example.org";
} else } else
data = get_config(); data = get_config();
if (data.name == "") if (CV_ISDEBUG) {
return 1; std::cout << "data.name = " << data.name << '\n';
const int SCREEN_WIDTH = 640; std::cout << "data.version = " << data.version << '\n';
const int SCREEN_HEIGHT = 480; std::cout << "data.author = " << data.author << '\n';
SDL_Window *window = nullptr; std::cout << "data.email = " << data.email << '\n';
SDL_Surface *screen_surface = nullptr;
SDL_Surface *img_surface = nullptr;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
std::cerr << bg_red(bold("ERROR"))
<< ": SDL could not initialize! SDL_Error: " << SDL_GetError()
<< std::endl;
return 1;
}
std::string name = data.name + " version " + data.version + " by " +
data.author + " <" + data.email + ">";
window = SDL_CreateWindow(name.c_str(), SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (window == nullptr) {
std::cerr << bg_red(bold("ERROR"))
<< ": Window could not be created! SDL_Error: " << SDL_GetError()
<< std::endl;
return 1;
}
screen_surface = SDL_GetWindowSurface(window);
SDL_FillRect(screen_surface, nullptr,
SDL_MapRGB(screen_surface->format, 0xFF, 0xFF, 0xFF));
screen_surface = SDL_GetWindowSurface(window);
SDL_FillRect(screen_surface, nullptr,
SDL_MapRGB(screen_surface->format, 0xFF, 0xFF, 0xFF));
SDL_UpdateWindowSurface(window);
// hack to make it stay open
SDL_Event e;
bool quit = false;
while (!quit) {
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
quit = true;
}
} }
} if (data.name == "")
SDL_DestroyWindow(window); return 1;
SDL_Quit(); const int SCREEN_WIDTH = 640;
return 0; const int SCREEN_HEIGHT = 480;
SDL_Window* window = nullptr;
SDL_Surface* screen_surface = nullptr;
SDL_Surface* img_surface = nullptr;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
std::cerr << bg_red(bold("ERROR"))
<< ": SDL could not initialize! SDL_Error: " << SDL_GetError()
<< std::endl;
return 1;
}
std::string name = data.name + " version " + data.version + " by " +
data.author + " <" + data.email + ">";
window = SDL_CreateWindow(name.c_str(), SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (window == nullptr) {
std::cerr << bg_red(bold("ERROR"))
<< ": Window could not be created! SDL_Error: "
<< SDL_GetError() << std::endl;
return 1;
}
screen_surface = SDL_GetWindowSurface(window);
SDL_FillRect(screen_surface, nullptr,
SDL_MapRGB(screen_surface->format, 0xFF, 0xFF, 0xFF));
screen_surface = SDL_GetWindowSurface(window);
SDL_FillRect(screen_surface, nullptr,
SDL_MapRGB(screen_surface->format, 0xFF, 0xFF, 0xFF));
SDL_UpdateWindowSurface(window);
// hack to make it stay open
SDL_Event e;
bool quit = false;
while (!quit) {
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
quit = true;
}
}
}
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
} }
int devel_lang(std::deque<std::string> args) { int devel_lang(std::deque<std::string> args) {
std::cout << TODO << ": Function is not made yet.\n"; NYI;
return 1; return 1;
} }
int main(int argc, char **argv) { int main(int argc, char** argv) {
if (argc <= 1) { if (argc <= 1) {
return usage();
}
if (std::getenv("DEBUG"))
CV_ISDEBUG = true;
std::deque<std::string> args;
for (int i = 1; i < argc; i++)
args.push_back(std::string(argv[i]));
std::string a1 = std::string(args[0]);
args.pop_front();
if (a1 == "init")
return create_fs(args);
if (a1 == "build")
return build_project(args);
if (a1 == "run")
return run_project(args);
if (a1 == "clean")
return clean_project(args);
if (a1 == "devel")
return devel(args);
std::string kw;
if (a1.substr(0, 2) == "--") {
kw = a1.substr(2);
if (kw == "version")
return show_version();
if (kw == "help")
return show_help();
}
if (a1.substr(0, 1) == "-") {
kw = a1.substr(1);
if (kw == "v")
return show_version();
if (kw == "h")
return show_help();
// XXX: for now, use devel. maybe change this in the future?
if (kw == "B")
return buildinfo();
}
std::cerr << bg_red(bold("ERROR")) << ": Unknown command `"
<< bright_magenta(a1) << "'\n"
<< std::endl;
return usage(); return usage();
}
std::deque<std::string> args;
for (int i = 1; i < argc; i++)
args.push_back(std::string(argv[i]));
std::string a1 = std::string(args[0]);
args.pop_front();
if (a1 == "init")
return create_fs(args);
if (a1 == "build")
return build_project(args);
if (a1 == "run")
return run_project(args);
if (a1 == "clean")
return clean_project(args);
if (a1 == "devel")
return devel(args);
std::string kw;
if (a1.substr(0, 2) == "--") {
kw = a1.substr(2);
if (kw == "version")
return show_version();
if (kw == "help")
return show_help();
}
if (a1.substr(0, 1) == "-") {
kw = a1.substr(1);
if (kw == "v")
return show_version();
if (kw == "h")
return show_help();
// XXX: for now, use devel. maybe change this in the future?
if (kw == "B")
return buildinfo();
}
std::cerr << bg_red(bold("ERROR")) << ": Unknown command `"
<< bright_magenta(a1) << "'\n"
<< std::endl;
return usage();
} }

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <algorithm>
#include <ceev/colors.h> #include <ceev/colors.h>
#include <unistd.h>
#include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <deque> #include <deque>
@ -47,19 +48,24 @@
#define HALTED bg_red(white("HALTED")) #define HALTED bg_red(white("HALTED"))
#define STATUS bg_green(bold("STATUS")) #define STATUS bg_green(bold("STATUS"))
#define WIP std::cout << TODO << ": Function is a work in progress" << std::endl
#define NYI \
std::cout << TODO << ": Function is not yet implemented" << std::endl
bool CV_ISDEBUG = false;
namespace fs = std::filesystem; namespace fs = std::filesystem;
struct config_data { struct config_data {
std::string name = ""; std::string name = "";
std::string version = ""; std::string version = "";
std::string author = ""; std::string author = "";
std::string email = ""; std::string email = "";
}; };
static int usage(); static int usage();
static int show_help(); static int show_help();
static int buildinfo(); static int buildinfo();
bool replace(std::string& str, const std::string& from, const std::string& to); bool replace(std::string& str, const std::string& from, const std::string& to);
static std::string query_author();
struct config_data get_config(bool ignore_err); struct config_data get_config(bool ignore_err);
int create_fs(std::deque<std::string> args); int create_fs(std::deque<std::string> args);
int build_project(std::deque<std::string> args); int build_project(std::deque<std::string> args);
@ -70,4 +76,4 @@ int devel_help();
int devel_roadmap(); int devel_roadmap();
int devel_sdl2(std::deque<std::string> args); int devel_sdl2(std::deque<std::string> args);
int devel_lang(std::deque<std::string> args); int devel_lang(std::deque<std::string> args);
int main(int argc, char **argv); int main(int argc, char** argv);