DEADSOFTWARE

fixed player menu titles
[d2df-sdl.git] / src / lib / enet / enetlist.pp
1 {$mode objfpc}{$H+}
2 unit enetlist;
4 {
5 ENet - Reliable UDP networking library
7 FreePascal DLL header: enetlist.pp
8 Copyright (c) 2015 Dmitry D. Chernov aka Black Doomer
10 Original file: list.h
11 Copyright (c) 2002-2014 Lee Salzman
13 Version 1 for 1.3.12: 25.02.2015
15 Permission is hereby granted, free of charge, to any person obtaining a copy
16 of this software and associated documentation files (the "Software"), to deal
17 in the Software without restriction, including without limitation the rights
18 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 copies of the Software, and to permit persons to whom the Software is
20 furnished to do so, subject to the following conditions:
22 The above copyright notice and this permission notice shall be included in all
23 copies or substantial portions of the Software.
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 SOFTWARE.
32 }
34 interface
36 type
38 {$PACKRECORDS C}
40 pENetListNode = ^ENetListNode;
41 ENetListNode = record
42 next : pENetListNode;
43 previous : pENetListNode;
44 end;
46 ENetListIterator = pENetListNode;
48 pENetList = ^TENetList;
49 TENetList = record
50 sentinel : ENetListNode;
51 end;
53 {$PACKRECORDS DEFAULT}
55 //inline macros
56 function enet_list_begin( list: pENetList ): ENetListIterator; inline;
57 function enet_list_end( list: pENetList ): ENetListIterator; inline;
59 function enet_list_empty( list: pENetList ): Boolean; inline;
61 function enet_list_next( iterator: ENetListIterator ): ENetListIterator; inline;
62 function enet_list_previous( iterator: ENetListIterator ): ENetListIterator; inline;
64 function enet_list_front( list: pENetList ): Pointer; inline;
65 function enet_list_back( list: pENetList ): Pointer; inline;
67 implementation
69 function enet_list_begin( list: pENetList ): ENetListIterator; inline;
70 begin Result := list^.sentinel.next;
71 end;
72 function enet_list_end( list: pENetList ): ENetListIterator; inline;
73 begin Result := @( list^.sentinel );
74 end;
76 function enet_list_empty( list: pENetList ): Boolean; inline;
77 begin Result := enet_list_begin(list) = enet_list_end(list);
78 end;
80 function enet_list_next( iterator: ENetListIterator ): ENetListIterator; inline;
81 begin Result := iterator^.next;
82 end;
83 function enet_list_previous( iterator: ENetListIterator ): ENetListIterator; inline;
84 begin Result := iterator^.previous;
85 end;
87 function enet_list_front( list: pENetList ): Pointer; inline;
88 begin Result := Pointer( list^.sentinel.next );
89 end;
90 function enet_list_back( list: pENetList ): Pointer; inline;
91 begin Result := Pointer( list^.sentinel.previous );
92 end;
94 end.