pcreposix.inc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {*************************************************
  2. * Perl-Compatible Regular Expressions *
  3. *************************************************}
  4. { Copyright (c) 1997-2000 University of Cambridge }
  5. {
  6. * @file include/pcreposix.h
  7. * @brief PCRE definitions
  8. }
  9. { This is the header for the POSIX wrapper interface to the PCRE Perl-
  10. Compatible Regular Expression library. It defines the things POSIX says should
  11. be there. I hope. }
  12. { Have to include stdlib.h in order to ensure that size_t is defined. }
  13. { Options defined by POSIX. }
  14. const
  15. { Ignore case }
  16. REG_ICASE = $01;
  17. { Don't match newlines with wildcards }
  18. REG_NEWLINE = $02;
  19. { Don't match BOL }
  20. REG_NOTBOL = $04;
  21. { Don't match EOL }
  22. REG_NOTEOL = $08;
  23. { These are not used by PCRE, but by defining them we make it easier
  24. to slot PCRE into existing programs that make POSIX calls. }
  25. { UNUSED! }
  26. REG_EXTENDED = 0;
  27. { UNUSED! }
  28. REG_NOSUB = 0;
  29. { Error values. Not all these are relevant or used by the wrapper. }
  30. type
  31. pc_error = (
  32. REG_ASSERT = 1, { internal error ? }
  33. REG_BADBR, { invalid repeat counts in } {}
  34. REG_BADPAT, { pattern error }
  35. REG_BADRPT, { ? * + invalid }
  36. REG_EBRACE, { unbalanced } {}
  37. REG_EBRACK, { unbalanced [] }
  38. REG_ECOLLATE, { collation error - not relevant }
  39. REG_ECTYPE, { bad class }
  40. REG_EESCAPE, { bad escape sequence }
  41. REG_EMPTY, { empty expression }
  42. REG_EPAREN, { unbalanced () }
  43. REG_ERANGE, { bad range inside [] }
  44. REG_ESIZE, { expression too big }
  45. REG_ESPACE, { failed to get memory }
  46. REG_ESUBREG, { bad back reference }
  47. REG_INVARG, { bad argument }
  48. REG_NOMATCH { match failed }
  49. );
  50. { The structure representing a compiled regular expression. }
  51. regex_t = record
  52. re_pcre: Pointer;
  53. re_nsub, re_erroffset: size_t;
  54. end;
  55. Pregex_t = ^regex_t;
  56. { The structure in which a captured offset is returned. }
  57. regoff_t = Integer;
  58. regmatch_t = record
  59. rm_so, rm_eo: regoff_t;
  60. end;
  61. { The functions }
  62. {extern int regcomp(regex_t *, const char *, int);
  63. extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
  64. extern size_t regerror(int, const regex_t *, char *, size_t);
  65. extern void regfree(regex_t *);}