internal.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef MC__SEARCH_INTERNAL_H
  2. #define MC__SEARCH_INTERNAL_H
  3. /*** typedefs(not structures) and defined constants **********************************************/
  4. #ifdef SEARCH_TYPE_GLIB
  5. #define mc_search_regex_t GRegex
  6. #else
  7. #ifdef HAVE_PCRE2
  8. #define mc_search_regex_t pcre2_code
  9. #else
  10. #define mc_search_regex_t pcre
  11. #endif
  12. #endif
  13. /*** enums ***************************************************************************************/
  14. typedef enum
  15. {
  16. COND__NOT_FOUND,
  17. COND__NOT_ALL_FOUND,
  18. COND__FOUND_CHAR,
  19. COND__FOUND_CHAR_LAST,
  20. COND__FOUND_OK,
  21. COND__FOUND_ERROR
  22. } mc_search__found_cond_t;
  23. /*** structures declarations (and typedefs of structures)*****************************************/
  24. typedef struct mc_search_cond_struct
  25. {
  26. GString *str;
  27. GString *upper;
  28. GString *lower;
  29. mc_search_regex_t *regex_handle;
  30. gchar *charset;
  31. } mc_search_cond_t;
  32. /*** global variables defined in .c file *********************************************************/
  33. /*** declarations of public functions ************************************************************/
  34. /* search/lib.c : */
  35. GString *mc_search__recode_str (const char *str, gsize str_len, const char *charset_from,
  36. const char *charset_to);
  37. GString *mc_search__get_one_symbol (const char *charset, const char *str, gsize str_len,
  38. gboolean * just_letters);
  39. GString *mc_search__tolower_case_str (const char *charset, const GString * str);
  40. GString *mc_search__toupper_case_str (const char *charset, const GString * str);
  41. /* search/regex.c : */
  42. void mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_search,
  43. mc_search_cond_t * mc_search_cond);
  44. gboolean mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
  45. gsize start_search, gsize end_search, gsize * found_len);
  46. GString *mc_search_regex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
  47. /* search/normal.c : */
  48. void mc_search__cond_struct_new_init_normal (const char *charset, mc_search_t * lc_mc_search,
  49. mc_search_cond_t * mc_search_cond);
  50. gboolean mc_search__run_normal (mc_search_t * lc_mc_search, const void *user_data,
  51. gsize start_search, gsize end_search, gsize * found_len);
  52. GString *mc_search_normal_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
  53. /* search/glob.c : */
  54. void mc_search__cond_struct_new_init_glob (const char *charset, mc_search_t * lc_mc_search,
  55. mc_search_cond_t * mc_search_cond);
  56. gboolean mc_search__run_glob (mc_search_t * lc_mc_search, const void *user_data,
  57. gsize start_search, gsize end_search, gsize * found_len);
  58. GString *mc_search_glob_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
  59. /* search/hex.c : */
  60. void mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,
  61. mc_search_cond_t * mc_search_cond);
  62. gboolean mc_search__run_hex (mc_search_t * lc_mc_search, const void *user_data,
  63. gsize start_search, gsize end_search, gsize * found_len);
  64. GString *mc_search_hex_prepare_replace_str (mc_search_t * lc_mc_search, GString * replace_str);
  65. /*** inline functions ****************************************************************************/
  66. #endif /* MC__SEARCH_INTERNAL_H */