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

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