(file) Return to strhash.h CVS log (file) (dir) Up to [RizwankCVS] / testProject / source / src / afmlib

 1 rizwank 1.1 /*
 2              * String hash table.
 3              * Copyright (c) 1995, 1996, 1997 Markku Rossi.
 4              *
 5              * Author: Markku Rossi <mtr@iki.fi>
 6              */
 7             
 8             /*
 9              * This program is free software; you can redistribute it and/or modify
10              * it under the terms of the GNU General Public License as published by
11              * the Free Software Foundation; either version 2, or (at your option)
12              * any later version.
13              *
14              * This program is distributed in the hope that it will be useful,
15              * but WITHOUT ANY WARRANTY; without even the implied warranty of
16              * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17              * GNU General Public License for more details.
18              *
19              * You should have received a copy of the GNU General Public License
20              * along with this program; see the file COPYING.  If not, write to
21              * the Free Software Foundation, 59 Temple Place - Suite 330,
22 rizwank 1.1  * Boston, MA 02111-1307, USA.
23              */
24             
25             #ifndef STRHASH_H
26             #define STRHASH_H
27             
28             #ifndef ___P
29             #if PROTOTYPES
30             #define ___P(protos) protos
31             #else /* no PROTOTYPES */
32             #define ___P(protos) ()
33             #endif /* no PROTOTYPES */
34             #endif
35             
36             typedef struct stringhash_st *StringHashPtr;
37             
38             /*
39              * Init a hash and return a hash handle or NULL if there were errors.
40              */
41             StringHashPtr strhash_init ___P ((void));
42             
43 rizwank 1.1 /*
44              * Free hash <hash>. Frees all resources that hash has allocated. <hash>
45              * shouldn't be used after this function is called.
46              */
47             void strhash_free ___P ((StringHashPtr hash));
48             
49             /*
50              * Put key <key> to hash <hash>. <data> will be bind to <key>. Returns
51              * true (1) if operation was successful or false (0) otherwise. If <key>
52              * is already bind to another data, then <old_data> will be set to old
53              * data. Otherwise it will be set to NULL.
54              */
55             int strhash_put ___P ((StringHashPtr hash, char *key, int keylen, void *data,
56             		       void **old_data_return));
57             
58             /*
59              * Get data associated to key <key>. Data is returned in <*data>.
60              * Returns true (1) is key was found or false (0) otherwise.
61              */
62             int strhash_get ___P ((StringHashPtr hash, const char *key, int keylen,
63             		       void **data_return));
64 rizwank 1.1 
65             /*
66              * Deletes key <key> form <hash>. Data is returned in <*data>. Returns
67              * true (1) if <key> was found or false (0) if <key> was not found or
68              * errors were encountered.
69              */
70             int strhash_delete ___P ((StringHashPtr hash, const char *key, int keylen,
71             			  void **data_return));
72             
73             /*
74              * Get first item from hash <hash>.  Returns 1 if there were items
75              * or 0 otherwise.
76              */
77             int strhash_get_first ___P ((StringHashPtr hash, char **key_return,
78             			     int *keylen_return, void **data_return));
79             
80             /*
81              * Get next item from hash <hash>.  Returns 1 if there were items
82              * or 0 otherwise.
83              */
84             int strhash_get_next ___P ((StringHashPtr hash, char **key_return,
85 rizwank 1.1 			    int *keylen_return, void **data_return));
86             
87             #endif /* not STRHASH_H */

Rizwan Kassim
Powered by
ViewCVS 0.9.2