1 /* screen.h --
2 
3    This file is part of the UPX executable compressor.
4 
5    Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer
6    Copyright (C) 1996-2020 Laszlo Molnar
7    All Rights Reserved.
8 
9    UPX and the UCL library are free software; you can redistribute them
10    and/or modify them under the terms of the GNU General Public License as
11    published by the Free Software Foundation; either version 2 of
12    the License, or (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; see the file COPYING.
21    If not, write to the Free Software Foundation, Inc.,
22    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24    Markus F.X.J. Oberhumer              Laszlo Molnar
25    <markus@oberhumer.com>               <ezerotven+github@gmail.com>
26  */
27 
28 #ifndef __UPX_SCREEN_H
29 #define __UPX_SCREEN_H 1
30 
31 #if (USE_SCREEN)
32 
33 /*************************************************************************
34 //
35 **************************************************************************/
36 
37 struct screen_data_t;
38 struct screen_t;
39 typedef struct screen_t screen_t;
40 
41 struct screen_t {
42     /* public: */
43     void (*destroy)(screen_t *s);
44     void (*finalize)(screen_t *s);
45     void (*atExit)(void); /* atexit/signal handler */
46 
47     int (*init)(screen_t *s, int fd);
48 
49     void (*refresh)(screen_t *s);
50 
51     int (*getMode)(const screen_t *s);
52     int (*getPage)(const screen_t *s);
53     int (*getRows)(const screen_t *s);
54     int (*getCols)(const screen_t *s);
55     int (*isMono)(const screen_t *s);
56 
57     int (*getFg)(const screen_t *s);
58     int (*getBg)(const screen_t *s);
59     void (*getCursor)(const screen_t *s, int *x, int *y);
60     int (*getCursorShape)(const screen_t *s);
61 
62     void (*setFg)(screen_t *s, int);
63     void (*setBg)(screen_t *s, int);
64     void (*setCursor)(screen_t *s, int x, int y);
65     void (*setCursorShape)(screen_t *s, int shape);
66     int (*hideCursor)(screen_t *s);
67 
68     void (*putChar)(screen_t *s, int c, int x, int y);
69     void (*putCharAttr)(screen_t *s, int c, int attr, int x, int y);
70     void (*putString)(screen_t *s, const char *, int x, int y);
71     void (*putStringAttr)(screen_t *s, const char *, int attr, int x, int y);
72 
73     void (*clear)(screen_t *s);
74     void (*clearLine)(screen_t *s, int);
75     void (*updateLineN)(screen_t *s, const void *, int y, int len);
76 
77     int (*scrollUp)(screen_t *s, int);
78     int (*scrollDown)(screen_t *s, int);
79     int (*getScrollCounter)(const screen_t *s);
80 
81     int (*kbhit)(screen_t *s);
82 
83     int (*intro)(screen_t *s, void (*)(screen_t *));
84 
85     /* private: */
86     struct screen_data_t *data;
87 };
88 
89 screen_t *sobject_construct(const screen_t *c, size_t data_size);
90 void sobject_destroy(screen_t *);
91 screen_t *sobject_get_screen(void);
92 
93 screen_t *screen_curses_construct(void);
94 screen_t *screen_djgpp2_construct(void);
95 screen_t *screen_vcsa_construct(void);
96 screen_t *screen_win32_construct(void);
97 
98 void screen_show_frames(screen_t *);
99 
100 #endif /* USE_SCREEN */
101 
102 #endif /* already included */
103 
104 /* vim:set ts=4 sw=4 et: */
105