ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/lookup.h
(Generate patch)

Comparing ray/src/common/lookup.h (file contents):
Revision 2.11 by schorsch, Wed Jul 30 10:11:06 2003 UTC vs.
Revision 2.14 by greg, Tue May 25 22:04:13 2004 UTC

# Line 5 | Line 5
5   #ifndef _RAD_LOOKUP_H_
6   #define _RAD_LOOKUP_H_
7  
8 #include <string.h> /* strcmp() */
9
8   #ifdef __cplusplus
9   extern "C" {
10   #endif
11  
12 < typedef void lut_free_t(void*);
12 > typedef void lut_free_t(void *p);
13 > typedef unsigned long lut_hashf_t(const void *);
14 > typedef int lut_keycmpf_t(const void *, const void *);
15  
16   typedef struct {
17          char    *key;                   /* key name */
# Line 20 | Line 20 | typedef struct {
20   } LUENT;
21  
22   typedef struct {
23 <        unsigned long (*hashf)(char*);  /* key hash function */
24 <        int (*keycmp)(const char*, const char*);        /* key comparison function */
23 >        lut_hashf_t *hashf;     /* key hash function */
24 >        lut_keycmpf_t *keycmp;  /* key comparison function */
25          lut_free_t *freek;              /* free a key */
26          lut_free_t *freed;              /* free the data */
27          int     tsiz;                   /* current table size */
# Line 29 | Line 29 | typedef struct {
29          int     ndel;                   /* number of deleted entries */
30   } LUTAB;
31  
32 #undef strcmp
33 #define LU_SINIT(fk,fd)         {lu_shash,strcmp,fk,\
34                                fd,0,NULL,0}
32  
33   /*
34   * The lu_init routine is called to initialize a table.  The number of
# Line 80 | Line 77 | typedef struct {
77   * allocated table itself.
78   */
79  
80 + typedef int lut_doallf_t(const LUENT *e, void *p);
81 +
82 + extern lut_keycmpf_t lu_strcmp;
83   extern int      lu_init(LUTAB *tbl, int nel);
84 < extern unsigned long    lu_shash(char *s);
85 < extern LUENT    *lu_find(LUTAB *tbl, char *key);
86 < extern void     lu_delete(LUTAB *tbl, char *key);
87 < extern int      lu_doall(LUTAB *tbl, int (*f)(LUENT*));
84 > extern unsigned long    lu_shash(const void *s);
85 > extern LUENT    *lu_find(LUTAB *tbl, const char *key);
86 > extern void     lu_delete(LUTAB *tbl, const char *key);
87 > extern int      lu_doall(const LUTAB *tbl, lut_doallf_t *f, void *p);
88   extern void     lu_done(LUTAB *tbl);
89  
90 + #define LU_SINIT(fk,fd) {lu_shash,lu_strcmp,fk,fd,0,NULL,0}
91  
92   #ifdef __cplusplus
93   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines