Blame


1 b2cfc4e2 2003-09-30 devnull #ifndef _REGEXP9H_
2 b2cfc4e2 2003-09-30 devnull
3 b2cfc4e2 2003-09-30 devnull #define _REGEXP9H_ 1
4 b2cfc4e2 2003-09-30 devnull #include <utf.h>
5 b2cfc4e2 2003-09-30 devnull
6 b2cfc4e2 2003-09-30 devnull typedef struct Resub Resub;
7 b2cfc4e2 2003-09-30 devnull typedef struct Reclass Reclass;
8 b2cfc4e2 2003-09-30 devnull typedef struct Reinst Reinst;
9 b2cfc4e2 2003-09-30 devnull typedef struct Reprog Reprog;
10 b2cfc4e2 2003-09-30 devnull
11 b2cfc4e2 2003-09-30 devnull /*
12 b2cfc4e2 2003-09-30 devnull * Sub expression matches
13 b2cfc4e2 2003-09-30 devnull */
14 b2cfc4e2 2003-09-30 devnull struct Resub{
15 b2cfc4e2 2003-09-30 devnull union
16 b2cfc4e2 2003-09-30 devnull {
17 b2cfc4e2 2003-09-30 devnull char *sp;
18 b2cfc4e2 2003-09-30 devnull Rune *rsp;
19 b2cfc4e2 2003-09-30 devnull }s;
20 b2cfc4e2 2003-09-30 devnull union
21 b2cfc4e2 2003-09-30 devnull {
22 b2cfc4e2 2003-09-30 devnull char *ep;
23 b2cfc4e2 2003-09-30 devnull Rune *rep;
24 b2cfc4e2 2003-09-30 devnull }e;
25 b2cfc4e2 2003-09-30 devnull };
26 b2cfc4e2 2003-09-30 devnull
27 b2cfc4e2 2003-09-30 devnull /*
28 b2cfc4e2 2003-09-30 devnull * character class, each pair of rune's defines a range
29 b2cfc4e2 2003-09-30 devnull */
30 b2cfc4e2 2003-09-30 devnull struct Reclass{
31 b2cfc4e2 2003-09-30 devnull Rune *end;
32 b2cfc4e2 2003-09-30 devnull Rune spans[64];
33 b2cfc4e2 2003-09-30 devnull };
34 b2cfc4e2 2003-09-30 devnull
35 b2cfc4e2 2003-09-30 devnull /*
36 b2cfc4e2 2003-09-30 devnull * Machine instructions
37 b2cfc4e2 2003-09-30 devnull */
38 b2cfc4e2 2003-09-30 devnull struct Reinst{
39 b2cfc4e2 2003-09-30 devnull int type;
40 b2cfc4e2 2003-09-30 devnull union {
41 b2cfc4e2 2003-09-30 devnull Reclass *cp; /* class pointer */
42 b2cfc4e2 2003-09-30 devnull Rune r; /* character */
43 b2cfc4e2 2003-09-30 devnull int subid; /* sub-expression id for RBRA and LBRA */
44 b2cfc4e2 2003-09-30 devnull Reinst *right; /* right child of OR */
45 b2cfc4e2 2003-09-30 devnull }u1;
46 b2cfc4e2 2003-09-30 devnull union { /* regexp relies on these two being in the same union */
47 b2cfc4e2 2003-09-30 devnull Reinst *left; /* left child of OR */
48 b2cfc4e2 2003-09-30 devnull Reinst *next; /* next instruction for CAT & LBRA */
49 b2cfc4e2 2003-09-30 devnull }u2;
50 b2cfc4e2 2003-09-30 devnull };
51 b2cfc4e2 2003-09-30 devnull
52 b2cfc4e2 2003-09-30 devnull /*
53 b2cfc4e2 2003-09-30 devnull * Reprogram definition
54 b2cfc4e2 2003-09-30 devnull */
55 b2cfc4e2 2003-09-30 devnull struct Reprog{
56 b2cfc4e2 2003-09-30 devnull Reinst *startinst; /* start pc */
57 b2cfc4e2 2003-09-30 devnull Reclass class[16]; /* .data */
58 b2cfc4e2 2003-09-30 devnull Reinst firstinst[5]; /* .text */
59 b2cfc4e2 2003-09-30 devnull };
60 b2cfc4e2 2003-09-30 devnull
61 b2cfc4e2 2003-09-30 devnull extern Reprog *regcomp(char*);
62 b2cfc4e2 2003-09-30 devnull extern Reprog *regcomplit(char*);
63 b2cfc4e2 2003-09-30 devnull extern Reprog *regcompnl(char*);
64 b2cfc4e2 2003-09-30 devnull extern void regerror(char*);
65 b2cfc4e2 2003-09-30 devnull extern int regexec(Reprog*, char*, Resub*, int);
66 b2cfc4e2 2003-09-30 devnull extern void regsub(char*, char*, int, Resub*, int);
67 b2cfc4e2 2003-09-30 devnull
68 b2cfc4e2 2003-09-30 devnull extern int rregexec(Reprog*, Rune*, Resub*, int);
69 b2cfc4e2 2003-09-30 devnull extern void rregsub(Rune*, Rune*, Resub*, int);
70 b2cfc4e2 2003-09-30 devnull
71 b2cfc4e2 2003-09-30 devnull #endif