-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtyposcan.h
36 lines (32 loc) · 1.62 KB
/
typoscan.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <pcre.h>
/* Buffer manipulation macros. */
#define BUF_INIT(b) do { bufptr = b ## buf; } while (0)
#define BUF_ADD(b, c) do \
{ \
if (bufptr - b ## buf < sizeof (b ## buf) - 1) \
*(bufptr)++ = c; \
else \
{ \
fprintf (stdout, #b " overflow: %-*s", \
(int) sizeof (b ## buf) - 1, \
b ## buf); \
\
return - 1; \
} \
} \
while (0)
#define BUF_NUL(b) do { *(bufptr) = '\0'; } while (0)
/* Regular expressions. */
extern struct typo_regex
{
pcre *regex;
pcre_extra *extra;
const char *s;
} *regexes;
extern int regexalloccount, regexcount;
/* Options. */
extern int run_verbose;
/* Scanner functions. */
extern int dumpscanner_scan (void);
extern int typolist_scan_buffer (char *buf, size_t size);
extern int typolist_scan_file (FILE *f);