4 Part of the swftools package.
6 Copyright (c) 2001,2002,2003,2004 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 /* fifo buffered growing mem region */
40 typedef struct _ringbuffer_t
46 /* non-nul terminated string */
47 typedef struct _string_t {
52 /* key/value pairs of strings */
53 typedef struct _map_t {
57 /* (void*)s referenced by strings */
58 typedef struct _dictionary_t {
62 /* array of strings */
63 typedef struct _stringarray_t
76 int(*compare)(const void *, const void *);
79 void mem_init(mem_t*mem);
80 int mem_put(mem_t*m, void*data, int length);
81 int mem_putstring(mem_t*m, string_t str);
82 void mem_clear(mem_t*mem);
83 void mem_destroy(mem_t*mem);
85 void ringbuffer_init(ringbuffer_t*r);
86 void ringbuffer_put(ringbuffer_t*r, void*buf, int size);
87 int ringbuffer_read(ringbuffer_t*r, void*buf, int size);
88 void ringbuffer_clear(ringbuffer_t*r);
90 void string_set(string_t*str, char*text);
91 void string_set2(string_t*str, char*text, int len);
92 void string_dup(string_t*str, const char*text);
93 void string_dup2(string_t*str, const char*text, int len);
94 int string_equals(string_t*str, const char*text);
96 void stringarray_init(stringarray_t*sa);
97 void stringarray_put(stringarray_t*sa, string_t str);
98 char* stringarray_at(stringarray_t*sa, int pos);
99 string_t stringarray_at2(stringarray_t*sa, int pos);
100 int stringarray_find(stringarray_t*sa, string_t*str);
101 void stringarray_clear(stringarray_t*sa);
102 void stringarray_destroy(stringarray_t*sa);
104 void map_init(map_t*map);
105 void map_put(map_t*map, string_t t1, string_t t2);
106 char* map_lookup(map_t*map, const char*name);
107 void map_dump(map_t*map, FILE*fi, const char*prefix);
108 void map_clear(map_t*map);
109 void map_destroy(map_t*map);
111 void dictionary_init(dictionary_t*dict);
112 void dictionary_put(dictionary_t*dict, string_t t1, void* t2);
113 void dictionary_put2(dictionary_t*dict, const char* t1, void* t2);
114 void* dictionary_lookup(dictionary_t*dict, const char*name);
115 void dictionary_dump(dictionary_t*dict, FILE*fi, const char*prefix);
116 void dictionary_del(dictionary_t*dict, const char* name);
117 void dictionary_clear(dictionary_t*dict);
118 void dictionary_destroy(dictionary_t*dict);
120 void heap_init(heap_t*h,int n,int elem_size, int(*compare)(const void *, const void *));
121 void heap_clear(heap_t*h);
122 void heap_put(heap_t*h, void*e);
123 int heap_size(heap_t*h);
124 void* heap_max(heap_t*h);
125 void* heap_chopmax(heap_t*h);
126 void heap_dump(heap_t*h, FILE*fi);
127 void** heap_flatten(heap_t*h);
129 char* strdup_n(const char*str, int size);