OSDN Git Service

fix copyright year.
[bbk/bchan.git] / src / resindexhash.h
1 /*
2  * resindexhash.h
3  *
4  * Copyright (c) 2010 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        <bsys/queue.h>
29 #include        <btron/dp.h>
30
31 #ifndef __RESINDEXHASH_H__
32 #define __RESINDEXHASH_H__
33
34 #ifndef RESINDEXHASH_BASE
35 #define RESINDEXHASH_BASE 10 
36 #endif
37
38 typedef struct resindexhash_node_t_ {
39         QUEUE queue;
40         TC index;
41         UW attr;
42         COLOR color;
43 } resindexhash_node_t;
44
45 struct resindexhash_t_ {
46         W datanum;
47         resindexhash_node_t tbl[RESINDEXHASH_BASE];
48 };
49 typedef struct resindexhash_t_ resindexhash_t;
50
51 IMPORT W resindexhash_initialize(resindexhash_t *resindexhash);
52 IMPORT VOID resindexhash_finalize(resindexhash_t *resindexhash);
53 IMPORT W resindexhash_adddata(resindexhash_t *resindexhash, W index, UW attr, COLOR color);
54 #define RESINDEXHASH_SEARCHDATA_NOTFOUND 0
55 #define RESINDEXHASH_SEARCHDATA_FOUND    1
56 IMPORT W resindexhash_searchdata(resindexhash_t *resindexhash, W index, UW *attr, COLOR *color);
57 IMPORT VOID resindexhash_removedata(resindexhash_t *resindexhash, W index);
58 IMPORT W resindexhash_datanum(resindexhash_t *resindexhash);
59
60 struct resindexhash_iterator_t_ {
61         resindexhash_t *resindexhash;
62         W tbl_index;
63         resindexhash_node_t *node;
64 };
65 typedef struct resindexhash_iterator_t_ resindexhash_iterator_t;
66
67 IMPORT VOID resindexhash_iterator_initialize(resindexhash_iterator_t *iter, resindexhash_t *target);
68 IMPORT VOID resindexhash_iterator_finalize(resindexhash_iterator_t *iter);
69 IMPORT Bool resindexhash_iterator_next(resindexhash_iterator_t *iter, W *index, W *attr, W *color);
70
71 #endif