Ticket #1475: warningis fix
[midnight-commander.git] / src / global.h
blobd8bfc9a67b8972c9c771daab8f888c57ee24e0ab
2 /** \file global.h
3 * \brief Header: %global definitions for compatibility
5 * This file should be included after all system includes and before all local includes.
6 */
9 #ifndef MC_GLOBAL_H
10 #define MC_GLOBAL_H
12 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
13 # include <string.h>
14 /* An ANSI string.h and pre-ANSI memory.h might conflict */
15 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
16 # include <memory.h>
17 # endif /* !STDC_HEADERS & HAVE_MEMORY_H */
19 #else /* !STDC_HEADERS & !HAVE_STRING_H */
20 # include <strings.h>
21 /* memory and strings.h conflict on other systems */
22 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
24 #ifdef HAVE_SYS_PARAM_H
25 # include <sys/param.h>
26 #endif
28 /* The O_BINARY definition was taken from gettext */
29 #if !defined O_BINARY && defined _O_BINARY
30 /* For MSC-compatible compilers. */
31 # define O_BINARY _O_BINARY
32 #endif
33 #ifdef __BEOS__
34 /* BeOS 5 has O_BINARY, but is has no effect. */
35 # undef O_BINARY
36 #endif
37 /* On reasonable systems, binary I/O is the default. */
38 #ifndef O_BINARY
39 # define O_BINARY 0
40 #endif
42 /* Replacement for O_NONBLOCK */
43 #ifndef O_NONBLOCK
44 #ifdef O_NDELAY /* SYSV */
45 #define O_NONBLOCK O_NDELAY
46 #else /* BSD */
47 #define O_NONBLOCK FNDELAY
48 #endif /* !O_NDELAY */
49 #endif /* !O_NONBLOCK */
51 #ifdef HAVE_SYS_SELECT_H
52 # include <sys/select.h>
53 #endif
55 #if defined(__QNX__) && !defined(__QNXNTO__)
56 /* exec*() from <process.h> */
57 # include <unix.h>
58 #endif
60 #include <glib.h>
61 #include "glibcompat.h"
63 #ifndef __GNUC__
64 # define __attribute__(x)
65 #endif
67 #ifndef HAVE_GETUID
68 # define getuid() 0
69 #endif
70 #ifndef HAVE_GETGID
71 # define getgid() 0
72 #endif
73 #ifndef HAVE_GETEUID
74 # define geteuid() getuid()
75 #endif
76 #ifndef HAVE_GETEGID
77 # define getegid() getgid()
78 #endif
80 #ifdef ENABLE_NLS
81 # include <libintl.h>
82 # define _(String) gettext (String)
83 # ifdef gettext_noop
84 # define N_(String) gettext_noop (String)
85 # else
86 # define N_(String) (String)
87 # endif
88 #else /* Stubs that do something close enough. */
89 # define textdomain(String)
90 # define gettext(String) (String)
91 # define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
92 # define dgettext(Domain,Message) (Message)
93 # define dcgettext(Domain,Message,Type) (Message)
94 # define bindtextdomain(Domain,Directory)
95 # define _(String) (String)
96 # define N_(String) (String)
97 #endif /* !ENABLE_NLS */
99 #include "fs.h"
100 #include "util.h"
102 #include "textconf.h"
104 #ifdef USE_VFS
105 #include "../vfs/vfs.h"
106 #else
107 #include "vfsdummy.h"
108 #endif
110 extern const char *home_dir;
112 #ifdef min
113 #undef min
114 #endif
116 #ifdef max
117 #undef max
118 #endif
120 #define min(x, y) ((x) > (y) ? (y) : (x))
121 #define max(x, y) ((x) > (y) ? (x) : (y))
123 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
124 #define BUF_10K 10240L
125 #define BUF_8K 8192L
126 #define BUF_4K 4096L
127 #define BUF_1K 1024L
129 #define BUF_LARGE BUF_1K
130 #define BUF_MEDIUM 512
131 #define BUF_SMALL 128
132 #define BUF_TINY 64
134 void refresh_screen (void *);
136 /* AIX compiler doesn't understand '\e' */
137 #define ESC_CHAR '\033'
138 #define ESC_STR "\033"
140 /* C++ style type casts */
141 #define const_cast(m_type, m_expr) ((m_type) (m_expr))
143 #if 0
144 #ifdef MC_ENABLE_DEBUGGING_CODE
145 # undef NDEBUG
146 #else
147 # define NDEBUG
148 #endif
149 #include <assert.h>
150 #endif
152 #endif