chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / crt.h
1 /*
2  * crt.h:
3  *
4  * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
5  * All rights reserved.
6  *
7  */
8
9 /*
10  * $Id$
11  */
12
13 /*
14  * $Log$
15  * Revision 1.3  2008/02/06 11:30:37  james
16  * *** empty log message ***
17  *
18  * Revision 1.2  2008/02/04 20:23:55  james
19  * *** empty log message ***
20  *
21  * Revision 1.1  2008/02/03 23:31:25  james
22  * *** empty log message ***
23  *
24  */
25
26 #ifndef __CRT_H__
27 #define __CRT_H__
28
29 #define CRT_ROWS 25
30 #define CRT_COLS 80
31
32 #define CRT_CELS (CRT_ROWS*CRT_COLS)
33 #define CRT_ADDR(r,c) (((r)*CRT_COLS)+(c))
34 #define CRT_ADDR_POS(p) ((((p)->y)*CRT_COLS)+((p)->x))
35
36 #define CRT_ATTR_NORMAL    0x0
37 #define CRT_ATTR_UNDERLINE 0x1
38 #define CRT_ATTR_REVERSE   0x2
39 #define CRT_ATTR_BLINK     0x4
40 #define CRT_ATTR_BOLD      0x8
41
42 typedef struct
43 {
44   uint8_t chr;
45   uint8_t attr;
46 } CRT_CA;
47
48 typedef struct
49 {
50   int x;
51   int y;
52 } CRT_Pos;
53
54
55 typedef struct
56 {
57   CRT_CA screen[CRT_CELS];
58   CRT_Pos pos;
59   int hide_cursor;
60 } CRT;
61
62
63 static inline
64 crt_ca_cmp (CRT_CA a, CRT_CA b)
65 {
66   return memcmp (&a, &b, sizeof (a));
67 }
68
69 #endif /* __CRT_H__ */