4 Part of the swftools package.
6 Copyright (c) 2001,2002,2003 Matthias Kramm <kramm@quiss.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
26 #include "../config.h"
32 /* dynamically growing mem section */
33 typedef struct _mem_t {
39 typedef struct _ringbuffer_t
45 /* non-nul terminated string */
46 typedef struct _string_t {
51 /* key/value pairs of strings */
52 typedef struct _map_t {
56 /* (void*)s referenced by strings */
57 typedef struct _dictionary_t {
61 /* array of strings */
62 typedef struct _stringarray_t
67 void mem_init(mem_t*mem);
68 int mem_put(mem_t*m, void*data, int length);
69 int mem_putstring(mem_t*m, string_t str);
70 void mem_clear(mem_t*mem);
71 void mem_destroy(mem_t*mem);
73 void ringbuffer_init(ringbuffer_t*r);
74 void ringbuffer_put(ringbuffer_t*r, void*buf, int size);
75 int ringbuffer_read(ringbuffer_t*r, void*buf, int size);
76 void ringbuffer_clear(ringbuffer_t*r);
78 void string_set(string_t*str, char*text);
79 void string_set2(string_t*str, char*text, int len);
80 void string_dup(string_t*str, const char*text);
81 void string_dup2(string_t*str, const char*text, int len);
82 int string_equals(string_t*str, const char*text);
84 void stringarray_init(stringarray_t*sa);
85 void stringarray_put(stringarray_t*sa, string_t str);
86 char* stringarray_at(stringarray_t*sa, int pos);
87 string_t stringarray_at2(stringarray_t*sa, int pos);
88 int stringarray_find(stringarray_t*sa, string_t*str);
89 void stringarray_clear(stringarray_t*sa);
90 void stringarray_destroy(stringarray_t*sa);
92 void map_init(map_t*map);
93 void map_put(map_t*map, string_t t1, string_t t2);
94 char* map_lookup(map_t*map, const char*name);
95 void map_dump(map_t*map, FILE*fi, const char*prefix);
96 void map_clear(map_t*map);
97 void map_destroy(map_t*map);
99 void dictionary_init(dictionary_t*dict);
100 void dictionary_put(dictionary_t*dict, string_t t1, void* t2);
101 void dictionary_put2(dictionary_t*dict, const char* t1, void* t2);
102 void* dictionary_lookup(dictionary_t*dict, const char*name);
103 void dictionary_dump(dictionary_t*dict, FILE*fi, const char*prefix);
104 void dictionary_del(dictionary_t*dict, const char* name);
105 void dictionary_clear(dictionary_t*dict);
106 void dictionary_destroy(dictionary_t*dict);
108 char* strdup_n(const char*str, int size);
110 void* qmalloc_internal(int len);
111 void* qrealloc_internal(void*old, int len);
112 void qfree_internal(void*old);
114 #define qmalloc(len) qmalloc_internal(len)
115 #define qrealloc(old, len) qmalloc_internal(old, len)
116 #define qfree(old) qmalloc_internal(old)