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
+33 -33
View File
@@ -4,59 +4,59 @@
#include <stdlib.h>
#include <string.h>
TestFuncResult test_commander_cmd_success(void) {
Str8List cmd = wapp_dbl_list(Str8);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("hello world"));
WpTestFuncResult test_commander_cmd_success(void) {
WpStr8List cmd = wpDblList(WpStr8);
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit("echo"));
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit("hello world"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
result.error == WP_SHELL_ERR_NO_ERROR;
return wapp_tester_result(succeeded);
return wpTesterResult(succeeded);
}
TestFuncResult test_commander_cmd_failure(void) {
Str8List cmd = wapp_dbl_list(Str8);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("grep"));
WpTestFuncResult test_commander_cmd_failure(void) {
WpStr8List cmd = wpDblList(WpStr8);
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit("grep"));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_DISCARD, NULL, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
result.error == WP_SHELL_ERR_NO_ERROR;
return wapp_tester_result(failed);
return wpTesterResult(failed);
}
TestFuncResult test_commander_cmd_out_buf_success(void) {
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
WpTestFuncResult test_commander_cmd_out_buf_success(void) {
WpStr8 buf = wpStr8Buf(64);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit(msg));
WpStr8List cmd = wpDblList(WpStr8);
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit("echo"));
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
result.error == WP_SHELL_ERR_NO_ERROR && wpStr8EqualToCount(&buf, &expected, strlen(msg));
return wapp_tester_result(succeeded);
return wpTesterResult(succeeded);
}
TestFuncResult test_commander_cmd_out_buf_failure(void) {
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
WpTestFuncResult test_commander_cmd_out_buf_failure(void) {
WpStr8 buf = wpStr8Buf(4);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8);
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo"));
wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit(msg));
WpStr8List cmd = wpDblList(WpStr8);
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit("echo"));
wpDblListPushBack(WpStr8, &cmd, &wpStr8Lit(msg));
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
result.error == WP_SHELL_ERR_OUT_BUF_FULL && !wpStr8Equal(&buf, &expected);
return wapp_tester_result(failed);
return wpTesterResult(failed);
}
+40 -40
View File
@@ -4,66 +4,66 @@
#include <stdlib.h>
#include <string.h>
TestFuncResult test_commander_cmd_success(void) {
Str8List cmd = wapp_dbl_list(Str8);
Str8 echo = wapp_str8_lit("echo");
Str8 msg = wapp_str8_lit("hello world");
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &msg);
WpTestFuncResult test_commander_cmd_success(void) {
WpStr8List cmd = wpDblList(WpStr8);
WpStr8 echo = wpStr8Lit("echo");
WpStr8 msg = wpStr8Lit("hello world");
wpDblListPushBack(WpStr8, &cmd, &echo);
wpDblListPushBack(WpStr8, &cmd, &msg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
result.error == WP_SHELL_ERR_NO_ERROR;
return wapp_tester_result(succeeded);
return wpTesterResult(succeeded);
}
TestFuncResult test_commander_cmd_failure(void) {
Str8List cmd = wapp_dbl_list(Str8);
Str8 grep = wapp_str8_lit("grep");
wapp_dbl_list_push_back(Str8, &cmd, &grep);
WpTestFuncResult test_commander_cmd_failure(void) {
WpStr8List cmd = wpDblList(WpStr8);
WpStr8 grep = wpStr8Lit("grep");
wpDblListPushBack(WpStr8, &cmd, &grep);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_DISCARD, nullptr, &cmd);
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR;
result.error == WP_SHELL_ERR_NO_ERROR;
return wapp_tester_result(failed);
return wpTesterResult(failed);
}
TestFuncResult test_commander_cmd_out_buf_success(void) {
Str8 buf = wapp_str8_buf(64);
Str8 expected = wapp_str8_buf(64);
WpTestFuncResult test_commander_cmd_out_buf_success(void) {
WpStr8 buf = wpStr8Buf(64);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8);
Str8 echo = wapp_str8_lit("echo");
Str8 arg = wapp_str8_lit(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
WpStr8List cmd = wpDblList(WpStr8);
WpStr8 echo = wpStr8Lit("echo");
WpStr8 arg = wpStr8Lit(msg);
wpDblListPushBack(WpStr8, &cmd, &echo);
wpDblListPushBack(WpStr8, &cmd, &arg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg));
result.error == WP_SHELL_ERR_NO_ERROR && wpStr8EqualToCount(&buf, &expected, strlen(msg));
return wapp_tester_result(succeeded);
return wpTesterResult(succeeded);
}
TestFuncResult test_commander_cmd_out_buf_failure(void) {
Str8 buf = wapp_str8_buf(4);
Str8 expected = wapp_str8_buf(64);
WpTestFuncResult test_commander_cmd_out_buf_failure(void) {
WpStr8 buf = wpStr8Buf(4);
WpStr8 expected = wpStr8Buf(64);
char msg[] = "hello world";
wapp_str8_copy_cstr_capped(&expected, msg);
wpStr8CopyCstrCapped(&expected, msg);
Str8List cmd = wapp_dbl_list(Str8);
Str8 echo = wapp_str8_lit("echo");
Str8 arg = wapp_str8_lit(msg);
wapp_dbl_list_push_back(Str8, &cmd, &echo);
wapp_dbl_list_push_back(Str8, &cmd, &arg);
WpStr8List cmd = wpDblList(WpStr8);
WpStr8 echo = wpStr8Lit("echo");
WpStr8 arg = wpStr8Lit(msg);
wpDblListPushBack(WpStr8, &cmd, &echo);
wpDblListPushBack(WpStr8, &cmd, &arg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
WpCmdResult result = wpShellCommanderExecute(WP_SHELL_OUTPUT_CAPTURE, &buf, &cmd);
b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected);
result.error == WP_SHELL_ERR_OUT_BUF_FULL && !wpStr8Equal(&buf, &expected);
return wapp_tester_result(failed);
return wpTesterResult(failed);
}
+4 -4
View File
@@ -3,9 +3,9 @@
#include "wapp.h"
TestFuncResult test_commander_cmd_success(void);
TestFuncResult test_commander_cmd_failure(void);
TestFuncResult test_commander_cmd_out_buf_success(void);
TestFuncResult test_commander_cmd_out_buf_failure(void);
WpTestFuncResult test_commander_cmd_success(void);
WpTestFuncResult test_commander_cmd_failure(void);
WpTestFuncResult test_commander_cmd_out_buf_success(void);
WpTestFuncResult test_commander_cmd_out_buf_failure(void);
#endif // !TEST_SHELL_COMMANDER_H