internal.h 2.7 KB

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