#

| Chapter 5 PL/Vision Package Specifications |

## 5.24 PLVstk: Stack Manager

The PLVstk (PL/Vision STacK manager) package is a generic manager for both first-in-first-out (FIFO) and last-in-last-out (LIFO) stacks; it is built on PLVlst. See the companion disk for details.

### 5.24.1 Package constants

`defstk CONSTANT VARCHAR2(5) := 'stack';`

  The name of the default stack.

`lifo CONSTANT VARCHAR2(4) := 'LIFO';`

  Indicates that you are working with a last-in-first-out stack. Used in calls to `pop`.

`fifo CONSTANT VARCHAR2(4) := 'FIFO';`

  Indicates that you are working with a first-in-first-out stack. Used in calls to `pop`.

### 5.24.2 Creating and destroying stacks

`PROCEDURE make`
`(stack_in IN VARCHAR2 := defstk,`
`overwrite_in IN BOOLEAN := TRUE);`

  Allocates storage for a stack of up to 1,000 items with the specified name. By default, if the stack already exists it will be reinitialized to an empty stack.

`PROCEDURE destroy (stack_in IN VARCHAR2 := defstk);`

  Releases all memory associated with this stack.

### 5.24.3 Modifying stack contents

`PROCEDURE push`
`(item_in IN VARCHAR2, stack_in IN VARCHAR2 := defstk);`

  Pushes an item onto the specified stack.

`PROCEDURE pop`
`(value_out IN OUT VARCHAR2,`
`stack_in IN VARCHAR2 := defstk,`
`stack_type_in IN VARCHAR2 := lifo);`

  Pops an item off the top (LIFO) or bottom (FIFO) of the stack.

### 5.24.4 Analyzing stack contents

`FUNCTION nitems (stack_in IN VARCHAR2 := defstk)`
`RETURN INTEGER;`

  Returns the number of items currently in the stack.

`FUNCTION itemin (stack_in IN VARCHAR2, item_in IN VARCHAR2)`
`RETURN BOOLEAN;`

  Returns TRUE if the specified item is found in the stack.

### 5.24.5 Tracing Stack Activity

`PROCEDURE show`
`(stack_in IN VARCHAR2 := defstk,`
`show_contents_in IN BOOLEAN := FALSE);`

  Requests that pre-action status of stack be displayed for the specified stack (or all).

`PROCEDURE noshow;`

  Turns off display of pre-action status.

`FUNCTION showing RETURN BOOLEAN;`

  Returns TRUE if showing pre-action status.

`PROCEDURE verify`
`(stack_in IN VARCHAR2 := defstk,`
`show_contents_in IN BOOLEAN := FALSE);`

  Requests that post-action status of stack be displayed for the specified stack (or all).

`PROCEDURE noverify;`

  Turns off display of post-action status.

`FUNCTION verifying RETURN BOOLEAN;`

  Returns TRUE if showing post-action status.

5.23 PLVrb: Rollback Processing |  | 5.25 PLVtab: Table Interface

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.