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 00073 typedef _gdsl_node_t _gdsl_list_t; 00074 00075 /******************************************************************************/ 00076 /* Management functions of low-level doubly-linked lists */ 00077 /******************************************************************************/ 00078 00092 extern _gdsl_list_t 00093 _gdsl_list_alloc (const gdsl_element_t E 00094 ); 00095 00109 extern void 00110 _gdsl_list_free (_gdsl_list_t L, 00111 const gdsl_free_func_t FREE_F 00112 ); 00113 00114 /******************************************************************************/ 00115 /* Consultation functions of low-level doubly-linked lists */ 00116 /******************************************************************************/ 00117 00127 extern bool 00128 _gdsl_list_is_empty (const _gdsl_list_t L 00129 ); 00130 00138 extern ulong 00139 _gdsl_list_get_size (const _gdsl_list_t L 00140 ); 00141 00142 /******************************************************************************/ 00143 /* Modification functions of low-level doubly-linked lists */ 00144 /******************************************************************************/ 00145 00157 extern void 00158 _gdsl_list_link (_gdsl_list_t L1, 00159 _gdsl_list_t L2 00160 ); 00161 00174 extern void 00175 _gdsl_list_insert_after (_gdsl_list_t L, 00176 _gdsl_list_t PREV 00177 ); 00178 00191 extern void 00192 _gdsl_list_insert_before (_gdsl_list_t L, 00193 _gdsl_list_t SUCC 00194 ); 00195 00208 extern void 00209 _gdsl_list_remove (_gdsl_node_t NODE 00210 ); 00211 00212 /******************************************************************************/ 00213 /* Search functions of low-level doubly-linked lists */ 00214 /******************************************************************************/ 00215 00231 extern _gdsl_list_t 00232 _gdsl_list_search (_gdsl_list_t L, 00233 const gdsl_compare_func_t COMP_F, 00234 void* VALUE 00235 ); 00236 00237 /******************************************************************************/ 00238 /* Parse functions of low-level doubly-linked lists */ 00239 /******************************************************************************/ 00240 00258 extern _gdsl_list_t 00259 _gdsl_list_map_forward (const _gdsl_list_t L, 00260 const _gdsl_node_map_func_t MAP_F, 00261 void* USER_DATA 00262 ); 00263 00281 extern _gdsl_list_t 00282 _gdsl_list_map_backward (const _gdsl_list_t L, 00283 const _gdsl_node_map_func_t MAP_F, 00284 void* USER_DATA 00285 ); 00286 00287 /******************************************************************************/ 00288 /* Input/output functions of low-level doubly-linked lists */ 00289 /******************************************************************************/ 00290 00307 extern void 00308 _gdsl_list_write (const _gdsl_list_t L, 00309 const _gdsl_node_write_func_t WRITE_F, 00310 FILE* OUTPUT_FILE, 00311 void* USER_DATA 00312 ); 00313 00332 extern void 00333 _gdsl_list_write_xml (const _gdsl_list_t L, 00334 const _gdsl_node_write_func_t WRITE_F, 00335 FILE* OUTPUT_FILE, 00336 void* USER_DATA 00337 ); 00338 00356 extern void 00357 _gdsl_list_dump (const _gdsl_list_t L, 00358 const _gdsl_node_write_func_t WRITE_F, 00359 FILE* OUTPUT_FILE, 00360 void* USER_DATA 00361 ); 00362 00368 #ifdef __cplusplus 00369 } 00370 #endif /* __cplusplus */ 00371 00372 00373 #endif /* __GDSL_LIST_H_ */ 00374 00375