internal.h 2.9 KB

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