abyss_data.h
Go to the documentation of this file.00001 #ifndef DATA_H_INCLUDED
00002 #define DATA_H_INCLUDED
00003
00004 #include "abyss_thread.h"
00005
00006
00007
00008
00009
00010 typedef struct {
00011 void **item;
00012 uint16_t size;
00013 uint16_t maxsize;
00014 abyss_bool autofree;
00015 } TList;
00016
00017 void
00018 ListInit(TList * const listP);
00019
00020 void
00021 ListInitAutoFree(TList * const listP);
00022
00023 void
00024 ListFree(TList * const listP);
00025
00026 void
00027 ListFreeItems(TList * const listP);
00028
00029 abyss_bool
00030 ListAdd(TList * const listP,
00031 void * const str);
00032
00033 void
00034 ListRemove(TList * const listP);
00035
00036 abyss_bool
00037 ListAddFromString(TList * const listP,
00038 const char * const c);
00039
00040 abyss_bool
00041 ListFindString(TList * const listP,
00042 const char * const str,
00043 uint16_t * const indexP);
00044
00045
00046 typedef struct
00047 {
00048 char *name,*value;
00049 uint16_t hash;
00050 } TTableItem;
00051
00052 typedef struct
00053 {
00054 TTableItem *item;
00055 uint16_t size,maxsize;
00056 } TTable;
00057
00058 void
00059 TableInit(TTable * const t);
00060
00061 void
00062 TableFree(TTable * const t);
00063
00064 abyss_bool
00065 TableAdd(TTable * const t,
00066 const char * const name,
00067 const char * const value);
00068
00069 abyss_bool
00070 TableAddReplace(TTable * const t,
00071 const char * const name,
00072 const char * const value);
00073
00074 abyss_bool
00075 TableFindIndex(TTable * const t,
00076 const char * const name,
00077 uint16_t * const index);
00078
00079 char *
00080 TableFind(TTable * const t,
00081 const char * const name);
00082
00083
00084
00085
00086
00087
00088 typedef struct _TPoolZone {
00089 char * pos;
00090 char * maxpos;
00091 struct _TPoolZone * next;
00092 struct _TPoolZone * prev;
00093
00094 char data[1];
00095 } TPoolZone;
00096
00097 typedef struct {
00098 TPoolZone * firstzone;
00099 TPoolZone * currentzone;
00100 uint32_t zonesize;
00101 TMutex mutex;
00102 } TPool;
00103
00104 abyss_bool
00105 PoolCreate(TPool * const poolP,
00106 uint32_t const zonesize);
00107
00108 void
00109 PoolFree(TPool * const poolP);
00110
00111 void *
00112 PoolAlloc(TPool * const poolP,
00113 uint32_t const size);
00114
00115 void
00116 PoolReturn(TPool * const poolP,
00117 void * const blockP);
00118
00119 const char *
00120 PoolStrdup(TPool * const poolP,
00121 const char * const origString);
00122
00123
00124 #endif