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

SPI Programming Examples
SPI Programming Manual427506-006
E-10
Example E-3: Working With Lists in TAL
Example E-3. TAL File: Working With Lists (page 1 of 3)
-- File name: SET0205
-- SPI EXAMPLE TAL 2-5
-- Figure 2-5. Pointer Manipulation and lists
?SYMBOLS, INSPECT
LITERAL
max^bufsize = 256; ! in bytes
?SOURCE SETCDECS
?NOLIST, SOURCE $system.system.extdecs0 (
? abend, debug, dnumout, fileinfo, initializer, myterm, numout,
? open, stop, writex,
? spi_buffer_formatfinish_, spi_buffer_formatnext_,
? spi_buffer_formatstart_,
? ssinit, ssgettkn, ssmovetkn,
? ssput, ssputtkn )
?LIST
?SOURCE SETCUTIL
?PAGE "PROC spitest MAIN"
PROC spitest MAIN;
BEGIN
bufsize := max^bufsize;
CALL initializer;
CALL myterm(termname);
CALL open(termname,term);
IF <> THEN CALL abend;
!
! Create the SPI buffer "b1"
!
IF (err := ssinit (b1, bufsize, ssid,zspi^val^cmdhdr)) THEN
CALL display^spi^error (err, zspi^val^ssinit, 0d, true);
val := "A";
IF (err := ssputtkn (b1, tkn^1, val)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^1, true);
val := "B";
IF (err := ssputtkn (b1, tkn^2, val)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^2, true);
IF (err := ssputtkn (b1, zspi^tkn^datalist)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, zspi^tkn^datalist, true);
val := "C";
IF (err := ssputtkn (b1, tkn^3, val)) THEN