2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2003 by authors.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
37 //*****************************************************************************
38 //*****************************************************************************
42 //*****************************************************************************
43 //*****************************************************************************
46 // Some useful things to track parameters.
61 // The list entry. This should not be modified outside the list routines.
63 typedef struct ALlistEntry_Struct
66 // The previous list entry.
68 struct ALlistEntry_Struct
* Previous
;
71 // The next list entry.
73 struct ALlistEntry_Struct
* Next
;
76 // The data for the current entry.
84 // This is the context to pass to all the list calls. It must be initialized
85 // before any list calls are made.
87 typedef struct //ALlist_Struct
90 // This is the pointer to the first item in the list.
95 // This is the pointer to the last item in the list.
100 // This is the list iterator.
102 ALlistEntry
* Current
;
105 // This is the list lock to prevent simultaneous addition and removal
108 CRITICAL_SECTION Lock
;
111 // This maintains a count of the number of entries in the list.
113 ALint NumberOfEntries
;
116 // This is set if the list is locked. For debug use only.
126 //*****************************************************************************
127 //*****************************************************************************
131 //*****************************************************************************
132 //*****************************************************************************
134 //*****************************************************************************
136 //*****************************************************************************
137 // Adds an entry to the tail of the list. Each entry must be unique.
139 ALvoid alListAddEntry
142 IN ALlistEntry
* pEntry
145 //*****************************************************************************
146 // alListAddEntryToHead
147 //*****************************************************************************
148 // Adds an entry to the head of the list. Each entry must be unique.
150 ALvoid alListAddEntryToHead
153 IN ALlistEntry
* pEntry
156 //*****************************************************************************
158 //*****************************************************************************
159 // This is called to acquire the list lock for operations that span multiple
160 // list calls like iterating over the list.
162 ALvoid alListAcquireLock
167 //*****************************************************************************
169 //*****************************************************************************
170 // Creates and initializes a list.
172 ALboolean alListCreate
177 //*****************************************************************************
179 //*****************************************************************************
180 // Destroys the list. Dynamically allocated entries are not freed.
187 //*****************************************************************************
189 //*****************************************************************************
190 // Returns the data from the list entry.
192 ALvoid
* alListGetData
194 IN ALlistEntry
* pEntry
197 //*****************************************************************************
199 //*****************************************************************************
200 // Returns the entry in the list at the specified index of the list.
202 ALlistEntry
* alListGetEntryAt
208 //*****************************************************************************
209 // alListGetEntryCount
210 //*****************************************************************************
211 // Returns the number of items stored in the list.
213 ALint alListGetEntryCount
218 //*****************************************************************************
220 //*****************************************************************************
221 // Returns the first entry in the list.
223 ALlistEntry
* alListGetHead
228 //*****************************************************************************
230 //*****************************************************************************
231 // Returns the entry after to the entry pointed to by the iterator. If
232 // the iterator is at the last entry (or has finished iterating over the
233 // list), the returned entry will be 0.
235 ALlistEntry
* alListGetNext
240 //*****************************************************************************
242 //*****************************************************************************
243 // Returns the entry previous to the entry pointed to by the iterator. If
244 // the iterator is at the first entry, the returned entry will be 0.
246 ALlistEntry
* alListGetPrevious
251 //*****************************************************************************
253 //*****************************************************************************
254 // Returns the last entry in the list.
256 ALlistEntry
* alListGetTail
261 //*****************************************************************************
262 // alListInitializeEntry
263 //*****************************************************************************
264 // Initializes a preallocated list entry.
266 ALvoid alListInitializeEntry
268 IN ALlistEntry
* pListEntry
,
272 //*****************************************************************************
274 //*****************************************************************************
275 // Returns the TRUE if the list is empty.
277 ALboolean alListIsEmpty
282 //*****************************************************************************
284 //*****************************************************************************
285 // Returns the entry pointed to by the iterator.
287 ALlistEntry
* alListIteratorGet
292 //*****************************************************************************
293 // alListIteratorFindData
294 //*****************************************************************************
295 // Searches the list for the matching item and return the pointer to the
296 // entry. If the match is not found, the return will be 0.
298 ALlistEntry
* alListIteratorFindData
304 //*****************************************************************************
305 // alListIteratorNext
306 //*****************************************************************************
307 // This is called to advance the list iterator to the next entry in the list
308 // and return that entry.
310 ALlistEntry
* alListIteratorNext
315 //*****************************************************************************
316 // alListIteratorPrevious
317 //*****************************************************************************
318 // This is called to advance the list iterator to the previous entry in the
319 // list and return that entry.
321 ALlistEntry
* alListIteratorPrevious
326 //*****************************************************************************
327 // alListIteratorReset
328 //*****************************************************************************
329 // Returns the list iterator to the head of the list and returns the head
332 ALlistEntry
* alListIteratorReset
337 //*****************************************************************************
338 // alListIteratorRemove
339 //*****************************************************************************
340 // Removes the current item from the list and returns it. The iterator will
341 // equal the next item in the list.
343 ALlistEntry
* alListIteratorRemove
348 //*****************************************************************************
350 //*****************************************************************************
351 // Sets the current entry pointer to the entry passed in. If the entry is not
352 // found, the current entry will be 0.
354 ALlistEntry
* alListIteratorSet
357 IN ALlistEntry
* pEntry
360 //*****************************************************************************
362 //*****************************************************************************
363 // Matches the entry to an item in the list and returns the data in that
364 // entry. If the match is not found, the return will be 0.
366 ALvoid
* alListMatchEntry
369 IN ALlistEntry
* pEntry
372 //*****************************************************************************
374 //*****************************************************************************
375 // Searches the list for the matching item and return the pointer to the
376 // entry. If the match is not found, the return will be 0.
378 ALlistEntry
* alListMatchData
384 //*****************************************************************************
386 //*****************************************************************************
387 // This is called to release the list lock.
389 ALvoid alListReleaseLock
394 //*****************************************************************************
396 //*****************************************************************************
397 // Removes the item from the list and returns the data from the item. If
398 // this is the current item, the current item will equal the next item in the
401 ALvoid
* alListRemoveEntry
404 IN ALlistEntry
* pEntry
407 //*****************************************************************************
409 //*****************************************************************************
410 // Removes the list entry at the head of the list. If this is the current
411 // item, the current item will equal the next item in the list.
413 ALlistEntry
* alListRemoveHead
418 //*****************************************************************************
420 //*****************************************************************************
421 // Removes the list entry at the tail of the list. If this is the current
422 // item, the current item will be null.
424 ALlistEntry
* alListRemoveTail