-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebcurses.h
More file actions
63 lines (51 loc) · 1.33 KB
/
webcurses.h
File metadata and controls
63 lines (51 loc) · 1.33 KB
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
62
63
#ifndef WEBCURSES_H
#define WEBCURSES_H
#include <stdbool.h>
#include <stdint.h>
/**************
* DEFINITIONS
***************/
#undef ERR
#define ERR (-1)
#undef OK
#define OK (0)
#if 1 && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef uint32_t chtype;
typedef uint32_t mmask_t;
#endif
#define NCURSES_CAST(type,value) (type)(value)
#define NCURSES_ATTR_SHIFT 8
#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT))
#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0)
#define COLOR_PAIR(n) (NCURSES_BITS((n), 0) & A_COLOR)
#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
#define COLOR_BLACK 0
#define COLOR_RED 1
#define COLOR_GREEN 2
#define COLOR_YELLOW 3
#define COLOR_BLUE 4
#define COLOR_MAGENTA 5
#define COLOR_CYAN 6
#define COLOR_WHITE 7
/**************
* FUNCTIONS
***************/
//reference: https://github.com/mirror/ncurses
void initscr();
void noecho();
void curs_set(int vis);
void endwin();
int getch();
int mvaddch(int y, int x, int ch);
bool has_colors();
int start_color();
int init_pair(short pair, short f, short b);
int pair_content(short pair, short *f, short *b);
int use_default_colors(void);
int clear(void);
int refresh(void);
void timeout(int delay);
#endif