gdsl
1.6
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2006 Nicolas Darnis <ndarnis@free.fr>. 00004 * 00005 * The GDSL library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License as 00007 * published by the Free Software Foundation; either version 2 of 00008 * the License, or (at your option) any later version. 00009 * 00010 * The GDSL library 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 the GDSL library; see the file COPYING. 00017 * If not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00019 * 00020 * $RCSfile: gdsl__stack_8h_source.html,v $ 00021 * $Revision: 1.2 $ 00022 * $Date: 2012/08/21 14:01:03 $ 00023 */ 00024 00025 00026 #ifndef _GDSL_STACK_H_ 00027 #define _GDSL_STACK_H_ 00028 00029 00030 #include <stdio.h> 00031 00032 00033 #include "gdsl_types.h" 00034 00035 #ifdef __cplusplus 00036 extern "C" 00037 { 00038 #endif /* __cplusplus */ 00039 00040 00053 typedef struct _gdsl_stack* gdsl_stack_t; 00054 00055 /******************************************************************************/ 00056 /* Management functions of stacks */ 00057 /******************************************************************************/ 00058 00079 extern gdsl_stack_t 00080 gdsl_stack_alloc (const char* NAME, 00081 gdsl_alloc_func_t ALLOC_F, 00082 gdsl_free_func_t FREE_F 00083 ); 00084 00098 extern void 00099 gdsl_stack_free (gdsl_stack_t S 00100 ); 00101 00115 extern void 00116 gdsl_stack_flush (gdsl_stack_t S 00117 ); 00118 00119 /******************************************************************************/ 00120 /* Consultation functions of stacks */ 00121 /******************************************************************************/ 00122 00132 extern const char* 00133 gdsl_stack_get_name (const gdsl_stack_t S 00134 ); 00135 00143 extern ulong 00144 gdsl_stack_get_size (const gdsl_stack_t S 00145 ); 00146 00164 extern ulong 00165 gdsl_stack_get_growing_factor (const gdsl_stack_t S 00166 ); 00167 00176 extern bool 00177 gdsl_stack_is_empty (const gdsl_stack_t S 00178 ); 00179 00190 extern gdsl_element_t 00191 gdsl_stack_get_top (const gdsl_stack_t S 00192 ); 00193 00204 extern gdsl_element_t 00205 gdsl_stack_get_bottom (const gdsl_stack_t S 00206 ); 00207 00208 /******************************************************************************/ 00209 /* Modification functions of stacks */ 00210 /******************************************************************************/ 00211 00225 extern gdsl_stack_t 00226 gdsl_stack_set_name (gdsl_stack_t S, 00227 const char* NEW_NAME 00228 ); 00229 00248 extern void 00249 gdsl_stack_set_growing_factor (gdsl_stack_t S, 00250 ulong G 00251 ); 00252 00272 extern gdsl_element_t 00273 gdsl_stack_insert (gdsl_stack_t S, 00274 void* VALUE 00275 ); 00276 00289 extern gdsl_element_t 00290 gdsl_stack_remove (gdsl_stack_t S 00291 ); 00292 00293 /******************************************************************************/ 00294 /* Search functions of stacks */ 00295 /******************************************************************************/ 00296 00312 extern gdsl_element_t 00313 gdsl_stack_search (const gdsl_stack_t S, 00314 gdsl_compare_func_t COMP_F, 00315 void* VALUE 00316 ); 00317 00328 extern gdsl_element_t 00329 gdsl_stack_search_by_position (const gdsl_stack_t S, 00330 ulong POS 00331 ); 00332 00333 /******************************************************************************/ 00334 /* Parse functions of stacks */ 00335 /******************************************************************************/ 00336 00354 extern gdsl_element_t 00355 gdsl_stack_map_forward (const gdsl_stack_t S, 00356 gdsl_map_func_t MAP_F, 00357 void* USER_DATA 00358 ); 00359 00377 extern gdsl_element_t 00378 gdsl_stack_map_backward (const gdsl_stack_t S, 00379 gdsl_map_func_t MAP_F, 00380 void* USER_DATA 00381 ); 00382 00383 /******************************************************************************/ 00384 /* Input/output functions of stacks */ 00385 /******************************************************************************/ 00386 00402 extern void 00403 gdsl_stack_write (const gdsl_stack_t S, 00404 gdsl_write_func_t WRITE_F, 00405 FILE* OUTPUT_FILE, 00406 void* USER_DATA 00407 ); 00408 00425 extern void 00426 gdsl_stack_write_xml (gdsl_stack_t S, 00427 gdsl_write_func_t WRITE_F, 00428 FILE* OUTPUT_FILE, 00429 void* USER_DATA 00430 ); 00431 00448 extern void 00449 gdsl_stack_dump (gdsl_stack_t S, 00450 gdsl_write_func_t WRITE_F, 00451 FILE* OUTPUT_FILE, 00452 void* USER_DATA 00453 ); 00454 00455 00456 /* 00457 * @} 00458 */ 00459 00460 00461 #ifdef __cplusplus 00462 } 00463 #endif /* __cplusplus */ 00464 00465 00466 #endif /* _GDSL_STACK_H_ */ 00467 00468