diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/luaproc/list.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/libraries/luaproc/list.h b/libraries/luaproc/list.h new file mode 100644 index 0000000..6aa21c0 --- /dev/null +++ b/libraries/luaproc/list.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /*************************************************** | ||
2 | |||
3 | Copyright 2008 Alexandre Skyrme, Noemi Rodriguez, Roberto Ierusalimschy | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in | ||
13 | all copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | THE SOFTWARE. | ||
22 | |||
23 | ***************************************************** | ||
24 | |||
25 | [list.h] | ||
26 | |||
27 | ****************************************************/ | ||
28 | |||
29 | #ifndef _LIST_H_ | ||
30 | #define _LIST_H_ | ||
31 | |||
32 | #define LIST_COUNT_ERROR -1 | ||
33 | |||
34 | /* node pointer type */ | ||
35 | typedef struct stnode *node; | ||
36 | |||
37 | /* list pointer type */ | ||
38 | typedef struct stlist *list; | ||
39 | |||
40 | /* create new (empty) list */ | ||
41 | list list_new( void ); | ||
42 | |||
43 | /* create new node */ | ||
44 | node list_new_node( void *data ); | ||
45 | |||
46 | /* add node to list */ | ||
47 | node list_add( list lst, node n ); | ||
48 | |||
49 | /* search for a node */ | ||
50 | node list_search( list lst, void *data ); | ||
51 | |||
52 | /* remove node from list */ | ||
53 | void list_remove( list lst, node n ); | ||
54 | |||
55 | /* destroy list */ | ||
56 | void list_destroy( list lst ); | ||
57 | |||
58 | /* return list's first node */ | ||
59 | node list_head( list lst ); | ||
60 | |||
61 | /* return node's next node */ | ||
62 | node list_next( node n ); | ||
63 | |||
64 | /* return a node's data */ | ||
65 | void *list_data( node n ); | ||
66 | |||
67 | /* pop the head node from the list */ | ||
68 | node list_pop_head( list lst ); | ||
69 | |||
70 | /* destroy a node */ | ||
71 | void list_destroy_node( node n ); | ||
72 | |||
73 | /* return a list's node count */ | ||
74 | int list_node_count( list lst ); | ||
75 | |||
76 | #endif | ||