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)
16extern "C" {
17#endif
18
19#define MAP_TMP_FIELD "\1"
20
21int map_compare(const var_p_t var_a, const var_p_t var_b);
22int map_is_empty(const var_p_t var_p);
23int map_to_int(const var_p_t var_p);
24int map_length(const var_p_t var_p);
25int map_get_bool(var_p_t base, const char *name);
26int map_get_int(var_p_t base, const char *name, int def);
27const char *map_get_str(var_p_t base, const char *name);
28var_p_t map_get(var_p_t base, const char *name);
29var_p_t map_elem_key(const var_p_t var_p, int index);
30var_p_t map_resolve_fields(var_p_t base, var_p_t *parent);
31var_p_t map_add_var(var_p_t base, const char *name, int value);
32void map_init(var_p_t map);
33void map_free(var_p_t var_p);
34void map_get_value(var_p_t base, var_p_t key, var_p_t *result);
35void map_set(var_p_t dest, const var_p_t src);
36void map_set_int(var_p_t base, const char *name, var_int_t n);
37char *map_to_str(const var_p_t var_p);
38void map_write(const var_p_t var_p, int method, intptr_t handle);
39void map_parse_str(const char *js, size_t len, var_p_t dest);
40void map_from_str(var_p_t var_p);
41void map_from_codearray(var_p_t var_p);
42
43#if defined(__cplusplus)
44}
45#endif
46
47#endif
48
49