30 #define DISABLE_DEBUGLOG 33 #include <gwenhywfar/misc.h> 34 #include <gwenhywfar/debug.h> 75 if (l->firstElement==0)
78 el->prevElement=l->lastElement;
80 l->lastElement->nextElement=el;
98 while ((el=l->firstElement)) {
115 el->nextElement=l->firstElement;
118 if (l->lastElement==0)
142 el->prevElement->nextElement=el->nextElement;
146 el->nextElement->prevElement=el->prevElement;
149 if (l->firstElement==el)
150 l->firstElement=el->nextElement;
151 if (l->lastElement==el)
152 l->lastElement=el->prevElement;
157 if (el->parent->firstChild==el)
158 el->parent->firstChild=el->nextElement;
159 if (el->parent->lastChild==el)
160 el->parent->lastChild=el->prevElement;
164 el->nextElement=
NULL;
165 el->prevElement=
NULL;
177 l=elToReplace->treePtr;
185 if (elReplacement->treePtr!=
NULL) {
191 elReplacement->nextElement=
NULL;
192 elReplacement->prevElement=
NULL;
193 elReplacement->parent=
NULL;
195 elReplacement->treePtr=elToReplace->treePtr;
198 if (elToReplace->prevElement)
199 elToReplace->prevElement->nextElement=elReplacement;
202 if (elToReplace->nextElement)
203 elToReplace->nextElement->prevElement=elReplacement;
206 if (l->firstElement==elToReplace)
207 l->firstElement=elReplacement;
208 if (l->lastElement==elToReplace)
209 l->lastElement=elReplacement;
210 l->count-=(elToReplace->count)+1;
211 l->count+=(elReplacement->count)+1;
214 if (elToReplace->parent) {
215 elReplacement->parent=elToReplace->parent;
216 if (elToReplace->parent->firstChild==elToReplace)
217 elToReplace->parent->firstChild=elToReplace;
218 if (elToReplace->parent->lastChild==elToReplace)
219 elToReplace->parent->lastChild=elToReplace;
220 elToReplace->count-=(elToReplace->count)+1;
221 elToReplace->count+=(elReplacement->count)+1;
224 elToReplace->nextElement=
NULL;
225 elToReplace->prevElement=
NULL;
226 elToReplace->parent=
NULL;
227 elToReplace->treePtr=
NULL;
242 if (where->firstChild==0)
243 where->firstChild=el;
245 el->prevElement=where->lastChild;
246 if (where->lastChild)
247 where->lastChild->nextElement=el;
252 el->treePtr=where->treePtr;
253 el->treePtr->count++;
268 el->nextElement=where->firstChild;
269 where->firstChild=el;
271 if (where->lastChild==
NULL)
276 el->treePtr=where->treePtr;
277 el->treePtr->count++;
287 return l->firstElement->data;
296 return l->lastElement->data;
321 if (el->firstChild) {
334 return el->prevElement->data;
343 return el->nextElement->data;
352 return el->firstChild->data;
353 else if (el->nextElement)
354 return el->nextElement->data;
357 while (el && el->parent) {
358 if (el->parent->nextElement)
359 return el->parent->nextElement->data;
373 return el->firstChild->data;
382 return el->lastChild->data;
391 return el->parent->data;
void * GWEN_TreeElement_GetLastChild(const GWEN_TREE_ELEMENT *el)
struct GWEN_TREE_ELEMENT GWEN_TREE_ELEMENT
void * GWEN_Tree_GetFirst(const GWEN_TREE *l)
void * GWEN_TreeElement_GetParent(const GWEN_TREE_ELEMENT *el)
void GWEN_Tree_AddList(GWEN_TREE *dest, GWEN_TREE *l)
#define GWEN_FREE_OBJECT(varname)
int GWEN_Tree_GetCount(const GWEN_TREE *l)
void GWEN_Tree_free(GWEN_TREE *l)
void * GWEN_TreeElement_GetFirstChild(const GWEN_TREE_ELEMENT *el)
void GWEN_Tree_InsertChild(GWEN_TREE_ELEMENT *where, GWEN_TREE_ELEMENT *el)
void * GWEN_Tree_GetLast(const GWEN_TREE *l)
void GWEN_Tree_Del(GWEN_TREE_ELEMENT *el)
void * GWEN_TreeElement_GetNext(const GWEN_TREE_ELEMENT *el)
void * GWEN_TreeElement_GetPrevious(const GWEN_TREE_ELEMENT *el)
GWEN_TREE_ELEMENT * GWEN_TreeElement_new(void *d)
#define GWEN_NEW_OBJECT(typ, varname)
void GWEN_Tree_Replace(GWEN_TREE_ELEMENT *elToReplace, GWEN_TREE_ELEMENT *elReplacement)
void GWEN_Tree_AddChild(GWEN_TREE_ELEMENT *where, GWEN_TREE_ELEMENT *el)
uint32_t GWEN_TreeElement_GetChildrenCount(const GWEN_TREE_ELEMENT *el)
GWEN_TREE * GWEN_Tree_new(void)
void GWEN_Tree_Insert(GWEN_TREE *l, GWEN_TREE_ELEMENT *el)
struct GWEN_TREE GWEN_TREE
#define DBG_ERROR(dbg_logger, format, args...)
void * GWEN_TreeElement_GetBelow(const GWEN_TREE_ELEMENT *el)
void GWEN_TreeElement_free(GWEN_TREE_ELEMENT *el)
void GWEN_Tree_Add(GWEN_TREE *l, GWEN_TREE_ELEMENT *el)