Main Page | Modules | File List | Globals

gdsl_stack.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Generic Data Structures Library (GDSL).
00003  * Copyright (C) 1998-2004 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.4 $
00022  * $Date: 2004/10/03 14:35:38 $
00023  */
00024 
00025 #ifndef _GDSL_STACK_H_
00026 #define _GDSL_STACK_H_
00027 
00028 
00029 #include <stdio.h>
00030 
00031 
00032 #include "gdsl_types.h"
00033 
00034 #ifdef __cplusplus
00035 extern "C" 
00036 {
00037 #endif /* __cplusplus */
00038 
00039 
00052 typedef struct _gdsl_stack* gdsl_stack_t;
00053 
00054 /******************************************************************************/
00055 /* Management functions of stacks                                             */
00056 /******************************************************************************/
00057 
00078 extern gdsl_stack_t
00079 gdsl_stack_alloc (const char *NAME,
00080           gdsl_alloc_func_t ALLOC_F,
00081           gdsl_free_func_t FREE_F
00082           );
00083 
00097 extern void 
00098 gdsl_stack_free (gdsl_stack_t S
00099          );
00100 
00114 extern void
00115 gdsl_stack_flush (gdsl_stack_t S
00116           );
00117 
00118 /******************************************************************************/
00119 /* Consultation functions of stacks                                           */
00120 /******************************************************************************/
00121 
00131 extern const char*
00132 gdsl_stack_get_name (const gdsl_stack_t S
00133              );
00134 
00142 extern ulong
00143 gdsl_stack_get_size (const gdsl_stack_t S
00144              );
00145 
00163 extern ubyte
00164 gdsl_stack_get_growing_factor (const gdsl_stack_t S
00165                    );
00166 
00175 extern bool 
00176 gdsl_stack_is_empty (const gdsl_stack_t S
00177              );
00178 
00189 extern gdsl_element_t
00190 gdsl_stack_get_top (const gdsl_stack_t S
00191             );
00192 
00203 extern gdsl_element_t
00204 gdsl_stack_get_bottom (const gdsl_stack_t S
00205                );
00206 
00207 /******************************************************************************/
00208 /* Modification functions of stacks                                           */
00209 /******************************************************************************/
00210 
00224 extern gdsl_stack_t
00225 gdsl_stack_set_name (gdsl_stack_t S,
00226              const char *NEW_NAME
00227              );
00228 
00247 extern void
00248 gdsl_stack_set_growing_factor (gdsl_stack_t S,
00249                    ubyte G
00250                    );
00251 
00271 extern gdsl_element_t
00272 gdsl_stack_insert (gdsl_stack_t S,
00273            void *VALUE
00274            );
00275 
00288 extern gdsl_element_t
00289 gdsl_stack_remove (gdsl_stack_t S
00290            );
00291 
00292 /******************************************************************************/
00293 /* Search functions of stacks                                                 */
00294 /******************************************************************************/
00295 
00311 extern gdsl_element_t
00312 gdsl_stack_search (const gdsl_stack_t S,
00313            gdsl_compare_func_t COMP_F,
00314            void *VALUE
00315            );
00316 
00327 extern gdsl_element_t
00328 gdsl_stack_search_by_position (const gdsl_stack_t S,
00329                    ulong POS
00330                    );
00331 
00332 /******************************************************************************/
00333 /* Parse functions of stacks                                                  */
00334 /******************************************************************************/
00335 
00353 extern gdsl_element_t
00354 gdsl_stack_map_forward (const gdsl_stack_t S,
00355             gdsl_map_func_t MAP_F,
00356             void* USER_DATA
00357             );
00358 
00376 extern gdsl_element_t
00377 gdsl_stack_map_backward (const gdsl_stack_t S,
00378              gdsl_map_func_t MAP_F,
00379              void* USER_DATA
00380              );
00381 
00382 /******************************************************************************/
00383 /* Input/output functions of stacks                                           */ 
00384 /******************************************************************************/
00385 
00401 extern void
00402 gdsl_stack_write (const gdsl_stack_t S,
00403           gdsl_write_func_t WRITE_F,
00404           FILE *OUTPUT_FILE,
00405           void *USER_DATA
00406           );
00407 
00424 extern void
00425 gdsl_stack_write_xml (gdsl_stack_t S,
00426               gdsl_write_func_t WRITE_F,
00427               FILE *OUTPUT_FILE,
00428               void *USER_DATA
00429               );
00430 
00447 extern void 
00448 gdsl_stack_dump (gdsl_stack_t S,
00449          gdsl_write_func_t WRITE_F,
00450          FILE *OUTPUT_FILE,
00451          void *USER_DATA
00452          );
00453 
00454 
00455 /*
00456  * @}
00457  */
00458 
00459 
00460 #ifdef __cplusplus
00461 }
00462 #endif /* __cplusplus */
00463 
00464 
00465 #endif /* _GDSL_STACK_H_ */
00466 

Generated on Sun Oct 3 16:15:50 2004 for GDSL by doxygen 1.3.5