Main Page | Class List | Directories | File List | Class Members | File Members

cpp_calc.h File Reference

CKPM C pre-processor calc based calculator definitions. More...


Classes

struct  _calc
 This structure describes the calculator calc. More...

Defines

#define MAX_STACK_LENGTH   40
#define STACK_STATUS_OK   0
#define STACK_STATUS_UNDERFLOW   1
#define STACK_STATUS_OVERFLOW   2

Functions

_calcCalc_Create ()
 create and initialise a struct _calc
void Calc_Destroy (struct _calc *s)
 destroy a variable of struct _calc
void Calc_Dump (struct _calc *s, int fd)
 dump the stack to stderr
void Calc_Push (struct _calc *s, int n)
 push a value onto the stack
int Calc_Pop (struct _calc *s)
 pop a value from the top of the stack
void Calc_Dup (struct _calc *s)
 duplicate the value from the top of the stack
int Calc_Stack_Length (struct _calc *s)
 return the current length of the calculator stack
void Calc_Add (struct _calc *s)
 add the two top values on the stack and push the result onto the stack
void Calc_Subtract (struct _calc *s)
 subtract the two top values on the stack and push the result onto the stack
void Calc_Multiply (struct _calc *s)
 multiply the two top values on the stack and push the result onto the stack
void Calc_Divide (struct _calc *s)
 divide the two top values on the stack and push the result onto the stack
void Calc_Rem (struct _calc *s)
 divide the two top values on the stack and push the reminder onto the stack
void Calc_And (struct _calc *s)
 do a logical and of the two top values on the stack and push the result onto the stack
void Calc_Or (struct _calc *s)
 do a logical or of the two top values on the stack and push the result onto the stack
void Calc_Not (struct _calc *s)
 logically negate the top value on the stack and push the result onto the stack
void Calc_Shift_Left (struct _calc *s)
 shift the top but one value on the stack left by the top value of the stack and push the result onto the stack
void Calc_Shift_Right (struct _calc *s)
 add the two top values on the stack and push the result onto the stack
void Calc_Cmp_EQ (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack
void Calc_Cmp_NEQ (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack
void Calc_Cmp_GE (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack
void Calc_Cmp_GT (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack
void Calc_Cmp_LE (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack
void Calc_Cmp_LT (struct _calc *s)
 compare the two top values on the stack and push the result onto the stack


Detailed Description

CKPM C pre-processor calc based calculator definitions.


Define Documentation

#define MAX_STACK_LENGTH   40
 

maximal length of the calc

#define STACK_STATUS_OK   0
 

calc calculation succeeded

#define STACK_STATUS_OVERFLOW   2
 

calc is too small

#define STACK_STATUS_UNDERFLOW   1
 

calc calculation failed


Function Documentation

struct _calc* Calc_Create  ) 
 

create and initialise a struct _calc

Returns:
a pointer to a new stack

void Calc_Destroy struct _calc s  ) 
 

destroy a variable of struct _calc

Parameters:
s the pointer to a struct _calc variable

void Calc_Dump struct _calc s,
int  fd
 

dump the stack to stderr

Parameters:
fd the file descriptor index of the output file
s the pointer to a struct _calc variable

int Calc_Pop struct _calc s  ) 
 

pop a value from the top of the stack

Returns:
the value from top of the stack


Generated on Thu Jul 13 03:56:36 2006 for CKPMcc by  doxygen 1.4.4