cool stuff

This commit is contained in:
2026-06-15 20:27:50 +10:00
parent 284b08b12a
commit 80140ed798
41 changed files with 470 additions and 4 deletions

16
src/Log/Error.c Normal file
View File

@@ -0,0 +1,16 @@
#include "../../include/ground.h"
void _GroundLogError(const char* message) {
if (Ground.Log.errorCount >= 4096) {
Ground.Internal.giveUpAndCry();
}
char* copy = malloc(sizeof(char) * (strlen(message) + 1));
if (copy == NULL) {
Ground.Internal.giveUpAndCry();
}
strcpy(copy, message);
Ground.Log.errors[Ground.Log.errorCount] = copy;
Ground.Log.errorCount++;
}

16
src/Log/Warning.c Normal file
View File

@@ -0,0 +1,16 @@
#include "../../include/ground.h"
void _GroundLogWarning(const char* message) {
if (Ground.Log.warningCount >= 4096) {
Ground.Internal.giveUpAndCry();
}
char* copy = malloc(sizeof(char) * (strlen(message) + 1));
if (copy == NULL) {
Ground.Internal.giveUpAndCry();
}
strcpy(copy, message);
Ground.Log.warnings[Ground.Log.warningCount] = copy;
Ground.Log.warningCount++;
}

16
src/Log/printErrors.c Normal file
View File

@@ -0,0 +1,16 @@
#include "../../include/ground.h"
void _GroundLogPrintErrors() {
if (Ground.Log.errorCount != 0) {
printf("%zu errors:\n", Ground.Log.errorCount);
for (size_t i = 0; i < Ground.Log.errorCount; i++) {
printf(" \e[0;31m%zu: %s\n\e[0m", Ground.Log.errorCount, Ground.Log.errors[i]);
}
}
if (Ground.Log.warningCount != 0) {
printf("%zu warnings:\n", Ground.Log.warningCount);
for (size_t i = 0; i < Ground.Log.warningCount; i++) {
printf(" \e[0;33m%zu: %s\n\e[0m", Ground.Log.warningCount, Ground.Log.warnings[i]);
}
}
}