UNIX-style ARGC/ARGV Parse - ARGV Capitalize a Character - CAPS Capitalize a String - CAPSTR Character Test Routines - ISx Character Skip Routines - SKx ------------------------------------------------------------- ARGV - UNIX-style ARGC/ARGV String Parser ENTER: HL = Address of Null-terminated String to parse DE = Address of token table A <> 0 if Null is to be placed after each token A = 0 if Null NOT to be placed after each token EXIT : A = 0, Zero Flag Set (Z) if No Error A <> 0, Zero Flag Reset (NZ) if more tokens than allowed (last token pointer points to the rest of the string) USES : AF Usage: This routine is used to isolate tokens within a string for subsequent action such as filename or argument parsing. Tokens are delimited by spaces and tabs. For example: " THIS IS FUN " contains three tokens, and ARGV will return pointers to the T in THIS, the I in IS, and the F in FUN. If A <> 0 on input, ARGV will store binary 0s (nulls) over the first space after the S in THIS, the S in IS, and the N in FUN. No changes are made to the string if A = 0 on entry. ARGV is called with the address of a table structured as: DEFB MAXENT ; number of token pointers filled| DEFS 1 ; number of tokens found by ARGV in | DEFS 2 ; pointer to token 1 (in string) by | DEFS 2 ; pointer to token 2 (in string) ARGV | ... | DEFS 2 ; Ptr to token MAXENT (in string) If there were more tokens in the string than allowed in the token table, ARGV returns with A<>0 and the Zero Flag Reset (NZ). In this case, the last token pointer points to the last token allowed, and extends to the end of the string. The null is not placed after the last token, so the rest of the string appears as a single token (and may be parsed by ARGV again). CAPS - Capitalize a Character ENTER: A = Character to capitalize EXIT : A = Capitalized character USES : AF Usage: This routine simply returns the Uppercase version of any Lowercase ASCII character specified. Characters other than those in the set [a-z] are returned unaffected. If the character is a Lowercase alphabetic character, it is converted to Uppercase in the set [A..Z]. Only the lower seven bits of the byte are considered, and the Most Signifi- cant Bit is masked off to zero. CAPSTR - Capitalize a String ENTER: HL = Pointer to first byte of a string EXIT : None (string is Capitalized) USES : None Usage: This routine simply capitalizes a Null-terminated string specified in the calling parameters. Character Test Routines Character Test routines check the specified ASCII character (after masking off the MSB) to see if it meets a specified condition. All routines conform to the same conventions as: ENTER: A = Character to test EXIT : A = Character, Zero Flag Set (Z) if Condition is TRUE Zero Flag Reset (NZ) if Condition is FALSE USES : Flags ISALNUM - Is Alphanumeric Char? - A-Z, a-z, 0-9 ISALPHA - Is Alphabetic Char? - A-Z, a-z ISCTRL - Is Control Char? - Less than SP or DEL ISDIGIT - Is Digit Char? - 0-9 ISGRAPH - Is Graphic Char? - Between SP and DEL ISHEX - Is Hexadecimal Char? - 0-9, A-F, a-f ISPRINT - Is Printable Char? - Between SP and DEL, incl SP ISPUN - Is Punctuation Char? - Between SP and DEL, incl DEL NOT 0-9, A-Z, or a-z ISSP - Is Space Char? - HT, LF, VT, FF, CR, and SP Character Skip Routines These routines are used to skip over characters in the string specified until either a character of the type not being skipped is encountered or the end of the string (NULL char) is found. They all conform to the same parameters as: ENTER: HL = Pointer to first char in Null-terminated string EXIT : HL = Pointer to character which terminated Skip USES : HL Character skip routines are: SKNPUN - Skip Over Non-Punctuation Chars SKNSP - Skip Over Non-Space Chars SKPUN - Skip Over Punctuation Chars SKSP - Skip Over Space Chars Punctuation Chars are those between SP and DEL which are NOT 0-9, A-Z, or a-z. Space Characters are any of the set HT, LF, VT, FF, CR, or SP.