PARITY - PURGE

PARITY

See ASSIGN.

PASS CONTROL

Supported On UX*  WS DOS*  IN
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PASS CONTROL passes Active Controller capability to a specified HP-IB device.

Example Statements

PASS CONTROL 719
PASS CONTROL @Device

Syntax

Item Description Range
I/O path name name assigned to an HP-IB device any valid name
device selector numeric expression, rounded to an integer must contain primary address (see Glossary)

Semantics

PASS CONTROL first addresses the specified device to talk and then sends the Take Control message (TCT), after which Attention is placed in the False state. The computer then assumes the role of a bus device (a non-active controller). The computer must currently be the active controller to execute this statement, and primary addressing (but not multiple listeners) must be specified. The controller may be either a System or Non-system controller.

Summary of Bus Actions
System Controller

Not System Controller
Interface Select Code Only Primary Address Specified Interface Select Code Only Primary Address Specified
Active Controller Error ATN

UNL

TAD

TCT

ATN

Error ATN

UNL

TAD

TCT

ATN

Not Active Controller Error Error Error Error

HP BASIC/UX Specifics

You cannot pass control on an interface containing a swap device or mounted file system.

HP BASIC/DOS Specifics

PASS CONTROL is fully supported for the measurement coprocessor's built-in HP-IB. PASS CONTROL is not supported for PC plug-in HP-IB cards such as the HP 82335A (select code 24 or 25).

PAUSE

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PAUSE temporarily suspends program execution; execution can be continued by pressing CONTINUE.

Example Statement

PAUSE

Syntax

Semantics

PAUSE suspends program execution until you press [CONTINUE] or execute CONT from the command line. If the program is modified while paused, RUN must be used to restart program execution. When program execution resumes, the computer attempts to service any ON INTR events that occurred while the program was paused. ON ERROR and ON TIMEOUT events generate errors if they occur while the program is paused. ON END, ON ERROR, or ON TIMEOUT events generate errors if they occur while the program is paused. ON KEY and ON KNOB events are ignored while the program is paused. Pressing [PAUSE] (or [Stop] on an ITF keyboard) or executing PAUSE from the command line suspends program execution at the end of the line currently being executed.

PDIR

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PDIR specifies the rotation angle at which the output from IPLOT, RPLOT, POLYGON, POLYLINE, and RECTANGLE is drawn. The angle is measured counterclockwise from the X axis using the current angle mode (DEG or RAD).

Example Statements

PDIR 30
IF Done THEN PDIR Old_angle

Syntax

Item Description Range
angle numeric expression in current units of angle; Default=0 --

Semantics

The rotation is about the local origin of the RPLOT, POLYGON, POLYLINE or RECTANGLE. The local origins are defined as follows:

The rotation angle specified with PDIR is measured counterclockwise from the positive X axis. Thus, the positive X axis is at zero degrees, the positive Y axis is at 90 degrees, and so on.

PEN

Supported On UX WS DOS IN
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PEN specifies the color of the graphics pen used for drawing lines and labels. For information about PEN as a secondary keyword, see the AREA statement.

Example Statements

PEN 2
PEN -1
PEN Pen

Syntax

Item Description Range
pen selector numeric expression, rounded to an integer -32 768 through +32 767 (device dependent)

Semantics

This statement specifies the line color or physical pen to be used for all subsequent lines and labels until one of the following executes:

The PEN statement can be used to specify that the current drawing mode is to erase lines on all devices which support such an operation. This is specified with a negative pen number. An alternate mode of operation which allows non-dominant and complementing drawing may be accessed through the GESCAPE statement. "Complement" means to change the state of pixels; that is, to draw lines where there are none, and to erase where lines already exist. When the PEN statement is executed, the pen used is mapped into the appropriate range, retaining the sign. The formulae used are as follows: For monochromatic displays:

For color displays not in COLOR MAP mode and the HP 98627A:

For displays in COLOR MAP mode:

Where MaxPen is the highest pen number (the lowest is 0). Four planes: MaxPen=15; six planes: MaxPen=63; eight planes: MaxPen=255. For an HPGL Plotter:

Where MaxPen is the highest pen number (the lowest is 0). Four planes: MaxPen=15; six planes: MaxPen=63; eight planes: MaxPen=255. For an HPGL Plotter:

On an HPGL plotter, no checking is done to determine if the requested pen actually exists. Pen 0 puts away any pen if the plotter supports such an operation.

Non-Color Map Mode

The value written into the frame buffer depends not only on what pen is being used, but whether or not the computer is in color map mode. The colors or gray levels for the default (non-color map) mode are given because the color map cannot be changed in this mode.  The meanings of the different pen values are shown in the table below. The pen value can cause either a 1 (draw), a 0 (erase), no change, or invert the value of each location in the frame buffer.

Non-Color Map Mode
Pen Color Plane 1\(Red) Plane 2\(Green) Plane 3\(Blue)
1 White 1 1 1
2 Red 1 0 0
3 Yellow 1 1 0
4 Green 0 1 0
5 Cyan 0 1 1
6 Blue 0 0 1
7 Magenta 1 0 1

For a gray scale monitor, pens 0 through 7 map to the following luminosities:

Pen Luminosity
0

0

1

1

2

.30

3

.89

4

.59

5

.70

6

.11

7

.41

Since hue and saturation are not involved in gray scale mapping, the luminosity values of pens 0 through 7 are simply repeated 32 times for pens 8 through 255.

Drawing with the pen numbers indicated in the above table results in the frame buffer planes being set to the indicated values. Drawing with the negatives of the pen numbers while in normal pen mode causes the bits to be cleared where there are 1s in the table. Drawing with the negatives of the pen numbers while in alternate pen mode causes the bits to be inverted where there are 1s in the table. In either case, no change will take place where there are 0s in the table. Although complementing lines can be drawn, complementing area fills cannot be executed.

Positive pen numbers in alternate drawing mode allows non-dominant drawing. (Non-dominant drawing causes the values in the frame buffer to be inclusively ORed with the value of the pen.) Pen 0 in normal mode complements. Pen 0 in alternate mode draws in the background color. Since the table represents the computer in non-color map mode, table entries for any additional frame buffer planes are all zeros.

Color Map Mode

When operating the color or gray scale display in color map mode, pen colors can be redefined at will. For this reason, no colors are mentioned in the following table. Unlike non-color-map mode, the fourth bit in the frame buffer is used when in color map mode. Also, memory planes 1, 2, and 3 are not associated with red, green, and blue.

Drawing with a pen merely puts the pen number into that pixel's location. The computer looks into the corresponding entry in the color map to determine what actual color the pixel is to exhibit.

Pen Action Plane 1 Plane 2 Plane 3 Plane 4
0 Background 0 0 0 0
1 Draw Pen 1 1 0 0 0
2 Draw Pen 2 0 1 0 0
3 Draw Pen 3 1 1 0 0
4 Draw Pen 4 0 0 1 0
5 Draw Pen 5 1 0 1 0
6 Draw Pen 6 0 1 1 0
7 Draw Pen 7 1 1 1 0
8 Draw Pen 8 0 0 0 1
9 Draw Pen 9 1 0 0 1
10 Draw Pen 10 0 1 0 1
11 Draw Pen 11 1 1 0 1
12 Draw Pen 12 0 0 1 1
13 Draw Pen 13 1 0 1 1
14 Draw Pen 14 0 1 1 1
15 Draw Pen 15 1 1 1 1

Drawing with the negatives of the pen numbers while in normal pen mode causes the bits to be cleared where there are 1s in the table. Drawing with the negatives of the pen numbers while in alternate pen mode causes the bits to be inverted where there are 1s in the table. In either case, no change will take place where there are 0s in the table.

Pen 0 merely draws in the background color. Although complementing lines can be drawn, complementing area fills cannot be executed.

Default Colors

The RGB (red/green/blue) and HSL (hue/saturation/luminosity) values for the default pen colors while in color map mode are shown in the following tables. These can be changed by the SET PEN statement.

RGB Values for Default Pen Colors
Pen Color Red Green Blue
0 Black 0 0 0
1 White 1 1 1
2 Red 1 0 0
3 Yellow 1 1 0
4 Green 0 1 0
5 Cyan 0 1 1
6 Blue 0 0 1
7 Magenta 1 0 1
8 Black 0 0 0
9 Olive Green .80 .73 .20
10 Aqua .20 .67 .47
11 Royal Blue .53 .40 .67
12 Maroon .80 .27 .40
13 Brick Red 1.00 .40 .20
14 Orange 1.00 .47 0.00
15 Brown .87 .53 .27

The same default color map colors are represented below in their HSL (hue/saturation/luminosity) representations:

HSL Values for Default Pen Colors
Pen Color Hue Sat. Lum.
0 Black 0 0 0
1 White 0 0 1
2 Red 0 1 1
3 Yellow .17 1 1
4 Green .33 1 1
5 Cyan .50 1 1
6 Blue .67 1 1
7 Magenta .83 1 1
8 Black 0 0 0
9 Olive Green .15 .75 .80
10 Aqua .44 .75 .68
11 Royal Blue .75 .36 .64
12 Maroon .95 .65 .78
13 Brick Red .04 .80 1.00
14 Orange .08 1.00 1.00
15 Brown .08 .70 .85

For a gray scale monitor, pens 0 through 15 map to the following luminosities:

Pen Luminosity
0 0
1 1
2 .30
3 .89
4 .59
5 .70
6 .11
7 .41
8 0
9 .69
10 .51
11 .47
12 .44
13 .56
14 .58
15 .60

To calculate luminosity for pens 16 through 255, use the following formula:

                         luminosity = 256-pen

                                               241

PENUP

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PENUP lifts the pen on the current plotting device.

Example Statement

PENUP

Syntax

PERMIT

Supported On UX WS DOS*
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PERMIT modifies the owner, group, or public access permissions of an HFS or SRM/UX file or directory.

Example Statements

       PERMIT "/DirPath/HFSfile";OWNER:READ,WRITE; GROUP:READ
       PERMIT FileSpec$
       PERMIT "/Dir/*";GROUP:READ

Syntax

Item Description Range
file or directory specifier string expression specifying a file on an HFS or SRM/UX volume (see drawing)
directory path literal (see MASS STORAGE IS)
HFS file or directory name literal 1 to 14 characters (see Glossary)
SRM/UX file or directory name literal 1 to 16 characters
volume specifier literal (see MASS STORAGE IS)

Semantics

The PERMIT statement is used to:

Restricting access is useful, for instance, to prevent accidental purges of files or to prevent others from reading or writing to a file. You must be the current owner of the file or directory in order to execute PERMIT. There are 9 bits of "permission" for HFS and SRM/UX files.

OWNER GROUP OTHER
Read Write Search Read Write Search Read Write Search

These bits are shown in the PERMISSION column (PERMS column for SRM/UX) of a CAT listing of the directory in which the file or directory resides (R for READ; W for WRITE; X for SEARCH; - for "no permission"):

FILE NAME FILE TYPE NUM RECS REC LEN MODIFIED DATE TIME PERMISSION OWNER GROUP
File 8192 1 7-Nov-86 9:23 RW-RW-RW- 18 9
Directory 256 1 7-Nov-86 9:24 RWXRWXRWX 18 9

The default permission bits for directories are: RWXRWXRWX.

The default permission bits for files are: RW-RW-RW-.

The default permissions on SRM/UX can be changed. See your system administrator if you want to change the default permissions.

There are three classes of users:

Each class of users has three types of permissions for accessing a file or directory:

When a user class is specified, all permission bits for that class are changed:

If no user class is specified, the default permissions for that file are restored. For example, executing PERMIT "Div";Other: gives the following permission: RWXRWX--- and executing: PERMIT "File" gives the following permission: RW-RW-RW- If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PERMIT. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details.

HP BASIC/DOS Specifics

For the HFS file system, HP BASIC/DOS fully supports the PERMIT statement, but only if the HP 82313A Hierarchical File System has been installed.

For the DFS file system, HP BASIC/DOS provides partial PERMIT functionality. By default, DFS sets the permission bits to "RW-RW-RW-" for all files ("RWXRWXRWX" for a directory). You can use the PERMIT statement to make a file read-only with the following statement.

PERMIT "MYFILE";OWNER:READ

This sets the permission bits to "R--R--R--". You cannot set the GROUP and OTHER bits separately.

You can make the file read-write ("RW-RW-RW-") again with the statement:

PERMIT "MYFILE";OWNER:WRITE

You cannot change the permission bits of a DFS directory with PERMIT.

PI

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PI returns 3.141 592 653 589 79, which is an approximate value for π.

Example Statements

Area=PI*Radius^2
PRINT X,X*2*PI

Syntax

PIVOT

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PIVOT specifies a rotation of coordinates which is applied to all drawn lines, but not to labels or axes.

Example Statements

PIVOT 30
IF Special THEN PIVOT Radians

Syntax

Item Description Range
angle numeric expression in current units of angle (same as COS)

Semantics

The specified angle is interpreted according to the current angle mode (RAD or DEG).

The specified angular rotation is performed about the logical pen's position at the time the PIVOT is executed. This rotation is applied only to lines drawn subsequent to the PIVOT; logical pen movement is not affected by PIVOT. Consequently, PIVOT generally causes the logical and physical pens to be left at different positions. Other operations which cause similar effects are attempts to draw outside clip limits and direct HPGL output to plotters.

PLOT

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PLOT moves the graphics pen from the current pen position to the specified X and Y coordinates. Depending on the pen control value, PLOT moves a pen with or without drawing a line.

Example Statements

PLOT 20,90
PLOT Next_x,Next_y,Pen_control

Syntax

Item Description Range
x coordinate numeric expression, in current units --
y coordinate numeric expression, in current units --
pen control numeric expression, rounded to an integer; Default=1 (down after move) -32 768 through +32 767
array name name of two-dimensional, two-column or three-column numeric array. (Requires GRAPHX) any valid name

Semantics

Non-Array Parameters

The specified X and Y position information is interpreted according to the current unit-of-measure. Lines are drawn using the current pen color and line type.

PLOT is affected by the PIVOT transformation.

The line is clipped at the current clipping boundary. If none of the line is inside the current clip limits, the pen is not moved, but the logical pen position is updated.

The optional pen control parameter specifies the following plotting actions; the default value is + 1 (down after move). Zero is considered positive.

Pen Control Resultant Action
-Even Pen up before move
-Odd Pen down before move
+Even Pen up after move
+Odd Pen down after move

Applicable Graphics Transformations

Scaling PIVOT CSIZE LDIR PDIR
Lines (generated by moves and draws) X X [4]
Polygons and rectangles X X X
Characters (generated by LABEL) X X
Axes (generated by AXES & GRID) X
Location of Labels [1] [3] [2]

1The starting point for labels drawn after lines or axes is affected by scaling.

2The starting point for labels drawn after other labels is affected by LDIR.

3The starting point for labels drawn after lines or axes is affected by PIVOT.

4RPLOT and IPLOT are affected by PDIR.

Array Parameters

When using the PLOT statement with an array, either a two-column or a three-column array may be used. If a two-column array is used, the third parameter is assumed to be +1; pen down after move.

FILL and EDGE

When FILL or EDGE is specified, each sequence of two or more lines forms a polygon. The polygon begins at the first point on the sequence, includes each successive point, and the final point is connected or closed back to the first point. A polygon is closed when the end of the array is reached, or when the value in the third column is an even number less than three, or in the range 5 to 8 or 10 to 15. Unexpected results can occur in attempts to FILL a polygon of zero area.

If FILL and/or EDGE are specified on the PLOT statement itself, it causes the polygons defined within it to be filled with the current fill color and/or edged with the current pen color. If polygon mode is entered from within the array, and the FILL/EDGE directive for that series of polygons differs from the FILL/EDGE directive on the PLOT statement itself, the directive in the array replaces the directive on the statement. In other words, if a "start polygon mode" operation selector (a 6, 10, or 11) is encountered, any current FILL/EDGE directive (whether specified by a keyword or an operation selector) is replaced by the new FILL/EDGE directive.

If FILL and EDGE are both declared on the PLOT statement, FILL occurs first. If neither one is specified, simple line drawing mode is assumed; that is, polygon closure does not take place.

If you attempt to fill a figure on an HPGL plotter, the figure will not be filled, but will be edged, regardless of the directives on the statement.

When using a PLOT statement with an array, the following table of operation selectors applies. An operation selector is the value in the third column of a row of the array to be plotted. The array must be a two-dimensional, two-column or three-column array. If the third column exists, it will contain operation selectors which instruct the computer to carry out certain operations. Polygons may be defined, edged (using the current pen), filled (using the current fill color), pen and line type may be selected, and so forth.

Column 1 Column 2 Operation\Selector Meaning
X Y -2 Pen up before moving
X Y -1 Pen down before moving
X Y 0 Pen up after moving (Same as +2)
X Y 1 Pen down after moving
X Y 2 Pen up after moving
pen number ignored 3 Select pen
line type repeat value 4 Select line type
color ignored 5 Color value
ignored ignored 6 Start polygon mode with FILL
ignored ignored 7 End polygon mode
ignored ignored 8 End of data for array
ignored ignored 9 NOP (no operation)
ignored ignored 10 Start polygon mode with EDGE
ignored ignored 11 Start polygon mode with FILL and EDGE
ignored ignored 12 Draw a FRAME
pen number ignored 13 Area pen value
red value green value 14 Color
blue value ignored 15 Value
ignored ignored >15 Ignored

Moving and Drawing

If the operation selector is less than or equal to two, it is interpreted in exactly the same manner as the third parameter in a non-array PLOT statement. Even is up, odd is down, positive is after pen motion, negative is before pen motion. Zero is considered positive.

Selecting Pens

An operation selector of 3 selects a pen. The value in column one is the pen number desired. The value in column two is ignored.

Selecting Line Types

An operation selector of 4 selects a line type. The line type (column one) selects the pattern, and the repeat value (column two) is the length in GDUs that the line extends before a single occurrence of the pattern is finished and it starts over. On the CRT, the repeat value is evaluated and rounded down to the next multiple of 5, with 5 as the minimum.

Selecting a Fill Color

Operation selector 13 selects a pen from the color map with which to do area fills. This works identically to the AREA PEN statement. Column one contains the pen number.

Defining a Fill Color

Operation selector 14 is used in conjunction with operation selector 15. Red and green are specified in columns one and two, respectively, and column three has the value 14. Following this row in the array (not necessarily immediately), is a row whose operation selector in column three has the value of 15. The first column in that row contains the blue value. These numbers range from 0 to >32 767, where 0 is no color and >32 767 is full intensity. Operation selectors 14 and 15 together comprise the equivalent of an AREA INTENSITY statement, which means it can be used on a monochromatic, gray scale, or color display.

Operation selector 15 actually puts the area intensity into effect, but only if an operation selector 14 has already been received.

Operation selector 5 is another way to select a fill color. The color selection is through a Red-Green-Blue (RGB) color model. The first column is encoded in the following manner. There are three groups of five bits right-justified in the word; that is, the most significant bit in the word is ignored. Each group of five bits contains a number which determines the intensity of the corresponding color component, which ranges from zero to sixteen. The value in each field will be sixteen minus the intensity of the color component. For example, if the value in the first column of the array is zero, all three five-bit values would thus be zero. Sixteen minus zero in all three cases would turn on all three color components to full intensity, and the resultant color would be a bright white.

Assuming you have the desired intensities (which range from 0 through 1) for red, green, and blue in the variables R, G, and B, respectively, the value for the first column in the array could be defined thus:

   Array(Row,1)=SHIFT(16*(1-B),-10)+SHIFT(16*(1-G),-5)+16*(1-R)

If there is a pen color in the color map similar to that which you request here, that non-dithered color will be used. If there is not a similar color, you will get a dithered pattern.

If you are using a gray scale display, Operation selector 5 uses the five bit values of the RGB color specified to calculate luminosity. The resulting gray luminosity is then used as the area fill. For detailed information on gray scale calculations, see the chapter "More About Color Graphics" in the HP BASIC Advanced Programming Techniques manual.

Polygons

A six, ten, or eleven in the third column of the array begins a "polygon mode". If the operation selector is 6, the polygon will be filled with the current fill color. If the operation selector is 10, the polygon will be edged with the current pen number and line type. If the operation selector is 11, the polygon will be both filled and edged. Many individual polygons can be filled without terminating the mode with an operation selector 7. This can be done by specifying several series of draws separated by moves. The first and second columns are ignored and should not contain the X and Y values of the first point of a polygon.

Operation selector 7 in the third column of a plotted array terminates definition of a polygon to be edged and/or filled and also terminates the polygon mode (entered by operation selectors 6, 10, or 11). The values in the first and second columns are ignored, and the X and Y values of the last data point should not be in them. Edging and/or filling of the most recent polygon will begin immediately upon encountering this operation selector.

Doing a FRAME

Operation selector 12 does a FRAME around the current soft-clip limits. Soft clip limits cannot be changed from within the PLOT statement, so one probably would not have more than one operation selector 12 in an array to PLOT, since the last FRAME will overwrite all the previous ones.

Premature Termination

Operation selector 8 causes the PLOT statement to be terminated. The PLOT statement will successfully terminate if the actual end of the array has been reached, so the use of operation selector 8 is optional.

Ignoring Selected Rows in the Array

Operation selector 9 causes the row of the array it is in to be ignored. Any operation selector greater that fifteen is also ignored, but operation selector 9 is retained for compatibility reasons. Operation selectors less than -2 are not ignored. If the value in the third column is less than zero, only evenness/oddness is considered.

PLOTTER IS

Supported On UX* WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PLOTTER IS performs these graphics functions:

Example Statements

PLOTTER IS CRT,"INTERNAL" ! Display mode non-color mapped.
PLOTTER IS CRT,"INTERNAL";COLOR MAP ! Display mode color mapped.
PLOTTER IS Device,Id$
PLOTTER IS 705,"HPGL"
PLOTTER IS "Plot_file","HPGL", P1x,P2x,P1y,P2y
PLOTTER IS "MyBDATfile","HPGL"
PLOTTER IS 28,"98627A;US TV"
PLOTTER IS 601,"WINDOW";COLOR MAP ! BASIC/UX in X only
PLOTTER IS "lp -dplot","HPGL",xmin,xmax,ymin,ymax ! BASIC/UX
PLOTTER IS "MyBDATFile","HPGL";APPEND ! Requires MS binary

Syntax

Item Description Range
device selector numeric expression, rounded to an integer (see Glossary)
display/plotter specifier string expression (see drawing)
color map display specifier string expression INTERNAL or WINDOW
file specifier string expression, except substring (see drawing)
plot specifier string expression HPGL
window specifier numeric expression WINDOW
xmin numeric expression; Default=-392.75mm device dependent; xmin < xmax; absolute value &leq; 819.175
xmax numeric expression; Default=392.75mm device dependent; absolute value &leq; 819.175
ymin numeric expression; Default=-251.5mm device dependent; ymin < ymax; absolute value &leq; 819.175
ymax numeric expression; Default=251.5mm device dependent; absolute value &leq; 819.175
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)

Semantics

Plotters

The hard clip limits of the plotter are read in when this statement is executed. Therefore, the specified device must be capable of responding to this interrogation.

Files

Using PLOTTER IS with a file specifier causes all subsequent plotter output to go to the indicated file. The file must be a BDAT or HP-UX file. The PLOTTER IS statement positions the file pointer to the beginning of the file unless you specify the APPEND option. Thus, PLOTTER IS overwrites existing files unless you specify APPEND. The file is closed when another PLOTTER IS statement is executed or SCRATCH A, GINIT or Reset is executed. An end-of-file error occurs when the end of a LIF file is reached.

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PLOTTER IS. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with PLOTTER IS must match one and only one file name.

Xmin, Xmax, Ymin, Ymax are the hard clip limits of the plotter in millimeters. This assumes 0.025 mm per plotter unit. The default size is for an HP 7580 or HP 7585 D-size drawing. See the plotter manual for more information on plotter limits. If you want to send HPGL commands to a file that is currently the PLOTTER IS device, use the GSEND statement. See the keyword dictionary entry for GSEND for details.

SRM and HFS Files

In order to write to a PLOTTER IS file on an HFS volume, you need to have R (read) and W (write) permission on the file, and X (search) permission on all superior directories.

In order to write to a PLOTTER IS file in an SRM volume, you need to have R (read) and W (write) permissions on the file, as well as R permission on all superior directories. No end-of-file errors occur on SRM or HFS files, because these files are extensible. That is, if the data output to the file with this statement would overflow the file's space allocation, the file is automatically extended provided the disk contains enough unused storage space.

SRM Plotter Spoolers

If the specified file is in the SRM plotter spooler directory and the file contains data, then the SRM system sends the data to the plotting device (when the file is closed) and then purges the file. You may close the file by executing another PLOTTER IS statement, GINIT, SCRATCH A or SCRATCH BIN, or by pressing [RESET] ([SHIFT]-[PAUSE] or [Shift]-[Break]).

Displays

The statement PLOTTER IS CRT, "INTERNAL" is executed whenever a graphics statement is executed which needs a plotter (see GINIT) and no plotter is active. The plotter activated is the first device encountered in the following order:

  1. The alpha display, if it has graphics capabilities
  2. Internal 98542A, 98543A, 98544A, 98545A, 98547A, 98548A, 98549A, 98550A, 98700, or 98720 at select code 6
  3. Model 362/382 internal displays at select code 132.
  4. Non-bit-mapped alpha display with graphics capabilities at select code 3 (HP BASIC/UX supports the 98546A compatibility interface only)
  5. External 98700 or 98720 at select code > 7
  6. 98627A at select code > 7 (HP BASIC/WS only).

If the COLOR MAP option is specified and the plotting device has a color or gray map, the capability of changing the color or gray map is enabled (see SET PEN). If the COLOR MAP option is specified (explicitly or by default) you can change the colors assigned to each pen number using SET PEN. Also, the values written into the frame buffer are different than they would be if color map mode was not enabled. If the COLOR MAP option is not included and the plotting device is the Model 236 color display, the 4th memory plane is cleared (HP BASIC/WS only).

Non-Color Map Mode

Executing a PLOTTER IS statement without the COLOR MAP keyword causes the color map to be defined as follows, where 0 is zero intensity and 1 is full intensity. This emulates the HP 98627A non-color-mapped device on a color bit-mapped display.

Pen Color Red Green Blue
0 Complement 0 0 0
1 White 1 1 1
2 Red 1 0 0
3 Yellow 1 1 0
4 Green 0 1 0
5~~ Cyan 0 1 1
6 Blue 0 0 1
7 Magenta 1 0 1

For a gray scale monitor, pens 0 through 7 map to the following luminosities:

Pen Luminosity
0 0
1 1
2 .30
3 .89
4 .59
5 .70
6 .11
7 .41

Since hue and saturation are not involved in gray scale mapping, the luminosity values of pens 0 through 7 are simply repeated 32 times for pens 8 through 255.

On a display with bit-mapped alpha, the non-color map mode affects the ALPHA PEN, PRINT PEN, KEY LABELS PEN, and KBD LINE PEN statements as follows: 8 is black (the same as 0) and 9 through 15 are white (the same as 1).

The complementing cursor will be white on top of all colors except white, in which case it will be black.

COLOR MAP

In the COLOR MAP mode, the color map is initialized so that the first eight colors are the same as they were in the default mode, and the second eight colors simulate HP's designer colors of plotter pen ink or gray map luminosity.

Although the pen numbers select the same color or gray luminosity in color map mode as in non-color map mode (for the first eight pens), the actual values written to the frame buffer are different. This results from the different interpretation of the values in the frame buffer: in non-color map mode, the values are RGB values or gray luminosity; in color-map mode, the values are indices into the color or gray map. This means that a picture drawn in non-color map mode will change colors or gray luminosity if a PLOTTER IS with the COLOR MAP option is executed. The reverse is also true.

On a console or a terminal, when the PLOTTER IS statement is executed, the color or gray map is initialized to a default state. If the graphics write-enable mask is left in the default mode, the entire color or gray map will be initialized as before. Otherwise, the following algorithm is used: all color or gray map entries whose binary representation has 1s in non-graphics planes will remain unchanged. This is done to insure that only pens dedicated to graphics are initialized. For example, with a graphics write mask of 7 (binary 0000 0111), only pens 0 through 7 are initialized. Higher numbered pens would remain unchanged since their binary representation would have 1s in non-graphics planes.

In windows, the color map is initialized to whatever the color map was when HP BASIC was booted.

Display Specifiers

There are several values which can be used when specifying the display on which graphics operations are done:
PLOTTER IS CRT,"INTERNAL" or PLOTTER IS 1,"INTERNAL" This is the safest of the possibilities. "CRT" is a built-in function which returns the value 1, and the value 1 is interpreted by the graphics system as "the default display." The default display may be an external display if no internal display exists.
PLOTTER IS 3,"INTERNAL" This specifies a non-bit-mapped display if there is one; otherwise, the action is equivalent to PLOTTER IS 1,"INTERNAL". Specifying a value of 3 makes sense for all Series 200 displays except the Model 237.
PLOTTER IS 6,"INTERNAL" Always specifies a bit-mapped display. If one is not found, an error results.
PLOTTER IS dev_sel ,"INTERNAL" With the 98700 and 98720 displays, it is possible to configure the display card so that it is at an external select code. For example, if you set the select code to 25, you would use PLOTTER IS 25,"INTERNAL"
PLOTTER IS window_id,"WINDOW" HP BASIC/UX only) This specifier works only in a windowing environment. A window id of 600 is equivalent to PLOTTER IS CRT,"INTERNAL" in the windowing environment.
PLOTTER IS dev_sel,"98627A" HP BASIC/WS only) This specifies a color graphics display connected through the 98627A interface card. This may have any one of several options specifying television format, etc. See the following table. PLOTTER IS dev_sel, "INTERNAL" is also accepted.

HP 98627A Display Specifiers
Desired Display Format Display Specifier
Standard Graphics

   512 by 390 pixels,

   60 Hz, non-interlaced

98627A or 98627A;US STD
  512 by 390 pixels,

   50 Hz, non-interlaced

98627A;EURO STD
High-Resolution Graphics

     512 by 512 pixels

     46.5 Hz, non-interlaced

98627A;HI RES
TV Compatible Graphics

    512 by 474 pixels,

    60 Hz, interlaced

   (30 Hz refresh rate)

98627A;US TV
   512 by 512 pixels,

   50 Hz, interlaced

   (25 Hz refresh rate)

98627A;EURO TV

Default Pen Colors

The PLOTTER IS statement defines the color or gray map to default values in a non-windowing environment. These values are different depending on whether or not the COLOR MAP option was selected.

Note that the color assignments for pens 16-31 depend on the video hardware and drivers used by your computer. If your video hardware and drivers support 256 colors or more, HP BASIC will assign the colors listed in the following table to pens 16-31. If your video hardware and drivers do not support at least 256 colors, HP BASIC will assign the same colors to pens 16-31 that are used for pens 1-15. Thus, on a video display that supports fewer than 256 colors (such as VGA), pens 1 and 16 are the same color, pens 2 and 17 are the same color, and so on.

Color Map Default Color Definitions (RGB)
Pen Color Red Green Blue
0 Black                         0 0 0
1 White 1 1 1
2 Red 1 0 0
3 Yellow 1 1 0
4 Green 0 1 0
5 Cyan 0 1 1
6 Blue 0 0 1
7 Magenta 1 0 1
8 Black 0 0 0
9 Olive Green .80 .73 .20
10 Aqua .20 .67 .47
11 Royal Blue .53 .40 .67
12 Maroon .80 .27 .40
13 Brick Red 1.00 .40 .20
14 Orange 1.00 .47 0.00
15 Brown .87 .53 .27

The same default color map colors are represented below in their HSL (hue/saturation/luminosity) representations:

Color Map Default Color Definitions (HSL)
Pen Color Hue Sat. Lum.
0 Black 0 0 0
1 White 0 0 1
2 Red 0 1 1
3 Yellow .17 1 1
4 Green .33 1 1
5 Cyan .50 1 1
6 Blue .67 1 1
7 Magenta .83 1 1
8 Black 0 0 0
9 Olive Green              .15 .75 .80
10 Aqua .44 .75 .68
11 Royal Blue .75 .36 .64
12 Maroon .95 .65 .78
13 Brick Red .04 .80 1.00
14 Orange .08 1.00 1.00
15 Brown .08 .70 .85

For a gray scale monitor, pens 0 through 15 map to the following luminosities:

Pen Luminosity
0 0
1 1
2 .30
3 .89
4 .59
5 .70
6 .11
7 .41
8 0
9 .69
10 .51
11 .47
12 .44
13 .56
14 .58
15 .60

To calculate luminosity for pens 16 through 255, use the following formula:

                             luminosity = 256-pen

                                                  241

Eight-plane machines have 256-entry color or gray maps. In these machines, pens 16 through 255 are defined to a variety of shades. For exact values, interrogate the color or gray map with GESCAPE.

HP BASIC/UX Specifics

HP BASIC/UX treats output to a pipe as it would output to a file. The pipe must be explicitly closed before any output becomes permanent (or takes place). Output to a spooled device will not be sent to the spooler until the pipe has been closed. The closing of pipes can be achieved with a subsequent PLOTTER IS, QUIT, or SCRATCH A command. When running in the X Window environment, pen colors depend on the color map as determined by the parameters of the X Window System.

POLYGON

Supported On UX* WS DOS
Option Required GRAPHX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

POLYGON draws all or part of a closed regular polygon. The polygon can be filled and/or edged.

Example Statements

POLYGON Radius,Total_sides,Drawn_sides
POLYGON -Size,5,FILL,EDGE

Syntax

Item Description Range
radius numeric expression, in current units --
total sides numeric expression, rounded to an integer. Default=60 3 through 32 767
sides to draw numeric expression, rounded to an integer. Default=all sides 1 through 32 767

Semantics

The radius is the distance that the vertices of the polygon will be from the logical pen position. The first vertex will be at a distance specified by "radius" in the direction of the positive X-axis. Specifying a negative radius results in the figure being rotated 180 degrees.

The total sides and the number of sides drawn need not be the same. Thus:

   POLYGON 1.5,8,5

will start to drawn an octagon whose vertices are 1.5 units from the current pen position, but will only draw five sides of it before closing the polygon at the first point. If the number of sides to draw is greater than the specified total sides, sides to draw is treated as if it were equal to total sides.

POLYGON forces polygon closure, that is, the first vertex is connected to the last vertex, so there is always an inside and an outside area. This is true even for the degenerate case of drawing only one side of a polygon, in which case a single line results. This is actually two lines, from the first point to the last point, and back to the first point.

Polygon Shape

The shape of the polygon is affected by the viewing transformation specified by SHOW or WINDOW. Therefore, anisotropic scaling causes the polygon to be distorted; stretched or compressed along the axes. If a rotation transformation is in effect, the polygon will be rotated first, then stretched or compressed along the unrotated axes.

The pen status also affects the final shape of a polygon if sides to draw is less than total sides. If the pen is up at the time POLYGON is specified, the first vertex specified is connected to the last vertex specified, not including the center of the polygon, which is the current pen position. If the pen is down, however, the center of the polygon is also included in it. If sides to draw is less than total sides, piece-of-pie shaped polygon segments are created.

FILL and EDGE

FILL causes the interior of the polygon or polygon segment to be filled with the current fill color as defined by AREA PEN, AREA COLOR, or AREA INTENSITY. EDGE causes the edges of the polygon to be drawn using the current pen and line type. If both FILL and EDGE are specified, the interior will be filled, then the edge will be drawn. If neither FILL nor EDGE is specified, EDGE is assumed. Unexpected results can occur in attempts to FILL a polygon of zero area.

Polygons sent to an HPGL plotter are edged but not filled regardless of any FILL or EDGE directives in the statement.

After POLYGON has executed, the pen is in the same position it was before the statement was executed, and the pen is up. The polygon is clipped at the current clip limits.

Summary of POLYGON Graphics Transformations

Scaling PIVOT CSIZE LDIR PDIR
Lines (generated by moves and draws) X X [4]
Polygons and rectangles X X X
Characters (generated by LABEL) X X
Axes (generated by AXES & GRID) X
Location of Labels [1] [3] [2]

1The starting point for labels drawn after lines or axes is affected by scaling.

2The starting point for labels drawn after other labels is affected by LDIR.

3The starting point for labels drawn after lines or axes is affected by PIVOT.

4RPLOT and IPLOT are affected by PDIR.

HP BASIC/UX Specifics

There are device dependent limitations on the number of vertices for which a correct FILL will be obtained. Polygon fills in the X Windows environment do not fill to include the lower and right boundaries.

POLYLINE

Supported On UX WS DOS
Option Required GRAPHX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

POLYLINE draws all or part of an open regular polygon.

Example Statements

POLYLINE Radius,Total_sides,Drawn_sides
POLYLINE -Size,5

Syntax

Item Description Range
radius numeric expression, in current units --
total sides numeric expression, rounded to an integer. Default=60 3 through 32 767
sides to draw numeric expression, rounded to an integer. Default=all sides 1 through 32 767

Semantics

The radius is the distance that the vertices of the polygon will be from the current pen position. The first vertex will be at a distance specified by "radius" in the direction of the positive X-axis. Specifying a negative radius results in the figure being rotated 180 degrees.

The total sides and the number of sides drawn need not be the same. Thus:

         POLYLINE 1.5,8,5

will start to drawn an octagon whose vertices are 1.5 units from the current pen position, but will only draw five sides of it. If the number of sides to draw is greater than the total sides specified, it is treated as if it were equal to the total sides.

Shape of Perimeter

POLYLINE does not force polygon closure, that is, if sides to draw is less than total sides, the first vertex is not connected to the last vertex, so there is no "inside" or "outside" area.

The shape of the polygon is affected by the viewing transformation specified by SHOW or WINDOW. Therefore, anisotropic scaling causes the perimeter to be distorted; stretched or compressed along the axes. If a rotation transformation is in effect, the polygon will be rotated first, then stretched or compressed along the unrotated axes.

The pen status also affects the way a POLYLINE statement works. If the pen is up at the time POLYLINE is specified, the first vertex is on the perimeter. If the pen is down, the first point is the current pen position, which is connected to the first point on the perimeter.

After POLYLINE has executed, the current pen position is in the same position it was before the statement was executed, and the pen is up. The polygon is clipped at the current clip limits.

Summary of POLYLINE Graphics Transformations

Scaling PIVOT CSIZE LDIR PDIR
Lines (generated by moves and draws) X X [4]
Polygons and rectangles X X X
Characters (generated by LABEL) X X
Axes (generated by AXES & GRID) X
Location of Labels [1] [3] [2]

1The starting point for labels drawn after lines or axes is affected by scaling.

2The starting point for labels drawn after other labels is affected by LDIR.

3The starting point for labels drawn after lines or axes is affected by PIVOT.

4RPLOT and IPLOT are affected by PDIR.

POS

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

POS returns the first position of a substring within a string. If the searched string contains two-byte characters, the position is measured in bytes, not characters.

Example Statements

Point=POS(Big$,Little$)
IF POS(A$,CHR$(10)) THEN Line_end

Syntax

Item Description
string searched string expression --
string searched for string expression --

Semantics

If the value returned is greater than 0, it is the position of the first character of the string being searched for in the string being searched. If the value returned is 0, the string being searched for cannot be found (or the string searched for is the null string).

Note that the position returned is the relative position within the string expression used as the first argument. Thus, when a substring is searched, the position value refers to that substring.

Two-Byte Language Specifics

Certain localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. The POS function can handle any combination of one- and two-byte characters. The value returned is the byte position of the first character being searched for. For more information about two-byte characters, refer to the globalization chapters of HP BASIC Porting and Globalization.

PPOLL

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PPOLL conducts a Parallel Poll and returns a byte representing eight status-bit messages of the devices on an HP-IB.

Example Statements

Stat=PPOLL(7)
IF BIT(PPOLL(@Hpib),3) THEN Respond

Syntax

Item Description Range
I/O path name name assigned to an interface select code any valid name (see ASSIGN)
interface select code numeric expression, rounded to an integer 7 through 31

Semantics

The computer must be the active controller to execute this function.

Bus Actions

Summary of PPOLL Bus Actions
Interface Select Code Only Primary Address Specified

ATN & EOI

(duration > 25µs)

Read byte

____

EOI

Restore ATN to previous state

Error

PPOLL CONFIGURE

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PPOLL CONFIGURE programs the logical sense and data bus line on which a specified device responds to a parallel poll.

Example Statements

PPOLL CONFIGURE 711;2
PPOLL CONFIGURE @Dvm;Response

Syntax

Item Description Range
I/O path name name assigned to a device or devices any valid name
device selector numeric expression, rounded to an integer must contain a primary address (see Glossary)
configure byte numeric expression, rounded to an integer 0 through 15

Semantics

This statement assumes that the device's response is bus-programmable. The computer must be the active controller to execute this statement. The configure byte is coded. The three least significant bits determine the data bus line for the response. The fourth bit determines the logical sense of the response.

Bus Actions

Summary of PPOLL CONFIGURE Bus Actions
Interface Select Code Only Primary Address Specified
Error ATN

MTA

UNL

LAG

PPC

PPE

PPOLL RESPONSE

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PPOLL RESPONSE defines the computer's response to a Parallel Poll on an HP-IB interface. The response indicates whether or not the computer needs service.

Example Statements

PPOLL RESPONSE Isc;Service
PPOLL RESPONSE @Hpib;1

Syntax

Item Description Range
I/O path name name assigned to an interface select code any valid name
interface select code numeric expression, rounded to an integer 7 through 31
I do/don't need service numeric expression, rounded to an integer 0 or 1

Semantics

This statement defines the computer's response to a Parallel Poll (ATN and EOI) performed by the current Active Controller on the specified HP-IB Interface. This statement only sets up a potential response; no actual response is generated when the statement is executed.

If the value of the "I do/don't need service" parameter is 0, the computer is directed to place a logical false on the bit on which it has been defined to respond; this response will tell the Active Controller that this (non-active) controller does not need service. Any non-zero, positive value of this parameter (within the stated range) directs the computer to set up a true response, which will tell a polling Active Controller that the computer requires service.

The bit on which the computer is to place its Parallel Poll response is determined by the value of the last "configure byte" written to CONTROL Register 5 of the corresponding HP-IB Interface. In general, this configure byte can be read from HP-IB STATUS Register 7 by the service routine that responds to Parallel-Poll-Configuration-Change interrupts (Bit 14 of the Interrupt Enable Register). This configure byte may then be written into HP-IB CONTROL Register 5, and the response desired by the Active Controller will be sent when a Parallel Poll is conducted.

This statement may be executed by either an Active Controller or a non-active controller.

PPOLL UNCONFIGURE

Supported On UX WS DOS
Option Required IO
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PPOLL UNCONFIGURE disables the parallel poll response of a specified device or devices.

Example Statements

PPOLL UNCONFIGURE 7
PPOLL UNCONFIGURE Device
PPOLL UNCONFIGURE @Meter

Syntax

Item Description Range
I/O path name name assigned to a device or devices any valid name
device selector numeric expression, rounded to an integer (see Glossary)

Semantics

The computer must be the active controller to execute PPOLL UNCONFIGURE. The computer may be either a System or Non-System Controller.

If multiple devices are specified by an I/O path name, all specified devices are deactivated from parallel poll response. If the device selector or I/O path name refers only to an interface select code, all devices on that interface are deactivated from parallel poll response.

Bus Actions

Summary of PPOLL UNCONFIGURE Bus Actions
Interface Select Code Only Primary Address Specified
ATN

ATN

PPU

MTA

UNL

LAG

PPC

PPD

PRINT

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRINT sends items to the PRINTER IS device. The default PRINTER IS device is the alphanumeric display.

Example Statements

PRINT "LINE";Number
PRINT Array(*)
PRINT TABXY(1,1),Head$,TABXY(Col,3),Msg$
PRINT String$[1,8],TAB(12),Result
PRINT USING 125;X,Y,Z
PRINT USING "5Z.DD";Money
PRINT USING Fmt3;Id,Item$,Kilograms/2.2

Item Description Range
image line number integer constant identifying an IMAGE statement 1 through 32 766 (1 through 2 147 483 646 for HP BASIC/UX 700)
image line label name identifying an IMAGE statement any valid name
image specifier string expression (see drawings)
string array name name of a string array any valid name
numeric array name name of a numeric array any valid name
column numeric expression, rounded to an integer device dependent
CRT column numeric expression, rounded to an integer 1 through screen width
CRT row numeric expression, rounded to an integer 1 through alpha height
image specifier list literal (see drawings)
repeat factor integer constant 1 through 32 767
literal string constant composed of characters from the keyboard, including those generated using the ANY CHAR key quote mark not allowed

Semantics

Standard Numeric Format

The standard numeric format depends on the value of the number being displayed. If the absolute value of the number is greater than or equal to 1E-4 and less than 1E+6, it is rounded to 12 digits and displayed in floating point notation. If it is not within these limits, it is displayed in scientific notation. The standard numeric format is used unless USING is selected, and may be specified by using K in an image specifier.

COMPLEX numbers are treated like two REAL numbers separated by a semicolon.

Automatic End-Of-Line Sequence

After the print list is exhausted, an End-Of-Line (EOL) sequence is sent to the PRINTER IS device, unless it is suppressed by trailing punctuation or a pound-sign (#) image specifier. The printer width for EOL sequences generation is set to the screen width (50, 80 or 128 characters) for CRTs and to 80 for external devices unless the WIDTH attribute of the PRINTER IS statement was specified. WIDTH is off for files. This "printer width exceeded" EOL is not suppressed by trailing punctuation, but can be suppressed by the use of an image specifier.

Control Codes

Some ASCII control codes have a special effect in PRINT statements if the PRINTER IS device is the CRT (device selector=1):

Character Keystroke Name Action
CHR$(7) [CTRL]-[G] bell Sounds the beeper
CHR$(8) [CTRL]-[H] backspace Moves the print position back one character.
CHR$(10) [CTRL]-[J] line-feed Moves the print position down one line.
CHR$(12) [CTRL]-[L] form-feed Prints two line-feeds, then advances the CRT buffer enough lines to place the next item at the top of the CRT.
CHR$(13) [CTRL]-[M] carriage-return Moves the print position to column 1.

The effect of ASCII control codes on a printer is device dependent. See your printer manual to find which control codes are recognized by your printer and their effects.

CRT Enhancements

There are several character enhancements (such as inverse video and underlining) available on some CRTs. They are accessed through characters with decimal values above 127. For a list of the characters and their effects, see the "Display Enhancement Characters" table in "Useful Tables" at the back of this book.

Arrays

Entire arrays may be printed using the asterisk specifier. Each element in an array is treated as a separate item by the PRINT statement, as if the items were listed separately, separated by the punctuation following the array specifier. If no punctation follows the array specifier, a comma is assumed.

COMPLEX array elements are treated as if the real and imaginary parts are separated by a semicolon. The array is output in row major order (rightmost subscript varies fastest).

PRINT Fields

If PRINT is used without USING, the punctuation following an item determines the width of the item's print field; a semicolon selects the compact field, and a comma selects the default print field. Any trailing punctation will suppress the automatic EOL sequence, in addition to selecting the print field to be used for the print item preceding it.

The compact field is slightly different for numeric and string items. Numeric items are printed with one trailing blank. String items are printed with no leading or trailing blanks.

The default print field prints items with trailing blanks to fill to the beginning of the next 10-character field.

Numeric data is printed with one leading blank if the number is positive, or with a minus sign if the number is negative, whether in compact or default field.

TAB

The TAB function is used to position the next character to be printed on a line. In the TAB function, a column parameter less than one is treated as one. A column parameter greater than zero is subjected to the following formula:

        TAB position = ((column - 1) MOD width) +1

where "width" is 50 for the Model 226 CRT, 128 for Model 237 and other hi-resolution displays, and 80 for all other devices.

If the TAB position evaluates to a column number less than or equal to the number of characters printed since the last EOL sequence, then an EOL sequence is printed, followed by (TAB position - 1) blanks. If the TAB position evaluates to a column number greater than the number of characters printed since the last EOL, sufficient blanks are printed to move to the TAB position.

TABXY

The TABXY function provides X-Y character positioning on the CRT. It is ignored if a device other than the CRT is the PRINTER IS device. TABXY(1,1) specifies the upper left-hand corner of the CRT. If a negative value is provided for CRT row or CRT column, it is an error. Any number greater than the screen width for CRT column is treated as the last column on the screen. Any number greater than the height of the output area for CRT row is treated as the last line of the output area. If 0 is provided for either parameter, the current value of that parameter remains unchanged.

Display Type Output Area Height Display Width
226 18 50
216, 220, 236, and

98546, DOS EGA

18 80
98542 and 98543 19 80
DOS VGA 27 80
237, 98544, 98545,

98547, 98549, 98700,

and Model 362/382

1024 x 768 internal

41 128
98548 and 98550 44 128
Model 362/382 640 X

480 internal, DOS VGA

23 80

PRINT With Using

When the computer executes a PRINT USING statement, it reads the image specifier, acting on each field specifier (field specifiers are separated from each other by commas) as it is encountered. If nothing is required from the print items, the field specifier is acted upon without accessing the print list. When the field specifier requires characters, it accesses the next item in the print list, using the entire item. Each element in an array is considered a separate item.

The processing of image specifiers stops when there is no matching display item (and the specifier requires a display item). If the image specifiers are exhausted before the display items, they are reused, starting at the beginning.

COMPLEX values require two REAL image specifiers (i.e. each COMPLEX value is treated like two REAL values).

If a numeric item requires more decimal places to the left of the decimal point than are provided by the field specifier, an error is generated. A minus sign takes a digit place if M or S is not used, and can generate unexpected overflows of the image field. If the number contains more digits to the right of the decimal point than are specified, it is rounded to fit the specifier.

If a string is longer than the field specifier, it is truncated, and the right-most characters are lost. If it is shorter than the specifier, trailing blanks are used to fill out the field.

Effects of the image specifiers on the PRINT statement are shown in the following table:

Image\Specifier Meaning

K

Compact field. Prints a number or string in standard form with no leading or trailing blanks.

-K

Same as K.

H

Similar to K, except the number is printed using the European number format (comma radix). (Requires IO)

-H

Same as H. (Requires IO)

S

Prints the number's sign (= or -).

M

Prints the number's sign if negative, a blank if positive.

D

Digit specifier prints one digit character. A leading zero is replaced by a blank. If the number is negative and no sign image is specified, the minus sign will occupy a leading digit position. If a sign is printed, it will float to the left of the left-most digit.

Z

Same as D, except that leading zeros are printed.

*

Like Z, except that asterisks are printed instead of leading zeros. (Requires IO)

.

Prints a decimal-point radix specifier.

R

Prints a comma radix specifier (European radix). (Requires IO)

E

Prints an E, a sign, and a two-digit exponent.

ESZ

Prints an E, a sign, and a one-digit exponent.

ESZZ

Same as E.

ESZZZ

Prints an E, a sign, and a three-digit exponent.

A

Prints a string character. Trailing blanks are output if the number of characters specified is greater than the number available in the corresponding string. If the image specifier is exhausted before the corresponding string, the remaining characters are ignored. Use AA or 2A for two-byte globalization characters.

X

Prints a blank.

literal

Prints the characters contained in the literal.

B

Prints the character represented by one byte of data. This is similar to the CHR$ function. The number is rounded to an INTEGER and the least-significant byte is sent. If the number is greater than 32 767, then 255 is used; if the number is less than -32 768, then 0 is used.

W

Prints two characters represented by the two bytes in a 16-bit, two's-complement integer word. The corresponding numeric item is rounded to an INTEGER. If it is greater than 32 767, then 32 767 is used; if it is less than -32 768, then -32 768 is used. On an 8-bit interface, the most-significant byte is sent first. On a 16-bit interface, the two bytes are sent as one word in a single operation.

Y

Same as W. (Requires IO)

#

Suppresses the automatic output of the EOL (End-Of-Line) sequence following the last print item.

%

Ignored in PRINT images.

=

Changes the automatic EOL sequence that normally follows the last print item to a single carriage-return. (Requires IO)

-

Changes the automatic EOL sequence that normally follows the last print item to a single line-feed. (Requires IO)

/

Sends a carriage-return and a line-feed to the PRINTER IS device.

L

Sends the current EOL sequence to the PRINTER IS device. The default EOL characters are CR and LF; see PRINTER IS for information on re-defining the EOL sequence. If the destination is an I/O path name with the WORD attribute, a pad byte may be sent after the EOL characters to achieve word alignment.

@

Sends a form-feed to the PRINTER IS device.

NOTE
Some localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. When using this localized language remember that the IMAGE, ENTER USING, OUTPUT USING, and PRINT USING statements define a one-byte ASCII character image with A. Use the image AA to designate a two-byte character.

For a general discussion of globalization and localization, refer to the HP BASIC Porting and Globalization manual. For LANGUAGE specific details, refer to Using LanguageX With HP BASIC, where LanguageX is your local language.

PRINTALL IS

Supported On UX* WS DOS
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRINTALL IS assigns a logging device, file, or pipe for recording operator interaction and troubleshooting messages. The PRINTALL device is 1 (the CRT) at power-on and after SCRATCH A.

Example Statements

    PRINTALL IS 701
    PRINTALL IS Gpio
    PRINTALL IS 614 !HP BASIC/UX in X only
    PRINTALL IS "debug.out" ! HP BASIC/UX/WS only
  
    PRINTALL IS " fold  pr -e -o8  lp" ! HP BASIC/UX only

The following examples require the IO binary.

    PRINTALL IS 707;EOL My$ DELAY .5
    PRINTALL IS Device;WIDTH 120,EOL My$ END

The following example requires the MS binary.

    PRINTALL IS "debug.out";APPEND

The following examples require the LANGUAGE binary.

    PRINTALL IS 701;EXCHANGE "HP-16"
    PRINTALL IS 701;EXCHANGE "JIS" SHIFT IN In$ OUT Out$

Syntax

Item Description Range
device selector numeric expression, rounded to an integer; Default=CRT (see Glossary)
file specifier string expression -
pipe string expression -
end-of-line characters string expression; Default=CR/LF 0 through 8 characters
seconds numeric expression, rounded to the nearest 0.001 seconds; Default=0 0.001 through 32.767
line width numeric expression, rounded to an integer; Default=infinity (see text) 1 through 32 767
exchange string string expression choices depend on LANGUAGE
shift in string string expression depends on printer used; six bytes maximum
shift out string string expression depends on printer used; six bytes maximum
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)

Semantics

PRINTALL IS defines a device or file as the destination for for logging certain messages. You can turn PRINTALL logging on and off using the {{Print All}} or [PRT ALL] key. An asterisk (*) is displayed on the softkey label if PRINTALL is on.

When PRINTALL is on, all items generated by DISP, all operator input followed by the [Return], [ENTER], [CONTINUE], or [EXECUTE] key, and all error messages from the computer are logged. All TRACE activity is logged if tracing is enabled.

At power-on and SCRATCH A, the default printall device is the CRT (select code 1).

The EOL Attribute (Requires IO)

The EOL attribute re-defines the end-of-line (EOL) sequence, which is sent at the following times: after the number of characters specified by line width and after each line of text. Up to eight characters may be specified as the EOL characters; an error is reported if the string contains more than eight characters. If END is included in the EOL attribute, an interface-dependent END indication is sent with the last character of the EOL sequence. If DELAY is included, the computer delays the specified number of seconds (after sending the last character) before continuing. The default EOL sequence consists of a carriage-return and a line-feed character with no END indication and no delay period.

Using PRINTALL IS With WIDTH (Requires IO)

The secondary keyword WIDTH specifies the maximum number of characters sent to the PRINTER IS destination before an end-of-line (EOL) sequence is automatically sent. The EOL characters are not counted as part of the line width. If a USING clause is included in the PRINT statement, the WIDTH attribute is ignored.~~ The default width for the Model 226 CRT is 50, Model 237 and other high-resolution displays is 128, and the default for all other devices or file is 80. Specifying WIDTH OFF sets the width to infinity. If the default is desired, it must be restored explicitly.

PRINTALL IS file

The file must be a BDAT, DFS, or HP-UX file.

The PRINTALL IS file statement positions the file pointer to the beginning of the file unless you specify the APPEND option. Thus, PRINTALL IS overwrites an existing file unless you specify APPEND. The file is closed when another PRINTALL IS statement is executed and at SCRATCH A.

You can read the file with ENTER if it is ASSIGNed with FORMAT ON. An end-of-file error occurs when the end of a LIF file is reached.

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PRINTALL IS. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with PRINTALL IS must match one and only one file name.

SRM, DFS, and HFS Files

In order to write to a PRINTALL IS file on a DFS or an HFS volume, you need to have R (read) and W (write) permission on the file, and X (search) permission on all superior directories.

In order to write to a PRINTALL IS file on an SRM volume, you need to have READ and WRITE capabilities on the immediately superior directory, as well as READ capabilities on all other superior directories.

No end-of-file error occurs when writing to a file on an SRM, DFS, or HFS volume because these files are extensible. That is, if the data output to the file with this statement would otherwise overflow the file's space allocation, the HP BASIC system automatically allocates the additional space needed (provided the media contains enough unused storage space).

If the specified file is in the SRM printer spooler directory, is of type BDAT, and contains data, then the SRM system sends the data to the printer (after the file is closed) and then purges the file. The SRM printer spooler will also spool ASCII files, which can be written by HP BASIC using OUTPUT, SAVE or RE-SAVE.

You may close the file by executing another PRINTALL IS statement, or a SCRATCH A or SCRATCH BIN command. The SRM printer spooler will also spool ASCII files, which can be written by HP BASIC using OUTPUT, SAVE or RE-SAVE.

HP BASIC/UX Specifics

On HP-UX systems, the line-printer is a spooled device. Writing directly to the printer as 701 may interfere with other spooled output. It is recommended that PRINTALL IS output be directed to either a file or the line-printer spooler by, for example, the statement:

   PRINTALL IS "|lp"

HP BASIC/UX treats output to a pipe as it would output to a file. The pipe must be explicitly closed before any output becomes permanent (or takes place). Output to a spooled device will not be sent to the spooler until the pipe has been closed. The closing of pipes can be achieved with a subsequent PRINTALL IS, QUIT, or SCRATCH A command.

If PRINTALL IS device is a window and that window is destroyed (with DESTROY WINDOW), PRINTALL IS is undefined and generates an error.

Using EXCHANGE and SHIFT IN...OUT (Requires LANGUAGE)

Some localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. The secondary keyword EXCHANGE allows you to automatically convert internal HP-15 character codes to the codes supported by your two-byte printer. The available choices and default values for exchange string depend on the particular LANGUAGE localization binary that you are using. You can turn the EXCHANGE function off by specifying EXCHANGE OFF. If you specify EXCHANGE without an exchange string, "HP-16" is assumed.

The secondary keywords SHIFT IN and OUT are useful with certain printers that use special control strings to turn two-byte printing on and off. HP BASIC automatically sends the specified shift in string before two-byte characters. HP BASIC also sends the specified shift out string before one-byte characters that follow two-byte characters.

NOTE
SHIFT IN and SHIFT OUT cause Error 257 if used with HP-15 characters. Use EXCHANGE to convert HP-15 characters to your LANGUAGE two-byte characters.

For a general discussion of globalization and localization including printers, refer to the HP BASIC Porting and Globalization manual. For LANGUAGE specific details, refer to Using LanguageX with HP BASIC, where LanguageX is your local language.

PRINTER IS

Supported On UX* WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRINTER IS specifies the system printer device, file, or pipe.

Example Statements

    PRINTER IS "myfile"
    PRINTER IS PRT;WIDTH 80
    PRINTER IS "myfile";APPEND
    PRINTER IS 701
    PRINTER IS Gpio
    PRINTER IS "Spooler:REMOTE"
    PRINTER IS 614 ! HP BASIC/UX in X only
    PRINTER IS "| fold | pr -e -o8 | lp" ! HP BASIC/UX only

The following example requires the MS binary.

    PRINTER IS "MyBDATFile";APPEND

The following examples require the IO binary.

    PRINTER IS 701;EOL CHR$(13) END,WIDTH 65
    PRINTER IS 707;EOL My$ DELAY .5
    PRINTER IS Device;WIDTH 120,EOL My$ END

The following examples require the LANGUAGE binary.

    PRINTER IS 701;EXCHANGE "HP-16"
    PRINTER IS 701;EXCHANGE "JIS" SHIFT IN In$ OUT Out$

Item Description Range
file specifier string expression -
device selector numeric expression, rounded to an integer (see Glossary)
pipe string expression -
end-of-line characters string expression; Default=CR/LF 0 through 8 characters
seconds numeric expression, rounded to the nearest 0.001 seconds; Default=0 0.001 through 32.767
line width numeric expression, rounded to an integer; Default=(see text) 1 through 32 767
exchange string string expression choices depend on LANGUAGE
shift in string string expression depends on printer used; six bytes maximum
shift out string string expression depends on printer used; six bytes maximum
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)

Semantics

The system printing device or file receives all data sent by the PRINT, CAT, LIST, and XREF statements in which the destination is not explicitly specified. The default printing device is the alphanumeric display (select code 1) at power-on and after executing SCRATCH A.

Using the EOL Attribute (Requires IO)

The EOL attribute re-defines the end-of-line (EOL) sequence, which is sent at the following times: after the number of characters specified by line width, after each line of text, and when an "L" specifier is used in a PRINT USING statement. Up to eight characters may be specified as the EOL characters; an error is reported if the string contains more than eight characters. If END is included in the EOL attribute, an interface-dependent END indication is sent with the last character of the EOL sequence. If DELAY is included, the computer delays the specified number of seconds (after sending the last character) before continuing. The default EOL sequence consists of a carriage-return and a line-feed character with no END indication and no delay period. END and DELAY are ignored for files.

Using PRINTER IS With WIDTH

The WIDTH attribute specifies the maximum number of characters which will be sent to the printing device before an EOL sequence is automatically sent. The EOL characters are not counted as part of the line width. If a USING clause is included in the PRINT statement, WIDTH is ignored. The default WIDTH for files is OFF. The default width for the Model 226 CRT is 50, Model 237 and other high-resolution displays is 128, and the default for all other devices is 80. Specifying WIDTH OFF sets the width to infinity. If the default is desired, it must be restored explicitly.

Using PRINTER IS With Files

The file must be a BDAT, DFS, or HP-UX file.

The PRINTER IS file statement positions the file pointer to the beginning of the file unless you specify the APPEND option. Thus, PRINTER IS overwrites existing files unless you specify APPEND. The file is closed when another PRINTER IS statement is executed and at SCRATCH A.

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PRINTER IS. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details. Wildcard file specifiers used with PRINTER IS must match one and only one file name.

You can read the file with ENTER if it is created using ASSIGN with FORMAT ON.

An end-of-file error occurs when the end of a LIF file is reached. LIF files are not extensible, unlike most files under hierarchical file systems.

SRM, DFS, and HFS Files

In order to write to a PRINTER IS file on a DFS or an HFS volume, you need to have R (read) and W (write) permission on the file, and X (search) permission on all superior directories.

In order to write to a PRINTER IS file on an SRM volume, you need to have READ and WRITE capabilities on the immediately superior directory, as well as READ capabilities on all other superior directories.

No end-of-file error occurs when writing to a file on an SRM, DFS, or HFS volume because these files are extensible. That is, if the data output to the file with this statement would otherwise overflow the file's space allocation, the HP BASIC system automatically allocates the additional space needed (provided the media contains enough unused storage space).

If the specified file is in the SRM printer spooler directory, is of type BDAT, and contains data, then the SRM system sends the data to the printer (after the file is closed) and then purges the file. You may close the file by executing another PRINTER IS statement, or a SCRATCH A or SCRATCH BIN command.

HP BASIC/UX Specifics

On HP-UX systems, the line-printer is a spooled device. Writing directly to the printer as 701 may interfere with other spooled output. It is recommended that printer output be directed to either a file or the line-printer spooler by, for example, the statement:

       PRINTER IS "lp"

HP BASIC/UX treats output to a pipe as it would output to a file. The pipe must be explicitly closed before any output becomes permanent (or takes place). Output to a spooled device will not be sent to the spooler until the pipe has been closed. The closing of pipes can be achieved with a subsequent PRINTER IS, QUIT, or SCRATCH A command.

Using EXCHANGE and SHIFT IN...OUT (Requires LANGUAGE)

Some localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. The secondary keyword EXCHANGE allows you to automatically convert internal HP-15 character codes to the codes supported by your two-byte printer. The available choices and default values for exchange string depend on the particular LANGUAGE localization binary that you are using. You can turn the EXCHANGE function off by specifying EXCHANGE OFF. If you specify EXCHANGE without an exchange string, "HP-16" is assumed.

The secondary keywords SHIFT IN and OUT are useful with certain printers that use special control strings to turn two-byte printing on and off. HP BASIC automatically sends the specified shift in string before two-byte characters. HP BASIC also sends the specified shift out string before one-byte characters that follow two-byte characters.

NOTE
SHIFT IN and SHIFT OUT cause Error 257 if used with HP-15 characters. Use EXCHANGE to convert HP-15 characters to your LANGUAGE two-byte characters.

For a general discussion of globalization and localization including printers, refer to the HP BASIC Porting and Globalization manual. For LANGUAGE specific details, refer to Using LanguageX with HP BASIC, where LanguageX is your local language.

PRINT LABEL

Supported On UX* WS DOS*
Option Required MS
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRINT LABEL gives a name to a mass storage volume (not supported for HFS in HP BASIC/UX nor for DFS in HP BASIC/DOS).

Example Statements

PRINT LABEL "MyVol"
PRINT LABEL Volume_name$ TO Volume$

Syntax

Item Description Range
volume label name to be given to the volume --
volume specifier string expression; Default=the default mass storage unit (see MASS STORAGE IS)

Semantics

The new name overwrites any previous name for the volume.

The volume label can be zero to six characters in length consisting of letters and numbers. For maximum interchange, the characters should be limited to upper-case letters (A-Z) and digits (0-9) with the first character being a letter.

You cannot use PRINT LABEL with SRM volumes; instead, you will have to name the volume at the SRM console.

HP BASIC/UX Specifics

PRINT LABEL does not work in HP BASIC/UX for HFS.

HP BASIC/DOS Specifics

PRINT LABEL is not supported for DFS.

PRINT PEN

Supported On UX WS DOS
Option Required CRTX
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRINT PEN sets the pen color or gray value to be used in the output area and display line of the CRT.

Example Statements

PRINT PEN Pen_value
PRINT PEN 143
IF Color_blue THEN PRINT PEN 141

Syntax

Item Description/Default Range Restrictions
pen value numeric expression --

Semantics

The set of alpha colors is given in the following table:

Value Result
< 16 The number is evaluated MOD 8 and resulting values produce the following:

0 -- black

1 -- white

2 -- red

3 -- yellow

4 -- green

5 -- cyan

6 -- blue

7 -- magenta

16 to 135 Ignored
136 White
137 Red
138 Yellow
139 Green
140 Cyan
141 Blue
142 Magenta
143 Black
144 to 255 Ignored

This statement has no effect on single plane monochrome displays. On gray scale (multi-plane monochrome displays) this statement changes the display color to a different shade of gray.

For displays with bit-mapped alpha, PRINT PEN specifies the graphics pen to be used for subsequent alpha output. The range of values allowed with this statement are 0 through 255; these values are treated as MOD 2^n where n is the number of display planes.

The functionality of this statement can be achieved through CRT CONTROL register 15. PRINT PEN n and CONTROL CRT,15; n set the value of CRT control register 15. These statements have no effect on control registers 16 and 17 which are set using KEY LABELS PEN and KBD LINE PEN, respectively.

PRIORITY

See SYSTEM PRIORITY.

PROTECT

Supported On UX WS
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PROTECT specifies the protect code used on PROG, BDAT, and BIN files on LIF volumes. It also specifies passwords used on all types of files and directories on SRM volumes. However, SRM/UX does not support PROTECT. See PERMIT for access capabilities of files on HFS or SRM/UX volumes.

Example Statements

    PROTECT Name$,Lif_pc$
    PROTECT "Georgexy:INTERNAL","NEW" 

The following form of the PROTECT statement is valid only for SRM files, and any type of
file can be protected.
    PROTECT "dir:REMOTE",("mgr":MANAGER),("rw":READ,WRITE)
    PROTECT "File<rw>",("rw":DELETE) 

Item Description Range
LIF file specifier string expression (see "file specifier" drawing)
new LIF protect code string expression; first two non-blank characters are significant ">" not allowed
SRM file specifier string expression (see "file specifier" drawing)
SRM directory specifier string expression (see "directory specifier" drawing)
new SRM password literal; first 16 characters are significant any valid SRM password (see Glossary)
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
volume specifier literal (see MASS STORAGE IS)
directory name literal depends on volume's format (see Glossary)

Semantics

LIF Files

A protect code is necessary only for operations which write to a file or PURGE a file. The file can always be read without using the protect code (by LOAD, COPY, CAT "file name", etc.) The protect code is required for ASSIGN (and therefore ENTER) since ASSIGN opens a file for both read and write.

Protect codes are "trimmed" before they are used. Therefore, leading and trailing blanks are insignificant. To remove a protect code from a file, assign a protect code that is the null string or contains all blanks.

SRM Files (Requires SRM and DCOMM)

Note: on SRM/UX, as opposed to SRM, HP-UX file protection and permissions are used.  This section applies to SRM alone.

PROTECT allows you to control access to SRM files and directories by protecting access capabilities with password(s). Access capabilities are either public (available to all SRM users) or password-protected (available only to users supplying the correct password with the file or directory specifier).

The three access capabilities--MANAGER, READ and WRITE--are public until the PROTECT statement associates a password with one or more of those capabilities.

Once the capability on a given file or directory is password-protected, the capability can be exercised on the file or directory only if the correct password is included in the file or directory specifier. For instance, if a file's READ capabilities are protected, any user wishing to execute a command or statement that reads the file must supply a password protecting the file's READ capability.

SRM/UX does not support the PROTECT statement, and will give Error 62 if PROTECT is used. Use PERMIT to control access to SRM/UX files.

MANAGER Access Capability (SRM) (not supported on HP BASIC/UX 700)

Public MANAGER capability allows any SRM user to PROTECT, PURGE or RENAME a file or directory. Password-protected MANAGER capability provides READ and WRITE, as well as MANAGER, access capabilities to users who know the password.

You must have MANAGER capabilities on a file or directory to PROTECT the access capabilities on that file or directory. This includes adding, deleting and changing passwords.

READ Access Capability (SRM) (not supported on HP BASIC/UX 700)

READ capability on a file allows use of commands and statements that read the contents of a file (for example: ENTER, LOAD, GET). READ capability on a directory allows you to read the files in the directory (CAT), or to "pass through" a directory by including the directory name (and password, if assigned) in a directory path.

WRITE Access Capability (SRM) (not supported on HP BASIC/UX 700)

WRITE capability on a file allows use of commands and statements that write to the file (for example: OUTPUT, RE-SAVE, RE-STORE). WRITE capability on a directory allows use of commands that add or delete file names in the directory (for example: SAVE, STORE, PURGE, CREATE, RENAME).

Use of PROTECT on SRM

Each PROTECT statement allows up to six password/capability combinations per statement. The number of PROTECT statements that can be executed for each file or directory is unlimited, however, as long as each password is unique.

Successive associations of capabilities with the same password are not cumulative. To retain previous capability assignments for a file or directory, you must include those assignments in subsequent PROTECT statements designating the same password for that file or directory.

Assume you protected the READ access capability on a file with the password passme then wanted to change that assignment so that passme would protect both the READ and WRITE access capabilities for that file. If you executed a second PROTECT statement associating passme with the WRITE capability only, passme would no longer protect the READ capability. Instead, you should specify the password and both the READ and WRITE capabilities in the second PROTECT statement.

To modify the access capabilities protected by a password, execute the PROTECT with the existing password and the new password/capability pair(s).

The secondary keyword DELETE is used to delete existing password assignments for a file or directory. To be effective, DELETE must be the only secondary keyword used with a password/capability pair in the PROTECT statement. Otherwise, DELETE is ignored. MANAGER capability is required to perform the DELETE. A DELETE executed without MANAGER capability results in a protect code violation error.

PROTECT with WILDCARDS

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PROTECT. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details.

PROUND

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PROUND returns the value of the argument rounded to a specified power of ten.

Example Statements

Money=PROUND(Result,-2)
PRINT PROUND(Quantity,Decimal_place)

Syntax

Item Description Range
argument numeric expression --
power of ten numeric expression, rounded to an integer --

Semantics

COMPLEX arguments are not allowed with this function.

PRT

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PRT returns 701, the factory-set device selector for an external HP-IB printer.

Example Statements

PRINTER IS PRT
OUTPUT PRT;Text$

Syntax

PURGE

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

PURGE deletes a file or directory.

Example Statements

PURGE File_name$
PURGE "File"
PURGE "C:\TEMP\*.*"
PURGE "George&<PC>"
PURGE "Dir_a<SRM_RW_pass>/File<MGR_pass>"
PURGE "Dir1/Dir2/Dir3"
PURGE "*"
PURGE "Monday_?"
PURGE "Dir/Type_[A-Z]" ! WILDCARDS UX only

Item Description Range
file specifier string expression (see drawing)
directory specifier string expression (see drawing)
directory path literal (see MASS STORAGE IS)
file name literal depends on volume's format (see Glossary)
LIF protect code literal; first two non-blank characters are significant > not allowed
SRM password literal; first 16 non-blank characters are significant > not allowed
volume specifier literal (see MASS STORAGE IS)
directory name literal depends on volume's format (see Glossary)

Semantics

Once a file is purged, you cannot access the information which was in the file. The records of a purged file are returned to "available space."

An open file must be closed before it can be purged. Any file opened by ASSIGN can be closed by ASSIGN TO * (see ASSIGN). All files except those opened with the PRINTER IS statement are closed by [RESET] ([SHIFT]-[PAUSE] or [Shift]-[Break]). A PRINTER IS file can be closed by executing a PRINTER IS to another device or file. A PLOTTER IS file can be closed by GINIT or PLOTTER IS to another device or file. SCRATCH A closes all files.

If you are using a version of HP BASIC that supports wildcards, you can use them in file specifiers with PURGE. You must first enable wildcard recognition using WILDCARDS. Refer to the keyword entry for WILDCARDS for details.

When PURGE is executed from the keyboard with a wildcard argument that matches more than one item, HP BASIC prompts you to continue, thus ensuring safe file purging. HP BASIC does not prompt you to continue when executing PURGE from a program.

Purging Files and Directories

To PURGE a directory or file, all of the following conditions must be met: