1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <math.h>
5 #include <ctype.h>
6 #include "re.h"
7 
8 #define CHAR	unsigned char
9 #define MAXPAT 128
10 #define MAXPATT 256
11 #define MAXDELIM 8            /* Max size of a delimiter pattern */
12 #define SHORTREG 15
13 #define MAXREG   30
14 #define MAXNAME  256
15 #define Max_Pats 12    /* max num of patterns */
16 #define Max_Keys 12    /* max num of keywords */
17 #define Max_Psize 128  /* max size of a pattern counting all the characters */
18 #define Max_Keyword 31 /* the max size of a keyword */
19 #define WORD 32        /* the size of a word */
20 #define MaxError 8     /* the max number of errors allowed */
21 #define MaxRerror 4    /* the max number of erros for regular expression */
22 #define MaxDelimit 16   /* the max raw length of a user defined delimiter */
23 #define BlockSize  49152
24 #define Max_record 49152
25 #define SIZE 16384       /* BlockSIze in sgrep */
26 #define MAXLINE   1024  /* maxline in sgrep */
27 #define Maxline   1024
28 #define RBLOCK    8192
29 #define RMAXLINE  1024
30 #define MaxNext   66000
31 #define ON 1
32 #define OFF 0
33 #define Compl 1
34 #define Maxresult 10000
35 #define MaxCan 2500
36 #define MAXSYM 256 /* ASCII */
37 #define WORDB     241    /* -w option */
38 #define LPARENT   242    /* ( */
39 #define RPARENT   243    /* ) */
40 #define LRANGE    244    /* [ */
41 #define RRANGE    245    /* ] */
42 #define LANGLE    246    /* < */
43 #define RANGLE    247    /* > */
44 #define NOTSYM    248    /* ^ */
45 #define WILDCD    249    /* wildcard */
46 #define ORSYM     250   /* | */
47 #define ORPAT     251   /* , */
48 #define ANDPAT    252   /* ; */
49 #define STAR      253   /* closure */
50 #define HYPHEN    237   /* - */
51 #define NOCARE    238   /* . */
52 #define NNLINE    239   /* special symbol for newline in begin of pattern*/
53                        /* matches '\n' and NNLINE */
54 
55 /* asearch.c */
56 void asearch(CHAR old_D_pat[], int text, register unsigned D);
57 
58 /* asearch1.c */
59 void asearch1(char old_D_pat[], int text, register unsigned D);
60 
61 /* bitap.c */
62 void bitap(char old_D_pat[], char *Pattern, int fd, int M, int D);
63 int fill_buf(int fd, unsigned char *buf, int record_size);
64 
65 /* checkfile.c */
66 int check_file(char *fname);
67 
68 /* compat.c */
69 void compat(void);
70 
71 /* main.c */
72 void output (register CHAR *buffer, int i1, int i2, int j);
73 void re1(int Text, int M, int D);
74 void re(int Text, int M, int D);
75 
76 /* maskgen.c */
77 int maskgen(unsigned char *Pattern, int D);
78 
79 /* mgrep.c */
80 void prepf(int fp);
81 void mgrep(int fp);
82 
83 /* preprocess.c */
84 void preprocess(CHAR *D_pattern, CHAR *Pattern);
85 
86 /* sgrep.c */
87 void sgrep(CHAR *pat, int m, int fd, int D);
88 
89