pike.git / src / modules / Regexp / pike_regexp.c

version» Context lines:

pike.git/src/modules/Regexp/pike_regexp.c:206:   #define HASWIDTH 01 /* Known never to match null string. */   #define SIMPLE 02 /* Simple enough to be STAR or KPLUS operand. */   #define SPSTART 04 /* Starts with * */   #define WORST 0 /* Worst case. */      /*    * Global work variables for regcomp().    */   static short *regparse; /* Input-scan pointer. */   static int regnpar; /* () count. */ - static char regdummy; +    static char *regcode; /* Code-emit pointer; &regdummy = don't. */   static long regsize; /* Code size. */ -  + static char regdummy;      /*    * Forward declarations for regcomp()'s friends.    */   #ifndef STATIC   #define STATIC static   #endif   STATIC char *reg(int, int *);   STATIC char *regbranch(int *);   STATIC char *regpiece(int *);
pike.git/src/modules/Regexp/pike_regexp.c:828:    return (1);    } while (*s++ != '\0');       /* Failure. */    return (0);   }      /*    - regtry - try match at specific point    */ - #ifdef __STDC__ -  +    static int regtry(regexp *prog, char *string) -  - #else -  - static int regtry(prog, string) - regexp *prog; - char *string; -  - #endif +    {    register int i;    register char **sp;    register char **ep;       reginput = string;    regstartp = prog->startp;    regendp = prog->endp;       sp = prog->startp;
pike.git/src/modules/Regexp/pike_regexp.c:872:   /*    - regmatch - main matching routine    *    * Conceptually the strategy is simple: check to see whether the current    * node matches, call self recursively to see whether the rest matches,    * and then act accordingly. In practice we make some effort to avoid    * recursion, in particular by going through "ordinary" nodes (that don't    * need to know whether the rest of the match failed) by a loop instead of    * by recursion.    */ - #ifdef __STDC__ -  +    static int regmatch(char *prog) -  - #else -  - static int regmatch(prog) - char *prog; -  - #endif +    {    register char *scan; /* Current node. */    char *nxt; /* nxt node. */       check_c_stack (4 * sizeof (void *));       scan = prog;   #ifdef PIKE_DEBUG    if (scan != NULL && regnarrate)    fprintf(stderr, "%s(\n", regprop(scan));
pike.git/src/modules/Regexp/pike_regexp.c:1070:    * We get here only if there's trouble -- normally "case END" is the    * terminating point.    */    regerror("corrupted pointers");    return (0);   }      /*    - regrepeat - repeatedly match something simple, report how many    */ - #ifdef __STDC__ -  +    static ptrdiff_t regrepeat(char *p) -  - #else -  - static ptrdiff_t regrepeat(p) - char *p; -  - #endif +    {    register ptrdiff_t count = 0;    register char *scan;    register char *opnd;       scan = reginput;    opnd = OPERAND(p);    switch (OP(p)) {    case ANY:    count = strlen(scan);
pike.git/src/modules/Regexp/pike_regexp.c:1124:    }    reginput = scan;       return (count);   }         /*    - regnext - dig the "nxt" pointer out of a node    */ - #ifdef __STDC__ -  +    static char *regnext(register char *p) -  - #else -  - static char *regnext(p) - register char *p; -  - #endif +    {    register int offset;       if (p == &regdummy)    return (NULL);       offset = NEXT(p);    if (offset == 0)    return (NULL);   
pike.git/src/modules/Regexp/pike_regexp.c:1157:    return (p + offset);   }      #ifdef PIKE_DEBUG      STATIC char *regprop(char *);      /*    - regdump - dump a regexp onto stdout in vaguely comprehensible form    */ - #ifdef __STDC__ -  +    void regdump(regexp *r) -  - #else -  - void regdump(r) - regexp *r; -  - #endif +    {    register char *s;    register char op = EXACTLY; /* Arbitrary non-END op. */    register char *nxt;       s = r->program;    while (op != END) { /* While that wasn't END last time... */    op = OP(s);    printf("%2ld%s", /* Where, what. */    DO_NOT_WARN((long)(s - r->program)),
pike.git/src/modules/Regexp/pike_regexp.c:1209:    if (r->reganch)    printf("anchored ");    if (r->regmust != NULL)    printf("must have \"%s\"", r->regmust);    printf("\n");   }      /*    - regprop - printable representation of opcode    */ - #ifdef __STDC__ -  +    static char *regprop(char *op) -  - #else -  - static char *regprop(op) - char *op; -  - #endif +    {    register char *p;    static char buf[50];       strcpy(buf, ":");       switch (OP(op)) {    case BOL:    p = "BOL";    break;