Graphviz  2.41.20171026.1811
IntStack.h
Go to the documentation of this file.
1 /* $Id$Revision: */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifndef IntStack_H
15 #define IntStack_H
16 
17 /* last in first out integer stack */
19  int last;/* position of the last element, If empty, last = -1 */
20  int max_len;
21  int *stack;
22 };
23 
24 typedef struct IntStack_struct* IntStack;
25 
26 IntStack IntStack_new(void);
27 
28 void IntStack_delete(IntStack s);
29 
30 #define IntStack_get_length(s) (1+(s)->last)
31 
32 int IntStack_push(IntStack s, int i);/* add an item and return the pos (>=0).
33  Return negative value of malloc failed */
34 
35 int IntStack_pop(IntStack s, int *flag);/* remove the last item. If none exist, flag = -1, and return -1. */
36 
37 void IntStack_print(IntStack s);
38 
39 #endif
struct IntStack_struct * IntStack
Definition: IntStack.h:24
IntStack IntStack_new(void)
Definition: IntStack.c:17
int IntStack_pop(IntStack s, int *flag)
Definition: IntStack.c:53
Definition: grammar.c:79
void IntStack_delete(IntStack s)
Definition: IntStack.c:28
int IntStack_push(IntStack s, int i)
Definition: IntStack.c:45
void IntStack_print(IntStack s)
Definition: IntStack.c:62