The following built-in functions operating upon the Data stack.

BUFTYPE Prints debugging info about the current Data stack.
DESBUF Deletes the contents of the current Data stack.
DROPBUF Deletes one or more buffers in the current Data stack.
MAKEBUF Creates a buffer marker in the current Data stack.
QUEUED Returns how many items are queued in the current Data stack.
RXQUEUE Create/delete Data stacks. Set the current Data stack.


BUFTYPE

Prints debugging info about the current Data stack to STDOUT (ie, typically, a command prompt window).

Synopsis
CALL BUFTYPE

Args

None.

Returns

None.

Notes

This prints information about the current Data stack to STDOUT, which is usually a command prompt window. The information that is printed out is the following:

1). The current Data stack's name.

2). The number of data items currently in the Data stack.

3). The items in each buffer are listed. The number of the buffer appears first, and then all of the items in that buffer. Each item is shown enclosed in quotes, and unprintable characters (ie, below a SPACE, or high ascii) are displayed as a blank space.

Some interpreters do not have this function.


DESBUF

Deletes the contents of the current Data stack, without deleting the stack itself.

Synopsis
result = DESBUF()

Args

None.

Returns

A 0 if successful, or a count of the undeleted buffers if an error.

Notes

This deletes all buffer markers and the contents of those buffers.

Some interpreters do not have this function.

See also

RXQUEUE's "D" option


DROPBUF

Deletes one or more buffers in the current Data stack.

Synopsis
remaining = DROPBUF(delete)

Args

delete is the desired number of buffers to delete (0 = all buffers). If omitted, DROPBUF() deletes all buffers.

Returns

The number of buffers remaining in the Data stack after DROPBUF() deletes the requested number of buffers.

Notes

All of the items in the deleted buffers are also deleted.

Some interpreters do not have this function.

See also

MAKEBUF


MAKEBUF

Creates a new buffer marker at the bottom of the current Data stack.

Synopsis
remaining = MAKEBUF()

Args

None.

Returns

The number of buffers in this queue after this new buffer is created.

Notes

Some interpreters do not have this function.

See also

DROPBUF


QUEUED

Returns how many items are queued in the current Data stack.

Synopsis
count = QUEUED()

Args

None.

Returns

A count of how many data items are currently contained in the current Data stack. Will be 0 if there are no items. (An error in accessing the Data stack could also result in a count of 0).

Notes

This counts the data items in all buffers contained within a Data stack.

Some interpreters will return a 1 to indicate that there is at least one item in the stack, rather than an actual count of the items in a stack. So, if QUEUED() reports 1, then after you retrieve an item, you may need to call QUEUED() again to see if there really are no more items queued. Reginald always reports the actual number of items for its internal queues.

See also

RXQUEUE, Data stack


RXQUEUE

Creates/deletes Data stacks. Can also be used to set the current Data stack (ie, the one used with any subsequent PULL, PUSH, and QUEUE keywords). Also, RXQUEUE can fetch the name of the current Data stack.

Synopsis
result = RXQUEUE(option, param)

Args

option tells which operation to perform, and must be one of the following:

Option
Meaning
C (Create) Create a new Data stack. param is the desired name for the new Data stack. If there is already a Data stack with this name, then REXX chooses a unique name for the Data stack. If param is omitted, then REXX also chooses a unique name. RXQUEUE() returns the name of the newly created Data stack if it is successfully created, or an empty string if not. The returned name is upper-cased.
D (Delete) Delete a Data stack (and all the buffer markers and data items in it). param is the name of the Data stack to be deleted. RXQUEUE() returns 0 if the Data stack is successfully deleted, or non-zero if an error.
G (Get) Fetch the name of the current Data stack. param is not needed. RXQUEUE() returns the name of the Data stack if successful, or an empty string if not. The returned name is upper-cased.
S (Set) Sets which Data stack is the current one (ie, the one upon which subsequent uses of QUEUE, PULL, and PUSH keywords operate). param is the name for the Data stack to set as the current one. If there is no Data stack with this name, a new Data stack is created as per the "C" option above. If support for external stacks is disabled, RXQUEUE() returns the name of the Data stack that previously was the current one. If support of external stacks is enabled, RXQUEUE() instead returns the name of the Data stack that is now current. If an error setting the Data stack as the current one, an empty string is returned.

Returns

Depends upon option as noted above.

Notes

If deleting a Data stack, and RXQUEUE() returns non-zero, then the following values mean errors:

Value
Meaning
4 or 12 Couldn't get enough memory needed to perform this operation.
5 The Data stack you named was the default "SESSION" Data stack. You cannot delete this Data stack. Or for external stacks, the Data stack you named was not a valid name.
9 The Data stack you named did not exist.

Reginald does not currently support external Data stacks. Therefore, support for external stacks is disabled by default.

Examples

Example use
Return value
RXQUEUE('C', 'My stack')
'MY STACK' /* or some unique name, if successful */
RXQUEUE('C')
/* A unique name if successful, or empty string if not */
RXQUEUE('G')
/* If no Data stacks have yet been created, returns the name of the default stack */
RXQUEUE('S', 'MY STACK')
/* Returns the name of the previously current stack */

See also

QUEUED, Data stack