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

SPI Programming Examples
SPI Programming Manual427506-006
E-11
Example E-3: Working With Lists in TAL
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^3, true);
val := "D";
IF (err := ssputtkn (b1, tkn^4, val)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^4, true);
val := "E";
IF (err := ssputtkn (b1, tkn^5, val)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^5, true);
IF (err := ssputtkn (b1, zspi^tkn^endlist)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, zspi^tkn^endlist, true);
val := "F";
IF (err := ssputtkn (b1, tkn^6, val)) THEN
CALL display^spi^error (err, zspi^val^ssputtkn, tkn^6, true);
sline ':=' "After RESET BUFFER: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
!
! Get the tokens in the SPI buffer "b1"
!
IF (err := ssgettkn (b1, tkn^1, val, 1)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, tkn^1, true);
sline ':=' "After GETTKN TKN^1: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
IF (err := ssgettkn (b1, tkn^2, val, 1)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, tkn^2, true);
sline ':=' "After GETTKN TKN^2: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
-- This call should get an error (missing token)
sline ':=' "After GETTKN TKN^3: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
IF (err := ssgettkn (b1, tkn^3, val, 1)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, tkn^3, false);
IF (err := ssgettkn (b1, zspi^tkn^datalist)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, zspi^tkn^datalist, true);
sline ':=' "After GETTKN DATALIST: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
IF (err := ssgettkn (b1, tkn^3, val, 1)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, tkn^3, true);
sline ':=' "After GETTKN TKN^3: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
IF (err := ssgettkn (b1, tkn^5, val, 1)) THEN
CALL display^spi^error (err, zspi^val^ssgettkn, tkn^5, true);
sline ':=' "After GETTKN TKN^5: " -> @sp;
CALL writex (term, sline, @sp '-' @sline);
CALL dump^buf (b1);
-- This call should get an error (missing token)
sline ':=' "After GETTKN TKN^6: " -> @sp;
Example E-3. TAL File: Working With Lists (page 2 of 3)