SPI Programming Manual (G06.24+, H06.03+, J06.03+)

SPI Programming Examples
SPI Programming Manual427506-006
E-31
Example E-9: A Simple SPI Requester in TAL
! Put in the current volume/subvolume.
server^name ':=' start^buffer.default FOR 8 WORDS;
! Parse parameters for 'debug'
debug^flag := false;
SCAN start^buffer.param WHILE " " -> @l^start^ptr;
IF NOT $CARRY THEN ! Found a non-null string
BEGIN
IF l^start^ptr = "D" OR l^start^ptr = "d" THEN
BEGIN
debug^flag := true;
END;
END;
CALL replyx ( ,,,, 70); ! Must reply and get PARAMs and ASSIGNs
IF <> THEN CALL get^file^error (l^recv^file^num);
-31 -> ! Process CLOSE message
l^init^complete := true;
CALL replyx (start^buffer, l^count^read); ! Must reply
IF <> THEN CALL get^file^error (l^recv^file^num);
OTHERWISE ->
CALL replyx (start^buffer, l^count^read); ! Must reply
IF <> THEN CALL get^file^error (l^recv^file^num);
END; -- of CASE
END; -- of WHILE l^init^complete = false DO
! Open the terminal
CALL myterm (l^termname); ! Get the terminal name
CALL open (l^termname, term); ! Open the terminal
IF <> THEN CALL get^file^error (-1);
! Do the NEWPROCESS call of the server
server^up := false;
DO
BEGIN
CALL restart^server;
END
UNTIL server^up = true;
END; -- of PROC initialize
?PAGE "open^server"
!===========================================================================!
! Proc :open^server !
! Function :This procedure will open the server. !
!===========================================================================!
PROC open^server;
BEGIN
! Open the server to send the STARTUP msg
CALL open (process^id, srvr^file^num);
IF <> THEN
BEGIN
CALL fileinfo (-1, file^error);
sline ':=' "File system error (" -> @sp;
CALL numout (sp, file^error, 10, 3);
Example E-9. TAL File: A Simple SPI Requester (page 4 of 8)