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
+102 -102
View File
@@ -6,176 +6,176 @@
#define MAIN_BUF_SIZE 4096
#define TMP_BUF_SIZE 1024
TestFuncResult test_cpath_join_path(void) {
WpTestFuncResult test_cpath_join_path(void) {
b8 result;
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
Str8 out = wapp_str8_buf(MAIN_BUF_SIZE);
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
WpStr8 expected = wpStr8Buf(MAIN_BUF_SIZE);
WpStr8 out = wpStr8Buf(MAIN_BUF_SIZE);
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
Str8List parts = wapp_dbl_list(Str8);
wapp_dbl_list_push_back(Str8, &parts, &tmp);
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit("home"));
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit("abdelrahman"));
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit("Documents"));
WpStr8List parts = wpDblList(WpStr8);
wpDblListPushBack(WpStr8, &parts, &tmp);
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit("home"));
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit("abdelrahman"));
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit("Documents"));
wapp_cpath_join_path(&out, &parts);
result = wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = wpStr8Equal(&out, &expected);
wapp_dbl_list_pop_front(Str8, &parts);
wpDblListPopFront(WpStr8, &parts);
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
wapp_str8_concat_capped(&tmp, &wapp_str8_lit_ro("home"));
wapp_dbl_list_pop_front(Str8, &parts);
wapp_dbl_list_push_front(Str8, &parts, &tmp);
wpStr8ConcatCapped(&tmp, &wpStr8LitRo("home"));
wpDblListPopFront(WpStr8, &parts);
wpDblListPushFront(WpStr8, &parts, &tmp);
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
wapp_str8_format(&tmp, "home%c", WAPP_PATH_SEP);
wapp_dbl_list_pop_front(Str8, &parts);
wapp_dbl_list_push_front(Str8, &parts, &wapp_str8_lit("home"));
wpStr8Format(&tmp, "home%c", WP_PATH_SEP);
wpDblListPopFront(WpStr8, &parts);
wpDblListPushFront(WpStr8, &parts, &wpStr8Lit("home"));
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
wapp_dbl_list_empty(Str8, &parts);
wpDblListEmpty(WpStr8, &parts);
wapp_str8_format(&tmp, "%chome", WAPP_PATH_SEP);
wapp_dbl_list_push_back(Str8, &parts, &tmp);
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit(""));
wpStr8Format(&tmp, "%chome", WP_PATH_SEP);
wpDblListPushBack(WpStr8, &parts, &tmp);
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit(""));
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
wapp_dbl_list_pop_front(Str8, &parts);
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit(""));
wpDblListPopFront(WpStr8, &parts);
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit(""));
wapp_str8_format(&expected, "%s", "");
wpStr8Format(&expected, "%s", "");
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
wapp_dbl_list_pop_back(Str8, &parts);
wapp_dbl_list_push_back(Str8, &parts, &wapp_str8_lit("home"));
wpDblListPopBack(WpStr8, &parts);
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit("home"));
wapp_str8_copy_cstr_capped(&expected, "home");
wpStr8CopyCstrCapped(&expected, "home");
wapp_cpath_join_path(&out, &parts);
result = result && wapp_str8_equal(&out, &expected);
wpCpathJoinPath(&out, &parts);
result = result && wpStr8Equal(&out, &expected);
return wapp_tester_result(result);
return wpTesterResult(result);
}
TestFuncResult test_cpath_dirname(void) {
Allocator arena = wapp_mem_arena_allocator_init(MiB(8));
if (wapp_mem_allocator_invalid(&arena)) {
return wapp_tester_result(false);
WpTestFuncResult test_cpath_dirname(void) {
WpAllocator arena = wpMemArenaAllocatorInit(MiB(8));
if (wpMemAllocatorInvalid(&arena)) {
return wpTesterResult(false);
}
b8 result;
Str8 *output = NULL;
WpStr8 *output = NULL;
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
WpStr8 expected = wpStr8Buf(MAIN_BUF_SIZE);
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
// CASE 1
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
wpStr8Format(&expected, "%c", WP_PATH_SEP);
output = wapp_cpath_dirname(&arena, &tmp);
result = output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirname(&arena, &tmp);
result = output != NULL && wpStr8Equal(output, &expected);
// CASE 2
wapp_str8_format(&expected, "%s", ".");
wpStr8Format(&expected, "%s", ".");
output = wapp_cpath_dirname(&arena, &wapp_str8_lit("home"));
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirname(&arena, &wpStr8Lit("home"));
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 3
output = wapp_cpath_dirname(&arena, &wapp_str8_lit(""));
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirname(&arena, &wpStr8Lit(""));
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 4
wapp_str8_format(&tmp, "%chome%ctest", WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%chome%ctest", WP_PATH_SEP, WP_PATH_SEP);
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
output = wapp_cpath_dirname(&arena, &tmp);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirname(&arena, &tmp);
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 5
wapp_str8_format(&tmp, "%chome%ctest%c", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%chome%ctest%c", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
output = wapp_cpath_dirname(&arena, &tmp);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirname(&arena, &tmp);
result = result && output != NULL && wpStr8Equal(output, &expected);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wapp_tester_result(result);
return wpTesterResult(result);
}
TestFuncResult test_cpath_dirup(void) {
Allocator arena = wapp_mem_arena_allocator_init(MiB(8));
if (wapp_mem_allocator_invalid(&arena)) {
return wapp_tester_result(false);
WpTestFuncResult test_cpath_dirup(void) {
WpAllocator arena = wpMemArenaAllocatorInit(MiB(8));
if (wpMemAllocatorInvalid(&arena)) {
return wpTesterResult(false);
}
b8 result;
Str8 *output = NULL;
WpStr8 *output = NULL;
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
WpStr8 expected = wpStr8Buf(MAIN_BUF_SIZE);
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
// CASE 1
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
wpStr8Format(&expected, "%c", WP_PATH_SEP);
output = wapp_cpath_dirup(&arena, &tmp, 3);
result = output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirup(&arena, &tmp, 3);
result = output != NULL && wpStr8Equal(output, &expected);
// CASE 2
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
wpStr8Format(&expected, "%c", WP_PATH_SEP);
output = wapp_cpath_dirup(&arena, &tmp, 3);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirup(&arena, &tmp, 3);
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 3
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_copy_cstr_capped(&expected, ".");
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
wpStr8CopyCstrCapped(&expected, ".");
output = wapp_cpath_dirup(&arena, &tmp, 3);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirup(&arena, &tmp, 3);
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 4
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
output = wapp_cpath_dirup(&arena, &tmp, 2);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirup(&arena, &tmp, 2);
result = result && output != NULL && wpStr8Equal(output, &expected);
// CASE 5
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
wapp_str8_copy_cstr_capped(&expected, "home");
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
wpStr8CopyCstrCapped(&expected, "home");
output = wapp_cpath_dirup(&arena, &tmp, 2);
result = result && output != NULL && wapp_str8_equal(output, &expected);
output = wpCpathDirup(&arena, &tmp, 2);
result = result && output != NULL && wpStr8Equal(output, &expected);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wapp_tester_result(result);
return wpTesterResult(result);
}