Manual pages: mcmcdiffmceditmcview

root/lib/global.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   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 
   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 /*** typedefs(not structures) and defined constants **********************************************/
  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  // Stubs that do something close enough.
  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 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
  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 /* Used to distinguish between a normal MC termination and */
  94 /* one caused by typing 'exit' or 'logout' in the subshell */
  95 #define SUBSHELL_EXIT   128
  96 
  97 #define MC_ERROR        g_quark_from_static_string (PACKAGE)
  98 
  99 #define DEFAULT_CHARSET "ASCII"
 100 
 101 /*** enums ***************************************************************************************/
 102 
 103 /* run mode and params */
 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 /*** structures declarations (and typedefs of structures)*****************************************/
 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     // Used so that widgets know if they are being destroyed or shut down
 121     gboolean midnight_shutdown;
 122 
 123     /* sysconfig_dir: Area for default settings from maintainers of distributuves
 124        default is /etc/mc or may be defined by MC_DATADIR */
 125     char *sysconfig_dir;
 126     // share_data_dir: Area for default settings from developers
 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     // Numbers of (file I/O) and (input/display) codepages. -1 if not selected
 135     int source_codepage;
 136     int display_codepage;
 137 
 138     // If utf-8 terminal utf8_display = TRUE
 139     gboolean utf8_display;
 140 
 141     // Set if the nice message (hint) bar is visible
 142     gboolean message_visible;
 143     // Set if the nice and useful keybar is visible
 144     gboolean keybar_visible;
 145 
 146 #ifdef ENABLE_BACKGROUND
 147     // If true, this is a background process
 148     gboolean we_are_background;
 149 #endif
 150 
 151     struct
 152     {
 153         // Asks for confirmation before clean up of history
 154         gboolean confirm_history_cleanup;
 155 
 156         // Set if you want the possible completions dialog for the first time
 157         gboolean show_all_if_ambiguous;
 158 
 159         // Ugly hack in order to distinguish between left and right panel in menubar
 160         // Set if the command is being run from the "Right" menu
 161         gboolean is_right;  // If the selected menu was the right
 162     } widget;
 163 
 164     // The user's shell
 165     mc_shell_t *shell;
 166 
 167     struct
 168     {
 169         // Use the specified skin
 170         char *skin;
 171         // Dialog window and drop down menu have a shadow
 172         gboolean shadows;
 173 
 174         char *setup_color_string;
 175         char *term_color_string;
 176         char *color_terminal_string;
 177         // colors specified on the command line: they override any other setting
 178         char *command_line_colors;
 179 
 180 #ifndef LINUX_CONS_SAVER_C
 181         // Used only in mc, not in cons.saver
 182         char console_flag;
 183 #endif
 184         // If using a subshell for evaluating commands this is true
 185         gboolean use_subshell;
 186 
 187 #ifdef ENABLE_SUBSHELL
 188         // File descriptors of the pseudoterminal used by the subshell
 189         int subshell_pty;
 190 #endif
 191 
 192         // This flag is set by xterm detection routine in function main()
 193         // It is used by function toggle_subshell()
 194         gboolean xterm_flag;
 195 
 196         // disable x11 support
 197         gboolean disable_x11;
 198 
 199         // For slow terminals
 200         // If true lines are shown by spaces
 201         gboolean slow_terminal;
 202 
 203         // Set to force black and white display at program startup
 204         gboolean disable_colors;
 205 
 206         // If true use +, -, | for line drawing
 207         gboolean ugly_line_drawing;
 208 
 209         // Tries to use old highlight mouse tracking
 210         gboolean old_mouse;
 211 
 212         /* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
 213            and M-- and keypad + / - */
 214         gboolean alternate_plus_minus;
 215     } tty;
 216 
 217     struct
 218     {
 219         // Set when cd symlink following is desirable (bash mode)
 220         gboolean cd_symlinks;
 221 
 222         // Preallocate space before file copying
 223         gboolean preallocate_space;
 224 
 225     } vfs;
 226 } mc_global_t;
 227 
 228 /*** global variables defined in .c file *********************************************************/
 229 
 230 extern mc_global_t mc_global;
 231 
 232 /*** declarations of public functions ************************************************************/
 233 
 234 char *mc_get_package_copyright (void);
 235 
 236 /*** inline functions ****************************************************************************/
 237 #endif

/* [previous][next][first][last][top][bottom][index][help]  */