root/src/diffviewer/internal.h

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

INCLUDED FROM


   1 #ifndef MC__DIFFVIEW_INTERNAL_H
   2 #define MC__DIFFVIEW_INTERNAL_H
   3 
   4 #include "lib/global.h"
   5 #include "lib/mcconfig.h"
   6 #include "lib/search.h"
   7 #include "lib/tty/color.h"
   8 #include "lib/widget.h"
   9 
  10 /*** typedefs(not structures) and defined constants **********************************************/
  11 
  12 typedef int (*DFUNC) (void *ctx, int ch, int line, off_t off, size_t sz, const char *str);
  13 typedef int PAIR[2];
  14 
  15 #define error_dialog(h, s) query_dialog (h, s, D_ERROR, 1, _ ("&Dismiss"))
  16 
  17 /*** enums ***************************************************************************************/
  18 
  19 typedef enum
  20 {
  21     DATA_SRC_MEM = 0,
  22     DATA_SRC_TMP = 1,
  23     DATA_SRC_ORG = 2
  24 } DSRC;
  25 
  26 typedef enum
  27 {
  28     DIFF_LEFT = 0,
  29     DIFF_RIGHT = 1,
  30     DIFF_COUNT = 2
  31 } diff_place_t;
  32 
  33 typedef enum
  34 {
  35     DIFF_NONE = 0,
  36     DIFF_ADD = 1,
  37     DIFF_DEL = 2,
  38     DIFF_CHG = 3
  39 } DiffState;
  40 
  41 /*** structures declarations (and typedefs of structures)*****************************************/
  42 
  43 typedef struct
  44 {
  45     int fd;
  46     int pos;
  47     int len;
  48     char *buf;
  49     int flags;
  50     void *data;
  51 } FBUF;
  52 
  53 typedef struct
  54 {
  55     int a[2][2];
  56     int cmd;
  57 } DIFFCMD;
  58 
  59 typedef struct
  60 {
  61     int off;
  62     int len;
  63 } BRACKET[DIFF_COUNT];
  64 
  65 typedef struct
  66 {
  67     int ch;
  68     int line;
  69     union
  70     {
  71         off_t off;
  72         size_t len;
  73     } u;
  74     void *p;
  75 } DIFFLN;
  76 
  77 typedef struct
  78 {
  79     FBUF *f;
  80     GArray *a;
  81     DSRC dsrc;
  82 } PRINTER_CTX;
  83 
  84 typedef struct WDiff
  85 {
  86     Widget widget;
  87 
  88     const char *args;              // Args passed to diff
  89     const char *file[DIFF_COUNT];  // filenames
  90     char *label[DIFF_COUNT];
  91     FBUF *f[DIFF_COUNT];
  92     const char *backup_sufix;
  93     gboolean merged[DIFF_COUNT];
  94     GArray *a[DIFF_COUNT];
  95     GPtrArray *hdiff;
  96     int ndiff;  // number of hunks
  97     DSRC dsrc;  // data source: memory or temporary file
  98 
  99     gboolean view_quit;  // Quit flag
 100 
 101     int height;
 102     int half1;
 103     int half2;
 104     int width1;
 105     int width2;
 106     int bias;
 107     gboolean new_frame;
 108     int skip_rows;
 109     int skip_cols;
 110     gboolean display_symbols;
 111     int display_numbers;
 112     gboolean show_cr;
 113     int tab_size;
 114     diff_place_t ord;
 115     gboolean full;
 116 
 117 #ifdef HAVE_CHARSET
 118     gboolean utf8;
 119     // converter for translation of text
 120     GIConv converter;
 121 #endif
 122 
 123     struct
 124     {
 125         int quality;
 126         gboolean strip_trailing_cr;
 127         gboolean ignore_tab_expansion;
 128         gboolean ignore_space_change;
 129         gboolean ignore_all_space;
 130         gboolean ignore_case;
 131     } opt;
 132 
 133     // Search variables
 134     struct
 135     {
 136         mc_search_t *handle;
 137         gchar *last_string;
 138 
 139         ssize_t last_found_line;
 140         ssize_t last_accessed_num_line;
 141     } search;
 142 } WDiff;
 143 
 144 /*** global variables defined in .c file *********************************************************/
 145 
 146 /*** declarations of public functions ************************************************************/
 147 
 148 /* search.c */
 149 void dview_search_cmd (WDiff *dview);
 150 void dview_continue_search_cmd (WDiff *dview);
 151 
 152 #endif

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