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 #include "glibcompat.h"
  25 
  26 #include "unixcompat.h"
  27 
  28 #include "fs.h"
  29 #include "shell.h"
  30 #include "mcconfig.h"
  31 
  32 /*** typedefs(not structures) and defined constants **********************************************/
  33 
  34 #ifdef ENABLE_NLS
  35 #include <libintl.h>
  36 #define _(String) gettext (String)
  37 #ifdef gettext_noop
  38 #define N_(String) gettext_noop (String)
  39 #else
  40 #define N_(String) (String)
  41 #endif
  42 #else  // Stubs that do something close enough.
  43 #define textdomain(String)                1
  44 #define gettext(String)                   (String)
  45 #define ngettext(String1, String2, Num)   (((Num) == 1) ? (String1) : (String2))
  46 #define dgettext(Domain, Message)         (Message)
  47 #define dcgettext(Domain, Message, Type)  (Message)
  48 #define bindtextdomain(Domain, Directory) 1
  49 #define _(String)                         (String)
  50 #define N_(String)                        (String)
  51 #endif
  52 
  53 #if MC_HAS_ATTRIBUTE(fallthrough)
  54 #define MC_FALLTHROUGH __attribute__ ((fallthrough))
  55 #else
  56 #define MC_FALLTHROUGH
  57 #endif
  58 
  59 #if MC_HAS_ATTRIBUTE(unused)
  60 #define MC_UNUSED __attribute__ ((unused))
  61 #else
  62 #define MC_UNUSED
  63 #endif
  64 
  65 #if MC_HAS_ATTRIBUTE(nonstring)
  66 #define MC_NONSTRING __attribute__ ((nonstring))
  67 #else
  68 #define MC_NONSTRING
  69 #endif
  70 
  71 #ifdef USE_MAINTAINER_MODE
  72 #include "lib/logging.h"
  73 #endif
  74 
  75 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
  76 #define BUF_10K       10240L
  77 #define BUF_8K        8192L
  78 #define BUF_4K        4096L
  79 #define BUF_2K        2048L
  80 #define BUF_1K        1024L
  81 
  82 #define BUF_LARGE     BUF_1K
  83 #define BUF_MEDIUM    512
  84 #define BUF_SMALL     128
  85 #define BUF_TINY      64
  86 
  87 #define UTF8_CHAR_LEN 6
  88 
  89 /* Used to distinguish between a normal MC termination and */
  90 /* one caused by typing 'exit' or 'logout' in the subshell */
  91 #define SUBSHELL_EXIT   128
  92 
  93 #define MC_ERROR        g_quark_from_static_string (PACKAGE)
  94 
  95 #define DEFAULT_CHARSET "ASCII"
  96 
  97 /*** enums ***************************************************************************************/
  98 
  99 /* run mode and params */
 100 typedef enum
 101 {
 102     MC_RUN_FULL = 0,
 103     MC_RUN_EDITOR,
 104     MC_RUN_VIEWER,
 105     MC_RUN_DIFFVIEWER
 106 } mc_run_mode_t;
 107 
 108 /*** structures declarations (and typedefs of structures)*****************************************/
 109 
 110 typedef struct
 111 {
 112     const char *mc_version;
 113 
 114     mc_run_mode_t mc_run_mode;
 115     gboolean run_from_parent_mc;
 116     // Used so that widgets know if they are being destroyed or shut down
 117     gboolean midnight_shutdown;
 118 
 119     /* sysconfig_dir: Area for default settings from maintainers of distributuves
 120        default is /etc/mc or may be defined by MC_DATADIR */
 121     char *sysconfig_dir;
 122     // share_data_dir: Area for default settings from developers
 123     char *share_data_dir;
 124 
 125     char *profile_name;
 126 
 127     mc_config_t *main_config;
 128     mc_config_t *panels_config;
 129 
 130     // Numbers of (file I/O) and (input/display) codepages. -1 if not selected
 131     int source_codepage;
 132     int display_codepage;
 133     /*
 134      * If utf-8 terminal utf8_display = TRUE
 135      * Display bits set UTF-8
 136      */
 137     gboolean utf8_display;
 138 
 139     // Set if the nice message (hint) bar is visible
 140     gboolean message_visible;
 141     // Set if the nice and useful keybar is visible
 142     gboolean keybar_visible;
 143 
 144 #ifdef ENABLE_BACKGROUND
 145     // If true, this is a background process
 146     gboolean we_are_background;
 147 #endif
 148 
 149     struct
 150     {
 151         // Asks for confirmation before clean up of history
 152         gboolean confirm_history_cleanup;
 153 
 154         // Set if you want the possible completions dialog for the first time
 155         gboolean show_all_if_ambiguous;
 156 
 157         // Ugly hack in order to distinguish between left and right panel in menubar
 158         // Set if the command is being run from the "Right" menu
 159         gboolean is_right;  // If the selected menu was the right
 160     } widget;
 161 
 162     // The user's shell
 163     mc_shell_t *shell;
 164 
 165     struct
 166     {
 167         // Use the specified skin
 168         char *skin;
 169         // Dialog window and drop down menu have a shadow
 170         gboolean shadows;
 171 
 172         char *setup_color_string;
 173         char *term_color_string;
 174         char *color_terminal_string;
 175         // colors specified on the command line: they override any other setting
 176         char *command_line_colors;
 177 
 178 #ifndef LINUX_CONS_SAVER_C
 179         // Used only in mc, not in cons.saver
 180         char console_flag;
 181 #endif
 182         // If using a subshell for evaluating commands this is true
 183         gboolean use_subshell;
 184 
 185 #ifdef ENABLE_SUBSHELL
 186         // File descriptors of the pseudoterminal used by the subshell
 187         int subshell_pty;
 188 #endif
 189 
 190         // This flag is set by xterm detection routine in function main()
 191         // It is used by function toggle_subshell()
 192         gboolean xterm_flag;
 193 
 194         // disable x11 support
 195         gboolean disable_x11;
 196 
 197         // For slow terminals
 198         // If true lines are shown by spaces
 199         gboolean slow_terminal;
 200 
 201         // Set to force black and white display at program startup
 202         gboolean disable_colors;
 203 
 204         // If true use +, -, | for line drawing
 205         gboolean ugly_line_drawing;
 206 
 207         // Tries to use old highlight mouse tracking
 208         gboolean old_mouse;
 209 
 210         /* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
 211            and M-- and keypad + / - */
 212         gboolean alternate_plus_minus;
 213     } tty;
 214 
 215     struct
 216     {
 217         // Set when cd symlink following is desirable (bash mode)
 218         gboolean cd_symlinks;
 219 
 220         // Preallocate space before file copying
 221         gboolean preallocate_space;
 222 
 223     } vfs;
 224 } mc_global_t;
 225 
 226 /*** global variables defined in .c file *********************************************************/
 227 
 228 extern mc_global_t mc_global;
 229 
 230 /*** declarations of public functions ************************************************************/
 231 
 232 /*** inline functions ****************************************************************************/
 233 #endif

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