home *** CD-ROM | disk | FTP | other *** search
- //
- // COMPONENT_NAME: somx
- //
- // ORIGINS: 27
- //
- //
- // 10H9767, 10H9769 (C) COPYRIGHT International Business Machines Corp. 1992,1994
- // All Rights Reserved
- // Licensed Materials - Property of IBM
- // US Government Users Restricted Rights - Use, duplication or
- // disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- //
-
- /* %Z% %I% %W% %G% %U% [%H% %T%] */
- /*
- * This file was generated by the SOM Compiler and Emitter Framework.
- * Generated using:
- * SOM Emitter emitxtm: 2.37
- */
-
- #ifndef SOM_Module_stack_Source
- #define SOM_Module_stack_Source
- #endif
- #define Stack_Class_Source
-
- #include "stack.xih"
-
- SOM_Scope boolean SOMLINK full(Stack *somSelf, Environment *ev)
- {
- StackData *somThis = StackGetData(somSelf);
- StackMethodDebug("Stack","full");
-
- /* Return statement to be customized: */
- return(somThis->stackTop == stackSize);
- }
-
- SOM_Scope boolean SOMLINK empty(Stack *somSelf, Environment *ev)
- {
- StackData *somThis = StackGetData(somSelf);
- StackMethodDebug("Stack","empty");
-
- /* Return statement to be customized: */
- return(somThis->stackTop == 0);
- }
-
- SOM_Scope long SOMLINK top(Stack *somSelf, Environment *ev)
- {
- StackData *somThis = StackGetData(somSelf);
- StackMethodDebug("Stack","top");
-
- /* Return statement to be customized: */
- if (somThis->stackTop > 0)
- {
-
- return(somThis->stackimpl[somThis->stackTop -1]);
- }
- else
- {
- somSetException(ev, USER_EXCEPTION, ex_STACK_UNDERFLOW, NULL);
- return(-1L);
- }
- }
-
- SOM_Scope long SOMLINK pop(Stack *somSelf, Environment *ev)
- {
- StackData *somThis = StackGetData(somSelf);
- StackMethodDebug("Stack","pop");
-
- /* Return statement to be customized: */
- if (somThis->stackTop > 0)
- {
- somThis->stackTop--;
- return(somThis->stackimpl[somThis->stackTop]);
- }
- else
- {
- somSetException(ev, USER_EXCEPTION, ex_STACK_UNDERFLOW, NULL);
- return(-1L);
- }
- }
-
- SOM_Scope void SOMLINK push(Stack *somSelf, Environment *ev,
- long el)
- {
- StackData *somThis = StackGetData(somSelf);
- StackMethodDebug("Stack","push");
- if (somThis->stackTop < stackSize)
- {
- somThis->stackimpl[somThis->stackTop] = el;
- somThis->stackTop++;
- }
- else
- {
- somSetException(ev, USER_EXCEPTION, ex_STACK_OVERFLOW, NULL);
- }
- }
-
- SOM_Scope void SOMLINK somDefaultInit(Stack *somSelf, somInitCtrl* ctrl)
- {
- StackData *somThis; /* set in BeginInitializer */
- somInitCtrl globalCtrl;
- somBooleanVector myMask;
- StackMethodDebug("Stack","somDefaultInit");
- Stack_BeginInitializer_somDefaultInit;
-
- Stack_Init_SOMObject_somDefaultInit(somSelf, ctrl);
-
- /* stackTop is index into stackValues for next pushed stack element.
- * stackValues[0..(stackSize-1)] holds stack elements.
- */
-
- somThis->stackTop = 0;
- }
-
-