Spooler Plus Programmer's Guide

Sample Perusal Process
Spooler Plus Programmers Guide522293-003
B-5
! This procedure breaks a string at a period or a space and puts
! the characters up to a period or a space in the second string
INT PROC breakstr (str, index, dest);
STRING .str,
.dest;
INT index;
BEGIN
INT i,ret;
i := 0;
! Check for invalid characters or a string longer than 8 characters.
WHILE ($ALPHA(str[i+index]) OR
$NUMERIC(str[i+index]) OR
str[i+index] = "#" OR
str[i+index] = "$" OR
str[i+index] = "\" )
AND i < 8 DO
BEGIN
dest[i] := str[i+index];
i := i+1;
END;
IF i >= 8 OR i <= 0 THEN ret := -1
ELSE IF str[i+index] = " " OR str[i+index] = %15 THEN ret := 0
ELSE IF str[i+index] = "." THEN ret := i + index
ELSE ret := -1;
RETURN (ret)
END;
?page
! This procedure returns an integer corresponding to the command
! received in its parameter
INT PROC getcom(comstr);
STRING .comstr;
BEGIN
INT i, j, match;
FOR i := 0 TO 7 DO IF $ALPHA(comstr[i]) THEN
comstr[i] := comstr[i] LAND %737;
match := 1;
FOR i := 1 TO 12 DO
BEGIN
FOR j := 0 to 7 DO
BEGIN
IF match THEN
IF command[(i*8)+j] <> comstr[j] THEN match := 0;
END;
IF match THEN RETURN (IF i > 6 THEN i-6 ELSE i);
match := 1;
END;
RETURN (0);
END;
?page
! comint reads a command from the terminal, decides which command
! it is, and separates the parameters.
PROC comint(command, jobn, location, page, number,lines, hold, device);
INT .command,
.jobn,
.location,
.page,
.number,
.lines,
.hold,