This is OperatorStack.h in view mode; [Download] [Up]
/***(OperatorStack.h)**********************************************************
*H* Push down stack for numeric operators V0.0, 09-FEB-91 *
*C* V0.0 09-FEB-91 Initial version --MDM *
******************************************************************************/
#import <objc/Object.h> /* Root object definition */
#define OPCODE_Equals 0
#define OPCODE_Plus 1
#define OPCODE_Minus 2
#define OPCODE_Multiply 3
#define OPCODE_Divide 4
#define OPCODE_OpenParen 5
#define OPCODE_CloseParen 6
#define OPCODE_Sin 7
#define OPCODE_ASin 8
#define OPCODE_SinH 9
#define OPCODE_ASinH 10
#define OPCODE_Cos 11
#define OPCODE_ACos 12
#define OPCODE_CosH 13
#define OPCODE_ACosH 14
#define OPCODE_Tan 15
#define OPCODE_ATan 16
#define OPCODE_TanH 17
#define OPCODE_ATanH 18
#define OPCODE_Exp 19
#define OPCODE_Ln 20
#define OPCODE_Log 21
#define OPCODE_TenToX 22
#define OPCODE_XToY 23
#define OPCODE_XrootY 24
#define OPCODE_XSquared 25
#define OPCODE_SqrRoot 26
#define OPCODE_Recip 27
#define OPCODE_Factorial 28
#define OPCODE_Pi 29
#define OPCODE_Modify 30
#define OPCODE_Integer 31
#define OPCODE_And 32
#define OPCODE_Or 33
#define OPCODE_Not 34
#define OPCODE_Xor 35
#define OPCODE_LShift 36
#define OPCODE_RShift 37
#define OPCODE_LastOpCode 37
#define OPCODE_OpCodes OPCODE_LastOpCode+1
/* Instance Type Definitions */
typedef struct OSoperStackItem
{
int opcode; /* operator code of stack item */
struct OSoperStackItem *blink; /* backward link to lower stack item */
} OToperStackItem;
/* Define OperatorStack to be a sub-class of the Object class */
@interface OperatorStack : Object
{/* Instance Variables */
OToperStackItem *OVstackTop; /* Pointer to top of stack */
unsigned long OVstackSize; /* Number of elements in stack */
}
/* Instance Methods */
- init;
/* Initialize a new OperStack instance */
- free;
/* Free stack data and destroy instance of stack */
- ClearStack;
/* Pop and free all values currently on the stack */
- ComparePrecedence: (int) opcode: (int *) result;
/* Compare opcode precedence, against top of stack */
- (unsigned long) GetSize;
/* Return the number of elements currently in the stack */
- NumberOfOperands :(int)opcode :(int*)noperands;
/* Return the number of operands needed for an opcode */
- Peek: (int *) opcode;
/* Return opcode on top of stack without removing it */
- Pop: (int *) opcode;
/* Return value and free data on top of stack */
- Push: (int) value;
/* Push a new operator code on the stack */
- PrintStack;
/* Dump the contents of the stack to standard I/O */
@end /* OperatorStack Interface */
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.