Rename aliases
This commit is contained in:
+11
-11
@@ -36,15 +36,15 @@ typedef enum {
|
||||
|
||||
// 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);
|
||||
wp_extern WFile *wapp_file_stdin(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);
|
||||
wp_extern WFile *wapp_file_stdout(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);
|
||||
wp_extern WFile *wapp_file_stderr(void);
|
||||
|
||||
WFile *wapp_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
i64 wapp_file_get_current_position(WFile *file);
|
||||
@@ -61,14 +61,14 @@ i32 wapp_file_close(WFile *file);
|
||||
i32 wapp_file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
i32 wapp_file_remove(Str8RO *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 WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
wp_extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
|
||||
wp_extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
|
||||
wp_extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
|
||||
wp_extern i32 _file_flush(WFile *file);
|
||||
wp_extern i32 _file_close(WFile *file);
|
||||
wp_extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
wp_extern i32 _file_remove(Str8RO *filepath);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
wapp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = O_RDONLY,
|
||||
[WAPP_ACCESS_WRITE] = O_WRONLY | O_CREAT,
|
||||
[WAPP_ACCESS_APPEND] = O_WRONLY | O_APPEND | O_CREAT,
|
||||
@@ -32,7 +32,7 @@ wapp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = O_RDWR | O_CREAT | O_EXCL,
|
||||
};
|
||||
|
||||
wapp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = 0,
|
||||
[WAPP_ACCESS_WRITE] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
[WAPP_ACCESS_APPEND] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
@@ -43,29 +43,29 @@ wapp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
};
|
||||
|
||||
wapp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
wp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
[WAPP_SEEK_START] = SEEK_SET,
|
||||
[WAPP_SEEK_CURRENT] = SEEK_CUR,
|
||||
[WAPP_SEEK_END] = SEEK_END,
|
||||
};
|
||||
|
||||
WFile *wapp_file_stdin(void) {
|
||||
wapp_persist WFile _stdin = { .fd = STDIN_FILENO };
|
||||
wp_persist WFile _stdin = { .fd = STDIN_FILENO };
|
||||
return &_stdin;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stdout(void) {
|
||||
wapp_persist WFile _stdout = { .fd = STDOUT_FILENO };
|
||||
wp_persist WFile _stdout = { .fd = STDOUT_FILENO };
|
||||
return &_stdout;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stderr(void) {
|
||||
wapp_persist WFile _stderr = { .fd = STDERR_FILENO };
|
||||
wp_persist WFile _stderr = { .fd = STDERR_FILENO };
|
||||
return &_stderr;
|
||||
}
|
||||
|
||||
WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
@@ -108,8 +108,8 @@ i32 _file_close(WFile *file) {
|
||||
}
|
||||
|
||||
i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
wapp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wapp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(old_tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(old_tmp, old_filepath->buf, old_filepath->size);
|
||||
memset(new_tmp, 0, WAPP_PATH_MAX);
|
||||
@@ -124,7 +124,7 @@ i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
}
|
||||
|
||||
i32 _file_remove(Str8RO *filepath) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
|
||||
+11
-11
@@ -15,7 +15,7 @@
|
||||
#include <fileapi.h>
|
||||
#include <intsafe.h>
|
||||
|
||||
wapp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = FILE_READ_DATA,
|
||||
[WAPP_ACCESS_WRITE] = FILE_WRITE_DATA,
|
||||
[WAPP_ACCESS_APPEND] = FILE_APPEND_DATA,
|
||||
@@ -26,7 +26,7 @@ wapp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = FILE_READ_DATA | FILE_WRITE_DATA,
|
||||
};
|
||||
|
||||
wapp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = OPEN_EXISTING,
|
||||
[WAPP_ACCESS_WRITE] = CREATE_ALWAYS,
|
||||
[WAPP_ACCESS_APPEND] = OPEN_ALWAYS,
|
||||
@@ -37,7 +37,7 @@ wapp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = CREATE_NEW,
|
||||
};
|
||||
|
||||
wapp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
[WAPP_ACCESS_WRITE] = FILE_SHARE_READ,
|
||||
[WAPP_ACCESS_APPEND] = FILE_SHARE_READ,
|
||||
@@ -48,32 +48,32 @@ wapp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = FILE_SHARE_READ,
|
||||
};
|
||||
|
||||
wapp_intern DWORD file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
wp_intern DWORD file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
[WAPP_SEEK_START] = FILE_BEGIN,
|
||||
[WAPP_SEEK_CURRENT] = FILE_CURRENT,
|
||||
[WAPP_SEEK_END] = FILE_END,
|
||||
};
|
||||
|
||||
WFile *wapp_file_stdin(void) {
|
||||
wapp_persist WFile _stdin = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stdin = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stdin.fh = GetStdHandle(STD_INPUT_HANDLE);
|
||||
return &_stdin;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stdout(void) {
|
||||
wapp_persist WFile _stdout = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stdout = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stdout.fh = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
return &_stdout;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stderr(void) {
|
||||
wapp_persist WFile _stderr = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stderr = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stderr.fh = GetStdHandle(STD_ERROR_HANDLE);
|
||||
return &_stderr;
|
||||
}
|
||||
|
||||
WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
@@ -148,8 +148,8 @@ i32 _file_close(WFile *file) {
|
||||
}
|
||||
|
||||
i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
wapp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wapp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(old_tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(old_tmp, old_filepath->buf, old_filepath->size);
|
||||
memset(new_tmp, 0, WAPP_PATH_MAX);
|
||||
@@ -163,7 +163,7 @@ i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
}
|
||||
|
||||
i32 _file_remove(Str8RO *filepath) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user