Extract additional platform-specific imports to basic compatibility header.master
@@ -179,7 +179,7 @@ add_executable( | |||||
src/packages/log/IZ_log.h | src/packages/log/IZ_log.h | ||||
src/packages/timer/IZ_timer.c | src/packages/timer/IZ_timer.c | ||||
src/packages/timer/IZ_timer.h | src/packages/timer/IZ_timer.h | ||||
src/packages/compat/IZ_windows.h | |||||
src/packages/compat/IZ_compat.h | |||||
src/packages/stdinc/IZ_stdlib.c | src/packages/stdinc/IZ_stdlib.c | ||||
src/packages/stdinc/IZ_stdlib.h | src/packages/stdinc/IZ_stdlib.h | ||||
) | ) | ||||
@@ -2,7 +2,7 @@ | |||||
#define IZ_STRING_MOCK_C | #define IZ_STRING_MOCK_C | ||||
#include <bdd-for-c-mocks.h> | #include <bdd-for-c-mocks.h> | ||||
#include "../../../src/packages/compat/IZ_windows.h" | |||||
#include "../../../src/packages/compat/IZ_compat.h" | |||||
mock(IZ_memset) void* IZ_memset(void* dst, int c, size_t len) { | mock(IZ_memset) void* IZ_memset(void* dst, int c, size_t len) { | ||||
mock_return(IZ_memset) 0; | mock_return(IZ_memset) 0; | ||||
@@ -0,0 +1,18 @@ | |||||
#ifndef IZ_COMPAT_H | |||||
#define IZ_COMPAT_H | |||||
#if defined IZ_WINDOWS | |||||
#define isatty _isatty | |||||
#define fileno _fileno | |||||
#endif | |||||
#if defined IZ_UNIX | |||||
typedef size_t rsize_t; | |||||
typedef int errno_t; | |||||
#endif | |||||
#if defined IZ_MACOS | |||||
typedef int errno_t; | |||||
#endif | |||||
#endif //IZ_COMPAT_H |
@@ -1,22 +0,0 @@ | |||||
#ifndef IZ_WINDOWS_H | |||||
#define IZ_WINDOWS_H | |||||
#if defined IZ_WINDOWS | |||||
#include <io.h> | |||||
#include <SDL_syswm.h> | |||||
#define _isatty isatty | |||||
#define _fileno fileno | |||||
#endif | |||||
#if defined IZ_UNIX | |||||
typedef size_t rsize_t; | |||||
typedef int errno_t; | |||||
#endif | |||||
#if defined IZ_MACOS | |||||
#include <unistd.h> | |||||
typedef int errno_t; | |||||
#endif | |||||
#endif //IZ_WINDOWS_H |
@@ -1,16 +1,21 @@ | |||||
#ifndef IZ_IO_H | #ifndef IZ_IO_H | ||||
#define IZ_IO_H | #define IZ_IO_H | ||||
#include <stdio.h> | |||||
#include <stdbool.h> | |||||
#include <stdarg.h> | |||||
#include "../compat/IZ_windows.h" | |||||
#ifdef IZ_UNIX | |||||
#if defined IZ_WINDOWS | |||||
#include <io.h> | |||||
#include <SDL_syswm.h> | |||||
#elif defined IZ_UNIX | |||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#elif defined IZ_MACOS | #elif defined IZ_MACOS | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <unistd.h> | |||||
#endif | #endif | ||||
#include <stdio.h> | |||||
#include <stdbool.h> | |||||
#include <stdarg.h> | |||||
#include "../compat/IZ_compat.h" | |||||
int IZ_sprintf(char*, size_t, const char*, ...); | int IZ_sprintf(char*, size_t, const char*, ...); | ||||
errno_t IZ_fopen(FILE**, const char*, const char*); | errno_t IZ_fopen(FILE**, const char*, const char*); | ||||
@@ -16,7 +16,14 @@ | |||||
#define IZ_LOG_LEVEL_FLAG_WARN | #define IZ_LOG_LEVEL_FLAG_WARN | ||||
#define IZ_LOG_LEVEL_FLAG_ERROR | #define IZ_LOG_LEVEL_FLAG_ERROR | ||||
#include "../compat/IZ_windows.h" | |||||
#if defined IZ_WINDOWS | |||||
#include <io.h> | |||||
#include <SDL_syswm.h> | |||||
#elif defined IZ_MACOS | |||||
#include <unistd.h> | |||||
#endif | |||||
#include "../compat/IZ_compat.h" | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
@@ -2,7 +2,12 @@ | |||||
#define IZ_STRING_H | #define IZ_STRING_H | ||||
#include <string.h> | #include <string.h> | ||||
#include "../compat/IZ_windows.h" | |||||
#if defined IZ_WINDOWS | |||||
#include <io.h> | |||||
#include <SDL_syswm.h> | |||||
#elif defined IZ_MACOS | |||||
#include <unistd.h> | |||||
#endif | |||||
errno_t IZ_memcpy(void*, rsize_t, const void*, rsize_t); | errno_t IZ_memcpy(void*, rsize_t, const void*, rsize_t); | ||||