summaryrefslogtreecommitdiff
path: root/stringmap.h
blob: 8a5d9dae0683bdf1d6dfe723e70b31eb8132d27f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * stringmap.h:
 * map of strings
 *
 * Copyright (c) 2001 Chris Lightfoot. All rights reserved.
 *
 * $Id: stringmap.h,v 1.1 2003/10/19 06:44:33 pdw Exp $
 *
 */

#ifndef __STRINGMAP_H_ /* include guard */
#define __STRINGMAP_H_

#include "vector.h"

typedef struct _stringmap {
    char *key;
    item d;
    struct _stringmap *l, *g;
} *stringmap;

stringmap stringmap_new(void);
void      stringmap_delete(stringmap);
void      stringmap_delete_free(stringmap);

/* Try to insert an item into a stringmap, returning 1 if the map already
 * contained an item with that key.
 */
item *stringmap_insert(stringmap, const char*, const item);
/* Find an item in a stringmap */
stringmap     stringmap_find(const stringmap, const char*);

#endif /* __STRINGMAP_H_ */