瀏覽代碼

Update macOS compat

Properly declare shims for macOS.
master
TheoryOfNekomata 1 年之前
父節點
當前提交
e86b23fec2
共有 7 個檔案被更改,包括 23 行新增18 行删除
  1. +1
    -1
      src/packages/asset-inv/main.c
  2. +14
    -4
      src/packages/compat/IZ_windows.h
  3. +3
    -3
      src/packages/game/IZ_app_input.c
  4. +2
    -0
      src/packages/io/IZ_io.h
  5. +1
    -5
      src/packages/log/IZ_log.c
  6. +1
    -1
      src/packages/timer/IZ_timer.c
  7. +1
    -4
      src/packages/timer/IZ_timer.h

+ 1
- 1
src/packages/asset-inv/main.c 查看文件

@@ -3,7 +3,7 @@
#include "../common/IZ_common.h"
#include "../stdinc/IZ_string.h"

#ifdef IZ_WINDOWS
#if defined IZ_WINDOWS
#include <windows.h>
#endif



+ 14
- 4
src/packages/compat/IZ_windows.h 查看文件

@@ -1,12 +1,22 @@
#ifndef IZ_WINDOWS_H
#define IZ_WINDOWS_H

#ifndef IZ_WINDOWS
typedef int errno_t;
typedef size_t rsize_t;
#else
#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

+ 3
- 3
src/packages/game/IZ_app_input.c 查看文件

@@ -1,14 +1,14 @@
#include "IZ_app_input.h"

#ifdef IZ_WINDOWS
#if defined IZ_WINDOWS
#define IZ_DEBUG_CONNECT SDLK_PAGEUP
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT
#elif IZ_UNIX
#elif defined IZ_UNIX
#define IZ_DEBUG_CONNECT SDLK_PAGEUP
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT
#elif IZ_MACOS
#elif defined IZ_MACOS
#define IZ_DEBUG_CONNECT SDLK_EQUALS
#define IZ_DEBUG_DISCONNECT SDLK_MINUS
#define IZ_DEBUG_SEND_MESSAGE SDLK_BACKSLASH


+ 2
- 0
src/packages/io/IZ_io.h 查看文件

@@ -7,6 +7,8 @@
#include "../compat/IZ_windows.h"
#ifdef IZ_UNIX
#include <sys/stat.h>
#elif defined IZ_MACOS
#include <sys/stat.h>
#endif

int IZ_sprintf(char*, size_t, const char*, ...);


+ 1
- 5
src/packages/log/IZ_log.c 查看文件

@@ -4,7 +4,7 @@ bool IZ_LogIsSupportedTerminal() {
bool result;
const char *term = getenv("TERM");
result = term && strcmp(term, "") != 0;
#ifndef _WIN32
#ifndef IZ_WINDOWS
return result;
#else
if (result) {
@@ -33,11 +33,7 @@ bool IZ_LogIsSupportedTerminal() {
}

bool IZ_LogIsSupportedColor(FILE* s) {
#ifdef IZ_WINDOWS
return _isatty(_fileno(s)) && IZ_LogIsSupportedTerminal();
#else
return isatty(fileno(s)) && IZ_LogIsSupportedTerminal();
#endif
}

void IZ_LogInitialize(const char* context, bool force_output) {


+ 1
- 1
src/packages/timer/IZ_timer.c 查看文件

@@ -1,6 +1,6 @@
#include "IZ_timer.h"

#ifdef IZ_WINDOWS
#if defined IZ_WINDOWS
typedef enum {
_CLOCK_REALTIME = 0,
#define CLOCK_REALTIME _CLOCK_REALTIME


+ 1
- 4
src/packages/timer/IZ_timer.h 查看文件

@@ -1,9 +1,6 @@
#ifndef IZ_TIMER_H
#define IZ_TIMER_H

//#define IZ_LOG_DATE_FRIENDLY
#define IZ_LOG_DATE_ELAPSED_FRIENDLY

#include <stdio.h>
#include <time.h>

@@ -11,7 +8,7 @@
* The start timestamp.
* @sa IZ_TimerStart
*/
static time_t IZ_TIMER_START_TIMESTAMP = 0;
static time_t IZ_TIMER_START_TIMESTAMP;

/**
* Gets the start timestamp.


Loading…
取消
儲存