4 Part of the swftools package.
6 Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
8 This file is distributed under the GPL, see file COPYING for details */
14 #include "../config.h"
20 /* dynamically growing mem section */
21 typedef struct _mem_t {
27 typedef struct _ringbuffer_t
33 /* non-nul terminated string */
34 typedef struct _string_t {
39 /* key/value pairs of strings */
40 typedef struct _map_t {
44 /* (void*)s referenced by strings */
45 typedef struct _dictionary_t {
49 /* array of strings */
50 typedef struct _stringarray_t
55 void mem_init(mem_t*mem);
56 int mem_put(mem_t*m, void*data, int length);
57 int mem_putstring(mem_t*m, string_t str);
58 void mem_clear(mem_t*mem);
59 void mem_destroy(mem_t*mem);
61 void ringbuffer_init(ringbuffer_t*r);
62 void ringbuffer_put(ringbuffer_t*r, void*buf, int size);
63 int ringbuffer_read(ringbuffer_t*r, void*buf, int size);
64 void ringbuffer_clear(ringbuffer_t*r);
66 void string_set(string_t*str, char*text);
67 void string_set2(string_t*str, char*text, int len);
68 void string_dup(string_t*str, const char*text);
69 void string_dup2(string_t*str, const char*text, int len);
70 int string_equals(string_t*str, const char*text);
72 void stringarray_init(stringarray_t*sa);
73 void stringarray_put(stringarray_t*sa, string_t str);
74 char* stringarray_at(stringarray_t*sa, int pos);
75 string_t stringarray_at2(stringarray_t*sa, int pos);
76 int stringarray_find(stringarray_t*sa, string_t*str);
77 void stringarray_clear(stringarray_t*sa);
78 void stringarray_destroy(stringarray_t*sa);
80 void map_init(map_t*map);
81 void map_put(map_t*map, string_t t1, string_t t2);
82 char* map_lookup(map_t*map, const char*name);
83 void map_dump(map_t*map, FILE*fi, const char*prefix);
84 void map_clear(map_t*map);
85 void map_destroy(map_t*map);
87 void dictionary_init(dictionary_t*dict);
88 void dictionary_put(dictionary_t*dict, string_t t1, void* t2);
89 void dictionary_put2(dictionary_t*dict, const char* t1, void* t2);
90 void* dictionary_lookup(dictionary_t*dict, const char*name);
91 void dictionary_dump(dictionary_t*dict, FILE*fi, const char*prefix);
92 void dictionary_del(dictionary_t*dict, const char* name);
93 void dictionary_clear(dictionary_t*dict);
94 void dictionary_destroy(dictionary_t*dict);
96 char* strdup_n(const char*str, int size);
98 void* qmalloc_internal(int len);
99 void* qrealloc_internal(void*old, int len);
100 void qfree_internal(void*old);
102 #define qmalloc(len) qmalloc_internal(len)
103 #define qrealloc(old, len) qmalloc_internal(old, len)
104 #define qfree(old) qmalloc_internal(old)