UbixOS V2 2.0

lists.h
Go to the documentation of this file.
1 /*-
2 * Copyright (c) 2002-2018 The UbixOS Project.
3 * All rights reserved.
4 *
5 * This was developed by Christopher W. Olsen for the UbixOS Project.
6 *
7 * Redistribution and use in source and binary forms, with or without modification, are permitted
8 * provided that the following conditions are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright notice, this list of
11 * conditions, the following disclaimer and the list of authors.
12 * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13 * conditions, the following disclaimer and the list of authors in the documentation and/or
14 * other materials provided with the distribution.
15 * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16 * endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #define IN
30 #define STATUS_FAILURE -1
31 #define STATUS_SUCCESS 0
32
33 typedef struct _item_t Item_t;
34 typedef struct _list_t List_t;
35 struct _item_t {
36 Item_t *Previous;
37 Item_t *Next;
38 void *data;
39 };
40
41 struct _list_t {
42 Item_t *First;
43 Item_t *Last;
44 };
45
46 List_t *
47 InitializeList();
48 Item_t *
49 CreateItem();
50 int
51 InsertItemAtFront( IN List_t * TList, IN Item_t * kItem);
52 int
53 InsertItemBetweenItems( IN List_t * TList, IN Item_t * Previous, IN Item_t * Next, IN Item_t * Insert);
54 int
55 RemoveItem( IN List_t * TList, IN Item_t * kItem);
56 int
57 DestroyItemsInList(IN List_t * ItemList);
58 int
59 DestroyItemList(IN List_t * ItemList);
60 Item_t *
61 GetFirstItem(IN List_t * kItem);
62
63 Item_t *
64 GetLastItem(IN List_t * kItem);
65 List_t *
66 RemoveItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next);
67
68 void
69 InsertItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next, IN List_t * Insert);
GetLastItem
Item_t * GetLastItem(List_t *kItem)
_item_t
Definition: lists.h:35
RemoveItem
int RemoveItem(List_t *TList, Item_t *kItem)
_list_t
Definition: lists.h:41
InsertItemAtFront
int InsertItemAtFront(List_t *TList, Item_t *kItem)
InitializeList
List_t * InitializeList()
InsertItemBetweenItems
int InsertItemBetweenItems(List_t *TList, Item_t *Previous, Item_t *Next, Item_t *Insert)
IN
#define IN
Definition: lists.h:29
_item_t::data
void * data
Definition: lists.h:38
InsertItemListBetweenItems
void InsertItemListBetweenItems(Item_t *Previous, Item_t *Next, List_t *Insert)
RemoveItemListBetweenItems
List_t * RemoveItemListBetweenItems(Item_t *Previous, Item_t *Next)
_item_t::Previous
Item_t * Previous
Definition: lists.h:36
GetFirstItem
Item_t * GetFirstItem(List_t *kItem)
CreateItem
Item_t * CreateItem()
DestroyItemsInList
int DestroyItemsInList(List_t *ItemList)
DestroyItemList
int DestroyItemList(List_t *ItemList)
_list_t::First
Item_t * First
Definition: lists.h:42
_list_t::Last
Item_t * Last
Definition: lists.h:43
_item_t::Next
Item_t * Next
Definition: lists.h:37