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

SPI Programming Manual427506-006
5-1
5
General SPI Programming
Guidelines
This section offers three categories of programming guidelines:
General Guidelines for All SPI Programs
The guidelines in this section apply to all SPI programsrequesters and servers.
Retrieving Tokens by Name
The most common way to retrieve tokens from the buffer is by passing their names to
SSGET. An application can ask for tokens in any convenient order.
A call to SSGET optionally specifies a value for an index parameter. This index lets
SSGET select a particular occurrence of a particular token in the buffer; as mentioned
in Section 2, SPI Concepts and Protocol
, there can be several occurrences (that is,
several instances of tokens with the same token code). Two cases are possible:
If the index value is n > 0 than zero, SSGET starts searching at the beginning of
the buffer and returns the
nth value of that token.
If the index value is zero (the default) or not supplied, SSGET retrieves the next
occurrence of the specified token.
An index that is zero or not supplied tells SSGET to start searching with the token
indicated by the next-token pointer. If the specified token is found, the current-token
position is set to the token that was returned, and the next-token pointer is updated to
the token following it. For example:
CALL SSGET (buffer, TKN-A, value)
Before the call, the positioning is:
current next
| |
v v
<TKN-A> <TKN-B> <TKN-C> <TKN-A> <TKN-D>
Topic Page
General Guidelines for All SPI Programs
5-1
Guidelines for SPI Requesters 5-8
Guidelines for SPI Servers 5-16