regis.h 935 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*-------------------------------------------------------------------------
  2. *
  3. * regis.h
  4. *
  5. * Declarations for fast regex subset, used by ISpell
  6. *
  7. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  8. *
  9. * src/include/tsearch/dicts/regis.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef __REGIS_H__
  14. #define __REGIS_H__
  15. typedef struct RegisNode
  16. {
  17. uint32
  18. type:2,
  19. len:16,
  20. unused:14;
  21. struct RegisNode *next;
  22. unsigned char data[FLEXIBLE_ARRAY_MEMBER];
  23. } RegisNode;
  24. #define RNHDRSZ (offsetof(RegisNode,data))
  25. #define RSF_ONEOF 1
  26. #define RSF_NONEOF 2
  27. typedef struct Regis
  28. {
  29. RegisNode *node;
  30. uint32
  31. issuffix:1,
  32. nchar:16,
  33. unused:15;
  34. } Regis;
  35. bool RS_isRegis(const char *str);
  36. void RS_compile(Regis *r, bool issuffix, const char *str);
  37. void RS_free(Regis *r);
  38. /*returns true if matches */
  39. bool RS_execute(Regis *r, char *str);
  40. #endif