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

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