X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fq.h;h=064949a3e36f92646520645003c059c80e98a226;hp=76bdd302c02c26d1a99733e23aa9038f59f7ddf8;hb=9788caae660683c6c8f98f53b3fc1a4274b73e47;hpb=bfe1524aca3a4f25d685e6552422d1e1986f570b diff --git a/lib/q.h b/lib/q.h index 76bdd30..064949a 100644 --- a/lib/q.h +++ b/lib/q.h @@ -3,7 +3,7 @@ Part of the swftools package. - Copyright (c) 2001,2002,2003 Matthias Kramm + Copyright (c) 2001,2002,2003,2004 Matthias Kramm This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ typedef struct _mem_t { int pos; } mem_t; +/* fifo buffered growing mem region */ typedef struct _ringbuffer_t { void*internal; @@ -64,6 +65,17 @@ typedef struct _stringarray_t void*internal; } stringarray_t; +/* heap */ +typedef struct _heap +{ + void**elements; + char*data; + int elem_size; + int size; + int max_size; + int(*compare)(const void *, const void *); +} heap_t; + void mem_init(mem_t*mem); int mem_put(mem_t*m, void*data, int length); int mem_putstring(mem_t*m, string_t str); @@ -105,6 +117,15 @@ void dictionary_del(dictionary_t*dict, const char* name); void dictionary_clear(dictionary_t*dict); void dictionary_destroy(dictionary_t*dict); +void heap_init(heap_t*h,int n,int elem_size, int(*compare)(const void *, const void *)); +void heap_clear(heap_t*h); +void heap_put(heap_t*h, void*e); +int heap_size(heap_t*h); +void* heap_max(heap_t*h); +void* heap_chopmax(heap_t*h); +void heap_dump(heap_t*h, FILE*fi); +void** heap_flatten(heap_t*h); + char* strdup_n(const char*str, int size); void* qmalloc_internal(int len);