1 #ifndef MC__SEARCH_INTERNAL_H
2 #define MC__SEARCH_INTERNAL_H
3
4
5
6 #ifdef SEARCH_TYPE_GLIB
7 #define mc_search_regex_t GRegex
8 #else
9 #ifdef HAVE_PCRE2
10 #define mc_search_regex_t pcre2_code
11 #else
12 #define mc_search_regex_t pcre
13 #endif
14 #endif
15
16
17
18 typedef enum
19 {
20 COND__NOT_FOUND,
21 COND__NOT_ALL_FOUND,
22 COND__FOUND_CHAR,
23 COND__FOUND_CHAR_LAST,
24 COND__FOUND_OK,
25 COND__FOUND_ERROR
26 } mc_search__found_cond_t;
27
28
29
30 typedef struct mc_search_cond_struct
31 {
32 GString *str;
33 GString *upper;
34 GString *lower;
35 mc_search_regex_t *regex_handle;
36 gchar *charset;
37 } mc_search_cond_t;
38
39
40
41
42
43
44
45 GString *mc_search__recode_str (const char *str, gsize str_len, const char *charset_from,
46 const char *charset_to);
47 GString *mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
48 gboolean * just_letters);
49 GString *mc_search__tolower_case_str (const char *charset, const GString * str);
50 GString *mc_search__toupper_case_str (const char *charset, const GString * str);
51
52
53
54 void mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_search,
55 mc_search_cond_t * mc_search_cond);
56 gboolean mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
57 gsize start_search, gsize end_search, gsize * found_len);
58 GString *mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
59
60
61
62 void mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * lc_mc_search,
63 mc_search_cond_t * mc_search_cond);
64 gboolean mc_search__run_normal (mc_search_t * lc_mc_search, const void *user_data,
65 gsize start_search, gsize end_search, gsize * found_len);
66 GString *mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
67
68
69
70 void mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * lc_mc_search,
71 mc_search_cond_t * mc_search_cond);
72 gboolean mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
73 gsize start_search, gsize end_search, gsize * found_len);
74 GString *mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
75
76
77
78 void mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,
79 mc_search_cond_t * mc_search_cond);
80 gboolean mc_search__run_hex (mc_search_t * lc_mc_search, const void *user_data,
81 gsize start_search, gsize end_search, gsize * found_len);
82 GString *mc_search_hex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
83
84
85
86 #endif