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

SPI Programming Examples
SPI Programming Manual427506-006
E-73
Example E-16: Common Routines for C Examples
Example E-16: Common Routines for C Examples
This C code contains common routines used by the other C example programs.
Source File
SECCUTLC
USE l^idx2;
IF err = 0 OR err = zspi^err^continue THEN
BEGIN
l^idx2 := 0;
FOR l^idx2 := 0 TO max^lines - 1 DO
BEGIN
IF l^lengths [l^idx2] > -1 THEN
BEGIN
CALL writex (term, l^sformat^buf [l^idx2 * max^line^len],
l^lengths [l^idx2]);
END; -- of IF l^lengths [l^idx2] > -1
END; -- of FOR l^idx2 := 0 to max^lines - 1 DO
END ELSE -- IF err = 0 OR err ... ELSE
BEGIN
! an error found, l^done printing
l^done := true;
CALL display^spi^error (err, zspi^val^buffer^formatnext, 0d, true);
END; -- of IF err = 0 OR err .... ELSE
! we are l^done printing IF all found (err = 0)
IF NOT err THEN l^done := true;
END; -- of WHILE NOT l^done DO
! release the format area
CALL spi_buffer_formatfinish_ (l^format^id, l^status1, l^status2);
! Write a blank line for output clarity
l^sformat^buf ':=' " " & l^sformat^buf FOR 79 BYTES;
CALL writex (term, l^sformat^buf, 2);
END; ! End of dump^buf PROC
?PAGE "PROC get^file^error"
!========================================================================!
! Proc : get^file^error !
! Function : This procedure will get the file error from the file !
! number that is passed and store it in "last^file^err". !
!========================================================================!
PROC get^file^error (p^file^num);
INT p^file^num;
BEGIN
CALL fileinfo (p^file^num, last^file^err);
CALL debug;
END; -- of PROC get^file^error
Example E-15. TAL File: SETCUTIL Supporting Code (page5of5)