regfi
void_stack.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005,2007,2009-2010 Timothy D. Morgan
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; version 3 of the License.
00007  * 
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  * 
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
00016  *
00017  * $Id: void_stack.h 253 2011-06-13 02:27:42Z tim $
00018  */
00019 
00028 #ifndef _VOID_STACK_H
00029 #define _VOID_STACK_H
00030 
00031 #include <stdlib.h>
00032 #include <stdbool.h>
00033 #include <string.h>
00034 #include <talloc.h>
00035 
00036 #include "compat.h"
00037 
00039 typedef struct _void_stack
00040 {
00041   void** elements;
00042   unsigned short max_size;
00043   unsigned short top;
00044 } void_stack;
00045 
00046 
00048 typedef struct _void_stack_iterator
00049 {
00050   const void_stack* stack;
00051   unsigned short cur;
00052 } void_stack_iterator;
00053 
00054 
00063 _EXPORT()
00064 void_stack* void_stack_new(unsigned short max_size);
00065 
00066 
00073 _EXPORT()
00074 void_stack* void_stack_copy(const void_stack* v);
00075 
00076 
00084 _EXPORT()
00085 void_stack* void_stack_copy_reverse(const void_stack* v);
00086 
00087 
00093 _EXPORT()
00094 void void_stack_free(void_stack* stack);
00095 
00096 
00106 _EXPORT()
00107 void void_stack_free_deep(void_stack* stack);
00108 
00109 
00116 _EXPORT()
00117 unsigned short void_stack_size(const void_stack* stack);
00118 
00119 
00127 _EXPORT()
00128 void* void_stack_pop(void_stack* stack);
00129 
00130 
00138 _EXPORT()
00139 bool void_stack_push(void_stack* stack, void* e);
00140 
00141 
00149 _EXPORT()
00150 const void* void_stack_cur(const void_stack* stack);
00151 
00152 
00159 _EXPORT()
00160 void_stack_iterator* void_stack_iterator_new(const void_stack* stack);
00161 
00162 
00169 _EXPORT()
00170 void void_stack_iterator_free(void_stack_iterator* iter);
00171 
00172 
00181 _EXPORT()
00182 const void* void_stack_iterator_next(void_stack_iterator* iter);
00183 
00184 
00185 /* XXX: for completeness, might want to add a void_stack_iterator_first()
00186  *      function, to return iterator to first element
00187  */
00188 #endif
 All Data Structures Files Functions Variables