Implement enough process handling logic to make psyq4.0 happy (#46)

* Implement enough process handling logic to make psyq4.0 happy

* revert gitignore

* data type update

* PR review

* DEBUG_LOG mistake

---------

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
This commit is contained in:
ConorB
2023-09-18 07:05:47 +01:00
committed by GitHub
parent ceb13b34de
commit 218b4d7d76
8 changed files with 167 additions and 23 deletions

View File

@@ -13,15 +13,22 @@
uint32_t wibo::lastError = 0;
char** wibo::argv;
int wibo::argc;
char *wibo::executableName;
char *wibo::commandLine;
wibo::Executable *wibo::mainModule = 0;
bool wibo::debugEnabled = false;
unsigned int wibo::debugIndent = 0;
void wibo::debug_log(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
if (wibo::debugEnabled)
if (wibo::debugEnabled) {
for (size_t i = 0; i < wibo::debugIndent; i++)
fprintf(stderr, "\t");
vfprintf(stderr, fmt, args);
}
va_end(args);
}
@@ -198,6 +205,11 @@ int main(int argc, char **argv) {
wibo::debugEnabled = true;
}
if (getenv("WIBO_DEBUG_INDENT")) {
wibo::debugIndent = std::stoul(getenv("WIBO_DEBUG_INDENT"));
}
files::init();
// Create TIB
@@ -264,6 +276,7 @@ int main(int argc, char **argv) {
wibo::commandLine = cmdLine.data();
DEBUG_LOG("Command line: %s\n", wibo::commandLine);
wibo::executableName = argv[0];
wibo::argv = argv + 1;
wibo::argc = argc - 1;