Previous Next Contents

3. User RPL Access Routines

3.1 Supplied Directory

The UFL comes with a directory of routines in `access.dir' which allow you to use the UFL's fonts in your own programs. These perform argument checking and can be used in User RPL programs or as the basis for System RPL programs. Included in this directory are the following access routines.

UFL?

Usage: ( -> flag )

Returns 0 or 1 on whether the UFL library exists.

FNT1?

Usage: ( -> flag )

Returns 0 or 1 depending on whether the FNT1 exists. Errors if the UFL does not exist, so check UFL? first.

FNT2?

Usage: ( -> flag )

Returns 0 or 1 depending on whether FNT2 exists. Errors if the UFL does not exist, so check UFL? first.

U->GROB

Usage: ( obj size -> grob )

Converts the specified object to a grob with the requested size font. This access routine is designed to ease User RPL access to the UFL, and is meant to be as compatible as possible with the built in ->GROB command.

U->GROB will not error if the UFL does not exist or if the requested font in the UFL does not exist. Instead, it will fall back on calling the built in ->GROB. This means users of U->GROB do not have to do many of the checks normally associated with use of the UFL and do not have to trap UFL errors.

Only strings will be be converted with the UFL fonts; all other objects are passed to ->GROB. Because there is currently no FNT3 in the UFL, a size of 0 or 3 will always be passed to the built in ->GROB.

F1->G

Usage: ( -> grob )

Recalls the current FNT1 as a 6 x 2048 grob. Errors for insufficient memory or if FNT1 does not exist. The output of this command is suitable for some older packages.

SGROB

Usage: ( string -> grob )

Takes a string and converts it to a graphics objects using FNT1. Errors for bad argument, insufficient memory, UFL does not exist, or FNT1 does not exist.

SDISP

Usage: ( string x y -> )

Takes a string on level 3, a real x coordinate on level 2, and a real y coordinate on level 1, then displays string on the screen with the supplied coordinates using FNT1.

SDISP9

Usage: ( string -> )

Clears the stack grob and displays the first 9 lines of the string from stack level 1 with FNT1. String can be any size. Leaves menu area alone.

SSTAT

Usage: ( string -> )

Clears the status area and displays the first 2 lines of the string from stack level 1 with FNT1. String can be any size.

F2->G

Usage: ( -> grob )

Recalls the current FNT2 as a 8 x 2048 grob. Errors for insufficient memory or if FNT2 does not exist. The output of this command is suitable for the contributed font editors or for StringWriter's `FONT' variable.

MGROB

Usage: ( string -> grob )

Takes a string and converts it to a graphics objects using FNT2. Errors for bad argument, insufficient memory, UFL does not exist, or FNT2 does not exist.

DISPN

Usage: ( string line -> )

Takes a string on level 2 and a real number on level 1, then displays the string on the screen using FNT2. The real number should be a line number between 1 and 7, where 1 is the top of the screen and 7 is the bottom. Errors for insufficient or bad arguments, UFL does not exist, FNT2 does not exist, or if the specified level is not between 1 and 7.

3.2 Error Handling Hierarchy

To avoid bogging down the main access routines, each level of error checking assumes you have properly checked the previous level. For example, if the UFL does not exist and you try to use DISPN, you will find you get "Error: Undefined XLIB Name" rather than a nice error message.


Previous Next Contents