Merge branch '4535_tmpdir_name'
[midnight-commander.git] / src / diffviewer / internal.h
blobad6fcb2d67f0462e100c7cd316892650ebce3458
1 #ifndef MC__DIFFVIEW_INTERNAL_H
2 #define MC__DIFFVIEW_INTERNAL_H
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"
10 /*** typedefs(not structures) and defined constants **********************************************/
12 typedef int (*DFUNC) (void *ctx, int ch, int line, off_t off, size_t sz, const char *str);
13 typedef int PAIR[2];
15 #define error_dialog(h, s) query_dialog(h, s, D_ERROR, 1, _("&Dismiss"))
17 /*** enums ***************************************************************************************/
19 typedef enum
21 DATA_SRC_MEM = 0,
22 DATA_SRC_TMP = 1,
23 DATA_SRC_ORG = 2
24 } DSRC;
26 typedef enum
28 DIFF_LEFT = 0,
29 DIFF_RIGHT = 1,
30 DIFF_COUNT = 2
31 } diff_place_t;
33 typedef enum
35 DIFF_NONE = 0,
36 DIFF_ADD = 1,
37 DIFF_DEL = 2,
38 DIFF_CHG = 3
39 } DiffState;
41 /*** structures declarations (and typedefs of structures)*****************************************/
43 typedef struct
45 int fd;
46 int pos;
47 int len;
48 char *buf;
49 int flags;
50 void *data;
51 } FBUF;
53 typedef struct
55 int a[2][2];
56 int cmd;
57 } DIFFCMD;
60 typedef struct
62 int off;
63 int len;
64 } BRACKET[DIFF_COUNT];
66 typedef struct
68 int ch;
69 int line;
70 union
72 off_t off;
73 size_t len;
74 } u;
75 void *p;
76 } DIFFLN;
78 typedef struct
80 FBUF *f;
81 GArray *a;
82 DSRC dsrc;
83 } PRINTER_CTX;
85 typedef struct WDiff
87 Widget widget;
89 const char *args; /* Args passed to diff */
90 const char *file[DIFF_COUNT]; /* filenames */
91 char *label[DIFF_COUNT];
92 FBUF *f[DIFF_COUNT];
93 const char *backup_sufix;
94 gboolean merged[DIFF_COUNT];
95 GArray *a[DIFF_COUNT];
96 GPtrArray *hdiff;
97 int ndiff; /* number of hunks */
98 DSRC dsrc; /* data source: memory or temporary file */
100 gboolean view_quit; /* Quit flag */
102 int height;
103 int half1;
104 int half2;
105 int width1;
106 int width2;
107 int bias;
108 gboolean new_frame;
109 int skip_rows;
110 int skip_cols;
111 gboolean display_symbols;
112 int display_numbers;
113 gboolean show_cr;
114 int tab_size;
115 diff_place_t ord;
116 gboolean full;
118 #ifdef HAVE_CHARSET
119 gboolean utf8;
120 /* converter for translation of text */
121 GIConv converter;
122 #endif /* HAVE_CHARSET */
124 struct
126 int quality;
127 gboolean strip_trailing_cr;
128 gboolean ignore_tab_expansion;
129 gboolean ignore_space_change;
130 gboolean ignore_all_space;
131 gboolean ignore_case;
132 } opt;
134 /* Search variables */
135 struct
137 mc_search_t *handle;
138 gchar *last_string;
140 ssize_t last_found_line;
141 ssize_t last_accessed_num_line;
142 } search;
143 } WDiff;
145 /*** global variables defined in .c file *********************************************************/
147 /*** declarations of public functions ************************************************************/
149 /* search.c */
150 void dview_search_cmd (WDiff * dview);
151 void dview_continue_search_cmd (WDiff * dview);
153 #endif /* MC__DIFFVIEW_INTERNAL_H */