2009-04-25 12:09:47 +04:00
|
|
|
#ifndef MC__SEARCH_INTERNAL_H
|
|
|
|
#define MC__SEARCH_INTERNAL_H
|
|
|
|
|
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2009-07-07 12:11:29 +04:00
|
|
|
#ifdef SEARCH_TYPE_GLIB
|
2009-05-05 17:19:32 +04:00
|
|
|
#define mc_search_regex_t GRegex
|
|
|
|
#else
|
2023-03-22 21:50:11 +03:00
|
|
|
#ifdef HAVE_PCRE2
|
|
|
|
#define mc_search_regex_t pcre2_code
|
|
|
|
#else
|
2009-06-19 17:08:48 +04:00
|
|
|
#define mc_search_regex_t pcre
|
2009-05-05 17:19:32 +04:00
|
|
|
#endif
|
2023-03-22 21:50:11 +03:00
|
|
|
#endif
|
2009-05-05 17:19:32 +04:00
|
|
|
|
2009-04-25 12:09:47 +04:00
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
typedef enum
|
|
|
|
{
|
2009-04-25 12:09:47 +04:00
|
|
|
COND__NOT_FOUND,
|
|
|
|
COND__NOT_ALL_FOUND,
|
|
|
|
COND__FOUND_CHAR,
|
|
|
|
COND__FOUND_CHAR_LAST,
|
|
|
|
COND__FOUND_OK,
|
|
|
|
COND__FOUND_ERROR
|
|
|
|
} mc_search__found_cond_t;
|
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
typedef struct mc_search_cond_struct
|
|
|
|
{
|
2009-04-25 12:09:47 +04:00
|
|
|
GString *str;
|
|
|
|
GString *upper;
|
|
|
|
GString *lower;
|
2009-05-05 17:19:32 +04:00
|
|
|
mc_search_regex_t *regex_handle;
|
2009-04-25 12:09:47 +04:00
|
|
|
gchar *charset;
|
|
|
|
} mc_search_cond_t;
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** declarations of public functions ************************************************************/
|
2009-04-25 12:09:47 +04:00
|
|
|
|
|
|
|
/* search/lib.c : */
|
|
|
|
|
2022-09-18 17:04:53 +03:00
|
|
|
GString *mc_search__recode_str (const char *str, gsize str_len, const char *charset_from,
|
|
|
|
const char *charset_to);
|
|
|
|
GString *mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
|
|
|
|
gboolean * just_letters);
|
2022-09-24 09:26:03 +03:00
|
|
|
GString *mc_search__tolower_case_str (const char *charset, const GString * str);
|
|
|
|
GString *mc_search__toupper_case_str (const char *charset, const GString * str);
|
2009-04-25 12:09:47 +04:00
|
|
|
|
|
|
|
/* search/regex.c : */
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
void mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_search,
|
|
|
|
mc_search_cond_t * mc_search_cond);
|
|
|
|
gboolean mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
|
|
|
gsize start_search, gsize end_search, gsize * found_len);
|
|
|
|
GString *mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
|
2009-04-29 19:45:21 +04:00
|
|
|
|
2009-04-25 12:09:47 +04:00
|
|
|
/* search/normal.c : */
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
void mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * lc_mc_search,
|
|
|
|
mc_search_cond_t * mc_search_cond);
|
|
|
|
gboolean mc_search__run_normal (mc_search_t * lc_mc_search, const void *user_data,
|
|
|
|
gsize start_search, gsize end_search, gsize * found_len);
|
|
|
|
GString *mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
|
2009-06-08 14:54:35 +04:00
|
|
|
|
2009-04-30 17:06:24 +04:00
|
|
|
/* search/glob.c : */
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
void mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * lc_mc_search,
|
|
|
|
mc_search_cond_t * mc_search_cond);
|
|
|
|
gboolean mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
|
|
|
|
gsize start_search, gsize end_search, gsize * found_len);
|
|
|
|
GString *mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
|
2009-04-30 17:06:24 +04:00
|
|
|
|
2009-05-06 20:12:32 +04:00
|
|
|
/* search/hex.c : */
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
void mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,
|
|
|
|
mc_search_cond_t * mc_search_cond);
|
|
|
|
gboolean mc_search__run_hex (mc_search_t * lc_mc_search, const void *user_data,
|
|
|
|
gsize start_search, gsize end_search, gsize * found_len);
|
|
|
|
GString *mc_search_hex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
|
2009-05-06 20:12:32 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
2021-05-16 13:56:44 +03:00
|
|
|
#endif /* MC__SEARCH_INTERNAL_H */
|