X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/f1d92a2564f181cebcabbd0f8c04fe8966bc17ff..HEAD:/src/tcl/regexp.c?ds=sidebyside diff --git a/src/tcl/regexp.c b/src/tcl/regexp.c index d5b248c..d28800d 100644 --- a/src/tcl/regexp.c +++ b/src/tcl/regexp.c @@ -165,16 +165,16 @@ static long regsize; /* Code size. */ #ifndef STATIC #define STATIC static #endif -STATIC char *reg(); -STATIC char *regbranch(); -STATIC char *regpiece(); -STATIC char *regatom(); -STATIC char *regnode(); -STATIC char *regnext(); -STATIC void regc(); -STATIC void reginsert(); -STATIC void regtail(); -STATIC void regoptail(); +STATIC char *reg(int paren, int *flagp); +STATIC char *regbranch(int *flagp); +STATIC char *regpiece(int *flagp); +STATIC char *regatom(int *flagp); +STATIC char *regnode(int op); +STATIC char *regnext(register char *p); +STATIC void regc(int b); +STATIC void reginsert(int op, char *opnd); +STATIC void regtail(char *p, char *val); +STATIC void regoptail(char *p, char *val); #ifdef STRCSPN STATIC int strcspn(); #endif @@ -195,8 +195,7 @@ STATIC int strcspn(); * of the structure of the compiled regexp. */ regexp * -regcomp(exp) -char *exp; +regcomp (char *exp) { register regexp *r; register char *scan; @@ -282,9 +281,10 @@ char *exp; * follows makes it hard to avoid. */ static char * -reg(paren, flagp) -int paren; /* Parenthesized? */ -int *flagp; +reg ( + int paren, /* Parenthesized? */ + int *flagp +) { register char *ret; register char *br; @@ -354,8 +354,7 @@ int *flagp; * Implements the concatenation operator. */ static char * -regbranch(flagp) -int *flagp; +regbranch (int *flagp) { register char *ret; register char *chain; @@ -393,8 +392,7 @@ int *flagp; * endmarker role is not redundant. */ static char * -regpiece(flagp) -int *flagp; +regpiece (int *flagp) { register char *ret; register char op; @@ -457,8 +455,7 @@ int *flagp; * separate node; the code is simpler that way and it's not worth fixing. */ static char * -regatom(flagp) -int *flagp; +regatom (int *flagp) { register char *ret; int flags; @@ -567,9 +564,8 @@ int *flagp; /* - regnode - emit a node */ -static char * /* Location. */ -regnode(op) -char op; +static char * +regnode (int op) { register char *ret; register char *ptr; @@ -592,9 +588,8 @@ char op; /* - regc - emit (if appropriate) a byte of code */ -static void -regc(b) -char b; +static void +regc (int b) { if (regcode != ®dummy) *regcode++ = b; @@ -607,10 +602,8 @@ char b; * * Means relocating the operand. */ -static void -reginsert(op, opnd) -char op; -char *opnd; +static void +reginsert (int op, char *opnd) { register char *src; register char *dst; @@ -636,10 +629,8 @@ char *opnd; /* - regtail - set the next-pointer at the end of a node chain */ -static void -regtail(p, val) -char *p; -char *val; +static void +regtail (char *p, char *val) { register char *scan; register char *temp; @@ -668,10 +659,8 @@ char *val; /* - regoptail - regtail on operand of first argument; nop if operandless */ -static void -regoptail(p, val) -char *p; -char *val; +static void +regoptail (char *p, char *val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) @@ -694,9 +683,9 @@ static char **regendp; /* Ditto for endp. */ /* * Forwards. */ -STATIC int regtry(); -STATIC int regmatch(); -STATIC int regrepeat(); +STATIC int regtry(regexp *prog, char *string); +STATIC int regmatch(char *prog); +STATIC int regrepeat(char *p); #ifdef DEBUG int regnarrate = 0; @@ -707,10 +696,8 @@ STATIC char *regprop(); /* - regexec - match a regexp against a string */ -int -regexec(prog, string) -register regexp *prog; -register char *string; +int +regexec (register regexp *prog, register char *string) { register char *s; #ifndef IS_LINUX @@ -772,9 +759,7 @@ register char *string; - regtry - try match at specific point */ static int /* 0 failure, 1 success */ -regtry(prog, string) -regexp *prog; -char *string; +regtry(regexp *prog, char *string) { register int i; register char **sp; @@ -809,8 +794,7 @@ char *string; * by recursion. */ static int /* 0 failure, 1 success */ -regmatch(prog) -char *prog; +regmatch(char *prog) { register char *scan; /* Current node. */ char *next; /* Next node. */ @@ -1005,8 +989,7 @@ char *prog; - regrepeat - repeatedly match something simple, report how many */ static int -regrepeat(p) -char *p; +regrepeat(char *p) { register int count = 0; register char *scan; @@ -1051,8 +1034,7 @@ char *p; - regnext - dig the "next" pointer out of a node */ static char * -regnext(p) -register char *p; +regnext (register char *p) { register int offset; @@ -1076,9 +1058,8 @@ STATIC char *regprop(); /* - regdump - dump a regexp onto stdout in vaguely comprehensible form */ -void -regdump(r) -regexp *r; +void +regdump (regexp *r) { register char *s; register char op = EXACTLY; /* Arbitrary non-END op. */ @@ -1121,8 +1102,7 @@ regexp *r; - regprop - printable representation of opcode */ static char * -regprop(op) -char *op; +regprop (char *op) { register char *p; static char buf[50]; @@ -1212,10 +1192,8 @@ char *op; * of characters not from s2 */ -static int -strcspn(s1, s2) -char *s1; -char *s2; +static int +strcspn (char *s1, char *s2) { register char *scan1; register char *scan2;