source: releases/0.2.2/include/void_stack.h @ 79

Last change on this file since 79 was 38, checked in by tim, 19 years ago

Cleaned up path2Stack. Added several supporting functions in void_stack code.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1/*
2 * Copyright (C) 2005 Timothy D. Morgan
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
16 *
17 * $Id: void_stack.h 38 2005-07-31 15:00:59Z tim $
18 */
19
20#include <stdlib.h>
21#include <stdbool.h>
22#include <string.h>
23
24typedef struct _void_stack
25{
26  void** elements;
27  unsigned short max_size;
28  unsigned short top;
29} void_stack;
30
31typedef struct _void_stack_iterator
32{
33  void_stack* stack;
34  unsigned short cur;
35} void_stack_iterator;
36
37
38void_stack* void_stack_new(unsigned short max_size);
39void_stack* void_stack_copy(const void_stack* v);
40void_stack* void_stack_copy_reverse(const void_stack* v);
41void void_stack_destroy(void_stack* stack);
42void void_stack_destroy_deep(void_stack* stack);
43unsigned short void_stack_size(void_stack* stack);
44void* void_stack_pop(void_stack* stack);
45bool void_stack_push(void_stack* stack, void* e);
46const void* void_stack_cur(void_stack* stack);
47void_stack_iterator* void_stack_iterator_new(void_stack* stack);
48void void_stack_iterator_destroy(void_stack_iterator* iter);
49const void* void_stack_iterator_next(void_stack_iterator* iter);
Note: See TracBrowser for help on using the repository browser.