global.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /** \file global.h
  2. * \brief Header: %global definitions for compatibility
  3. *
  4. * This file should be included after all system includes and before all local includes.
  5. */
  6. #ifndef MC_GLOBAL_H
  7. #define MC_GLOBAL_H
  8. #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  9. # include <string.h>
  10. /* An ANSI string.h and pre-ANSI memory.h might conflict */
  11. # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
  12. # include <memory.h>
  13. # endif /* !STDC_HEADERS & HAVE_MEMORY_H */
  14. #else /* !STDC_HEADERS & !HAVE_STRING_H */
  15. # include <strings.h>
  16. /* memory and strings.h conflict on other systems */
  17. #endif /* !STDC_HEADERS & !HAVE_STRING_H */
  18. #ifdef HAVE_SYS_PARAM_H
  19. # include <sys/param.h>
  20. #endif
  21. /* The O_BINARY definition was taken from gettext */
  22. #if !defined O_BINARY && defined _O_BINARY
  23. /* For MSC-compatible compilers. */
  24. # define O_BINARY _O_BINARY
  25. #endif
  26. #ifdef __BEOS__
  27. /* BeOS 5 has O_BINARY, but is has no effect. */
  28. # undef O_BINARY
  29. #endif
  30. /* On reasonable systems, binary I/O is the default. */
  31. #ifndef O_BINARY
  32. # define O_BINARY 0
  33. #endif
  34. /* Replacement for O_NONBLOCK */
  35. #ifndef O_NONBLOCK
  36. #ifdef O_NDELAY /* SYSV */
  37. #define O_NONBLOCK O_NDELAY
  38. #else /* BSD */
  39. #define O_NONBLOCK FNDELAY
  40. #endif /* !O_NDELAY */
  41. #endif /* !O_NONBLOCK */
  42. #ifdef HAVE_SYS_SELECT_H
  43. # include <sys/select.h>
  44. #endif
  45. #if defined(__QNX__) && !defined(__QNXNTO__)
  46. /* exec*() from <process.h> */
  47. # include <unix.h>
  48. #endif
  49. #include <glib.h>
  50. #include "glibcompat.h"
  51. #ifndef __GNUC__
  52. # define __attribute__(x)
  53. #endif
  54. #ifdef ENABLE_NLS
  55. # include <libintl.h>
  56. # define _(String) gettext (String)
  57. # ifdef gettext_noop
  58. # define N_(String) gettext_noop (String)
  59. # else
  60. # define N_(String) (String)
  61. # endif
  62. #else /* Stubs that do something close enough. */
  63. # define textdomain(String)
  64. # define gettext(String) (String)
  65. # define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
  66. # define dgettext(Domain,Message) (Message)
  67. # define dcgettext(Domain,Message,Type) (Message)
  68. # define bindtextdomain(Domain,Directory)
  69. # define _(String) (String)
  70. # define N_(String) (String)
  71. #endif /* !ENABLE_NLS */
  72. #include "fs.h"
  73. #include "util.h"
  74. #ifdef USE_MAINTAINER_MODE
  75. #include "lib/logging.h"
  76. #endif
  77. extern const char *home_dir;
  78. #ifdef min
  79. #undef min
  80. #endif
  81. #ifdef max
  82. #undef max
  83. #endif
  84. #define min(x, y) ((x) > (y) ? (y) : (x))
  85. #define max(x, y) ((x) > (y) ? (x) : (y))
  86. /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
  87. #define BUF_10K 10240L
  88. #define BUF_8K 8192L
  89. #define BUF_4K 4096L
  90. #define BUF_1K 1024L
  91. #define BUF_LARGE BUF_1K
  92. #define BUF_MEDIUM 512
  93. #define BUF_SMALL 128
  94. #define BUF_TINY 64
  95. void refresh_screen (void *);
  96. /* AIX compiler doesn't understand '\e' */
  97. #define ESC_CHAR '\033'
  98. #define ESC_STR "\033"
  99. /* C++ style type casts */
  100. #define const_cast(m_type, m_expr) ((m_type) (m_expr))
  101. #if 0
  102. #ifdef MC_ENABLE_DEBUGGING_CODE
  103. # undef NDEBUG
  104. #else
  105. # define NDEBUG
  106. #endif
  107. #include <assert.h>
  108. #endif
  109. #define MC_ERROR mc_main_error_quark ()
  110. GQuark mc_main_error_quark (void);
  111. #endif