lex.h - bmf - bmf (Bayesian Mail Filter) 0.9.4 fork + patches
(HTM) git clone git://git.codemadness.org/bmf
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
lex.h (1156B)
---
1 /* $Id: lex.h,v 1.4 2002/10/12 17:36:41 tommy Exp $ */
2
3 /*
4 * Copyright (c) 2002 Tom Marshall <tommy@tig-grr.com>
5 *
6 * This program is free software. It may be distributed under the terms
7 * in the file LICENSE, found in the top level of the distribution.
8 */
9
10 #ifndef _TOK_H
11 #define _TOK_H
12
13 typedef enum { from, eof, word } toktype_t;
14
15 typedef struct _tok
16 {
17 toktype_t tt; /* token type */
18 char *p;
19 uint len;
20 } tok_t;
21
22 typedef enum { envelope, hdrs, body } msgsec_t;
23
24 typedef struct _lex
25 {
26 mbox_t mboxtype;
27 msgsec_t section; /* current section (envelope, headers, body) */
28 uint pos; /* current position */
29 uint bom; /* beginning of message */
30 uint eom; /* end of current message (start of next) */
31 uint lineend; /* line end (actually, start of next line) */
32 uint buflen; /* length of buffer */
33 char *pbuf;
34 } lex_t;
35
36 void lex_create ( lex_t* pthis, mbox_t mboxtype );
37 void lex_destroy ( lex_t* pthis );
38
39 bool_t lex_load ( lex_t* pthis, int fd );
40 void lex_nexttoken( lex_t* pthis, tok_t* ptok );
41
42 void lex_passthru ( lex_t* pthis, bool_t is_spam, double hits );
43
44 #endif /* ndef TOK_H */