home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / ZCPR33 / S-Z / V4LIBHLP.LBR / SYSLIBC.HZP / SYSLIBC.HLP
Text File  |  1989-05-01  |  4KB  |  111 lines

  1.  UNIX-style ARGC/ARGV Parse  - ARGV
  2.  Capitalize a Character      - CAPS
  3.  Capitalize a String         - CAPSTR
  4.  Character Test Routines     - ISx
  5.  Character Skip Routines     - SKx
  6. :ARGV - UNIX-style ARGC/ARGV String Parser
  7.  
  8.   ENTER: HL = Address of Null-terminated String to parse
  9.      DE = Address of token table
  10.       A <> 0 if Null is to be placed after each token
  11.           A = 0 if Null NOT to be placed after each token
  12.   EXIT :  A = 0, Zero Flag Set (Z) if No Error
  13.           A <> 0, Zero Flag Reset (NZ) if more tokens
  14.           than allowed (last token pointer points to
  15.           the rest of the string)
  16.   USES : AF
  17.  
  18.  Usage:  This routine is used to isolate tokens within a string
  19.   for subsequent action such as filename or argument parsing.
  20.   Tokens are delimited by spaces and tabs.  For example:
  21.           "  THIS     IS    FUN  "
  22.   contains three tokens, and ARGV will return pointers to the T
  23.   in THIS, the I in IS, and the F in FUN.  If A <> 0 on input,
  24.   ARGV will store binary 0s (nulls) over the first space after
  25.   the S in THIS, the S in IS, and the N in FUN.  No changes are
  26.   made to the string if A = 0 on entry.
  27.  
  28.   ARGV is called with the address of a table structured as:
  29.  
  30.         DEFB    MAXENT    ; number of token pointers
  31.   filled|   DEFS    1          ; number of tokens found by ARGV
  32.   in    |   DEFS    2          ; pointer to token 1 (in string)
  33.   by    |   DEFS    2          ; pointer to token 2 (in string)
  34.   ARGV  |   ...
  35.         |   DEFS    2          ; Ptr to token MAXENT (in string)
  36.  
  37.   If there were more tokens in the string than allowed in the
  38.   token table, ARGV returns with A<>0 and the Zero Flag Reset
  39.   (NZ).  In this case, the last token pointer points to the
  40.   last token allowed, and extends to the end of the string.
  41.   The null is not placed after the last token, so the rest of
  42.   the string appears as a single token (and may be parsed by
  43.   ARGV again).
  44.  
  45. :CAPS - Capitalize a Character
  46.  
  47.   ENTER:  A = Character to capitalize
  48.   EXIT :  A = Capitalized character
  49.   USES : AF
  50.  
  51.  Usage:  This routine simply returns the Uppercase version of
  52.   any Lowercase ASCII character specified.  Characters other
  53.   than those in the set [a-z] are returned unaffected.  If the
  54.   character is a Lowercase alphabetic character, it is
  55.   converted to Uppercase in the set [A..Z].  Only the lower
  56.   seven bits of the byte are considered, and the Most Signifi-
  57.   cant Bit is masked off to zero.
  58.  
  59. :CAPSTR - Capitalize a String
  60.  
  61.   ENTER: HL = Pointer to first byte of a string
  62.   EXIT : None    (string is Capitalized)
  63.   USES : None
  64.  
  65.  Usage:  This routine simply capitalizes a Null-terminated
  66.   string specified in the calling parameters.
  67.  
  68. :                Character Test Routines 
  69.  
  70. Character Test routines check the specified ASCII character
  71. (after masking off the MSB) to see if it meets a specified
  72. condition.  All routines conform to the same conventions as:
  73.  
  74.   ENTER:  A = Character to test
  75.   EXIT :  A = Character, Zero Flag Set (Z) if Condition is TRUE
  76.         Zero Flag Reset (NZ) if Condition is FALSE
  77.   USES : Flags
  78.  
  79. ISALNUM    - Is Alphanumeric Char?    - A-Z, a-z, 0-9
  80. ISALPHA    - Is Alphabetic Char?    - A-Z, a-z
  81. ISCTRL    - Is Control Char?    - Less than SP or DEL
  82. ISDIGIT    - Is Digit Char?    - 0-9
  83. ISGRAPH    - Is Graphic Char?    - Between SP and DEL
  84. ISHEX    - Is Hexadecimal Char?    - 0-9, A-F, a-f
  85. ISPRINT    - Is Printable Char?    - Between SP and DEL, incl SP
  86. ISPUN    - Is Punctuation Char?    - Between SP and DEL, incl DEL
  87.                      NOT 0-9, A-Z, or a-z
  88. ISSP    - Is Space Char?    - HT, LF, VT, FF, CR, and SP
  89.  
  90. :                Character Skip Routines 
  91.  
  92. These routines are used to skip over characters in the string
  93. specified until either a character of the type not being
  94. skipped is encountered or the end of the string (NULL char) is
  95. found.  They all conform to the same parameters as:
  96.  
  97.   ENTER: HL = Pointer to first char in Null-terminated string
  98.   EXIT : HL = Pointer to character which terminated Skip
  99.   USES : HL
  100.  
  101.  Character skip routines are:
  102.  
  103.     SKNPUN    - Skip Over Non-Punctuation Chars
  104.     SKNSP    - Skip Over Non-Space Chars
  105.     SKPUN    - Skip Over Punctuation Chars
  106.     SKSP    - Skip Over Space Chars
  107.  
  108.   Punctuation Chars are those between SP and DEL which are NOT
  109.   0-9, A-Z, or a-z.  Space Characters are any of the set HT,
  110.   LF, VT, FF, CR, or SP.
  111.