## 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:
+48
-48
@@ -7,71 +7,71 @@
|
||||
#include "../../common/aliases/aliases.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
|
||||
|
||||
typedef struct WFile WFile;
|
||||
typedef struct WpFile WpFile;
|
||||
|
||||
typedef enum {
|
||||
WAPP_ACCESS_READ, // Equivalent to r
|
||||
WAPP_ACCESS_WRITE, // Equivalent to w
|
||||
WAPP_ACCESS_APPEND, // Equivalent to a
|
||||
WAPP_ACCESS_READ_EX, // Equivalent to r+
|
||||
WAPP_ACCESS_WRITE_EX, // Equivalent to w+
|
||||
WAPP_ACCESS_APPEND_EX, // Equivalent to a+
|
||||
WAPP_ACCESS_WRITE_FAIL_ON_EXIST, // Equivalent to wx
|
||||
WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX, // Equivalent to wx+
|
||||
WP_ACCESS_READ, // Equivalent to r
|
||||
WP_ACCESS_WRITE, // Equivalent to w
|
||||
WP_ACCESS_APPEND, // Equivalent to a
|
||||
WP_ACCESS_READ_EX, // Equivalent to r+
|
||||
WP_ACCESS_WRITE_EX, // Equivalent to w+
|
||||
WP_ACCESS_APPEND_EX, // Equivalent to a+
|
||||
WP_ACCESS_WRITE_FAIL_ON_EXIST, // Equivalent to wx
|
||||
WP_ACCESS_WRITE_FAIL_ON_EXIST_EX, // Equivalent to wx+
|
||||
|
||||
FILE_ACCESS_MODE_COUNT,
|
||||
} FileAccessMode;
|
||||
COUNT_FILE_ACCESS_MODE,
|
||||
} WpFileAccessMode;
|
||||
|
||||
typedef enum {
|
||||
WAPP_SEEK_START,
|
||||
WAPP_SEEK_CURRENT,
|
||||
WAPP_SEEK_END,
|
||||
WP_SEEK_START,
|
||||
WP_SEEK_CURRENT,
|
||||
WP_SEEK_END,
|
||||
|
||||
FILE_SEEK_ORIGIN_COUNT,
|
||||
} FileSeekOrigin;
|
||||
COUNT_FILE_SEEK_ORIGIN,
|
||||
} WpFileSeekOrigin;
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stdin to get the standard input stream
|
||||
wapp_extern WFile *wapp_file_stdin(void);
|
||||
// wpFileStdin to get the standard input stream
|
||||
wp_extern WpFile *wpFileStdin(void);
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stdout to get the standard output stream
|
||||
wapp_extern WFile *wapp_file_stdout(void);
|
||||
// wpFileStdout to get the standard output stream
|
||||
wp_extern WpFile *wpFileStdout(void);
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stderr to get the standard error stream
|
||||
wapp_extern WFile *wapp_file_stderr(void);
|
||||
// wpFileStderr to get the standard error stream
|
||||
wp_extern WpFile *wpFileStderr(void);
|
||||
|
||||
WFile *wapp_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
i64 wapp_file_get_current_position(WFile *file);
|
||||
i64 wapp_file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
|
||||
i64 wapp_file_get_length(WFile *file);
|
||||
u64 wapp_file_read(void *dst_buf, WFile *file, u64 byte_count);
|
||||
i64 wapp_file_write(const void *src_buf, WFile *file, u64 byte_count);
|
||||
u64 wapp_file_read_str8(Str8 *str, WFile *file);
|
||||
i64 wapp_file_write_str8(Str8RO *str, WFile *file);
|
||||
u64 wapp_file_read_array(GenericArray dst_buf, WFile *file, u64 item_count);
|
||||
i64 wapp_file_write_array(const GenericArray src_buf, WFile *file, u64 item_count);
|
||||
i32 wapp_file_flush(WFile *file);
|
||||
i32 wapp_file_close(WFile *file);
|
||||
i32 wapp_file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
i32 wapp_file_remove(Str8RO *filepath);
|
||||
WpFile *wpFileOpen(const WpAllocator *allocator, WpStr8RO *filepath, WpFileAccessMode mode);
|
||||
i64 wpFileGetCurrentPosition(WpFile *file);
|
||||
i64 wpFileSeek(WpFile *file, i64 offset, WpFileSeekOrigin origin);
|
||||
i64 wpFileGetLength(WpFile *file);
|
||||
u64 wpFileRead(void *dst_buf, WpFile *file, u64 byte_count);
|
||||
i64 wpFileWrite(const void *src_buf, WpFile *file, u64 byte_count);
|
||||
u64 wpFileReadStr8(WpStr8 *str, WpFile *file);
|
||||
i64 wpFileWriteStr8(WpStr8RO *str, WpFile *file);
|
||||
u64 wpFileReadArray(WpArray dst_buf, WpFile *file, u64 item_count);
|
||||
i64 wpFileWriteArray(const WpArray src_buf, WpFile *file, u64 item_count);
|
||||
i32 wpFileFlush(WpFile *file);
|
||||
i32 wpFileClose(WpFile *file);
|
||||
i32 wpFileRename(WpStr8RO *old_filepath, WpStr8RO *new_filepath);
|
||||
i32 wpFileRemove(WpStr8RO *filepath);
|
||||
|
||||
wapp_extern WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
wapp_extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
|
||||
wapp_extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
|
||||
wapp_extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
|
||||
wapp_extern i32 _file_flush(WFile *file);
|
||||
wapp_extern i32 _file_close(WFile *file);
|
||||
wapp_extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
wapp_extern i32 _file_remove(Str8RO *filepath);
|
||||
wp_extern WpFile *_fileOpen(const WpAllocator *allocator, WpStr8RO *filepath, WpFileAccessMode mode);
|
||||
wp_extern i64 _fileSeek(WpFile *file, i64 offset, WpFileSeekOrigin origin);
|
||||
wp_extern u64 _fileRead(void *dst_buf, u64 byte_count, WpFile *file, u64 file_length);
|
||||
wp_extern i64 _fileWrite(const void *src_buf, WpFile *file, u64 byte_count);
|
||||
wp_extern i32 _fileFlush(WpFile *file);
|
||||
wp_extern i32 _fileClose(WpFile *file);
|
||||
wp_extern i32 _fileRename(WpStr8RO *old_filepath, WpStr8RO *new_filepath);
|
||||
wp_extern i32 _fileRemove(WpStr8RO *filepath);
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#endif // !FILE_H
|
||||
|
||||
Reference in New Issue
Block a user