Back to index

tetex-bin  3.0
Public Member Functions | Private Member Functions | Private Attributes
PSStack Class Reference
Collaboration diagram for PSStack:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PSStack ()
void pushBool (GBool booln)
void pushInt (int intg)
void pushReal (double real)
GBool popBool ()
int popInt ()
double popNum ()
GBool empty ()
GBool topIsInt ()
GBool topTwoAreInts ()
GBool topIsReal ()
GBool topTwoAreNums ()
void copy (int n)
void roll (int n, int j)
void index (int i)
void pop ()

Private Member Functions

GBool checkOverflow (int n=1)
GBool checkUnderflow ()
GBool checkType (PSObjectType t1, PSObjectType t2)

Private Attributes

PSObject stack [psStackSize]
int sp

Detailed Description

Definition at line 810 of file Function.cc.


Constructor & Destructor Documentation

PSStack::PSStack ( ) [inline]

Definition at line 813 of file Function.cc.

{ sp = psStackSize; }

Member Function Documentation

GBool PSStack::checkOverflow ( int  n = 1) [private]

Definition at line 846 of file Function.cc.

                                  {
  if (sp - n < 0) {
    error(-1, "Stack overflow in PostScript function");
    return gFalse;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GBool PSStack::checkType ( PSObjectType  t1,
PSObjectType  t2 
) [private]

Definition at line 862 of file Function.cc.

                                                         {
  if (stack[sp].type != t1 && stack[sp].type != t2) {
    error(-1, "Type mismatch in PostScript function");
    return gFalse;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 854 of file Function.cc.

                              {
  if (sp == psStackSize) {
    error(-1, "Stack underflow in PostScript function");
    return gFalse;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 916 of file Function.cc.

                        {
  int i;

  if (!checkOverflow(n)) {
    return;
  }
  for (i = sp + n - 1; i <= sp; ++i) {
    stack[i - n] = stack[i];
  }
  sp -= n;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GBool PSStack::empty ( ) [inline]

Definition at line 820 of file Function.cc.

{ return sp == psStackSize; }

Definition at line 952 of file Function.cc.

                         {
  if (!checkOverflow()) {
    return;
  }
  --sp;
  stack[sp] = stack[sp + 1 + i];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 960 of file Function.cc.

                  {
  if (!checkUnderflow()) {
    return;
  }
  ++sp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 891 of file Function.cc.

                       {
  if (checkUnderflow() && checkType(psBool, psBool)) {
    return stack[sp++].booln;
  }
  return gFalse;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 898 of file Function.cc.

                    {
  if (checkUnderflow() && checkType(psInt, psInt)) {
    return stack[sp++].intg;
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

double PSStack::popNum ( )

Definition at line 905 of file Function.cc.

                       {
  double ret;

  if (checkUnderflow() && checkType(psInt, psReal)) {
    ret = (stack[sp].type == psInt) ? (double)stack[sp].intg : stack[sp].real;
    ++sp;
    return ret;
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 870 of file Function.cc.

                                  {
  if (checkOverflow()) {
    stack[--sp].type = psBool;
    stack[sp].booln = booln;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 877 of file Function.cc.

                              {
  if (checkOverflow()) {
    stack[--sp].type = psInt;
    stack[sp].intg = intg;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PSStack::pushReal ( double  real)

Definition at line 884 of file Function.cc.

                                  {
  if (checkOverflow()) {
    stack[--sp].type = psReal;
    stack[sp].real = real;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PSStack::roll ( int  n,
int  j 
)

Definition at line 928 of file Function.cc.

                               {
  PSObject obj;
  int i, k;

  if (j >= 0) {
    j %= n;
  } else {
    j = -j % n;
    if (j != 0) {
      j = n - j;
    }
  }
  if (n <= 0 || j == 0) {
    return;
  }
  for (i = 0; i < j; ++i) {
    obj = stack[sp];
    for (k = sp; k < sp + n - 1; ++k) {
      stack[k] = stack[k+1];
    }
    stack[sp + n - 1] = obj;
  }
}

Here is the caller graph for this function:

GBool PSStack::topIsInt ( ) [inline]

Definition at line 821 of file Function.cc.

{ return sp < psStackSize && stack[sp].type == psInt; }

Here is the caller graph for this function:

GBool PSStack::topIsReal ( ) [inline]

Definition at line 826 of file Function.cc.

{ return sp < psStackSize && stack[sp].type == psReal; }

Here is the caller graph for this function:

Definition at line 822 of file Function.cc.

    { return sp < psStackSize - 1 &&
            stack[sp].type == psInt &&
             stack[sp+1].type == psInt; }

Here is the caller graph for this function:

Definition at line 827 of file Function.cc.

    { return sp < psStackSize - 1 &&
            (stack[sp].type == psInt || stack[sp].type == psReal) &&
            (stack[sp+1].type == psInt || stack[sp+1].type == psReal); }

Here is the caller graph for this function:


Member Data Documentation

int PSStack::sp [private]

Definition at line 843 of file Function.cc.

Definition at line 842 of file Function.cc.


The documentation for this class was generated from the following file: