2009-02-05 21:28:18 +03:00
|
|
|
|
|
|
|
/** \file global.h
|
2009-02-06 17:46:15 +03:00
|
|
|
* \brief Header: %global definitions for compatibility
|
2009-02-05 21:28:18 +03:00
|
|
|
*
|
|
|
|
* This file should be included after all system includes and before all local includes.
|
2001-09-07 20:46:31 +04:00
|
|
|
*/
|
|
|
|
|
2009-02-05 21:28:18 +03:00
|
|
|
|
2004-12-03 22:17:46 +03:00
|
|
|
#ifndef MC_GLOBAL_H
|
|
|
|
#define MC_GLOBAL_H
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2002-07-14 23:34:17 +04:00
|
|
|
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
|
|
|
# include <string.h>
|
|
|
|
/* An ANSI string.h and pre-ANSI memory.h might conflict */
|
|
|
|
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
|
|
|
|
# include <memory.h>
|
|
|
|
# endif /* !STDC_HEADERS & HAVE_MEMORY_H */
|
|
|
|
|
|
|
|
#else /* !STDC_HEADERS & !HAVE_STRING_H */
|
|
|
|
# include <strings.h>
|
|
|
|
/* memory and strings.h conflict on other systems */
|
|
|
|
#endif /* !STDC_HEADERS & !HAVE_STRING_H */
|
|
|
|
|
2001-08-19 20:23:24 +04:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
2001-09-07 20:46:31 +04:00
|
|
|
# include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
2002-09-23 10:43:22 +04:00
|
|
|
/* The O_BINARY definition was taken from gettext */
|
|
|
|
#if !defined O_BINARY && defined _O_BINARY
|
|
|
|
/* For MSC-compatible compilers. */
|
|
|
|
# define O_BINARY _O_BINARY
|
|
|
|
#endif
|
|
|
|
#ifdef __BEOS__
|
2002-09-23 11:00:30 +04:00
|
|
|
/* BeOS 5 has O_BINARY, but is has no effect. */
|
2002-09-23 10:43:22 +04:00
|
|
|
# undef O_BINARY
|
|
|
|
#endif
|
|
|
|
/* On reasonable systems, binary I/O is the default. */
|
|
|
|
#ifndef O_BINARY
|
|
|
|
# define O_BINARY 0
|
|
|
|
#endif
|
|
|
|
|
2002-12-16 03:41:06 +03:00
|
|
|
/* Replacement for O_NONBLOCK */
|
2004-12-03 22:17:46 +03:00
|
|
|
#ifndef O_NONBLOCK
|
|
|
|
#ifdef O_NDELAY /* SYSV */
|
|
|
|
#define O_NONBLOCK O_NDELAY
|
|
|
|
#else /* BSD */
|
|
|
|
#define O_NONBLOCK FNDELAY
|
|
|
|
#endif /* !O_NDELAY */
|
|
|
|
#endif /* !O_NONBLOCK */
|
2002-12-16 03:41:06 +03:00
|
|
|
|
2001-09-07 20:46:31 +04:00
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
# include <sys/select.h>
|
|
|
|
#endif
|
|
|
|
|
2002-02-19 00:54:27 +03:00
|
|
|
#if defined(__QNX__) && !defined(__QNXNTO__)
|
|
|
|
/* exec*() from <process.h> */
|
|
|
|
# include <unix.h>
|
|
|
|
#endif
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#include <glib.h>
|
2003-09-23 00:21:48 +04:00
|
|
|
#include "glibcompat.h"
|
2001-08-19 20:23:24 +04:00
|
|
|
|
2001-10-20 07:38:41 +04:00
|
|
|
#ifndef __GNUC__
|
2002-01-21 23:47:05 +03:00
|
|
|
# define __attribute__(x)
|
|
|
|
#endif
|
|
|
|
|
2003-10-26 07:11:12 +03:00
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
# include <libintl.h>
|
|
|
|
# define _(String) gettext (String)
|
|
|
|
# ifdef gettext_noop
|
|
|
|
# define N_(String) gettext_noop (String)
|
|
|
|
# else
|
|
|
|
# define N_(String) (String)
|
|
|
|
# endif
|
|
|
|
#else /* Stubs that do something close enough. */
|
|
|
|
# define textdomain(String)
|
|
|
|
# define gettext(String) (String)
|
2005-11-11 06:32:39 +03:00
|
|
|
# define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
|
2003-10-26 07:11:12 +03:00
|
|
|
# define dgettext(Domain,Message) (Message)
|
|
|
|
# define dcgettext(Domain,Message,Type) (Message)
|
|
|
|
# define bindtextdomain(Domain,Directory)
|
|
|
|
# define _(String) (String)
|
|
|
|
# define N_(String) (String)
|
|
|
|
#endif /* !ENABLE_NLS */
|
|
|
|
|
2001-08-19 20:23:24 +04:00
|
|
|
#include "fs.h"
|
2010-01-21 13:47:01 +03:00
|
|
|
#include "util.h"
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
|
2009-10-30 00:57:40 +03:00
|
|
|
#ifdef USE_MAINTAINER_MODE
|
2010-01-21 16:47:19 +03:00
|
|
|
#include "lib/logging.h"
|
2009-10-30 00:57:40 +03:00
|
|
|
#endif
|
|
|
|
|
2004-09-25 17:46:23 +04:00
|
|
|
extern const char *home_dir;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#ifdef min
|
|
|
|
#undef min
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef max
|
|
|
|
#undef max
|
|
|
|
#endif
|
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#define min(x, y) ((x) > (y) ? (y) : (x))
|
|
|
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
1998-02-27 07:54:42 +03:00
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
/* Just for keeping Your's brains from invention a proper size of the buffer :-) */
|
|
|
|
#define BUF_10K 10240L
|
|
|
|
#define BUF_8K 8192L
|
|
|
|
#define BUF_4K 4096L
|
|
|
|
#define BUF_1K 1024L
|
1998-02-27 07:54:42 +03:00
|
|
|
|
Glibing..... (2)
Wed Jan 27 03:17:44 1999 Timur Bakeyev <mc@bat.ru>
* Converted memory managment to Glib. Now we use g_new()/g_malloc()/
g_strdup()/g_free() routings. Also, copy_strings() replaced by
g_strconcat(), strcasecmp() -> g_strcasecmp(),and sprintf() by
g_snprintf().
* Some sequences of malloc()/sprintf() changed to g_strdup_printf().
* mad.[ch]: Modified, to work with new GLib's memory managment. Fixed
a missing #undef for tempnam, which caused dead loop. Add several new
functions to emulate GLib memory managment.
*main.c, mad.[ch]: Add a new switch "-M", which allows to redirect MAD
messages to the file.
* util.[ch], utilunix.c: Modified, deleted our variants of strcasecmp()
and strdup() - we have g_ equivalences. Remove get_full_name() - it is
similar to concat_dir_and_file(). Some other tricks with g_* functions.
* global.h: Modified, extended. Now it is main memory mangment include -
i.e. all inclusions of <stdlib.h>, <malloc.h>, <glib.h>, "fs.h", "mem.h",
"util.h" and "mad.h" done there. This elimanates problem with proper or-
der of #include's.
* All around the source - changed order of #include's, most of them gone
to global.h (see above), minor changes, like "0" -> NULL in string func-
tions.
1999-01-27 04:08:30 +03:00
|
|
|
#define BUF_LARGE BUF_1K
|
|
|
|
#define BUF_MEDIUM 512
|
|
|
|
#define BUF_SMALL 128
|
|
|
|
#define BUF_TINY 64
|
|
|
|
|
|
|
|
void refresh_screen (void *);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* AIX compiler doesn't understand '\e' */
|
|
|
|
#define ESC_CHAR '\033'
|
|
|
|
#define ESC_STR "\033"
|
|
|
|
|
2004-08-16 19:42:48 +04:00
|
|
|
/* C++ style type casts */
|
|
|
|
#define const_cast(m_type, m_expr) ((m_type) (m_expr))
|
|
|
|
|
2005-07-01 03:12:08 +04:00
|
|
|
#if 0
|
2005-04-26 23:42:37 +04:00
|
|
|
#ifdef MC_ENABLE_DEBUGGING_CODE
|
|
|
|
# undef NDEBUG
|
|
|
|
#else
|
|
|
|
# define NDEBUG
|
|
|
|
#endif
|
|
|
|
#include <assert.h>
|
2005-07-01 03:12:08 +04:00
|
|
|
#endif
|
2005-04-26 23:42:37 +04:00
|
|
|
|
2009-09-28 18:04:25 +04:00
|
|
|
#define MC_ERROR mc_main_error_quark ()
|
|
|
|
GQuark mc_main_error_quark (void);
|
|
|
|
|
2004-12-03 22:17:46 +03:00
|
|
|
#endif
|