1
/* Copyright (c) 2009 Sam Trenholme
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
15
* This software is provided 'as is' with no guarantees of correctness or
16
* fitness for purpose.
20
#define dwd_dict dw_hash
22
/* Initialize a Deadwood dictionary store */
25
/* Add a dictionary key/value pair to the compiled list of MaraRC
28
* Input: Number of MaraRC parameter to modify
29
* Dictionary key index to modify
30
* Value for said key index
32
* Output: Location of hash in memory after performing operation; this may
33
* move as we grow the dictionary to accommodate more data in the
34
* hash. This *must* always be called like this:
36
* hash = dwd_add(hash,key,value);
39
dwd_dict *dwd_add(dwd_dict *hash, dw_str *key, dw_str *value);
41
/* Fetch a value from a given dictionary variable (num is the number for
42
* the dictionary variable we are seeking a given value for, given the
43
* dictionary variable and the key inside that variable) */
44
dw_str *dwd_fetch(dwd_dict *hash, dw_str *key);
46
/* For a given dictionary variable, and a key, return (as a *copied* dw_str
47
* object) the next key or 0 if we're at the last key. If the key given to
48
* this function is 0, return the first key. */
49
dw_str *dwd_nextkey(dwd_dict *hash, dw_str *key);