next up previous contents
Next: Return Used Length Up: Contents Previous: Scanning of Text

String Scanning and Decoding Subprograms

The following subprograms are available for scanning text strings to pickup individual words from within them and for decoding words into numeric values. They allow an Application Program to cope with the situation where the detailed format of a response is variable (e.g. it could be either a text word or Integer value). By attempting to decode the string into an Integer variable via the appropriate decoding Subprogram and noting the Error Code returned, the Application Program can determine which format was used.

UI_NEXT_WORD ) Get next Word from UINXWD ) Text String

UI_USED_LENGTH ) Return Used Length UIUSLE ) of Text String

UI_DECODE_DECIMAL ) Decode Decimal Integer UIDCDE ) Value

UI_DECODE_DEC_BOUNDS ) Decode Decimal Integer UIDCDB ) Upper and Lower Bounds

UI_DECODE_DEC_LIST ) Decode Decimal Integer UIDCDL ) List of Values

UI_DECODE_DEC_MEMBER ) Decode Decimal Integer UIDCDM ) Set Member

UI_DECODE_DEC_SET ) Decode Decimal Integer UIDCDS ) Set of Values

UI_DECODE_DOUBLE ) Decode Double Precision UIDCDP ) (Real*8) Value

UI_DECODE_DOUBLE_BOUNDS ) Decode Double Precision UIDCPB ) Upper and Lower Bounds

UI_DECODE_DOUBLE_LIST ) Decode Double Precision UIDCPL ) List of Values

UI_DECODE_DOUBLE_MEMBER ) Decode Double Precision UIDCPM ) Set Member

UI_DECODE_DOUBLE_SET ) Decode Double Precision UIDCPS ) Set of Values

UI_DECODE_FILENAME ) Decode Filename UIDCFI )

UI_DECODE_HEX ) Decode Hexadecimal Value UIDCHX )

UI_DECODE_HEX_BOUNDS ) Decode Hexadecimal Upper UIDCHB ) and Lower Bounds

UI_DECODE_HEX_LIST ) Decode Hexadecimal List UIDCHL ) of Values

UI_DECODE_HEX_MEMBER ) Decode Hexadecimal UIDCHM ) Set Member

UI_DECODE_HEX_SET ) Decode Hexadecimal Set UIDCHS ) of Values

UI_DECODE_INTEGER ) Decode Integer Value UIDCIN )

UI_DECODE_INT_BOUNDS ) Decode Integer Upper and UIDCIB ) Lower Bounds

UI_DECODE_INT_LIST ) Decode Integer List UIDCIL ) of Values

UI_DECODE_INT_MEMBER ) Decode Integer UIDCIM ) Set Member

UI_DECODE_INT_SET ) Decode Integer Set UIDCIS ) of Values

UI_DECODE_LOGICAL ) Decode Logical UIDCLO ) (True/False) Value

UI_DECODE_LOGSET ) Decode Logical UIDCLS ) (True/False) Set

UI_DECODE_OCTAL ) Decode Octal Value UIDCOC )

UI_DECODE_OCT_BOUNDS ) Decode Octal Upper and UIDCOB ) Lower Bounds

UI_DECODE_OCT_LIST ) Decode Octal List UIDCOL ) of Values

UI_DECODE_OCT_MEMBER ) Decode Octal UIDCOM ) Set Member

UI_DECODE_OCT_SET ) Decode Octal Set UIDCOS ) of Values

UI_DECODE_ONOFF ) Decode Logical (On/Off) UIDCON ) Value

UI_DECODE_REAL ) Decode Floating (Real) UIDCRE ) Value

UI_DECODE_REAL_BOUNDS ) Decode Real Upper and UIDCRB ) Lower Bounds

UI_DECODE_REAL_LIST ) Decode Real List UIDCRL ) of Values

UI_DECODE_REAL_MEMBER ) Decode Real UIDCRM ) Set Member

UI_DECODE_REAL_SET ) Decode Real Set UIDCRS ) of Values

UI_DECODE_TEXT_LIST ) Decode Text List UIDCRL ) of Values

UI_DECODE_TEXT_MEMBER ) Decode Text UIDCTM ) Set Member

UI_DECODE_VERB ) Decode Text String into UIDCVB ) Verb

UI_DECODE_YESNO ) Decode Logical (Yes/No) UIDCYE ) Value

This Subprogram returns the next Word encountered during the Scan of a Text String. Sequential calls to this Subprogram will return sequential words within the text string. The Word Terminator Characters as specified by this call will be used in order to separate individual words from each other.

Short Name Calling Sequence

STATUS = UINXWD(LINE,LININD,TERMLS,WORD,WRDLEN,TERMCH)

Long Name Calling Sequence

STATUS = UI_NEXT_WORD(...)

Input Arguments

LINE (Character) Line of Text LININD (Integer) Initial Line Index TERMLS (Character) List of Terminator Chars

Output Arguments

LININD (Integer) Initial Line Index WORD (Character) Extracted Word WRDLEN (Integer) Length of Extracted Word TERMCH (Character*1) Terminator Character

Function Value

UI__SUCCESS ) Success UISUCC )

UI__TRUNCATED ) Word Truncated UITRUN )

UI__EMPTY ) Scan exhausted UIMPTY )

Note:

  1. The Text Index LININD Argument is used to keep track of the current index into the Text String being scanned. The Application Programmer should initialise it to 1 (one), and it will then be incremented automatically such that sequential calls will return sequential words in the Text String.
  2. The TERMLS Argument enumerates the word terminator characters. Thus, if space ' ', comma ',' and equals '=' are the valid word terminators, then TERMLS should be a CHARACTER*3 variable containing ' ,='.
  3. The TERMCH Argument will return the single character that terminated the returned word.
  4. Trailing spaces will be ignored in performing the Scan. Consider the following example:-

    SILLY = 10 ,, DAFT = 20

    Given the same list of terminator characters as above, then the words returned by calls to UI_NEXT_WORD will be ``SILLY" (terminated by ``="), ``10" (terminated by ``,"), `` " (terminated by ``,"), ``DAFT" (terminated by ``=") and ``20" (terminated by `` ").

  5. A null Text String (all spaces) will return a single zero length word (WORD set to all spaces and WRDLEN set to zero) before the Text String is treated as exhausted.
  6. The final word within a Text String is treated as having a space as terminator character.
  7. UI__TRUNCATED tests indicates that the word picked up from the Text String Line was too long for the WORD Argument and has therefore been truncated.
  8. The WRDLEN Argument returns the number of significant characters returned in WORD, ignoring trailing spaces, and after any truncation.
  9. UI__EMPTY will be returned, WORD set to spaces and WRDLEN to zero when a Text String is exhausted.




next up previous contents
Next: Return Used Length Up: Contents Previous: Scanning of Text



Liz Buckle
Fri Jan 13 17:28:23 CST 1995