sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
fthash.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * fthash.h
4 *
5 * Hashing functions (specification).
6 *
7 */
8
9/*
10 * Copyright 2000 Computing Research Labs, New Mexico State University
11 * Copyright 2001-2015
12 * Francesco Zappa Nardelli
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the "Software"),
16 * to deal in the Software without restriction, including without limitation
17 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 * and/or sell copies of the Software, and to permit persons to whom the
19 * Software is furnished to do so, subject to the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
28 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
29 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
30 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 */
32
33 /**************************************************************************
34 *
35 * This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50
36 *
37 * taken from Mark Leisher's xmbdfed package
38 *
39 */
40
41
46#ifndef FTHASH_H_
47#define FTHASH_H_
48
49
50#include <freetype/freetype.h>
51
52
53FT_BEGIN_HEADER
54
55
56 typedef union FT_Hashkey_
57 {
58 FT_Int num;
59 const char* str;
60
61 } FT_Hashkey;
62
63
64 typedef struct FT_HashnodeRec_
65 {
66 FT_Hashkey key;
67 size_t data;
68
69 } FT_HashnodeRec;
70
71 typedef struct FT_HashnodeRec_ *FT_Hashnode;
72
73
74 typedef FT_ULong
75 (*FT_Hash_LookupFunc)( FT_Hashkey* key );
76
77 typedef FT_Bool
78 (*FT_Hash_CompareFunc)( FT_Hashkey* a,
79 FT_Hashkey* b );
80
81
82 typedef struct FT_HashRec_
83 {
84 FT_UInt limit;
85 FT_UInt size;
86 FT_UInt used;
87
88 FT_Hash_LookupFunc lookup;
89 FT_Hash_CompareFunc compare;
90
91 FT_Hashnode* table;
92
93 } FT_HashRec;
94
95 typedef struct FT_HashRec_ *FT_Hash;
96
97
98 FT_Error
99 ft_hash_str_init( FT_Hash hash,
100 FT_Memory memory );
101
102 FT_Error
103 ft_hash_num_init( FT_Hash hash,
104 FT_Memory memory );
105
106 void
107 ft_hash_str_free( FT_Hash hash,
108 FT_Memory memory );
109
110#define ft_hash_num_free ft_hash_str_free
111
112 FT_Error
113 ft_hash_str_insert( const char* key,
114 size_t data,
115 FT_Hash hash,
116 FT_Memory memory );
117
118 FT_Error
119 ft_hash_num_insert( FT_Int num,
120 size_t data,
121 FT_Hash hash,
122 FT_Memory memory );
123
124 FT_Error
125 ft_hash_str_insert_no_overwrite( const char* key,
126 size_t data,
127 FT_Hash hash,
128 FT_Memory memory );
129
130 FT_Error
131 ft_hash_num_insert_no_overwrite( FT_Int num,
132 size_t data,
133 FT_Hash hash,
134 FT_Memory memory );
135
136 size_t*
137 ft_hash_str_lookup( const char* key,
138 FT_Hash hash );
139
140 size_t*
141 ft_hash_num_lookup( FT_Int num,
142 FT_Hash hash );
143
144 FT_Bool
145 ft_hash_num_iterator( FT_UInt *idx,
146 FT_Int *key,
147 size_t *value,
148 FT_Hash hash );
149
150 FT_Bool
151 ft_hash_str_iterator( FT_UInt *idx,
152 const char* *key,
153 size_t *value,
154 FT_Hash hash );
155
156FT_END_HEADER
157
158
159#endif /* FTHASH_H_ */
160
161
162/* END */