regexp.h 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef regexp_h
  2. #define regexp_h
  3. #define regcompx js_regcompx
  4. #define regfreex js_regfreex
  5. #define regcomp js_regcomp
  6. #define regexec js_regexec
  7. #define regfree js_regfree
  8. typedef struct Reprog Reprog;
  9. typedef struct Resub Resub;
  10. Reprog *regcompx(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
  11. const char *pattern, int cflags, const char **errorp);
  12. void regfreex(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
  13. Reprog *prog);
  14. Reprog *regcomp(const char *pattern, int cflags, const char **errorp);
  15. int regexec(Reprog *prog, const char *string, Resub *sub, int eflags);
  16. void regfree(Reprog *prog);
  17. enum {
  18. /* regcomp flags */
  19. REG_ICASE = 1,
  20. REG_NEWLINE = 2,
  21. /* regexec flags */
  22. REG_NOTBOL = 4,
  23. };
  24. /* If you redefine REG_MAXSUB, you must make sure both the calling
  25. * code and the regexp.c compilation unit use the same value!
  26. */
  27. #ifndef REG_MAXSUB
  28. #define REG_MAXSUB 16
  29. #endif
  30. struct Resub {
  31. int nsub;
  32. struct {
  33. const char *sp;
  34. const char *ep;
  35. } sub[REG_MAXSUB];
  36. };
  37. #endif