Standardize naming conventions (#12)
Release / release (push) Successful in 8s

## Summary

Standardize naming conventions across the entire wizapp-stdlib codebase by replacing inconsistent prefixes and snake_case with a unified `wp` prefix + CamelCase scheme.

## Changes

### Naming convention applied

| Pattern | Before | After |
|---|---|---|
| Public functions | `wapp_module_function` | `wpModuleFunction` |
| Public types | `GenericXxx`, bare `Xxx` | `WpXxx` |
| Constants / enum values | `WAPP_XXX`, `SHELL_XXX` | `WP_XXX`, `WP_SHELL_XXX` |
| Internal functions | `_module_function` | `_moduleFunction` |
| Storage-class macros | `wapp_extern`, `wapp_intern` | `wp_extern`, `wp_intern` |

### Modules affected

All 20 modules were renamed: `arena`, `array`, `dbl_list`, `queue`, `str8`, `mem_allocator`, `mem_utils`, `mem_os`, `file`, `cpath`, `log`, `shell_commander`, `shell_termcolour`, `shell_utils`, `prng/xorshift`, `uuid`, `tester`, `aliases`, `assert`, `misc_utils`, `platform` — plus their test files.

### Backward compatibility

Added `src/oldnames.h` with `#define OLD_NAME NEW_NAME` for every renamed symbol, organized by module under Constants → Types → Functions sections. Existing code that includes this file will compile without changes.

Reviewed-on: #12
Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com>
Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
This commit was merged in pull request #12.
This commit is contained in:
2026-06-26 17:17:27 +00:00
committed by Abdelrahman Said
parent ea689e7357
commit a998f6b981
89 changed files with 4081 additions and 3486 deletions
+13 -13
View File
@@ -6,14 +6,14 @@
#include "../platform/platform.h"
#include <stdint.h>
#if defined(WAPP_PLATFORM_C) && WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C11_VERSION && !defined(WAPP_PLATFORM_APPLE)
#if defined(WP_PLATFORM_C) && WP_PLATFORM_C_VERSION >= WP_PLATFORM_C11_VERSION && !defined(WP_PLATFORM_APPLE)
#include <uchar.h>
#if WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C23_VERSION
#if WP_PLATFORM_C_VERSION >= WP_PLATFORM_C23_VERSION
typedef char8_t c8;
#else
typedef uint8_t c8;
#endif // !WAPP_PLATFORM_C23_VERSION
#endif // !WP_PLATFORM_C23_VERSION
typedef char16_t c16;
typedef char32_t c32;
@@ -21,7 +21,7 @@
typedef uint8_t c8;
typedef uint16_t c16;
typedef uint32_t c32;
#endif // !WAPP_PLATFORM_C
#endif // !WP_PLATFORM_C
typedef uint8_t u8;
typedef uint16_t u16;
@@ -30,7 +30,7 @@ typedef uint64_t u64;
typedef uint8_t b8;
#ifndef WAPP_PLATFORM_CPP
#ifndef WP_PLATFORM_CPP
#ifndef false
#define false (b8)0
@@ -40,7 +40,7 @@ typedef uint8_t b8;
#define true (b8)1
#endif // !true
#endif // !WAPP_PLATFORM_CPP
#endif // !WP_PLATFORM_CPP
typedef int8_t i8;
typedef int16_t i16;
@@ -54,14 +54,14 @@ typedef long double f128;
typedef uintptr_t uptr;
typedef intptr_t iptr;
#define wapp_extern extern
#define wapp_intern static
#define wapp_persist static
#define wp_extern extern
#define wp_intern static
#define wp_persist static
#ifdef WAPP_PLATFORM_CPP
#define wapp_class_mem static
#define BEGIN_C_LINKAGE wapp_extern "C" {
#ifdef WP_PLATFORM_CPP
#define wp_class_mem static
#define BEGIN_C_LINKAGE wp_extern "C" {
#define END_C_LINKAGE }
#endif // WAPP_PLATFORM_CPP
#endif // WP_PLATFORM_CPP
#endif // !ALIASES_H
+18 -18
View File
@@ -9,42 +9,42 @@
#include <stdlib.h>
#include <inttypes.h>
#ifdef WAPP_PLATFORM_CPP
#ifdef WP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
#endif // !WP_PLATFORM_CPP
#define wapp_static_assert(EXPR, MSG) wapp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
#define wpStaticAssert(EXPR, MSG) wp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
#ifndef WAPP_NO_RUNTIME_ASSERT
#define wapp_runtime_assert(EXPR, MSG) __wapp_runtime_assert(EXPR, MSG)
#ifndef WP_NO_RUNTIME_ASSERT
#define wpRuntimeAssert(EXPR, MSG) _runtimeAssert(EXPR, MSG)
#else
#define wapp_runtime_assert(EXPR, MSG)
#define wpRuntimeAssert(EXPR, MSG)
#endif
#ifdef WAPP_DEBUG_ASSERT
#define wapp_debug_assert(EXPR, MSG) wapp_runtime_assert(EXPR, MSG)
#ifdef WP_DEBUG_ASSERT
#define wpDebugAssert(EXPR, MSG) wpRuntimeAssert(EXPR, MSG)
#else
#define wapp_debug_assert(EXPR, MSG)
#define wpDebugAssert(EXPR, MSG)
#endif
#ifdef WAPP_PLATFORM_WINDOWS
#define __wapp_runtime_assert(EXPR, MSG) do { \
#ifdef WP_PLATFORM_WINDOWS
#define _runtimeAssert(EXPR, MSG) do { \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
if (!(EXPR)) { \
__pragma(warning(pop)) \
__runtime_assert_failed(EXPR, MSG); \
_runtimeAssertFailed(EXPR, MSG); \
} \
} while(false)
#else
#define __wapp_runtime_assert(EXPR, MSG) do { \
#define _runtimeAssert(EXPR, MSG) do { \
if (!(EXPR)) { \
__runtime_assert_failed(EXPR, MSG); \
_runtimeAssertFailed(EXPR, MSG); \
} \
} while(false)
#endif // !WAPP_PLATFORM_WINDOWS
#endif // !WP_PLATFORM_WINDOWS
#define __runtime_assert_failed(EXPR, MSG) do { \
#define _runtimeAssertFailed(EXPR, MSG) do { \
fprintf( \
stderr, \
"%s:%d (In function `%s`): Assertion failed (%" PRIu32 ")\nDiagnostic: %s\n\n", \
@@ -54,8 +54,8 @@ BEGIN_C_LINKAGE
abort(); \
} while(false)
#ifdef WAPP_PLATFORM_CPP
#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
#endif // !WP_PLATFORM_CPP
#endif // !WAPP_ASSERT_H
+10 -10
View File
@@ -5,9 +5,9 @@
#include "../aliases/aliases.h"
#ifdef WAPP_PLATFORM_CPP
#ifdef WP_PLATFORM_CPP
BEGIN_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP
#endif // !WP_PLATFORM_CPP
#define KiB(SIZE) (((u64)SIZE) << 10)
#define MiB(SIZE) (((u64)SIZE) << 20)
@@ -23,7 +23,7 @@ BEGIN_C_LINKAGE
#define PB(SIZE) (TB(SIZE) * 1000llu)
#define EB(SIZE) (PB(SIZE) * 1000llu)
#define wapp_misc_utils_reserve_padding(SIZE) u8 reserved_padding[sizeof(void *) - ((SIZE) % sizeof(void *))]
#define wpMiscUtilsReservePadding(SIZE) u8 reserved_padding[sizeof(void *) - ((SIZE) % sizeof(void *))]
#define U64_RSHIFT_OR_1(X) (((u64)X) | (((u64)X) >> 1))
#define U64_RSHIFT_OR_2(X) (((u64)X) | (((u64)X) >> 2))
@@ -31,7 +31,7 @@ BEGIN_C_LINKAGE
#define U64_RSHIFT_OR_8(X) (((u64)X) | (((u64)X) >> 8))
#define U64_RSHIFT_OR_16(X) (((u64)X) | (((u64)X) >> 16))
#define U64_RSHIFT_OR_32(X) (((u64)X) | (((u64)X) >> 32))
#define wapp_misc_utils_u64_round_up_pow2(X) ( \
#define wpMiscUtilsU64RoundUpPow2(X) ( \
( \
U64_RSHIFT_OR_32( \
U64_RSHIFT_OR_16( \
@@ -47,17 +47,17 @@ BEGIN_C_LINKAGE
) + 1 \
)
#define wapp_is_power_of_two(NUM) ((NUM & (NUM - 1)) == 0)
#define wapp_pointer_offset(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET)))
#define wpMiscUtilsIsPowerOfTwo(NUM) ((NUM & (NUM - 1)) == 0)
#define wpMiscUtilsOffsetPointer(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET)))
#ifdef WAPP_PLATFORM_CPP
#ifdef WP_PLATFORM_CPP
END_C_LINKAGE
#include <tuple>
#define wapp_misc_utils_va_args_count(T, ...) (std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value)
#define wpMiscUtilsVaArgsCount(T, ...) (std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value)
#else
#define wapp_misc_utils_va_args_count(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T))
#endif // !WAPP_PLATFORM_CPP
#define wpMiscUtilsVaArgsCount(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T))
#endif // !WP_PLATFORM_CPP
#endif // !MISC_UTILS_H
+69 -69
View File
@@ -4,110 +4,110 @@
#define PLATFORM_H
#if defined(__ANDROID__)
#define WAPP_PLATFORM_ANDROID
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_ANDROID
#define WP_PLATFORM_POSIX
#elif defined(__FreeBSD__)
#define WAPP_PLATFORM_FREE_BSD
#define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_FREE_BSD
#define WP_PLATFORM_BSD
#define WP_PLATFORM_POSIX
#elif defined(__NetBSD__)
#define WAPP_PLATFORM_NET_BSD
#define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_NET_BSD
#define WP_PLATFORM_BSD
#define WP_PLATFORM_POSIX
#elif defined(__OpenBSD__)
#define WAPP_PLATFORM_OPEN_BSD
#define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_OPEN_BSD
#define WP_PLATFORM_BSD
#define WP_PLATFORM_POSIX
#elif defined(__DragonFly__)
#define WAPP_PLATFORM_DRAGON_FLY
#define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_DRAGON_FLY
#define WP_PLATFORM_BSD
#define WP_PLATFORM_POSIX
#elif defined(__bsdi__)
#define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_BSD
#define WP_PLATFORM_POSIX
#elif defined(__linux__) || defined(linux) || defined(__linux) || defined(__gnu_linux__)
#define WAPP_PLATFORM_LINUX
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_LINUX
#define WP_PLATFORM_POSIX
#elif defined(__GNU__) || defined(__gnu_hurd__)
#define WAPP_PLATFORM_GNU
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_GNU
#define WP_PLATFORM_POSIX
#elif defined(__APPLE__) || defined(__MACH__)
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#define WAPP_PLATFORM_IOS
#define WAPP_PLATFORM_APPLE
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_IOS
#define WP_PLATFORM_APPLE
#define WP_PLATFORM_POSIX
#elif TARGET_OS_MAC
#define WAPP_PLATFORM_MACOS
#define WAPP_PLATFORM_APPLE
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_MACOS
#define WP_PLATFORM_APPLE
#define WP_PLATFORM_POSIX
#else
#error "Unrecognised Apple platform"
#endif
#elif defined(_WIN64)
#define WAPP_PLATFORM_WINDOWS64
#define WAPP_PLATFORM_WINDOWS
#define WP_PLATFORM_WINDOWS64
#define WP_PLATFORM_WINDOWS
#elif defined(_WIN32)
#define WAPP_PLATFORM_WINDOWS32
#define WAPP_PLATFORM_WINDOWS
#define WP_PLATFORM_WINDOWS32
#define WP_PLATFORM_WINDOWS
#elif defined(__CYGWIN__)
#define WAPP_PLATFORM_CYGWIN
#define WAPP_PLATFORM_WINDOWS
#define WP_PLATFORM_CYGWIN
#define WP_PLATFORM_WINDOWS
#elif defined(__unix__) || defined(__unix)
#define WAPP_PLATFORM_UNIX
#define WAPP_PLATFORM_POSIX
#define WP_PLATFORM_UNIX
#define WP_PLATFORM_POSIX
#else
#error "Unrecognised platform"
#endif
#ifdef __cplusplus
#define WAPP_PLATFORM_CPP
#define WAPP_PLATFORM_CPP_VERSION __cplusplus
#define WAPP_PLATFORM_CPP98_VERSION 199711L
#define WAPP_PLATFORM_CPP11_VERSION 201103L
#define WAPP_PLATFORM_CPP14_VERSION 201402L
#define WAPP_PLATFORM_CPP17_VERSION 201703L
#define WAPP_PLATFORM_CPP20_VERSION 202002L
#define WAPP_PLATFORM_CPP23_VERSION 202302L
#define WP_PLATFORM_CPP
#define WP_PLATFORM_CPP_VERSION __cplusplus
#define WP_PLATFORM_CPP98_VERSION 199711L
#define WP_PLATFORM_CPP11_VERSION 201103L
#define WP_PLATFORM_CPP14_VERSION 201402L
#define WP_PLATFORM_CPP17_VERSION 201703L
#define WP_PLATFORM_CPP20_VERSION 202002L
#define WP_PLATFORM_CPP23_VERSION 202302L
#if WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP98_VERSION
#define WAPP_PLATFORM_CPP98
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP11_VERSION
#define WAPP_PLATFORM_CPP11
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP14_VERSION
#define WAPP_PLATFORM_CPP14
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP17_VERSION
#define WAPP_PLATFORM_CPP17
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP20_VERSION
#define WAPP_PLATFORM_CPP20
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP23_VERSION
#define WAPP_PLATFORM_CPP23
#if WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP98_VERSION
#define WP_PLATFORM_CPP98
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP11_VERSION
#define WP_PLATFORM_CPP11
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP14_VERSION
#define WP_PLATFORM_CPP14
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP17_VERSION
#define WP_PLATFORM_CPP17
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP20_VERSION
#define WP_PLATFORM_CPP20
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP23_VERSION
#define WP_PLATFORM_CPP23
#else
#error "Unrecognised C++ version"
#endif
#else
#define WAPP_PLATFORM_C
#define WP_PLATFORM_C
#if defined(__STDC_VERSION__)
#define WAPP_PLATFORM_C_VERSION __STDC_VERSION__
#define WAPP_PLATFORM_C99_VERSION 199901L
#define WAPP_PLATFORM_C11_VERSION 201112L
#define WAPP_PLATFORM_C17_VERSION 201710L
#define WAPP_PLATFORM_C23_VERSION 202311L
#define WP_PLATFORM_C_VERSION __STDC_VERSION__
#define WP_PLATFORM_C99_VERSION 199901L
#define WP_PLATFORM_C11_VERSION 201112L
#define WP_PLATFORM_C17_VERSION 201710L
#define WP_PLATFORM_C23_VERSION 202311L
#if WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C99_VERSION
#define WAPP_PLATFORM_C99
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C11_VERSION
#define WAPP_PLATFORM_C11
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C17_VERSION
#define WAPP_PLATFORM_C17
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C23_VERSION
#define WAPP_PLATFORM_C23
#if WP_PLATFORM_C_VERSION == WP_PLATFORM_C99_VERSION
#define WP_PLATFORM_C99
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C11_VERSION
#define WP_PLATFORM_C11
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C17_VERSION
#define WP_PLATFORM_C17
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C23_VERSION
#define WP_PLATFORM_C23
#else
#error "Unrecognised C version"
#endif
#else
#define WAPP_PLATFORM_C89
#define WP_PLATFORM_C89
#endif
#endif // !__cplusplus