-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack_config.h
55 lines (45 loc) · 1.52 KB
/
stack_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
This file is part of Hyacc, a LR(0)/LALR(1)/LR(1)/LR(k) parser generator.
Copyright (C) 2007 Xin Chen. [email protected]
Hyacc is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Hyacc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Hyacc; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _STACK_CONFIG_H_
#define _STACK_CONFIG_H_
/*
* stack_config.h
*
* An expandable integer stack, implemented as an array.
*
* @Author: Xin Chen
* @Created on: 2/27/2006
* @Last modified: 6/19/2007
*/
#include "y.h"
#define DEBUG_STACK 0
#define STACK_INIT_SIZE 256
#define USE_WARNING 0
typedef struct {
//int * array;
Configuration ** array;
int pt;
int capacity;
} stack;
stack * stack_create();
stack * stack_create2(int init_capacity);
void stack_push(stack * s, Configuration * n);
Configuration * stack_pop(stack * s);
Configuration * stack_top(stack * s);
int stack_count(stack * s); /* number of elements in stack */
void stack_destroy(stack * s);
void stack_dump(stack * s);
#endif