calcurse  4.5.1
About: calcurse is a text-based calendar and scheduling application.
  Fossies Dox: calcurse-4.5.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

htable.h File Reference
#include <stdint.h>
#include <string.h>
Include dependency graph for htable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HTABLE_HEAD(name, size, type)
 
#define HTABLE_ENTRY(type)   struct type *next /* To build the bucket chain list. */
 
#define HTABLE_SIZE(head)   (sizeof (*(head)->bkts) ? sizeof ((head)->bkts) / sizeof (*(head)->bkts) : 0)
 
#define HTABLE_COUNT(head)   ((head)->noitems ? (head)->noitems : 0)
 
#define HTABLE_EMPTY(head)   (HTABLE_COUNT((head)) == 0 ? 1 : 0)
 
#define HTABLE_COLLS(head)   ((head)->noitems ? 100.0 - 100 * (head)->nosingle / (head)->noitems : 0)
 
#define HTABLE_LOAD(head)
 
#define HTABLE_INITIALIZER(head)
 
#define HTABLE_INIT(head)
 
#define HTABLE_PROTOTYPE(name, type)
 
#define HTABLE_GENERATE(name, type, key, cmp)
 
#define FIRST_BKT   0
 
#define HTABLE_INSERT(name, x, y)   name##_HTABLE_INSERT(x, y)
 
#define HTABLE_REMOVE(name, x, y)   name##_HTABLE_REMOVE(x, y)
 
#define HTABLE_LOOKUP(name, x, y)   name##_HTABLE_LOOKUP(x, y)
 
#define HTABLE_FIRST_FROM(name, x, y)
 
#define HTABLE_FIRST(name, x)   HTABLE_FIRST_FROM(name, x, FIRST_BKT)
 
#define HTABLE_NEXT(name, x, y)
 
#define HTABLE_FOREACH(x, name, head)
 
#define HTABLE_HASH   HASH_JEN
 
#define HASH_JEN_MIX(a, b, c)
 
#define HASH_JEN(key, keylen, num_bkts, bkt)
 
#define HASH_OAT(key, keylen, num_bkts, bkt)
 

Macro Definition Documentation

◆ FIRST_BKT

#define FIRST_BKT   0

Definition at line 285 of file htable.h.

◆ HASH_JEN

#define HASH_JEN (   key,
  keylen,
  num_bkts,
  bkt 
)

Definition at line 322 of file htable.h.

◆ HASH_JEN_MIX

#define HASH_JEN_MIX (   a,
  b,
 
)
Value:
do { \
a -= b; a -= c; a ^= (c >> 13); \
b -= c; b -= a; b ^= (a << 8); \
c -= a; c -= b; c ^= (b >> 13); \
a -= b; a -= c; a ^= (c >> 12); \
b -= c; b -= a; b ^= (a << 16); \
c -= a; c -= b; c ^= (b >> 5); \
a -= b; a -= c; a ^= (c >> 3); \
b -= c; b -= a; b ^= (a << 10); \
c -= a; c -= b; c ^= (b >> 15); \
} while (0)

Definition at line 310 of file htable.h.

◆ HASH_OAT

#define HASH_OAT (   key,
  keylen,
  num_bkts,
  bkt 
)
Value:
do { \
register uint32_t hash; \
int i; \
\
hash = 0; \
for (i = 0; i < keylen; i++) \
{ \
hash += key[i]; \
hash += (hash << 10); \
hash ^= (hash >> 6); \
} \
hash += (hash << 3); \
hash ^= (hash >> 11); \
hash += (hash << 15); \
bkt = hash % (num_bkts); \
} while (0)

Definition at line 375 of file htable.h.

◆ HTABLE_COLLS

#define HTABLE_COLLS (   head)    ((head)->noitems ? 100.0 - 100 * (head)->nosingle / (head)->noitems : 0)

Definition at line 83 of file htable.h.

◆ HTABLE_COUNT

#define HTABLE_COUNT (   head)    ((head)->noitems ? (head)->noitems : 0)

Definition at line 77 of file htable.h.

◆ HTABLE_EMPTY

#define HTABLE_EMPTY (   head)    (HTABLE_COUNT((head)) == 0 ? 1 : 0)

Definition at line 80 of file htable.h.

◆ HTABLE_ENTRY

#define HTABLE_ENTRY (   type)    struct type *next /* To build the bucket chain list. */

Definition at line 71 of file htable.h.

◆ HTABLE_FIRST

#define HTABLE_FIRST (   name,
 
)    HTABLE_FIRST_FROM(name, x, FIRST_BKT)

Definition at line 292 of file htable.h.

◆ HTABLE_FIRST_FROM

#define HTABLE_FIRST_FROM (   name,
  x,
 
)
Value:
(HTABLE_EMPTY(x) ? NULL \
: name##_HTABLE_FIRST_FROM(x, y))

Definition at line 290 of file htable.h.

◆ HTABLE_FOREACH

#define HTABLE_FOREACH (   x,
  name,
  head 
)
Value:
for ((x) = HTABLE_FIRST(name, head); \
(x) != NULL; \
(x) = HTABLE_NEXT(name, head, x))

Definition at line 296 of file htable.h.

◆ HTABLE_GENERATE

#define HTABLE_GENERATE (   name,
  type,
  key,
  cmp 
)

Definition at line 116 of file htable.h.

◆ HTABLE_HASH

#define HTABLE_HASH   HASH_JEN

Definition at line 307 of file htable.h.

◆ HTABLE_HEAD

#define HTABLE_HEAD (   name,
  size,
  type 
)
Value:
struct name { \
uint32_t noitems; /* Number of items stored in hash table. */ \
uint32_t nosingle; /* Number of items alone in their bucket. */ \
uint32_t nofreebkts; /* Number of free buckets. */ \
struct type *bkts[size]; /* Pointers to user-defined data structures. */ \
}

Definition at line 63 of file htable.h.

◆ HTABLE_INIT

#define HTABLE_INIT (   head)
Value:
do { \
bzero ((head), sizeof (*(head))); \
(head)->nofreebkts = HTABLE_SIZE((head)); \
} while (0)

Definition at line 96 of file htable.h.

◆ HTABLE_INITIALIZER

#define HTABLE_INITIALIZER (   head)
Value:
{ 0, /* noitems */ \
0, /* nosingle */ \
HTABLE_SIZE((head)) /* nofreebkts */ \
}

Definition at line 90 of file htable.h.

◆ HTABLE_INSERT

#define HTABLE_INSERT (   name,
  x,
 
)    name##_HTABLE_INSERT(x, y)

Definition at line 287 of file htable.h.

◆ HTABLE_LOAD

#define HTABLE_LOAD (   head)
Value:
(HTABLE_SIZE((head)) ? \
100.0 - 100.0 * (head)->nofreebkts / HTABLE_SIZE((head)) : 0)

Definition at line 86 of file htable.h.

◆ HTABLE_LOOKUP

#define HTABLE_LOOKUP (   name,
  x,
 
)    name##_HTABLE_LOOKUP(x, y)

Definition at line 289 of file htable.h.

◆ HTABLE_NEXT

#define HTABLE_NEXT (   name,
  x,
 
)
Value:
(HTABLE_EMPTY(x) ? NULL \
: name##_HTABLE_NEXT(x, y))

Definition at line 293 of file htable.h.

◆ HTABLE_PROTOTYPE

#define HTABLE_PROTOTYPE (   name,
  type 
)
Value:
struct type *name##_HTABLE_INSERT(struct name *, struct type *); \
struct type *name##_HTABLE_REMOVE(struct name *, struct type *); \
struct type *name##_HTABLE_LOOKUP(struct name *, struct type *); \
uint32_t name##_HTABLE_FIND_BKT(struct name *, struct type *); \
int name##_HTABLE_CHAIN_LEN(struct name *, uint32_t); \
struct type *name##_HTABLE_FIRST_FROM(struct name *, int); \
struct type *name##_HTABLE_NEXT(struct name *, struct type *);

Definition at line 104 of file htable.h.

◆ HTABLE_REMOVE

#define HTABLE_REMOVE (   name,
  x,
 
)    name##_HTABLE_REMOVE(x, y)

Definition at line 288 of file htable.h.

◆ HTABLE_SIZE

#define HTABLE_SIZE (   head)    (sizeof (*(head)->bkts) ? sizeof ((head)->bkts) / sizeof (*(head)->bkts) : 0)

Definition at line 74 of file htable.h.

HTABLE_SIZE
#define HTABLE_SIZE(head)
Definition: htable.h:74
HTABLE_FIRST
#define HTABLE_FIRST(name, x)
Definition: htable.h:292
HTABLE_NEXT
#define HTABLE_NEXT(name, x, y)
Definition: htable.h:293
HTABLE_EMPTY
#define HTABLE_EMPTY(head)
Definition: htable.h:80
key
key
Definition: calcurse.h:488