fastmatch.h revision 256281
1/* $FreeBSD: stable/10/usr.bin/grep/regex/fastmatch.h 226035 2011-10-05 09:56:43Z gabor $ */ 2 3#ifndef FASTMATCH_H 4#define FASTMATCH_H 1 5 6#include <limits.h> 7#include <regex.h> 8#include <stdbool.h> 9#include <wchar.h> 10 11typedef struct { 12 size_t wlen; 13 size_t len; 14 wchar_t *wpattern; 15 bool *wescmap; 16 unsigned int qsBc[UCHAR_MAX + 1]; 17 unsigned int *bmGs; 18 char *pattern; 19 bool *escmap; 20 unsigned int defBc; 21 void *qsBc_table; 22 unsigned int *sbmGs; 23 const char *re_endp; 24 25 /* flags */ 26 bool hasdot; 27 bool bol; 28 bool eol; 29 bool word; 30 bool icase; 31 bool newline; 32 bool nosub; 33 bool matchall; 34 bool reversed; 35} fastmatch_t; 36 37extern int 38tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags); 39 40extern int 41tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags); 42 43extern int 44tre_fastexec(const fastmatch_t *preg, const char *string, size_t nmatch, 45 regmatch_t pmatch[], int eflags); 46 47extern void 48tre_fastfree(fastmatch_t *preg); 49 50extern int 51tre_fixwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags); 52 53extern int 54tre_fastwcomp(fastmatch_t *preg, const wchar_t *regex, int cflags); 55 56extern int 57tre_fastwexec(const fastmatch_t *preg, const wchar_t *string, 58 size_t nmatch, regmatch_t pmatch[], int eflags); 59 60/* Versions with a maximum length argument and therefore the capability to 61 handle null characters in the middle of the strings. */ 62extern int 63tre_fixncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags); 64 65extern int 66tre_fastncomp(fastmatch_t *preg, const char *regex, size_t len, int cflags); 67 68extern int 69tre_fastnexec(const fastmatch_t *preg, const char *string, size_t len, 70 size_t nmatch, regmatch_t pmatch[], int eflags); 71 72extern int 73tre_fixwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags); 74 75extern int 76tre_fastwncomp(fastmatch_t *preg, const wchar_t *regex, size_t len, int cflags); 77 78extern int 79tre_fastwnexec(const fastmatch_t *preg, const wchar_t *string, size_t len, 80 size_t nmatch, regmatch_t pmatch[], int eflags); 81 82#define fixncomp tre_fixncomp 83#define fastncomp tre_fastncomp 84#define fixcomp tre_fixcomp 85#define fastcomp tre_fastcomp 86#define fixwncomp tre_fixwncomp 87#define fastwncomp tre_fastwncomp 88#define fixwcomp tre_fixwcomp 89#define fastwcomp tre_fastwcomp 90#define fastfree tre_fastfree 91#define fastnexec tre_fastnexec 92#define fastexec tre_fastexec 93#define fastwnexec tre_fastwnexec 94#define fastwexec tre_fastwexec 95#define fixcomp tre_fixcomp 96#define fastcomp tre_fastcomp 97#define fastexec tre_fastexec 98#define fastfree tre_fastfree 99#define fixwcomp tre_fixwcomp 100#define fastwcomp tre_fastwcomp 101#define fastwexec tre_fastwexec 102#define fixncomp tre_fixncomp 103#define fastncomp tre_fastncomp 104#define fastnexec tre_fastnexec 105#define fixwncomp tre_fixwncomp 106#define fastwncomp tre_fastwncomp 107#define fastwnexec tre_fastwnexec 108#endif /* FASTMATCH_H */ 109