Pattern-matching source code

Rich Salz rsalz at bbn.com
Sat Feb 16 03:18:47 AEST 1991


In <1991Feb14.143705.3911 at ux1.cso.uiuc.edu> gordon at osiris.cso.uiuc.edu (John Gordon) writes:
|/***********  MATCH.C  ************************  Listing 1  ***********
| * Author:    Allen I. Holub
| * Function:  A group of subroutines to find a substring represented
| *            by a grep-like regular expression in a second string.
|typedef enum action     /* These are put in the pattern string  */ {
|                        /* to represent metacharacters.         */
|    M_BOL    = ( 0x80 | '^' ),  M_EOL   = ( 0x80 | '$' ),
...
|}
|action;
|
|typedef unsigned char pattern;  /* pattern strings are unsigned char */

Note that this code assumes 7bit chars.  It won't work with extended alphabets,
or even on a PC where you could have graphics characters.
	/r$
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.lang.c mailing list