2 * Regular Pattern Analyzer (RPA)
3 * Copyright (c) 2009-2010 Martin Stoilov
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * Martin Stoilov <martin@rpasearch.com>
25 #include "rlib/rarray.h"
26 #include "rlib/rcarray.h"
27 #include "rlib/rhash.h"
28 #include "rlib/rstring.h"
29 #include "rlib/robject.h"
36 #define r_harray_index(__harray__, __index__, __type__) r_carray_index((__harray__)->members, __index__, __type__)
37 #define r_harray_length(__harray__) r_carray_length((__harray__)->members)
38 #define r_harray_index(__harray__, __index__, __type__) r_carray_index((__harray__)->members, __index__, __type__)
39 #define r_harray_slot(__harray__, __index__) r_carray_slot((__harray__)->members, __index__)
41 typedef struct rharray_s {
49 rharray_t *r_harray_create(unsigned int elt_size);
50 void r_harray_destroy(rharray_t *array);
51 robject_t *r_harray_init(robject_t *obj, ruint32 type, r_object_cleanupfun cleanup, r_object_copyfun copy, unsigned int elt_size);
52 long r_harray_add(rharray_t *harray, const char *name, rsize_t namesize, rconstpointer pval);
53 long r_harray_add_s(rharray_t *harray, const char *name, rconstpointer pval);
54 long r_harray_replace(rharray_t *harray, const char *name, rsize_t namesize, rconstpointer pval);
55 long r_harray_replace_s(rharray_t *harray, const char *name, rconstpointer pval);
56 long r_harray_lookup(rharray_t *harray, const char *name, rsize_t namesize);
57 long r_harray_lookup_s(rharray_t *harray, const char *name);
58 long r_harray_taillookup(rharray_t *harray, const char *name, rsize_t namesize);
59 long r_harray_taillookup_s(rharray_t *harray, const char *name);
60 rhash_node_t* r_harray_nodelookup(rharray_t *harray, rhash_node_t *cur, const char *name, rsize_t namesize);
61 rhash_node_t* r_harray_nodelookup_s(rharray_t *harray, rhash_node_t *cur, const char *name);
62 rhash_node_t* r_harray_nodetaillookup(rharray_t *harray, rhash_node_t *cur, const char *name, rsize_t namesize);
63 rhash_node_t* r_harray_nodetaillookup_s(rharray_t *harray, rhash_node_t *cur, const char *name);
64 rpointer r_harray_get(rharray_t *harray, rsize_t index);
65 int r_harray_set(rharray_t *harray, long index, rconstpointer pval);
67 robject_t *r_harray_copy(const robject_t *obj);
68 void r_harray_cleanup(robject_t *obj);