OSDN Git Service

disable press number action when NG by word.
[bbk/bchan.git] / src / cache.h
1 /*
2  * cache.h
3  *
4  * Copyright (c) 2009-2011 project bchan
5  *
6  * This software is provided 'as-is', without any express or implied
7  * warranty. In no event will the authors be held liable for any damages
8  * arising from the use of this software.
9  *
10  * Permission is granted to anyone to use this software for any purpose,
11  * including commercial applications, and to alter it and redistribute it
12  * freely, subject to the following restrictions:
13  *
14  * 1. The origin of this software must not be misrepresented; you must not
15  *    claim that you wrote the original software. If you use this software
16  *    in a product, an acknowledgment in the product documentation would be
17  *    appreciated but is not required.
18  *
19  * 2. Altered source versions must be plainly marked as such, and must not be
20  *    misrepresented as being the original software.
21  *
22  * 3. This notice may not be removed or altered from any source
23  *    distribution.
24  *
25  */
26
27 #include    <basic.h>
28 #include    <btron/vobj.h>
29
30 #ifndef __CACHE_H__
31 #define __CACHE_H__
32
33 #define DATCACHE_RECORDTYPE_MAIN 31
34 #define DATCACHE_RECORDTYPE_INFO 30
35 #define DATCACHE_RECORDSUBTYPE_RETRIEVE 0x0001
36 #define DATCACHE_RECORDSUBTYPE_HEADER 0x0002
37 #define DATCACHE_RECORDSUBTYPE_RESIDINFO 0x0003
38 #define DATCACHE_RECORDSUBTYPE_RESINDEXINFO 0x0004
39 #define DATCACHE_RECORDSUBTYPE_NGWORDINFO 0x0005
40
41 #define DATCACHE_RESIDDATA_FLAG_NG    0x00000001
42 #define DATCACHE_RESIDDATA_FLAG_COLOR 0x00000002
43 #define DATCACHE_RESINDEXDATA_FLAG_NG    0x00000001
44 #define DATCACHE_RESINDEXDATA_FLAG_COLOR 0x00000002
45
46 typedef struct datcache_t_ datcache_t;
47 typedef struct datcache_datareadcontext_t_ datcache_datareadcontext_t;
48 typedef struct datcache_ngwordreadcontext_t_ datcache_ngwordreadcontext_t;
49
50 IMPORT datcache_t* datcache_new(VID vid);
51 IMPORT VOID datcache_delete(datcache_t *cache);
52 IMPORT W datcache_appenddata(datcache_t *cache, UB *data, W len);
53 IMPORT VOID datcache_cleardata(datcache_t *cache);
54 IMPORT VOID datcache_getlatestheader(datcache_t *cache, UB **header, W *len);
55 IMPORT W datcache_updatelatestheader(datcache_t *cache, UB *header, W len);
56 IMPORT VOID datcache_gethost(datcache_t *cache, UB **header, W *len);
57 IMPORT VOID datcache_getborad(datcache_t *cache, UB **borad, W *len);
58 IMPORT VOID datcache_getthread(datcache_t *cache, UB **thread, W *len);
59 IMPORT W datcache_datasize(datcache_t *cache);
60 IMPORT W datcache_writefile(datcache_t *cache);
61 IMPORT W datcache_addresiddata(datcache_t *cache, TC *idstr, W idstr_len, UW attr, COLOR color);
62 #define DATCACHE_SEARCHRESIDDATA_NOTFOUND 0 /* RESIDHASH_SEARCHDATA_NOTFOUND */
63 #define DATCACHE_SEARCHRESIDDATA_FOUND    1 /* RESIDHASH_SEARCHDATA_FOUND */
64 IMPORT W datcache_searchresiddata(datcache_t *cache, TC *idstr, W idstr_len, UW *attr, COLOR *color);
65 IMPORT VOID datcache_removeresiddata(datcache_t *cache, TC *idstr, W idstr_len);
66 IMPORT W datcache_addresindexdata(datcache_t *cache, W index, UW attr, COLOR color);
67 #define DATCACHE_SEARCHRESINDEXDATA_NOTFOUND 0 /* RESINDEXHASH_SEARCHDATA_NOTFOUND */
68 #define DATCACHE_SEARCHRESINDEXDATA_FOUND    1 /* RESINDEXHASH_SEARCHDATA_FOUND */
69 IMPORT W datcache_searchresindexdata(datcache_t *cache, W index, UW *attr, COLOR *color);
70 IMPORT VOID datcache_removeresindexdata(datcache_t *cache, W index);
71 IMPORT W datcache_appendngword(datcache_t *cache, TC *str, W len);
72 IMPORT VOID datcache_removengword(datcache_t *cache, TC *str, W len);
73 IMPORT Bool datcache_checkngwordexist(datcache_t *cache, TC *str, W len);
74
75 IMPORT datcache_datareadcontext_t* datcache_startdataread(datcache_t *cache, W start);
76 IMPORT VOID datcache_enddataread(datcache_t *cache, datcache_datareadcontext_t *context);
77
78 IMPORT Bool datcache_datareadcontext_nextdata(datcache_datareadcontext_t *context, UB **bin, W *len);
79
80 IMPORT datcache_ngwordreadcontext_t* datcache_startngwordread(datcache_t *cache);
81 IMPORT VOID datcache_endngwordread(datcache_t *cache, datcache_ngwordreadcontext_t *context);
82 IMPORT Bool datcache_ngwordreadcontext_nextdata(datcache_ngwordreadcontext_t *context, TC **str, W *len);
83
84 #endif