Introduction
Introduction Statistics Contact Development Disclaimer Help
dbh.h - bmf - bmf (Bayesian Mail Filter) 0.9.4 fork + patches
git clone git://git.codemadness.org/bmf
Log
Files
Refs
README
LICENSE
---
dbh.h (2129B)
---
1 /* $Id: dbh.h,v 1.3 2002/10/02 04:45:40 tommy Exp $ */
2
3 /*
4 * Copyright (c) 2002 Tom Marshall <[email protected]>
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 _DBH_H
11 #define _DBH_H
12
13 #define BOGOFILTER_HEADER "# bogofilter wordlist (format version A): %u\…
14 #define TEXTDB_MAXLINELEN (MAXWORDLEN+32)
15
16 /* record/field structure */
17 typedef struct _rec {
18 str_t w;
19 uint n;
20 } rec_t;
21
22 /* database table */
23 typedef struct _dbt dbt_t;
24 struct _dbt {
25 bool_t(*close) (dbt_t *);
26 bool_t(*mergeclose) (dbt_t *, vec_t *);
27 bool_t(*unmergeclose) (dbt_t *, vec_t *);
28 uint(*getmsgcount) (dbt_t *);
29 uint(*getcount) (dbt_t *, str_t *);
30 };
31
32 typedef struct _dbttext dbttext_t;
33 struct _dbttext
34 {
35 bool_t (*close)(dbttext_t*);
36 bool_t (*mergeclose)(dbttext_t*,vec_t*);
37 bool_t (*unmergeclose)(dbttext_t*,vec_t*);
38 uint (*getmsgcount)(dbttext_t*);
39 uint (*getcount)(dbttext_t*,str_t*);
40
41 int fd; /* file descriptor, if currently open */
42 char* pbuf; /* data buffer, if currently open */
43 uint nmsgs; /* number of messages represented in list */
44 uint nalloc; /* items alloced in pitems */
45 uint nitems; /* items available */
46 rec_t* pitems; /* growing vector of items */
47 };
48
49 typedef struct _dbhtext dbhtext_t;
50 struct _dbhtext
51 {
52 bool_t (*close)(dbhtext_t*);
53 dbt_t* (*opentable)(dbhtext_t*,cpchar,bool_t);
54
55 char* dir;
56 };
57
58 uint db_getnewcount(veciter_t * piter);
59
60 dbhtext_t* dbtext_db_open(cpchar dbname, bool_t rdonly);
61 bool_t dbtext_db_close( dbhtext_t* pthis );
62 dbt_t* dbtext_db_opentable( dbhtext_t* pthis, cpchar table, bool_t rdon…
63
64 bool_t dbtext_table_close( dbttext_t* pthis );
65 bool_t dbtext_table_mergeclose( dbttext_t* pthis, vec_t* pmsg );
66 bool_t dbtext_table_unmergeclose( dbttext_t* pthis, vec_t* pmsg );
67 uint dbtext_table_getmsgcount( dbttext_t* pthis );
68 uint dbtext_table_getcount( dbttext_t* pthis, str_t* pword );
69
70 #endif /* ndef _DBH_H */
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.