gdsl
1.8
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2017 Nicolas Darnis <ndarnis@free.fr>. 00004 * 00005 * GDSL is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * GDSL is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with GDSL. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * $RCSfile: _gdsl_list.h,v $ 00019 * $Revision: 1.28 $ 00020 * $Date: 2015/02/17 12:22:56 $ 00021 */ 00022 00027 #ifndef __GDSL_LIST_H_ 00028 #define __GDSL_LIST_H_ 00029 00030 00031 #include <stdio.h> 00032 00033 00034 #include "_gdsl_node.h" 00035 #include "gdsl_types.h" 00036 00037 00038 #ifdef __cplusplus 00039 extern "C" 00040 { 00041 #endif /* __cplusplus */ 00042 00043 00055 typedef _gdsl_node_t _gdsl_list_t; 00056 00057 /******************************************************************************/ 00058 /* Management functions of low-level doubly-linked lists */ 00059 /******************************************************************************/ 00060 00074 extern _gdsl_list_t 00075 _gdsl_list_alloc (const gdsl_element_t E 00076 ); 00077 00091 extern void 00092 _gdsl_list_free (_gdsl_list_t L, 00093 const gdsl_free_func_t FREE_F 00094 ); 00095 00096 /******************************************************************************/ 00097 /* Consultation functions of low-level doubly-linked lists */ 00098 /******************************************************************************/ 00099 00109 extern bool 00110 _gdsl_list_is_empty (const _gdsl_list_t L 00111 ); 00112 00120 extern ulong 00121 _gdsl_list_get_size (const _gdsl_list_t L 00122 ); 00123 00124 /******************************************************************************/ 00125 /* Modification functions of low-level doubly-linked lists */ 00126 /******************************************************************************/ 00127 00139 extern void 00140 _gdsl_list_link (_gdsl_list_t L1, 00141 _gdsl_list_t L2 00142 ); 00143 00156 extern void 00157 _gdsl_list_insert_after (_gdsl_list_t L, 00158 _gdsl_list_t PREV 00159 ); 00160 00173 extern void 00174 _gdsl_list_insert_before (_gdsl_list_t L, 00175 _gdsl_list_t SUCC 00176 ); 00177 00190 extern void 00191 _gdsl_list_remove (_gdsl_node_t NODE 00192 ); 00193 00194 /******************************************************************************/ 00195 /* Search functions of low-level doubly-linked lists */ 00196 /******************************************************************************/ 00197 00213 extern _gdsl_list_t 00214 _gdsl_list_search (_gdsl_list_t L, 00215 const gdsl_compare_func_t COMP_F, 00216 void* VALUE 00217 ); 00218 00219 /******************************************************************************/ 00220 /* Parse functions of low-level doubly-linked lists */ 00221 /******************************************************************************/ 00222 00240 extern _gdsl_list_t 00241 _gdsl_list_map_forward (const _gdsl_list_t L, 00242 const _gdsl_node_map_func_t MAP_F, 00243 void* USER_DATA 00244 ); 00245 00263 extern _gdsl_list_t 00264 _gdsl_list_map_backward (const _gdsl_list_t L, 00265 const _gdsl_node_map_func_t MAP_F, 00266 void* USER_DATA 00267 ); 00268 00269 /******************************************************************************/ 00270 /* Input/output functions of low-level doubly-linked lists */ 00271 /******************************************************************************/ 00272 00289 extern void 00290 _gdsl_list_write (const _gdsl_list_t L, 00291 const _gdsl_node_write_func_t WRITE_F, 00292 FILE* OUTPUT_FILE, 00293 void* USER_DATA 00294 ); 00295 00314 extern void 00315 _gdsl_list_write_xml (const _gdsl_list_t L, 00316 const _gdsl_node_write_func_t WRITE_F, 00317 FILE* OUTPUT_FILE, 00318 void* USER_DATA 00319 ); 00320 00338 extern void 00339 _gdsl_list_dump (const _gdsl_list_t L, 00340 const _gdsl_node_write_func_t WRITE_F, 00341 FILE* OUTPUT_FILE, 00342 void* USER_DATA 00343 ); 00344 00345 /* 00346 * @} 00347 */ 00348 00349 00350 #ifdef __cplusplus 00351 } 00352 #endif /* __cplusplus */ 00353 00354 00355 #endif /* __GDSL_LIST_H_ */ 00356 00357