4 * Copyright (c) 2010 project bchan
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.
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:
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.
19 * 2. Altered source versions must be plainly marked as such, and must not be
20 * misrepresented as being the original software.
22 * 3. This notice may not be removed or altered from any source
28 #include <bsys/queue.h>
31 #ifndef __RESINDEXHASH_H__
32 #define __RESINDEXHASH_H__
34 #ifndef RESINDEXHASH_BASE
35 #define RESINDEXHASH_BASE 10
38 typedef struct resindexhash_node_t_ {
43 } resindexhash_node_t;
45 struct resindexhash_t_ {
47 resindexhash_node_t tbl[RESINDEXHASH_BASE];
49 typedef struct resindexhash_t_ resindexhash_t;
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);
60 struct resindexhash_iterator_t_ {
61 resindexhash_t *resindexhash;
63 resindexhash_node_t *node;
65 typedef struct resindexhash_iterator_t_ resindexhash_iterator_t;
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);