FreeBASIC  0.91.0
fb_private_console.h
Go to the documentation of this file.
1 #define INIT_CONSOLE 1
2 #define INIT_X11 2
3 
4 #define TERM_GENERIC 0
5 #define TERM_XTERM 1
6 #define TERM_ETERM 2
7 
8 #define SEQ_LOCATE 0 /* "cm" - move cursor */
9 #define SEQ_HOME 1 /* "ho" - home cursor */
10 #define SEQ_SCROLL_REGION 2 /* "cs" - set scrolling region */
11 #define SEQ_CLS 3 /* "cl" - clear whole screen */
12 #define SEQ_CLEOL 4 /* "ce" - clear until end of line */
13 #define SEQ_WINDOW_SIZE 5 /* "WS" - set terminal window size */
14 #define SEQ_BEEP 6 /* "bl" - beep */
15 #define SEQ_FG_COLOR 7 /* "AF" - set foreground color */
16 #define SEQ_BG_COLOR 8 /* "AB" - set background color */
17 #define SEQ_RESET_COLOR 9 /* "me" - turn off all attributes */
18 #define SEQ_BRIGHT_COLOR 10 /* "md" - turn on bold (bright) attribute */
19 #define SEQ_SCROLL 11 /* "SF" - scroll forward */
20 #define SEQ_SHOW_CURSOR 12 /* "ve" - make cursor visible */
21 #define SEQ_HIDE_CURSOR 13 /* "vi" - make cursor invisible */
22 #define SEQ_DEL_CHAR 14 /* "dc" - delete character at cursor position */
23 #define SEQ_INIT_KEYPAD 15 /* "ks" - enable keypad keys */
24 #define SEQ_EXIT_KEYPAD 16 /* "ke" - disable keypad keys */
25 #define SEQ_MAX 17
26 #define SEQ_EXTRA 100
27 #ifdef HOST_LINUX
28  #define SEQ_INIT_CHARSET 100 /* xxxx - inits PC 437 characters set */
29  #define SEQ_EXIT_CHARSET 101 /* xxxx - exits PC 437 characters set */
30  #define SEQ_QUERY_CURSOR 102 /* xxxx - query cursor position (not in termcap) */
31  #define SEQ_QUERY_WINDOW 103 /* xxxx - query terminal window size (not in termcap) */
32  #define SEQ_INIT_XMOUSE 104 /* xxxx - enable X11 mouse */
33  #define SEQ_EXIT_XMOUSE 105 /* xxxx - disable X11 mouse */
34  #define SEQ_EXIT_GFX_MODE 106 /* xxxx - cleanup after console gfx mode */
35 #endif
36 #define SEQ_SET_COLOR_EX 107 /* xxxx - extended set color */
37 
38 typedef struct FBCONSOLE
39 {
40  int inited;
41  int term_type;
42  int h_in;
43  FILE *f_in;
44  struct termios old_term_out, old_term_in;
47  int cur_x, cur_y;
48  int w, h;
49  unsigned char *char_buffer, *attr_buffer;
50 #if defined HOST_LINUX && (defined HOST_X86 || defined HOST_X86_64)
51  int has_perm;
52 #endif
53  char *seq[SEQ_MAX];
54  int (*keyboard_getch)(void);
55  int (*keyboard_init)(void);
56  void (*keyboard_exit)(void);
57  void (*keyboard_handler)(void);
58  int (*mouse_init)(void);
59  void (*mouse_exit)(void);
60  void (*mouse_handler)(void);
61  void (*mouse_update)(int cb, int cx, int cy);
62  void (*gfx_exit)(void);
63 } FBCONSOLE;
64 
65 extern FBCONSOLE __fb_con;
66 
67 #ifdef HOST_LINUX
68 int fb_hTermQuery( int code, int *val1, int *val2 );
69 #endif
70 void fb_hRecheckConsoleSize( void );
71 int fb_hTermOut(int code, int param1, int param2);
72 void fb_hAddCh( int k );
73 int fb_hGetCh(int remove);
74 int fb_hXTermInitFocus(void);
75 void fb_hXTermExitFocus(void);
76 int fb_hXTermHasFocus(void);
78  (
79  void (*gfx_exit)(void),
80  void (*save)(void),
81  void (*restore)(void),
82  void (*key_handler)(int, int, int, int)
83  );
84 int fb_hInitConsole(void);
85 void fb_hExitConsole(void);
86 void fb_hStartBgThread( void );