3D-ICE 3.0.0
list_template.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is part of 3D-ICE, version 3.1.0 . *
3 * *
4 * 3D-ICE is free software: you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free *
6 * Software Foundation, either version 3 of the License, or any later *
7 * version. *
8 * *
9 * 3D-ICE is distributed in the hope that it will be useful, but WITHOUT *
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
12 * more details. *
13 * *
14 * You should have received a copy of the GNU General Public License along *
15 * with 3D-ICE. If not, see <http://www.gnu.org/licenses/>. *
16 * *
17 * Copyright (C) 2021 *
18 * Embedded Systems Laboratory - Ecole Polytechnique Federale de Lausanne *
19 * All Rights Reserved. *
20 * *
21 * Authors: Arvind Sridhar Alessandro Vincenzi *
22 * Giseong Bak Martino Ruggiero *
23 * Thomas Brunschwiler Eder Zulian *
24 * Federico Terraneo Darong Huang *
25 * Luis Costero Marina Zapater *
26 * David Atienza *
27 * *
28 * For any comment, suggestion or request about 3D-ICE, please register and *
29 * write to the mailing list (see http://listes.epfl.ch/doc.cgi?liste=3d-ice) *
30 * Any usage of 3D-ICE for research, commercial or other purposes must be *
31 * properly acknowledged in the resulting products or publications. *
32 * *
33 * EPFL-STI-IEL-ESL Mail : 3d-ice@listes.epfl.ch *
34 * Batiment ELG, ELG 130 (SUBSCRIPTION IS NECESSARY) *
35 * Station 11 *
36 * 1015 Lausanne, Switzerland Url : http://esl.epfl.ch/3d-ice *
37 ******************************************************************************/
38
41#include <stdio.h> // For the file type FILE
42
43#ifndef ListType
44#error missing macro ListType
45#endif
46
47#ifndef ListName
48#error missing macro ListName
49#endif
50
51#define PASTER(x,y) x ## y
52#define CNT(x,y) PASTER(x,y)
53
54#define LIST_NODE(nodetype, datatype) \
55 \
56 \
57 \
58 struct nodetype \
59 { \
60 \
61 \
62 datatype Data ; \
63 \
64 \
65 \
66 struct nodetype *Prev ; \
67 \
68 \
69 \
70 struct nodetype *Next ; \
71 } ; \
72 \
73 \
74 \
75 typedef struct nodetype nodetype ;
76
77
78#define LIST(listtype, nodetype) \
79 \
80 \
81 \
82 struct listtype \
83 { \
84 \
85 \
86 Quantity_t Size ; \
87 \
88 \
89 \
90 nodetype *First ; \
91 \
92 \
93 \
94 nodetype *Last ; \
95 } ; \
96 \
97 \
98 \
99 typedef struct listtype listtype ;
100
101
102
103#define FPROTO1(return, fid, param) \
104 \
105 return fid (param)
106
107#define FPROTO2(return, fid, param1, param2) \
108 \
109 return fid (param1, param2)
110
111#define FPROTO3(return, fid, param1, param2, param3) \
112 \
113 return fid (param1, param2, param3)
114
115#define FIMP(prototype, body) prototype { body }
116
117
118
119#define TTT_t CNT(ListType, _t)
120#define TTTList_t CNT(ListType, List_t)
121#define TTTListNode_t CNT(ListType, ListNode_t)
122
123#define TTT_list_init CNT(ListName, _list_init)
124#define TTT_list_destroy CNT(ListName, _list_destroy)
125#define TTT_list_copy CNT(ListName, _list_copy)
126#define TTT_list_begin CNT(ListName, _list_begin)
127#define TTT_list_end CNT(ListName, _list_end)
128#define TTT_list_next CNT(ListName, _list_next)
129#define TTT_list_prev CNT(ListName, _list_prev)
130#define TTT_list_data CNT(ListName, _list_data)
131#define TTT_list_insert_begin CNT(ListName, _list_insert_begin)
132#define TTT_list_insert_end CNT(ListName, _list_insert_end)
133#define TTT_list_find CNT(ListName, _list_find)
134#define TTT_list_print CNT(ListName, _list_print)
135
136/******************************************************************************/
137
138LIST_NODE (TTTListNode_t, TTT_t)
139
140LIST (TTTList_t, TTTListNode_t)
141
142/******************************************************************************/
143
144
145
151FPROTO1 (
152
153 void, TTT_list_init, TTTList_t *list) ;
154
155
156
165FPROTO2 (
166
167 void, TTT_list_copy, TTTList_t *dst, TTTList_t *src) ;
168
169
170
179FPROTO1 (
180
181 void, TTT_list_destroy, TTTList_t *list) ;
182
183
184
193FPROTO1 (
194
195 TTTListNode_t *, TTT_list_begin, TTTList_t *list) ;
196
197
198
207FPROTO1 (
208
209 TTTListNode_t *, TTT_list_end, TTTList_t *list) ;
210
211
212
221FPROTO1 (
222
223 TTTListNode_t *, TTT_list_next, TTTListNode_t *node) ;
224
225
226
235FPROTO1 (
236
237 TTTListNode_t *, TTT_list_prev, TTTListNode_t *node) ;
238
239
240
248FPROTO1 (
249
250 TTT_t *, TTT_list_data, TTTListNode_t *node) ;
251
252
253
263FPROTO2 (
264
265 void, TTT_list_insert_begin, TTTList_t *list, TTT_t *data) ;
266
267
268
278FPROTO2 (
279
280 void, TTT_list_insert_end, TTTList_t *list, TTT_t *data) ;
281
282
283
293FPROTO2 (
294
295 TTT_t *, TTT_list_find, TTTList_t *list, TTT_t *data) ;
296
297
298
306FPROTO3 (
307
308 void, TTT_list_print, TTTList_t *list, FILE *stream, String_t prefix) ;
309
310
311
312/******************************************************************************/
char * String_t
Definition: string_t.h:55