1 /******************************************************************************
2 *
3 * Copyright (C) 2006, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: hash 18.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15
16 #ifndef _HASH_
17 #define _HASH_
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif // __cplusplus
22
23 #include "arr.h"
24
25 //--------------------------------------------------------------------------
26
27 #define HASH_SIZE 4096
28
29 // Описание имени
30 typedef struct
31 {
32 ushort len; // длина имени
33 uint id; // Identifier. The number in the array
34 pvoid next; // The next hashitem
35 } hashitem, * phashitem;
36 // Additional size hash.isize
37 // name with zero at the end
38
39 // После этого идет строка имени
40 typedef struct
41 {
42 arr values; // Hash-values hash table pointer to the first hashitem
43 arr names; // Array of hash names = pointers to hashitem objects
44 uint isize; // Additional size
45 ubyte ignore; // If 1 then ignore case
46 } hash, * phash;
47
48 //--------------------------------------------------------------------------
49
50 phashitem STDCALL hash_create( phash ph, pubyte name );
51 phashitem STDCALL hash_find( phash ph, pubyte name );
52 void STDCALL hash_init( phash ph, uint size );
53 void STDCALL hash_delete( phash ph );
54 uint STDCALL hash_getuint( phash ph, pubyte name );
55 uint STDCALL hash_setuint( phash ph, pubyte name, uint val );
56 pubyte STDCALL hash_name( phash ph, uint id );
57
58 //--------------------------------------------------------------------------
59
60 #ifdef __cplusplus
61 }
62 #endif // __cplusplus
63
64 #endif // _HASH_
65
66