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 */
18struct IntStack_struct{
19 int last;/* position of the last element, If empty, last = -1 */
20 int max_len;
21 int *stack;
22};
23
24typedef struct IntStack_struct* IntStack;
25
26IntStack IntStack_new(void);
27
28void IntStack_delete(IntStack s);
29
30#define IntStack_get_length(s) (1+(s)->last)
31
32int IntStack_push(IntStack s, int i);/* add an item and return the pos (>=0).
33 Return negative value of malloc failed */
34
35int IntStack_pop(IntStack s, int *flag);/* remove the last item. If none exist, flag = -1, and return -1. */
36
37void IntStack_print(IntStack s);
38
39#endif
40