abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
parseStack.c File Reference
#include "parseInt.h"

Go to the source code of this file.

Data Structures

struct  ParseStackFnStruct
 DECLARATIONS ///. More...
 
struct  ParseStackOpStruct
 

Functions

Parse_StackFn_tParse_StackFnStart (int nDepth)
 FUNCTION DEFINITIONS ///. More...
 
int Parse_StackFnIsEmpty (Parse_StackFn_t *p)
 
void Parse_StackFnPush (Parse_StackFn_t *p, void *bFunc)
 
void * Parse_StackFnPop (Parse_StackFn_t *p)
 
void Parse_StackFnFree (Parse_StackFn_t *p)
 
Parse_StackOp_tParse_StackOpStart (int nDepth)
 
int Parse_StackOpIsEmpty (Parse_StackOp_t *p)
 
void Parse_StackOpPush (Parse_StackOp_t *p, int Oper)
 
int Parse_StackOpPop (Parse_StackOp_t *p)
 
void Parse_StackOpFree (Parse_StackOp_t *p)
 

Function Documentation

void Parse_StackFnFree ( Parse_StackFn_t p)

Function*************************************************************

Synopsis [Deletes the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file parseStack.c.

137 {
138  ABC_FREE( p->pData );
139  ABC_FREE( p );
140 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Parse_StackFnIsEmpty ( Parse_StackFn_t p)

Function*************************************************************

Synopsis [Checks whether the stack is empty.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file parseStack.c.

79 {
80  return (int)(p->Top == 0);
81 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void* Parse_StackFnPop ( Parse_StackFn_t p)

Function*************************************************************

Synopsis [Pops an entry out of the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file parseStack.c.

116 {
117  if ( p->Top == 0 )
118  {
119  printf( "Parse_StackFnPush(): Trying to extract data from the empty stack!\n" );
120  return NULL;
121  }
122  return p->pData[ --p->Top ];
123 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Parse_StackFnPush ( Parse_StackFn_t p,
void *  bFunc 
)

Function*************************************************************

Synopsis [Pushes an entry into the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file parseStack.c.

95 {
96  if ( p->Top >= p->Size )
97  {
98  printf( "Parse_StackFnPush(): Stack size is too small!\n" );
99  return;
100  }
101  p->pData[ p->Top++ ] = bFunc;
102 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Parse_StackFn_t* Parse_StackFnStart ( int  nDepth)

FUNCTION DEFINITIONS ///.

GLOBAL VARIABLES ///.

Function*************************************************************

Synopsis [Starts the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file parseStack.c.

58 {
60  p = ABC_ALLOC( Parse_StackFn_t, 1 );
61  memset( p, 0, sizeof(Parse_StackFn_t) );
62  p->pData = ABC_ALLOC( void *, nDepth );
63  p->Size = nDepth;
64  return p;
65 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct ParseStackFnStruct Parse_StackFn_t
INCLUDES ///.
Definition: parseInt.h:43
void Parse_StackOpFree ( Parse_StackOp_t p)

Function*************************************************************

Synopsis [Deletes the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 235 of file parseStack.c.

236 {
237  ABC_FREE( p->pData );
238  ABC_FREE( p );
239 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Parse_StackOpIsEmpty ( Parse_StackOp_t p)

Function*************************************************************

Synopsis [Checks whether the stack is empty.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file parseStack.c.

178 {
179  return (int)(p->Top == 0);
180 }
int Parse_StackOpPop ( Parse_StackOp_t p)

Function*************************************************************

Synopsis [Pops an entry out of the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file parseStack.c.

215 {
216  if ( p->Top == 0 )
217  {
218  printf( "Parse_StackOpPush(): Trying to extract data from the empty stack!\n" );
219  return -1;
220  }
221  return p->pData[ --p->Top ];
222 }
void Parse_StackOpPush ( Parse_StackOp_t p,
int  Oper 
)

Function*************************************************************

Synopsis [Pushes an entry into the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 193 of file parseStack.c.

194 {
195  if ( p->Top >= p->Size )
196  {
197  printf( "Parse_StackOpPush(): Stack size is too small!\n" );
198  return;
199  }
200  p->pData[ p->Top++ ] = Oper;
201 }
Parse_StackOp_t* Parse_StackOpStart ( int  nDepth)

Function*************************************************************

Synopsis [Starts the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file parseStack.c.

157 {
158  Parse_StackOp_t * p;
159  p = ABC_ALLOC( Parse_StackOp_t, 1 );
160  memset( p, 0, sizeof(Parse_StackOp_t) );
161  p->pData = ABC_ALLOC( int, nDepth );
162  p->Size = nDepth;
163  return p;
164 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229