internal.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. 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. /*** inline functions ****************************************************************************/
  56. #endif