#ifndef _REGEXP_H
#define _REGEXP_H

/*
 * Definitions etc. for regexp(3) routines.
 *
 * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
 * not the System V one.
 */

// Convert from data being char* to data being in a struct...

typedef int CHAR;
CHAR STRING[1024]; // global!!!

typedef int CHARINDEX;

#define NSUBEXP  10
typedef struct regexp {
        CHARINDEX startp[NSUBEXP];
        CHARINDEX endp[NSUBEXP];
        unsigned char regstart;          /* Internal use only. */
        unsigned char reganch;           /* Internal use only. */
        unsigned char *regmust;          /* Internal use only. */
        int regmlen;            /* Internal use only. */
        unsigned char program[1];        /* Unwarranted chumminess with compiler. */
} regexp;


/*
 * The first byte of the regexp internal "program" is actually this magic
 * number; the start node begins in the second byte.
 */
#define MAGIC   (unsigned char)0234

/* Headers for regexp.c */
extern regexp *regcomp(char *exp);
extern int regexec(regexp *prog, CHARINDEX string);
extern int regsub(regexp *prog, char *source, char *dest);
extern void regerror(char *s);
/* End of headers for regexp.c */

#ifdef DEBUG
extern void regdump(regexp *r);
#endif

#endif /* _REGEXP_H */
