Graphviz  2.41.20170921.2350
stack.h
Go to the documentation of this file.
1 /* $Id$Revision: */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /**********************************************************
5 * See the LICENSE file for copyright information. *
6 **********************************************************/
7 
8 #ifndef STACK_H
9 #define STACK_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /* needed for intptr_t */
16 #include "config.h"
17 #include <stdint.h>
18 
19 #include "misc.h"
20 
21 /* CONVENTIONS: All data structures for stacks have the prefix */
22 /* "stk_" to prevent name conflicts. */
23 /* */
24 /* Function names: Each word in a function name begins with */
25 /* a capital letter. An example funcntion name is */
26 /* CreateRedTree(a,b,c). Furthermore, each function name */
27 /* should begin with a capital letter to easily distinguish */
28 /* them from variables. */
29 /* */
30 /* Variable names: Each word in a variable name begins with */
31 /* a capital letter EXCEPT the first letter of the variable */
32 /* name. For example, int newLongInt. Global variables have */
33 /* names beginning with "g". An example of a global */
34 /* variable name is gNewtonsConstant. */
35 
36 /* if DATA_TYPE is undefined then stack.h and stack.c will be code for */
37 /* stacks of void *, if they are defined then they will be stacks of the */
38 /* appropriate data_type */
39 
40 #ifndef DATA_TYPE
41 #define DATA_TYPE void *
42 #endif
43 
44 typedef struct stk_stack_node {
46  struct stk_stack_node * next;
48 
49 typedef struct stk_stack {
52 } stk_stack ;
53 
54 /* These functions are all very straightforward and self-commenting so */
55 /* I didn't think additional comments would be useful */
56 stk_stack * StackJoin(stk_stack * stack1, stk_stack * stack2);
57 stk_stack * StackCreate(void);
58 void StackPush(stk_stack * theStack, DATA_TYPE newInfoPointer);
59 void * StackPop(stk_stack * theStack);
60 intptr_t StackNotEmpty(stk_stack *);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif
DATA_TYPE info
Definition: stack.h:45
struct stk_stack_node stk_stack_node
struct stk_stack stk_stack
struct stk_stack_node * next
Definition: stack.h:46
intptr_t StackNotEmpty(stk_stack *theStack)
Definition: stack.c:12
void StackPush(stk_stack *theStack, DATA_TYPE newInfoPointer)
Definition: stack.c:37
stk_stack_node * tail
Definition: stack.h:51
#define DATA_TYPE
Definition: stack.h:41
DATA_TYPE StackPop(stk_stack *theStack)
Definition: stack.c:55
stk_stack * StackJoin(stk_stack *stack1, stk_stack *stack2)
Definition: stack.c:16
stk_stack_node * top
Definition: stack.h:50
stk_stack * StackCreate()
Definition: stack.c:28