Lines Matching refs:pThis

72 static lnode *appendPrim(list pThis, void *el)  in appendPrim()  argument
77 if (pThis->tail != 0) { in appendPrim()
78 flink = &(pThis->tail->next); in appendPrim()
79 blink = pThis->tail; in appendPrim()
81 flink = &pThis->head; in appendPrim()
83pThis->cptr = ptr; /*- list was empty - set current to pThis element */ in appendPrim()
87 pThis->tail = ptr; in appendPrim()
92 pThis->aCount++; in appendPrim()
96 static lnode *prependPrim(list pThis, void *el) in prependPrim() argument
101 if (pThis->head != 0) { in prependPrim()
102 blink = &(pThis->head->prev); in prependPrim()
103 flink = pThis->head; in prependPrim()
105 blink = &pThis->tail; in prependPrim()
107pThis->cptr = ptr; /*- list was empty - set current to pThis element */ in prependPrim()
111 pThis->head = ptr; in prependPrim()
116 pThis->aCount++; in prependPrim()
124 list pThis = (list)rtl_allocateMemory(sizeof(struct _list)); in listNewEmpty() local
125 assert(pThis != 0); in listNewEmpty()
127 pThis->aCount = 0; in listNewEmpty()
128 pThis->eDtor = 0; in listNewEmpty()
129 pThis->head = pThis->tail = pThis->cptr = 0; in listNewEmpty()
131 return pThis; in listNewEmpty()
138 list pThis; in listNewCopy() local
141 pThis = rtl_allocateMemory(sizeof(struct _list)); in listNewCopy()
142 assert(pThis != 0); in listNewCopy()
146 pThis->aCount = 0; in listNewCopy()
147 pThis->eDtor = 0; in listNewCopy()
148 pThis->head = pThis->tail = pThis->cptr = 0; in listNewCopy()
151 c = appendPrim(pThis, ptr->value); in listNewCopy()
152 if (ptr == l->cptr) pThis->cptr = c; in listNewCopy()
156 return pThis; in listNewCopy()
160 void listDispose(list pThis) /*- dtor */ in listDispose() argument
162 assert(pThis != 0); in listDispose()
163 listClear(pThis); in listDispose()
164 rtl_freeMemory(pThis); in listDispose()
167 void listSetElementDtor(list pThis, list_destructor f) in listSetElementDtor() argument
169 assert(pThis != 0); in listSetElementDtor()
170 pThis->eDtor = f; in listSetElementDtor()
174 void *listCurrent(list pThis) in listCurrent() argument
176 assert(pThis != 0); in listCurrent()
177 assert(pThis->cptr != 0); in listCurrent()
178 return pThis->cptr->value; in listCurrent()
181 int listCount(list pThis) in listCount() argument
183 assert(pThis != 0); in listCount()
184 return pThis->aCount; in listCount()
187 int listIsEmpty(list pThis) in listIsEmpty() argument
189 assert(pThis != 0); in listIsEmpty()
190 return pThis->aCount == 0; in listIsEmpty()
195 int listAtFirst(list pThis) in listAtFirst() argument
197 assert(pThis != 0); in listAtFirst()
198 return pThis->cptr == pThis->head; in listAtFirst()
201 int listAtLast(list pThis) in listAtLast() argument
203 assert(pThis != 0); in listAtLast()
204 return pThis->cptr == pThis->tail; in listAtLast()
207 int listPosition(list pThis) in listPosition() argument
211 assert(pThis != 0); in listPosition()
213 ptr = pThis->head; in listPosition()
215 while (ptr != pThis->cptr) { in listPosition()
223 int listFind(list pThis, void *el) in listFind() argument
226 assert(pThis != 0); in listFind()
228 ptr = pThis->head; in listFind()
232 pThis->cptr = ptr; in listFind()
241 int listNext(list pThis) in listNext() argument
243 return listSkipForward(pThis, 1); in listNext()
246 int listSkipForward(list pThis, int n) in listSkipForward() argument
249 assert(pThis != 0); in listSkipForward()
251 if (pThis->cptr == 0) return 0; in listSkipForward()
254 if (pThis->cptr->next == 0) break; in listSkipForward()
255 pThis->cptr = pThis->cptr->next; in listSkipForward()
262 int listToFirst(list pThis) in listToFirst() argument
264 assert(pThis != 0); in listToFirst()
266 if (pThis->cptr != pThis->head) { in listToFirst()
267 pThis->cptr = pThis->head; in listToFirst()
273 int listToLast(list pThis) in listToLast() argument
275 assert(pThis != 0); in listToLast()
277 if (pThis->cptr != pThis->tail) { in listToLast()
278 pThis->cptr = pThis->tail; in listToLast()
284 int listPositionAt(list pThis, int n) /*- returns the actual position number… in listPositionAt() argument
287 assert(pThis != 0); in listPositionAt()
289 pThis->cptr = pThis->head; in listPositionAt()
291 if (pThis->cptr->next == 0) break; in listPositionAt()
292 pThis->cptr = pThis->cptr->next; in listPositionAt()
299 list listAppend(list pThis, void *el) in listAppend() argument
301 assert(pThis != 0); in listAppend()
303 appendPrim(pThis, el); in listAppend()
304 return pThis; in listAppend()
307 list listPrepend(list pThis, void *el) in listPrepend() argument
309 assert(pThis != 0); in listPrepend()
311 prependPrim(pThis, el); in listPrepend()
312 return pThis; in listPrepend()
315 list listInsertAfter(list pThis, void *el) in listInsertAfter() argument
318 assert(pThis != 0); in listInsertAfter()
320 if (pThis->cptr == 0) return listAppend(pThis, el); in listInsertAfter()
324 ptr->prev = pThis->cptr; in listInsertAfter()
325 ptr->next = pThis->cptr->next; in listInsertAfter()
326 pThis->cptr->next = ptr; in listInsertAfter()
331 pThis->tail = ptr; in listInsertAfter()
333 pThis->aCount++; in listInsertAfter()
334 return pThis; in listInsertAfter()
337 list listInsertBefore(list pThis, void *el) in listInsertBefore() argument
340 assert(pThis != 0); in listInsertBefore()
342 if (pThis->cptr == 0) return listAppend(pThis, el); in listInsertBefore()
346 ptr->prev = pThis->cptr->prev; in listInsertBefore()
347 ptr->next = pThis->cptr; in listInsertBefore()
348 pThis->cptr->prev = ptr; in listInsertBefore()
353 pThis->head = ptr; in listInsertBefore()
355 pThis->aCount++; in listInsertBefore()
356 return pThis; in listInsertBefore()
359 list listRemove(list pThis) in listRemove() argument
362 if (pThis->cptr == 0) return pThis; in listRemove()
364 if (pThis->cptr->next != 0) { in listRemove()
365 ptr = pThis->cptr->next; in listRemove()
366 pThis->cptr->next->prev = pThis->cptr->prev; in listRemove()
368 pThis->tail = pThis->cptr->prev; in listRemove()
371 if (pThis->cptr->prev != 0) { in listRemove()
372 if (ptr == 0) ptr = pThis->cptr->prev; in listRemove()
373 pThis->cptr->prev->next = pThis->cptr->next; in listRemove()
375 pThis->head = pThis->cptr->next; in listRemove()
378 if (pThis->eDtor) pThis->eDtor(pThis->cptr->value); /* call the dtor callback */ in listRemove()
380 rtl_freeMemory(pThis->cptr); in listRemove()
381 pThis->aCount--; in listRemove()
382 pThis->cptr = ptr; in listRemove()
383 return pThis; in listRemove()
386 list listClear(list pThis) in listClear() argument
388 lnode *node = pThis->head, *ptr; in listClear()
392 if (pThis->eDtor) pThis->eDtor(node->value); /* call the dtor callback */ in listClear()
394 pThis->aCount--; in listClear()
398 pThis->head = pThis->tail = pThis->cptr = 0; in listClear()
399 assert(pThis->aCount == 0); in listClear()
400 return pThis; in listClear()
405 void listForAll(list pThis, void (*f)(void *)) in listForAll() argument
407 lnode *ptr = pThis->head; in listForAll()