summaryrefslogtreecommitdiff
path: root/src/port.h
blob: acf9c7ba56a3221ab373ebd5be364551101e1901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _BIRUDA_PORT_HEADER_INCLUDED
#define _BIRUDA_PORT_HEADER_INCLUDED

// sleep with seconds
#ifndef _WIN32
#include <unistd.h>
#else
#define WIN32_MEAN_AND_LEAN
#include <windows.h>
#define sleep( SECONDS ) Sleep( SECONDS * 1000 )
#endif

// ISO C snprintf
#ifdef _WIN32
#define snprintf _snprintf
#endif

// strcasecmp
#ifdef _WIN32
#define strcasecmp _stricmp
#endif

// ISO C99 stdbool.h
#if defined( _WIN32 ) && ( _MSC_VER < 1800 )
typedef unsigned char _Bool;
#define bool _Bool
#define true 1
#define false 0
#else
#include <stdbool.h>
#endif

// directory separator
#ifdef _WIN32
#define PORT_DIR_SEPARATOR '\\'
#else
#define PORT_DIR_SEPARATOR '/'
#endif

// snprintf format for GPid (number on Unix, pointer/handle on Windows)
#ifdef _WIN32
#define PRIgid "%p"
#else
#define PRIgid "%d"
#endif

#endif