fbui | Framebuffer-based graphical environment |
| download: https://git.y1.nz/archives/fbui.tar.gz | |
| README | Files | Log | Refs |
libfbui/Term/fbterm.h
1
2
3 #ifdef HAVE_CONFIG_H
4 #include <config.h>
5 #endif
6
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <errno.h>
11 /* for struct winsize and struct termios, not always included by FORKPTY_HEADER */
12 #include <termios.h>
13 /* for pid_t, strangely not included by FORKPTY_HEADER */
14 #include <sys/types.h>
15 /* for execve, read, write */
16 #include <unistd.h>
17
18
19 #ifdef MULTIBYTE
20
21 # include <locale.h>
22 /* MacOS X doesn't have langinfo.h, although the docs say otherwise. It's a
23 bug on their part since it's a Single Unix Specification requirement */
24 # ifdef HAVE_NL_LANGINFO
25 # include <langinfo.h>
26 # endif
27
28 # ifdef HAVE_ISWPRINT
29 # include <wctype.h>
30 # else
31 # define wint_t unsigned int
32 int iswprint (wint_t wc);
33 # endif
34
35 #else /* MULTIBYTE */
36
37 # define wchar_t unsigned int
38 # include <ctype.h> /* pour isprint */
39
40 #endif /* MULTIBYTE */
41
42 #if !STDC_HEADERS
43
44 /* if the standard C headers are not present, we need to declare the functions
45 that may be declared in some other unknown header ourselves */
46 long int strtol(const char *nptr, char **endptr, int base);
47 void *memcpy(void *dest, const void *src, size_t n);
48 void *memset(void *s, int c, size_t n);
49 void *memmove(void *dest, const void *src, size_t n);
50 int strcmp(const char *s1, const char *s2);
51
52 /* Then maybe the functions themselves are not present... Tough! */
53 # if !HAVE_MEMMOVE
54 # /* find a solution */
55 # endif
56 # if !HAVE_MEMCPY
57 # /* find a solution */
58 # endif
59 # if !HAVE_MEMSET
60 # /* find a solution */
61 # endif
62 # if !HAVE_STRCMP
63 # /* find a solution */
64 # endif
65
66 #else
67 # include <string.h>
68 #endif /* STDC_HEADERS */
69
70
71 /* signals */
72 #include <signal.h>
73
74 /* for forkpty() */
75 #include <sys/ioctl.h> /* some systems (BSD) need it even with FORKPTY_HEADER */
76 #ifdef FORKPTY_HEADER
77 # include FORKPTY_HEADER
78 #else
79 pid_t forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp);
80 #endif
81
82 /* for select and associated macros */
83 #ifdef HAVE_SYS_SELECT_H
84 #include <sys/select.h>
85 #else
86 #include <sys/time.h>
87 #include <sys/types.h>
88 #include <unistd.h>
89 #endif
90
91 /* for gettimeofday */
92 #include <sys/time.h>
93
94
95 /* FBUI */
96 #include <ggi/ggi.h>
97
98 #define fbtermError(...) { fprintf (stderr, "%s: ", __func__); fprintf (stderr, __VA_ARGS__); fprintf (stderr, "\n"); }
99
100 #ifdef DEBUG
101 extern int debuglevel;
102 #define debug(level, ...) {if (level <= debuglevel) { fprintf (stdout, "%s: ", __func__); fprintf (stdout, __VA_ARGS__); fprintf (stdout, "\n"); }}
103 #else
104 #define debug(level, ...) {}
105 #endif
106
107 #define DEBUG_NONE 0
108 #define DEBUG_INFO 1
109 #define DEBUG_DETAIL 2
110 #define DEBUG_TOTAL 3
111
112 #define CURSOR_AUTO 0
113 #define CURSOR_HIDE 1
114 #define CURSOR_SHOW 2
115
116 #define MAX_PARAM_NUM 9
117 #define MAX_PARAM_VALUE 32767
118 #define MAX_PARAM_SIZE 5
119
120 /* must be at least MAX_PARAM_SIZE*2+5 chars long, since do_u6() can send that much */
121 #define SHELLINPUT_SIZE (MAX_PARAM_SIZE*2+5+17)
122
123 /* set with care:
124 - must be greater than the biggest escape sequence possible
125 - input is frozen while shell output is rendered, so user experience
126 commands it must not be too big either
127 - when rendering of entire strings gets implemented, a small value will
128 prevent taking advantage of it
129 128 seems a good compromise... */
130 #define SHELLOUTPUT_SIZE 128
131
132 /* must be defined because even if FT support is not compiled in,
133 FreetypeInit() is called with fontsize as argument */
134 #define DEFAULT_FONTSIZE 12
135
136 #define FBUIFLUSH_BUG
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.