Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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