Reorder fields in mc_global struct and change type for some of them.
[midnight-commander.git] / lib / global.h
blob7df9c4a268b11031106dd2f78dcd6c512dcd310a
1 /** \file global.h
2 * \brief Header: %global definitions for compatibility
4 * This file should be included after all system includes and before all local includes.
5 */
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
10 #if defined(HAVE_STRING_H)
11 #include <string.h>
12 /* An ANSI string.h and pre-ANSI memory.h might conflict */
13 #elif defined(HAVE_MEMORY_H)
14 #include <memory.h>
15 #else
16 #include <strings.h>
17 /* memory and strings.h conflict on other systems */
18 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
20 #ifdef HAVE_SYS_PARAM_H
21 #include <sys/param.h>
22 #endif
24 /*** typedefs(not structures) and defined constants **********************************************/
26 /* The O_BINARY definition was taken from gettext */
27 #if !defined O_BINARY && defined _O_BINARY
28 /* For MSC-compatible compilers. */
29 #define O_BINARY _O_BINARY
30 #endif
31 #ifdef __BEOS__
32 /* BeOS 5 has O_BINARY, but is has no effect. */
33 #undef O_BINARY
34 #endif
35 /* On reasonable systems, binary I/O is the default. */
36 #ifndef O_BINARY
37 #define O_BINARY 0
38 #endif
40 /* Replacement for O_NONBLOCK */
41 #ifndef O_NONBLOCK
42 #ifdef O_NDELAY /* SYSV */
43 #define O_NONBLOCK O_NDELAY
44 #else /* BSD */
45 #define O_NONBLOCK FNDELAY
46 #endif /* !O_NDELAY */
47 #endif /* !O_NONBLOCK */
49 #ifdef HAVE_SYS_SELECT_H
50 #include <sys/select.h>
51 #endif
53 #if defined(__QNX__) && !defined(__QNXNTO__)
54 /* exec*() from <process.h> */
55 #include <unix.h>
56 #endif
58 #include <glib.h>
59 #include "glibcompat.h"
61 #ifndef __GNUC__
62 #define __attribute__(x)
63 #endif
65 /* Solaris9 doesn't have PRIXMAX */
66 #ifndef PRIXMAX
67 #define PRIXMAX PRIxMAX
68 #endif
70 #ifdef ENABLE_NLS
71 #include <libintl.h>
72 #define _(String) gettext (String)
73 #ifdef gettext_noop
74 #define N_(String) gettext_noop (String)
75 #else
76 #define N_(String) (String)
77 #endif
78 #else /* Stubs that do something close enough. */
79 #define textdomain(String) 1
80 #define gettext(String) (String)
81 #define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
82 #define dgettext(Domain,Message) (Message)
83 #define dcgettext(Domain,Message,Type) (Message)
84 #define bindtextdomain(Domain,Directory) 1
85 #define _(String) (String)
86 #define N_(String) (String)
87 #endif /* !ENABLE_NLS */
89 #include "fs.h"
91 #ifdef USE_MAINTAINER_MODE
92 #include "lib/logging.h"
93 #endif
95 #ifdef min
96 #undef min
97 #endif
99 #ifdef max
100 #undef max
101 #endif
103 #define min(x, y) ((x) > (y) ? (y) : (x))
104 #define max(x, y) ((x) > (y) ? (x) : (y))
106 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
107 #define BUF_10K 10240L
108 #define BUF_8K 8192L
109 #define BUF_4K 4096L
110 #define BUF_1K 1024L
112 #define BUF_LARGE BUF_1K
113 #define BUF_MEDIUM 512
114 #define BUF_SMALL 128
115 #define BUF_TINY 64
117 /* AIX compiler doesn't understand '\e' */
118 #define ESC_CHAR '\033'
119 #define ESC_STR "\033"
121 /* OS specific defines */
122 #define PATH_SEP '/'
123 #define PATH_SEP_STR "/"
124 #define PATH_ENV_SEP ':'
125 #define TMPDIR_DEFAULT "/tmp"
126 #define SCRIPT_SUFFIX ""
127 #define get_default_editor() "vi"
128 #define OS_SORT_CASE_SENSITIVE_DEFAULT 1
129 #define UTF8_CHAR_LEN 6
131 /* C++ style type casts */
132 #define const_cast(m_type, m_expr) ((m_type) (m_expr))
134 #if 0
135 #ifdef MC_ENABLE_DEBUGGING_CODE
136 #undef NDEBUG
137 #else
138 #define NDEBUG
139 #endif
140 #ifdef HAVE_ASSERT_H
141 #include <assert.h>
142 #endif
143 #endif
145 #define MC_ERROR g_quark_from_static_string (PACKAGE)
147 /*** enums ***************************************************************************************/
149 /* run mode and params */
150 typedef enum
152 MC_RUN_FULL = 0,
153 MC_RUN_EDITOR,
154 MC_RUN_VIEWER,
155 MC_RUN_DIFFVIEWER
156 } mc_run_mode_t;
158 /*** structures declarations (and typedefs of structures)*****************************************/
160 typedef struct
162 mc_run_mode_t mc_run_mode;
163 /* Used so that widgets know if they are being destroyed or shut down */
164 gboolean midnight_shutdown;
166 /* sysconfig_dir: Area for default settings from maintainers of distributuves
167 default is /etc/mc or may be defined by MC_DATADIR */
168 char *sysconfig_dir;
169 /* share_data_dir: Area for default settings from developers */
170 char *share_data_dir;
172 #ifdef HAVE_CHARSET
173 /* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
174 int source_codepage;
175 int display_codepage;
176 #else
177 /* If true, allow characters in the range 160-255 */
178 int eight_bit_clean;
180 * If true, also allow characters in the range 128-159.
181 * This is reported to break on many terminals (xterm, qansi-m).
183 int full_eight_bits;
184 #endif /* !HAVE_CHARSET */
186 * If utf-8 terminal utf8_display = TRUE
187 * Display bits set UTF-8
189 gboolean utf8_display;
191 /* Set if the nice message (hint) bar is visible */
192 int message_visible;
193 /* Set if the nice and useful keybar is visible */
194 int keybar_visible;
196 #ifdef ENABLE_BACKGROUND
197 /* If true, this is a background process */
198 gboolean we_are_background;
199 #endif /* ENABLE_BACKGROUND */
201 struct
203 /* Asks for confirmation before clean up of history */
204 gboolean confirm_history_cleanup;
206 /* Set if you want the possible completions dialog for the first time */
207 gboolean show_all_if_ambiguous;
209 /* Ugly hack in order to distinguish between left and right panel in menubar */
210 /* Set if the command is being run from the "Right" menu */
211 gboolean is_right; /* If the selected menu was the right */
212 } widget;
214 struct
216 /* Use the specified skin */
217 char *skin;
219 char *setup_color_string;
220 char *term_color_string;
221 char *color_terminal_string;
222 /* colors specified on the command line: they override any other setting */
223 char *command_line_colors;
225 #ifndef LINUX_CONS_SAVER_C
226 /* Used only in mc, not in cons.saver */
227 char console_flag;
228 #endif /* !LINUX_CONS_SAVER_C */
229 /* If using a subshell for evaluating commands this is true */
230 gboolean use_subshell;
231 #ifdef HAVE_SUBSHELL_SUPPORT
232 /* File descriptors of the pseudoterminal used by the subshell */
233 int subshell_pty;
234 #endif /* !HAVE_SUBSHELL_SUPPORT */
236 /* This flag is set by xterm detection routine in function main() */
237 /* It is used by function view_other_cmd() */
238 gboolean xterm_flag;
240 /* disable x11 support */
241 gboolean disable_x11;
243 /* For slow terminals */
244 /* If true lines are shown by spaces */
245 gboolean slow_terminal;
247 /* Set to force black and white display at program startup */
248 gboolean disable_colors;
250 /* If true use +, -, | for line drawing */
251 gboolean ugly_line_drawing;
253 /* Tries to use old highlight mouse tracking */
254 gboolean old_mouse;
256 /* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
257 and M-- and keypad + / - */
258 gboolean alternate_plus_minus;
260 /* Set if the window has changed it's size */
261 gboolean winch_flag;
262 } tty;
264 struct
266 /* Set when cd symlink following is desirable (bash mode) */
267 gboolean cd_symlinks;
269 /* Preallocate space before file copying */
270 gboolean preallocate_space;
272 } vfs;
273 } mc_global_t;
275 /*** global variables defined in .c file *********************************************************/
277 extern mc_global_t mc_global;
279 /*** declarations of public functions ************************************************************/
281 void refresh_screen (void *);
283 /*** inline functions ****************************************************************************/
284 #endif