## 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:
+19
-19
@@ -7,44 +7,44 @@
|
||||
#include "../common/platform/platform.h"
|
||||
#include "../base/strings/str8/str8.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define UUID_BUF_LENGTH 48
|
||||
#define WAPP_UUID_SPEC WAPP_STR8_SPEC
|
||||
#define wapp_uuid_varg(WUUID) wapp_str8_varg((WUUID).uuid)
|
||||
#define WP_UUID_BUF_LENGTH 48
|
||||
#define WP_UUID_SPEC WP_STR8_SPEC
|
||||
#define wpUuidVarg(WpUuid) wpStr8Varg((WpUuid).uuid)
|
||||
|
||||
typedef struct WUUID WUUID;
|
||||
struct WUUID {
|
||||
Str8 uuid;
|
||||
typedef struct WpUuid WpUuid;
|
||||
struct WpUuid {
|
||||
WpStr8 uuid;
|
||||
};
|
||||
|
||||
// TODO (Abdelrahman): Update UUID implementation to work properly with C++ and tests for validation
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#define wapp_uuid_gen_uuid4() ([&](){ \
|
||||
wapp_persist WUUID uuid = wapp_uuid_create(); \
|
||||
return *(wapp_uuid_init_uuid4(&uuid)); \
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wpUuidGenUuid4() ([&](){ \
|
||||
wp_persist WpUuid uuid = wpUuidCreate(); \
|
||||
return *(wpUuidInitUuid4(&uuid)); \
|
||||
}())
|
||||
#else
|
||||
#define wapp_uuid_gen_uuid4() *(wapp_uuid_init_uuid4(&wapp_uuid_create()))
|
||||
#define wpUuidGenUuid4() *(wpUuidInitUuid4(&wpUuidCreate()))
|
||||
#endif
|
||||
|
||||
/* Low level UUID API */
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#define wapp_uuid_create() ([&](){ return WUUID{wapp_str8_buf(UUID_BUF_LENGTH)}; }())
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wpUuidCreate() ([&](){ return WpUuid{wpStr8Buf(WP_UUID_BUF_LENGTH)}; }())
|
||||
#else
|
||||
#define wapp_uuid_create() ((WUUID){.uuid = wapp_str8_buf(UUID_BUF_LENGTH)})
|
||||
#define wpUuidCreate() ((WpUuid){.uuid = wpStr8Buf(WP_UUID_BUF_LENGTH)})
|
||||
#endif
|
||||
|
||||
// Just returns the same pointer that was passed in with the UUID initialised.
|
||||
// Fails when passed a NULL pointer.
|
||||
WUUID *wapp_uuid_init_uuid4(WUUID *uuid);
|
||||
WpUuid *wpUuidInitUuid4(WpUuid *uuid);
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#endif // !UUID_H
|
||||
|
||||
Reference in New Issue
Block a user