aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-09-17 15:26:43 -0400
committernodist <kevin.comas.git@gmail.com>2026-09-17 15:26:43 -0400
commited19c8d27e2abf768ed2db33077330918b48ef84 (patch)
tree4bb45332f10b64766b0e7b7d2ab8b0aefa54abb5
parent2ff1b10b9e42fad82334b13390a49311990a69e4 (diff)
add macro header
-rw-r--r--Makefile30
-rw-r--r--TESTING2
-rw-r--r--include/kpl.h5
-rw-r--r--include/kpl/macro.h9
-rw-r--r--include/kpl/system.h2
-rw-r--r--source/kpl.c1
-rwxr-xr-xvm.sh12
7 files changed, 35 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 6745090..cf2f008 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,17 @@
-.PHONY: kpl_test_memory kpl_test_thread rsync_list clean
+.PHONY: kpl_test_memory kpl_test_thread clean rsync_list
MAKEFLAGS := -j$(shell nproc)
-INCLUDE_DIR := include
-SOURCE_DIR := source
-TEST_DIR := test
-
CC := gcc
OO := -g -Og
FFLAGS := -fno-omit-frame-pointer -fhardened
WFLAGS := -Wall -Wextra -Wstack-protector
-CFLAGS = -std=gnu99 $(FLAGS) -I./$(INCLUDE_DIR) $(OO) $(FFLAGS) $(WFLAGS)
+CFLAGS = -std=gnu99 $(FLAGS) -I./include $(OO) $(FFLAGS) $(WFLAGS)
CCOBJ = $(CC) $(CFLAGS) -o $@ $^
-SOURCE_OBJECTS := $(patsubst %.c, %.o, $(wildcard ./$(SOURCE_DIR)/*.c))
-TEST_OBJECTS := $(patsubst %.c, %.o, $(wildcard ./$(TEST_DIR)/*.c))
+SOURCE_OBJECTS := $(patsubst %.c, %.o, $(wildcard ./source/*.c))
+TEST_OBJECTS := $(patsubst %.c, %.o, $(wildcard ./test/*.c))
kpl: OO := -O2
kpl: WFLAGS += -Werror
@@ -32,16 +28,16 @@ kpl_test_memory: kpl_test
kpl_test_thread: FFLAGS += -fsanitize=thread
kpl_test_thread: kpl_test
-rsync_list:
- @echo "$(INCLUDE_DIR)/"
- @echo "$(INCLUDE_DIR)/*/"
- @echo "$(SOURCE_DIR)/"
- @echo "$(TEST_DIR)/"
- @echo "*.c"
- @echo "*.h"
- @echo "Makefile"
-
clean:
@rm -fv kpl
@rm -fv kpl_test
@find -type f -name "*.o" -exec rm -v {} \;
+
+rsync_list:
+ @echo "include/"
+ @echo "include/*/"
+ @echo "source/"
+ @echo "test/"
+ @echo "*.c"
+ @echo "*.h"
+ @echo "Makefile"
diff --git a/TESTING b/TESTING
index 3461f0a..cef6e59 100644
--- a/TESTING
+++ b/TESTING
@@ -69,7 +69,7 @@ Stopping:
Cleaning:
-./vm.sh -clean # Remove test files on each machine
+./vm.sh -clean # Remove test files on each vm machine
Destroying:
diff --git a/include/kpl.h b/include/kpl.h
index ad76991..adf366f 100644
--- a/include/kpl.h
+++ b/include/kpl.h
@@ -1,5 +1,6 @@
#pragma once
-#include "kpl/color.h"
-#include "kpl/type.h"
+// All headers in one file for including
+
+#include "kpl/macro.h"
diff --git a/include/kpl/macro.h b/include/kpl/macro.h
new file mode 100644
index 0000000..f682a30
--- /dev/null
+++ b/include/kpl/macro.h
@@ -0,0 +1,9 @@
+
+#pragma once
+
+// KPL specific macros
+
+#include "color.h"
+#include "type.h"
+
+#define KPL_TODO(MESSAGE) printf(KPL_COLOR2(BOLD, LIGHT_YELLOW) "TODO " KPL_COLOR(RESET) KPL_COLOR(BOLD) "%s" KPL_COLOR(RESET) ":" KPL_COLOR(LIGHT_BLUE) "%s" KPL_COLOR(RESET) ":" KPL_COLOR(LIGHT_MAGENTA) "%d" KPL_COLOR(RESET) "::" KPL_COLOR(LIGHT_YELLOW) "%s\n" KPL_COLOR(RESET), __FILE__, __FUNCTION__, __LINE__, MESSAGE)
diff --git a/include/kpl/system.h b/include/kpl/system.h
index f7d8239..06e8ad3 100644
--- a/include/kpl/system.h
+++ b/include/kpl/system.h
@@ -1,7 +1,7 @@
#pragma once
-// System headers and miscellaneous utilities
+// System headers
#include <stdlib.h>
#include <stdio.h>
diff --git a/source/kpl.c b/source/kpl.c
index 7e69777..05d9250 100644
--- a/source/kpl.c
+++ b/source/kpl.c
@@ -3,6 +3,7 @@
#ifdef KPL_MAIN
int32_t main(void) {
+ KPL_TODO("MAIN PROGRAM");
return 1;
}
#endif
diff --git a/vm.sh b/vm.sh
index fb84fc9..351886c 100755
--- a/vm.sh
+++ b/vm.sh
@@ -87,7 +87,7 @@ vm_boot() {
if [[ -f "$PID_FILE" ]]
then
echo "VM $1 is running"
- return
+ return 1
fi
local CMD=(
"${QEMU[$1]}"
@@ -123,7 +123,7 @@ vm_cli() {
vm_machine_check $VM
if [[ $? != 0 ]]
then
- return
+ return 1
fi
vm_boot $VM "-nographic"
}
@@ -136,10 +136,11 @@ vm_start() {
if [[ $? == 0 ]]
then
vm_boot $VM "-display" "none" "-daemonize"
+ return
else
echo "Invalid Machine Specified"
+ return 1
fi
- return
fi
for MACHINE in "${NAMES[@]}"
do
@@ -163,7 +164,7 @@ vm_cmd() {
vm_machine_check $MACHINE
if [[ $? != 0 ]]
then
- return
+ return 1
fi
local SSH_OPTIONS=()
vm_ssh_options $MACHINE SSH_OPTIONS
@@ -186,7 +187,7 @@ vm_rsync_machine() {
if [[ $? != 0 ]]
then
echo "Invalid Machine Specified"
- return
+ return 1
fi
local SSH_OPTIONS=()
vm_ssh_options $MACHINE SSH_OPTIONS
@@ -243,6 +244,7 @@ vm_test() {
echo "-----------------------"
fi
done
+ return $(( ${TEST_STATUS[$X64]} | ${TEST_STATUS[$A64]} ))
}
vm_stop() {