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
+37 -37
View File
@@ -17,85 +17,85 @@
#define CMD_BUF_LEN 8192
#define OUT_BUF_LEN 4096
wapp_intern CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf);
wapp_intern CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf);
wp_intern WpCmdResult executeCommand(WpStr8RO *cmd, WpCmdOutHandling out_handling, WpStr8 *out_buf);
wp_intern WpCmdError getCommandOutput(FILE *fp, WpCmdOutHandling out_handling, WpStr8 *out_buf);
CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd) {
WpCmdResult wpShellCommanderExecute(WpCmdOutHandling out_handling, WpStr8 *out_buf, const WpStr8List *cmd) {
if (!cmd) {
return CMD_NO_EXIT(SHELL_ERR_INVALID_ARGS);
return wpCmdNoExit(WP_SHELL_ERR_INVALID_ARGS);
}
Allocator arena = wapp_mem_arena_allocator_init(KiB(500));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(500));
Str8 *cmd_str = wapp_str8_join(&arena, cmd, &wapp_str8_lit_ro(" "));
WpStr8 *cmd_str = wpStr8Join(&arena, cmd, &wpStr8LitRo(" "));
if (!cmd_str) {
wapp_mem_arena_allocator_destroy(&arena);
return CMD_NO_EXIT(SHELL_ERR_ALLOCATION_FAIL);
wpMemArenaAllocatorDestroy(&arena);
return wpCmdNoExit(WP_SHELL_ERR_ALLOCATION_FAIL);
}
// Redirect output
cmd_str = wapp_str8_alloc_concat(&arena, cmd_str, &wapp_str8_lit_ro(" 2>&1"));
cmd_str = wpStr8AllocConcat(&arena, cmd_str, &wpStr8LitRo(" 2>&1"));
CMDResult output = execute_command(cmd_str, out_handling, out_buf);
WpCmdResult output = executeCommand(cmd_str, out_handling, out_buf);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return output;
}
wapp_intern CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf) {
wp_intern WpCmdResult executeCommand(WpStr8RO *cmd, WpCmdOutHandling out_handling, WpStr8 *out_buf) {
char cmd_buf[CMD_BUF_LEN] = {0};
wapp_str8_copy_to_cstr(cmd_buf, cmd, CMD_BUF_LEN);
wpStr8CopyToCstr(cmd_buf, cmd, CMD_BUF_LEN);
FILE *fp = wapp_shell_utils_popen(cmd_buf, "r");
FILE *fp = wpShellUtilsPopen(cmd_buf, "r");
if (!fp) {
return CMD_NO_EXIT(SHELL_ERR_PROC_START_FAIL);
return wpCmdNoExit(WP_SHELL_ERR_PROC_START_FAIL);
}
CMDResult output;
WpCmdResult output;
CMDError err = get_command_output(fp, out_handling, out_buf);
if (err > SHELL_ERR_NO_ERROR) {
output = CMD_NO_EXIT(err);
goto EXECUTE_COMMAND_CLOSE;
WpCmdError err = getCommandOutput(fp, out_handling, out_buf);
if (err > WP_SHELL_ERR_NO_ERROR) {
output = wpCmdNoExit(err);
goto executeCommand_CLOSE;
}
i32 st = EXIT_SUCCESS;
err = get_output_status(fp, &st);
if (err > SHELL_ERR_NO_ERROR) {
output = CMD_NO_EXIT(err);
goto EXECUTE_COMMAND_CLOSE;
err = _getOutputStatus(fp, &st);
if (err > WP_SHELL_ERR_NO_ERROR) {
output = wpCmdNoExit(err);
goto executeCommand_CLOSE;
}
// Process is already closed in get_output_status
// Process is already closed in _getOutputStatus
fp = NULL;
output = (CMDResult){
output = (WpCmdResult){
.exited = true,
.exit_code = st,
.error = SHELL_ERR_NO_ERROR,
.error = WP_SHELL_ERR_NO_ERROR,
};
EXECUTE_COMMAND_CLOSE:
executeCommand_CLOSE:
if (fp) {
wapp_shell_utils_pclose(fp);
wpShellUtilsPclose(fp);
}
return output;
}
wapp_intern CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) {
Str8 out = wapp_str8_buf(OUT_BUF_LEN);
wp_intern WpCmdError getCommandOutput(FILE *fp, WpCmdOutHandling out_handling, WpStr8 *out_buf) {
WpStr8 out = wpStr8Buf(OUT_BUF_LEN);
out.size = fread((void *)out.buf, sizeof(c8), out.capacity, fp);
if (out_handling == SHELL_OUTPUT_CAPTURE && out_buf != NULL) {
if (out_handling == WP_SHELL_OUTPUT_CAPTURE && out_buf != NULL) {
if (out.size >= out_buf->capacity) {
return SHELL_ERR_OUT_BUF_FULL;
return WP_SHELL_ERR_OUT_BUF_FULL;
}
wapp_str8_concat_capped(out_buf, &out);
} else if (out_handling == SHELL_OUTPUT_PRINT) {
printf(WAPP_STR8_SPEC, wapp_str8_varg(out));
wpStr8ConcatCapped(out_buf, &out);
} else if (out_handling == WP_SHELL_OUTPUT_PRINT) {
printf(WP_STR8_SPEC, wpStr8Varg(out));
}
return SHELL_ERR_NO_ERROR;
return WP_SHELL_ERR_NO_ERROR;
}