aboutsummaryrefslogtreecommitdiff
path: root/utils/adlmidi-2/input.hpp
blob: a1e5854d0326426fcc149b90a8b1e6745469ae43 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _WIN32
#include <unistd.h>
#endif

#ifdef _WIN32
# include <cctype>
# define WIN32_LEAN_AND_MEAN
# ifndef NOMINMAX
#   define NOMINMAX //To don't damage std::min and std::max
# endif
# include <windows.h>
#endif

#ifdef __DJGPP__
#include <conio.h>
#include <pc.h>
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
#include <sys/exceptn.h>
#include <dos.h>
#include <stdlib.h>
#define BIOStimer _farpeekl(_dos_ds, 0x46C)
static const unsigned NewTimerFreq = 209;
#elif !defined(_WIN32) || defined(__CYGWIN__)
# include <termios.h>
# include <fcntl.h>
# include <sys/ioctl.h>
# include <csignal>
#endif

#if (!defined(_WIN32) || defined(__CYGWIN__)) && !defined(__DJGPP__) && !defined(__APPLE__)
#define USE_TERMIO

#if defined(HAS_TERMIO)
typedef struct termio InputTermio_t;
#elif defined(HAS_TERMIOS)
typedef struct termios InputTermio_t;
#else
#   error Undefined type for termio;
#endif

#endif // USE_TERMIO

class xInput
{
#ifdef _WIN32
    void *inhandle;
#endif
#ifdef USE_TERMIO
    InputTermio_t back;
#endif

public:
    xInput();
    ~xInput();

    char PeekInput();
};

extern xInput Input;