1
2
3
4
5
6
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
9
10 #include <glib.h>
11
12 #if defined(__has_attribute)
13 #define MC_HAS_ATTRIBUTE(ATTR) __has_attribute (ATTR)
14 #else
15 #define MC_HAS_ATTRIBUTE(ATTR) 0
16 #endif
17
18 #if MC_HAS_ATTRIBUTE(weak) && defined(HAVE_TESTS)
19 #define MC_MOCKABLE __attribute__ ((weak))
20 #else
21 #define MC_MOCKABLE
22 #endif
23
24 #if defined(HAVE_TESTS)
25 #define MC_TESTABLE
26 #else
27 #define MC_TESTABLE static
28 #endif
29
30 #include "glibcompat.h"
31
32 #include "unixcompat.h"
33
34 #include "fs.h"
35 #include "shell.h"
36 #include "mcconfig.h"
37
38
39
40 #ifdef ENABLE_NLS
41 #include <libintl.h>
42 #define _(String) gettext (String)
43 #ifdef gettext_noop
44 #define N_(String) gettext_noop (String)
45 #else
46 #define N_(String) (String)
47 #endif
48 #else
49 #define textdomain(String) 1
50 #define gettext(String) (String)
51 #define ngettext(String1, String2, Num) (((Num) == 1) ? (String1) : (String2))
52 #define dgettext(Domain, Message) (Message)
53 #define dcgettext(Domain, Message, Type) (Message)
54 #define bindtextdomain(Domain, Directory) 1
55 #define _(String) (String)
56 #define N_(String) (String)
57 #endif
58
59 #if MC_HAS_ATTRIBUTE(fallthrough)
60 #define MC_FALLTHROUGH __attribute__ ((fallthrough))
61 #else
62 #define MC_FALLTHROUGH
63 #endif
64
65 #if MC_HAS_ATTRIBUTE(unused)
66 #define MC_UNUSED __attribute__ ((unused))
67 #else
68 #define MC_UNUSED
69 #endif
70
71 #if MC_HAS_ATTRIBUTE(nonstring)
72 #define MC_NONSTRING __attribute__ ((nonstring))
73 #else
74 #define MC_NONSTRING
75 #endif
76
77 #ifdef USE_MAINTAINER_MODE
78 #include "lib/logging.h"
79 #endif
80
81
82 #define BUF_10K 10240L
83 #define BUF_8K 8192L
84 #define BUF_4K 4096L
85 #define BUF_2K 2048L
86 #define BUF_1K 1024L
87
88 #define BUF_LARGE BUF_1K
89 #define BUF_MEDIUM 512
90 #define BUF_SMALL 128
91 #define BUF_TINY 64
92
93
94
95 #define SUBSHELL_EXIT 128
96
97 #define MC_ERROR g_quark_from_static_string (PACKAGE)
98
99 #define DEFAULT_CHARSET "ASCII"
100
101
102
103
104 typedef enum
105 {
106 MC_RUN_FULL = 0,
107 MC_RUN_EDITOR,
108 MC_RUN_VIEWER,
109 MC_RUN_DIFFVIEWER
110 } mc_run_mode_t;
111
112
113
114 typedef struct
115 {
116 const char *mc_version;
117
118 mc_run_mode_t mc_run_mode;
119 gboolean run_from_parent_mc;
120
121 gboolean midnight_shutdown;
122
123
124
125 char *sysconfig_dir;
126
127 char *share_data_dir;
128
129 char *profile_name;
130
131 mc_config_t *main_config;
132 mc_config_t *panels_config;
133
134
135 int source_codepage;
136 int display_codepage;
137
138
139 gboolean utf8_display;
140
141
142 gboolean message_visible;
143
144 gboolean keybar_visible;
145
146 #ifdef ENABLE_BACKGROUND
147
148 gboolean we_are_background;
149 #endif
150
151 struct
152 {
153
154 gboolean confirm_history_cleanup;
155
156
157 gboolean show_all_if_ambiguous;
158
159
160
161 gboolean is_right;
162 } widget;
163
164
165 mc_shell_t *shell;
166
167 struct
168 {
169
170 char *skin;
171
172 gboolean shadows;
173
174 char *setup_color_string;
175 char *term_color_string;
176 char *color_terminal_string;
177
178 char *command_line_colors;
179
180 #ifndef LINUX_CONS_SAVER_C
181
182 char console_flag;
183 #endif
184
185 gboolean use_subshell;
186
187 #ifdef ENABLE_SUBSHELL
188
189 int subshell_pty;
190 #endif
191
192
193
194 gboolean xterm_flag;
195
196
197 gboolean disable_x11;
198
199
200
201 gboolean slow_terminal;
202
203
204 gboolean disable_colors;
205
206
207 gboolean ugly_line_drawing;
208
209
210 gboolean old_mouse;
211
212
213
214 gboolean alternate_plus_minus;
215 } tty;
216
217 struct
218 {
219
220 gboolean cd_symlinks;
221
222
223 gboolean preallocate_space;
224
225 } vfs;
226 } mc_global_t;
227
228
229
230 extern mc_global_t mc_global;
231
232
233
234 char *mc_get_package_copyright (void);
235
236
237 #endif