Ticket #2277 (mcdiff cleanup)
[midnight-commander.git] / src / diffviewer / internal.h
blobc77f25f427b362a764fbf6122fe46d0a9af24d2d
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"
9 #include "src/widget.h"
11 /*** typedefs(not structures) and defined constants **********************************************/
13 typedef int (*DFUNC) (void *ctx, int ch, int line, off_t off, size_t sz, const char *str);
14 typedef int PAIR[2];
16 #define error_dialog(h, s) query_dialog(h, s, D_ERROR, 1, _("&Dismiss"))
18 /*** enums ***************************************************************************************/
20 typedef enum
22 DATA_SRC_MEM = 0,
23 DATA_SRC_TMP = 1,
24 DATA_SRC_ORG = 2
25 } DSRC;
27 typedef enum
29 DIFF_NONE = 0,
30 DIFF_ADD = 1,
31 DIFF_DEL = 2,
32 DIFF_CHG = 3
33 } DiffState;
35 /*** structures declarations (and typedefs of structures)*****************************************/
37 typedef struct
39 int fd;
40 int pos;
41 int len;
42 char *buf;
43 int flags;
44 void *data;
45 } FBUF;
47 typedef struct
49 int a[2][2];
50 int cmd;
51 } DIFFCMD;
54 typedef struct
56 int off;
57 int len;
58 } BRACKET[2];
60 typedef struct
62 int ch;
63 int line;
64 union
66 off_t off;
67 size_t len;
68 } u;
69 void *p;
70 } DIFFLN;
72 typedef struct
74 FBUF *f;
75 GArray *a;
76 DSRC dsrc;
77 } PRINTER_CTX;
79 typedef struct WDiff
81 Widget widget;
83 const char *args; /* Args passed to diff */
84 const char *file[2]; /* filenames */
85 char *label[2];
86 FBUF *f[2];
87 const char *backup_sufix;
88 gboolean merged;
89 GArray *a[2];
90 GPtrArray *hdiff;
91 int ndiff; /* number of hunks */
92 DSRC dsrc; /* data source: memory or temporary file */
94 int view_quit:1; /* Quit flag */
96 int height;
97 int half1;
98 int half2;
99 int width1;
100 int width2;
101 int bias;
102 int new_frame;
103 int skip_rows;
104 int skip_cols;
105 int display_symbols;
106 int display_numbers;
107 int show_cr;
108 int tab_size;
109 int ord;
110 int full;
111 gboolean utf8;
112 /* converter for translation of text */
113 GIConv converter;
114 struct
116 int quality;
117 gboolean strip_trailing_cr;
118 gboolean ignore_tab_expansion;
119 gboolean ignore_space_change;
120 gboolean ignore_all_space;
121 gboolean ignore_case;
122 } opt;
124 /* Search variables */
125 struct
127 mc_search_t *handle;
128 gchar *last_string;
130 ssize_t last_found_line;
131 ssize_t last_accessed_num_line;
132 } search;
134 } WDiff;
136 /*** global variables defined in .c file *********************************************************/
138 /*** declarations of public functions ************************************************************/
140 /* search.c */
141 void dview_search_cmd (WDiff * dview);
142 void dview_continue_search_cmd (WDiff * dview);
144 /* ydiff.c */
145 void dview_update (WDiff * dview);
147 #endif /* MC__DIFFVIEW_INTERNAL_H */