5 Commits

Author SHA1 Message Date
abdelrahman 8061692801 Add standard streams
Release / release (push) Successful in 3s
2026-05-17 11:13:40 +01:00
abdelrahman 70997f091f Avoid wrapping whole Makefile in bear
Release / release (push) Successful in 6s
2026-05-17 10:17:54 +01:00
abdelrahman f61cb3cae0 Minor shell commander tweaks 2026-05-17 10:17:36 +01:00
abdelrahman 946bcc9b59 Replace extern 2026-05-17 09:44:11 +01:00
abdelrahman 7ffebe7dce Fix missing semi-colon
Release / release (push) Successful in 3s
2026-05-10 02:22:46 +01:00
10 changed files with 30 additions and 17 deletions
+3 -3
View File
@@ -153,7 +153,7 @@ builddir:
@mkdir -p "$(BUILD_DIR)"
build-c-test:
$(CC) $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(TEST_INCLUDE) $(TEST_C_SRC) -o "$(TEST_C_OUT)"
bear -- $(CC) $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(TEST_INCLUDE) $(TEST_C_SRC) -o "$(TEST_C_OUT)"
run-c-test: build-c-test
@echo -e "\n\033[34;1mRUNNING C TESTS\033[0m"
@@ -161,7 +161,7 @@ run-c-test: build-c-test
@rm "$(TEST_C_OUT)"
build-cc-test:
$(CXX) $(CXXSTD) $(CFLAGS) $(BUILD_FLAGS) $(TEST_INCLUDE) $(TEST_CXX_SRC) "$(LIB_OUT)" -o "$(TEST_CXX_OUT)"
bear -a -- $(CXX) $(CXXSTD) $(CFLAGS) $(BUILD_FLAGS) $(TEST_INCLUDE) $(TEST_CXX_SRC) "$(LIB_OUT)" -o "$(TEST_CXX_OUT)"
run-cc-test: build-cc-test
@echo -e "\n\033[34;1mRUNNING C++ TESTS\033[0m"
@@ -175,6 +175,6 @@ install: build-lib
@bash $(HEADER_INSTALL_CMD) $(LIB_SRC) "$(INCLUDE_INSTALL)" $(INCLUDES)
build-lib: builddir
$(CC) -c $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(LIBFLAGS) $(LIB_SRC) -o "$(OBJ_OUT)"
bear -a -- $(CC) -c $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(LIBFLAGS) $(LIB_SRC) -o "$(OBJ_OUT)"
$(AR) r "$(LIB_OUT)" "$(OBJ_OUT)"
@rm "$(OBJ_OUT)"
+1 -1
View File
@@ -1 +1 @@
1.0.3
1.0.4
+1 -1
View File
@@ -55,4 +55,4 @@ if ! contains ${BUILD_TYPE} "${ACCEPTED_BUILD_TYPES[@]}"; then
exit 1
fi
bear -- make BUILD_TYPE=$BUILD_TYPE $ARGS
make BUILD_TYPE=$BUILD_TYPE $ARGS
+1 -1
View File
@@ -60,7 +60,7 @@ typedef intptr_t iptr;
#ifdef WAPP_PLATFORM_CPP
#define wapp_class_mem static
#define BEGIN_C_LINKAGE extern "C" {
#define BEGIN_C_LINKAGE wapp_extern "C" {
#define END_C_LINKAGE }
#endif // WAPP_PLATFORM_CPP
+1 -1
View File
@@ -13,7 +13,7 @@
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
#define wapp_static_assert(EXPR, MSG) extern char ASSERTION_FAILED[EXPR ? 1 : -1]
#define wapp_static_assert(EXPR, MSG) wapp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
#ifndef WAPP_NO_RUNTIME_ASSERT
#define wapp_runtime_assert(EXPR, MSG) __wapp_runtime_assert(EXPR, MSG)
+11 -8
View File
@@ -12,6 +12,9 @@ BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
typedef struct WFile WFile;
wapp_extern WFile *WF_STDIN;
wapp_extern WFile *WF_STDOUT;
wapp_extern WFile *WF_STDERR;
typedef enum {
WAPP_ACCESS_READ, // Equivalent to r
@@ -47,14 +50,14 @@ i32 wapp_file_close(WFile *file);
i32 wapp_file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
i32 wapp_file_remove(Str8RO *filepath);
extern WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
extern i32 _file_flush(WFile *file);
extern i32 _file_close(WFile *file);
extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
extern i32 _file_remove(Str8RO *filepath);
wapp_extern WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
wapp_extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
wapp_extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
wapp_extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
wapp_extern i32 _file_flush(WFile *file);
wapp_extern i32 _file_close(WFile *file);
wapp_extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
wapp_extern i32 _file_remove(Str8RO *filepath);
#ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE
+8
View File
@@ -49,6 +49,14 @@ wapp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
[WAPP_SEEK_END] = SEEK_END,
};
wapp_intern WFile _STDIN = { .fd = STDIN_FILENO };
wapp_intern WFile _STDOUT = { .fd = STDOUT_FILENO };
wapp_intern WFile _STDERR = { .fd = STDERR_FILENO };
WFile *WF_STDIN = &_STDIN;
WFile *WF_STDOUT = &_STDOUT;
WFile *WF_STDERR = &_STDERR;
WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
memset(tmp, 0, WAPP_PATH_MAX);
+1 -1
View File
@@ -86,7 +86,7 @@ EXECUTE_COMMAND_CLOSE:
wapp_intern CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) {
Str8 out = wapp_str8_buf(OUT_BUF_LEN);
out.size = fread((void *)out.buf, sizeof(u8), out.capacity, fp);
out.size = fread((void *)out.buf, sizeof(c8), out.capacity, fp);
if (out_handling == SHELL_OUTPUT_CAPTURE && out_buf != NULL) {
if (out.size >= out_buf->capacity) {
return SHELL_ERR_OUT_BUF_FULL;
+2
View File
@@ -10,6 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
// TODO (Abdelrahman): This module needs rethinking
#ifdef WAPP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
+1 -1
View File
@@ -25,7 +25,7 @@ struct WUUID {
#ifdef WAPP_PLATFORM_CPP
#define wapp_uuid_gen_uuid4() ([&](){ \
wapp_persist WUUID uuid = wapp_uuid_create(); \
return *(wapp_uuid_init_uuid4(&uuid)) \
return *(wapp_uuid_init_uuid4(&uuid)); \
}())
#else
#define wapp_uuid_gen_uuid4() *(wapp_uuid_init_uuid4(&wapp_uuid_create()))