internal.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #define mc_search_regex_t pcre
  8. #endif
  9. /*** enums ***************************************************************************************/
  10. typedef enum {
  11. COND__NOT_FOUND,
  12. COND__NOT_ALL_FOUND,
  13. COND__FOUND_CHAR,
  14. COND__FOUND_CHAR_LAST,
  15. COND__FOUND_OK,
  16. COND__FOUND_ERROR
  17. } mc_search__found_cond_t;
  18. /*** structures declarations (and typedefs of structures)*****************************************/
  19. typedef struct mc_search_cond_struct {
  20. GString *str;
  21. GString *upper;
  22. GString *lower;
  23. mc_search_regex_t *regex_handle;
  24. gsize len;
  25. gchar *charset;
  26. } mc_search_cond_t;
  27. /*** global variables defined in .c file *********************************************************/
  28. extern const char * STR_E_NOTFOUND;
  29. extern const char * STR_E_UNKNOWN_TYPE;
  30. extern const char * STR_E_RPL_NOT_EQ_TO_FOUND;
  31. extern const char * STR_E_RPL_INVALID_TOKEN;
  32. /*** declarations of public functions ************************************************************/
  33. /* search/lib.c : */
  34. gchar *mc_search__recode_str (const char *, gsize, const char *, const char *, gsize *);
  35. gchar *mc_search__get_one_symbol (const char *, const char *, gsize, gboolean *);
  36. int mc_search__get_char (mc_search_t *, const void *, gsize);
  37. GString *mc_search__tolower_case_str (const char *, const char *, gsize);
  38. GString *mc_search__toupper_case_str (const char *, const char *, gsize);
  39. /* search/regex.c : */
  40. void mc_search__cond_struct_new_init_regex (const char *, mc_search_t *, mc_search_cond_t *);
  41. gboolean mc_search__run_regex (mc_search_t *, const void *, gsize, gsize, gsize *);
  42. GString *mc_search_regex_prepare_replace_str (mc_search_t *, GString *);
  43. /* search/normal.c : */
  44. void mc_search__cond_struct_new_init_normal (const char *, mc_search_t *, mc_search_cond_t *);
  45. gboolean mc_search__run_normal (mc_search_t *, const void *, gsize, gsize, gsize *);
  46. GString *mc_search_normal_prepare_replace_str (mc_search_t *, GString *);
  47. /* search/glob.c : */
  48. void mc_search__cond_struct_new_init_glob (const char *, mc_search_t *, mc_search_cond_t *);
  49. gboolean mc_search__run_glob (mc_search_t *, const void *, gsize, gsize, gsize *);
  50. GString *mc_search_glob_prepare_replace_str (mc_search_t *, GString *);
  51. /* search/hex.c : */
  52. void mc_search__cond_struct_new_init_hex (const char *, mc_search_t *, mc_search_cond_t *);
  53. gboolean mc_search__run_hex (mc_search_t *, const void *, gsize, gsize, gsize *);
  54. GString *mc_search_hex_prepare_replace_str (mc_search_t *, GString *);
  55. #endif