Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Examples  

stack.c

Go to the documentation of this file.
00001 /*! \file stack.c
00002     This file implements a basic stack API.
00003  */
00004 
00005 
00006 #include <stdlib.h>
00007 
00008 #include "list.h"
00009 #include "stack.h"
00010 
00011 /*! \brief Stack up data at the top of the stack.
00012     \param pile Pointer to a stack data structure.
00013     \param donnee Pointer to the data to stack up.
00014     \return Upon successful completion the function return the value 0. Otherwise the function returns -1.
00015     \warning The inserted data is <B>NOT</B> copied into the linked list! Therefore you should not free it unless you know exactly what you
00016              are doing.
00017  */
00018 
00019 int stack_push(Stack *pile, const void *donnee) { return list_ins_next(pile, NULL, donnee); }
00020 
00021 /*! \example test_stack.c
00022     This test prpgram shows how to use the stack API.
00023  */
00024 
00025 /*! \brief Extract data from the top of the stack.
00026     \param pile Pointer to a stack data structure.
00027     \param donnee Pointer to a pointer the will point to the extracted data.
00028     \return Upon successful completion the function return the value 0. Otherwise the function returns -1.
00029     \warning This function does <B>NOT</B> free the element's data (it only frees the element's structure). Therefore you should use
00030              <i>donnee</i> to free the element's data yourself.
00031  */
00032 
00033 int stack_pop(Stack *pile, void **donnee) { return list_rem_next(pile, NULL, donnee); }
00034 
00035 /*! \example test_stack.c
00036     This test prpgram shows how to use the stack API.
00037  */
00038 
00039 
00040 

Generated on Thu Apr 3 16:23:44 2003 for Common_C_libraries by doxygen1.3-rc1