//
// Remove top stack element
//
INT_32 VMArgStack::PopElement()
{
    if (iStackPointer == iMaxStackSize) {
        throw StackUnderflow(0);
    }

    ++iStackPointer;

    return iStackPointer;
}
//
// Get element from specified position
//
CDT & VMArgStack::GetElement(const INT_32  iPos)
{
    if (iPos >= iMaxStackSize) {
        throw StackUnderflow(0);
    }

    if (iPos <  iStackPointer)  {
        throw StackOverflow(0);
    }

    return aStack[iPos];
}
//
// Clear stack on specified depth
//
INT_32 VMArgStack::ClearStack(const INT_32  iDepth)
{
    INT_32 iNewSP = iStackPointer + iDepth;

    if (iNewSP > iMaxStackSize) {
        throw StackUnderflow(0);
    }

    iStackPointer = iNewSP;

    return iNewSP;
}
Пример #4
0
//XXX dont run!!
void ERR09_0() {
  try {
    throw StackUnderflow();
  }
  catch( StackUnderflow &su ) {
    su.modify(); // modify exception object
    throw; // modifications not lost
  }
  catch( std::runtime_error &re ) {
    // /* ... */
    throw; // original type of exception not lost
  }
}