Ver código fonte

Update macOS compat

Properly declare shims for macOS.
master
TheoryOfNekomata 1 ano atrás
pai
commit
e86b23fec2
7 arquivos alterados com 23 adições e 18 exclusões
  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 Ver arquivo

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


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




+ 14
- 4
src/packages/compat/IZ_windows.h Ver arquivo

@@ -1,12 +1,22 @@
#ifndef IZ_WINDOWS_H #ifndef IZ_WINDOWS_H
#define 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 <io.h>
#include <SDL_syswm.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


#endif //IZ_WINDOWS_H #endif //IZ_WINDOWS_H

+ 3
- 3
src/packages/game/IZ_app_input.c Ver arquivo

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


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


+ 2
- 0
src/packages/io/IZ_io.h Ver arquivo

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


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


+ 1
- 5
src/packages/log/IZ_log.c Ver arquivo

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


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


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


+ 1
- 1
src/packages/timer/IZ_timer.c Ver arquivo

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


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


+ 1
- 4
src/packages/timer/IZ_timer.h Ver arquivo

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


//#define IZ_LOG_DATE_FRIENDLY
#define IZ_LOG_DATE_ELAPSED_FRIENDLY

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


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


/** /**
* Gets the start timestamp. * Gets the start timestamp.


Carregando…
Cancelar
Salvar