aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/fhandle.h
blob: f8033e3c1434f6cd267dfe0d0904c684367a320f (plain) (blame)
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
#pragma once

#include "defaults.h"

using WIN_HANDLE = void*;
#define INVALID_WIN_HANDLE ((WIN_HANDLE)(long)-1)

using UNIX_HANDLE = int;
#define INVALID_UNIX_HANDLE -1

#if defined(_win_)
using FHANDLE = WIN_HANDLE;
    #define INVALID_FHANDLE INVALID_WIN_HANDLE
#elif defined(_unix_)
using FHANDLE = UNIX_HANDLE;
    #define INVALID_FHANDLE INVALID_UNIX_HANDLE
#else
    #error
#endif

#if defined(_cygwin_)
using OS_HANDLE = WIN_HANDLE;
    #define INVALID_OS_HANDLE INVALID_WIN_HANDLE
#else
using OS_HANDLE = FHANDLE;
    #define INVALID_OS_HANDLE INVALID_FHANDLE
#endif