X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fq.h;h=2ea7fe1faa923df5207a4d3f0ae777862cab46b6;hp=df1c07459ad10bc3eaeb36e6f3a57bf6752dbcd8;hb=2ddfa640af28b592ecf4295f0b1b7b43c923f707;hpb=66a03382aab040571f94b0861719753bda3ff8f1 diff --git a/lib/q.h b/lib/q.h index df1c074..2ea7fe1 100644 --- a/lib/q.h +++ b/lib/q.h @@ -23,6 +23,7 @@ #define __q_h__ #include +#include "mem.h" #ifdef __cplusplus extern "C" { @@ -72,6 +73,7 @@ typedef struct _type_t { extern type_t charptr_type; extern type_t stringstruct_type; extern type_t ptr_type; +extern type_t int_type; typedef struct _dictentry { void*key; @@ -131,9 +133,23 @@ typedef struct _trie { void*rollback; } trie_t; +/* move to front list structure */ +typedef struct _mtf_item { + const void*key; + int num; + struct _mtf_item*next; +} mtf_item_t; + +typedef struct _mtf { + mtf_item_t*first; + type_t*type; +} mtf_t; + char* strdup_n(const char*str, int size); char* allocprintf(const char*str, ...); +float medianf(float*values, int n); + unsigned int crc32_add_byte(unsigned int crc32, unsigned char b); unsigned int crc32_add_string(unsigned int crc32, const char*s); @@ -189,6 +205,7 @@ dictentry_t* dict_get_slot(dict_t*h, const void*key); char dict_contains(dict_t*h, const void*s); void* dict_lookup(dict_t*h, const void*s); char dict_del(dict_t*h, const void*s); +char dict_del2(dict_t*h, const void*key, void*data); dict_t*dict_clone(dict_t*); void dict_foreach_keyvalue(dict_t*h, void (*runFunction)(void*data, const void*key, void*val), void*data); @@ -238,6 +255,10 @@ void trie_remember(trie_t*t); void trie_rollback(trie_t*t); void trie_dump(trie_t*t); +mtf_t* mtf_new(type_t*type); +void mtf_increase(mtf_t*m, const void*key); +void mtf_destroy(mtf_t*m); + array_t* array_new(); array_t* array_new2(type_t*type); void array_free(array_t*array);