1 | // This file is part of SmallBASIC |
2 | // |
3 | // Support for dictionary/associative array variables |
4 | // |
5 | // This program is distributed under the terms of the GPL v2.0 or later |
6 | // Download the GNU Public License (GPL) from www.gnu.org |
7 | // |
8 | // Copyright(C) 2007-2014 Chris Warren-Smith. [http://tinyurl.com/ja2ss] |
9 | |
10 | #include "include/var.h" |
11 | |
12 | #ifndef VAR_MAP_H |
13 | #define VAR_MAP_H |
14 | |
15 | #if defined(__cplusplus) |
16 | extern "C" { |
17 | #endif |
18 | |
19 | #define MAP_TMP_FIELD "\1" |
20 | |
21 | int map_compare(const var_p_t var_a, const var_p_t var_b); |
22 | int map_is_empty(const var_p_t var_p); |
23 | int map_to_int(const var_p_t var_p); |
24 | int map_length(const var_p_t var_p); |
25 | int map_get_bool(var_p_t base, const char *name); |
26 | int map_get_int(var_p_t base, const char *name, int def); |
27 | const char *map_get_str(var_p_t base, const char *name); |
28 | var_p_t map_get(var_p_t base, const char *name); |
29 | var_p_t map_elem_key(const var_p_t var_p, int index); |
30 | var_p_t map_resolve_fields(var_p_t base, var_p_t *parent); |
31 | var_p_t map_add_var(var_p_t base, const char *name, int value); |
32 | void map_init(var_p_t map); |
33 | void map_free(var_p_t var_p); |
34 | void map_get_value(var_p_t base, var_p_t key, var_p_t *result); |
35 | void map_set(var_p_t dest, const var_p_t src); |
36 | void map_set_int(var_p_t base, const char *name, var_int_t n); |
37 | char *map_to_str(const var_p_t var_p); |
38 | void map_write(const var_p_t var_p, int method, intptr_t handle); |
39 | void map_parse_str(const char *js, size_t len, var_p_t dest); |
40 | void map_from_str(var_p_t var_p); |
41 | void map_from_codearray(var_p_t var_p); |
42 | |
43 | #if defined(__cplusplus) |
44 | } |
45 | #endif |
46 | |
47 | #endif |
48 | |
49 | |