home *** CD-ROM | disk | FTP | other *** search
- ARGV -- Parse Similar to ARGC/ARGV under UNIX
- CAPS -- Capitalize a Character
- CAPSTR -- Capitalize a String
- ISx -- Character Test Routines
- SKx -- Character Skip Routines
- :ARGV
- Routine: ARGV
-
- Function║
- ARG╓ i≤ ß UNIX-stylσ ARGC/ARG╓ strinτ parser«á I⌠ i≤ passeΣ ì
- ß null-terminateΣ strinτ iε H╠ anΣ thσ addres≤ oµ ß tokeε pointe≥ ì
- table which is structured as follows:
-
- DB MAX$ENT ; number of token pointers
- filled| DS 1 ; number of tokens found by ARGV
- in | DS 2 ; pointer to token 1 (in string)
- by | DS 2 ; pointer to token 2 (in string)
- ARGV | ...
- | DS 2 ; pointer to token MAX$ENT (in string)
-
- Token≤ arσ delimiteΣ b∙ space≤ anΣ tabs« Fo≥ example:
- " THIS IS FUN "
- contain≤ threσ tokens¼á anΣ ARG╓ wil∞ returε pointer≤ t∩ thσ ╘ iε ì
- THIS, the I in IS, and the F in FUN.
-
-
- Iµá ┴ <╛ ░ oε input¼á ARG╓ wil∞ storσ ß binar∙ ░ (null⌐ int∩ ì
- thσ strinτ afte≥ eacΦ tokeε fo≥ late≥ easσ iε analysis«á Iεá thσ ì
- abovσ example¼ ß ░ woulΣ bσ storeΣ ove≥ thσ firs⌠ spacσ followinτ ì
- thσ ╙ iε THIS¼á thσ ╙ iε IS¼ anΣ thσ ╬ iε FUN« Iµ A=0¼ ARG╓ doe≤ ì
- no⌠ makσ an∙ change≤ t∩ thσ string«á Seσ thσ SYSLI┬ tes⌠ prograφ ì
- STEST016.MAC for examples of the use of ARGV.
- Oε output¼ ARG╓ ha≤ loadeΣ it≤ pointer≤ int∩ thσ tokeε tablσ ì
- anΣ return≤ witΦ A=░ anΣ thσ Zer∩ Flaτ Se⌠ iµ n∩ error« Iµ therσ ì
- werσá morσá token≤á iε thσ strinτ thaε alloweΣ fo≥ iεá thσá tokeε ì
- table¼ ARG╓ return≤ witΦ A=0FF╚ anΣ thσ Zer∩ Flaτ Rese⌠ (NZ)« Iε ì
- thi≤á case¼á thσá las⌠á tokeε pointe≥ point≤ t∩á thσá las⌠á tokeε ì
- allowed¼á anΣ thi≤ extend≤ t∩ thσ enΣ oµ thσ string« Thσ nul∞ i≤ ì
- no⌠á placeΣá afte≥á thσ las⌠ token¼á s∩ thσ res⌠á oµá thσá strinτ ì
- appears as a token (and may be parsed by ARGV again).
-
-
- Inputs: HL = address of string
- DE = address of token table
- A = 0 if null is not to be placed after each token
- A = 0FFH if null is placed after each token
-
- Outputs: A = 0 and Zero Flag Set (Z) if no error
- A = 0FFH and Zero Flag Reset (NZ) if more tokens
- than allowed for (last token pointer points
- to the rest of the string)
-
- Registers Affected: PSW
-
- SYSLIB Routines Called: -None-
-
- Special Error Conditions: None
-
- :Capitalize a Character
- Routine: CAPS
-
- Function║
- Capitalizσá ASCI╔á characte≥á iε Registe≥ ┴á iµá i⌠á i≤ ì
- lower-casσ alphabetiπ (a-z)╗ otherwise¼ returε ┴ unaffected« ì
- Onl∙á thσ lowe≥ seveε bit≤ oµ thσ bytσ arσá considered¼á anΣ ì
- thσ Mos⌠ Significan⌠ Bi⌠ i≤ maskeΣ ou⌠ t∩ zero.
-
- Inputs: A = character to capitalize
- Outputs: A = capitalized character
-
- Registers Affected: PSW
-
- SYSLIB Routines Called: -None-
- Special Error Conditions: -None-
-
- :Capitalize a String
- Routine: CAPSTR
-
- Function:
- CAPST╥ capitalize≤ thσ <NULL>-terminateΣ (0-terminated⌐ ì
- strinτ pointeΣ t∩ b∙ HL« N∩ Register≤ arσ affected.
-
- Inputs: HL pts to first byte of string
- Outputs: None (String is Capitalized)
-
- Registers Affected: None
-
- SYSLIB Routines Called: CAPS
- Special Error Conditions: None
-
- :Character Test Routines
-
- Thσá Characte≥ Tes⌠ routine≤ checδ thσ characte≥ iε thσ ì
- ┴ registe≥ (afte≥ maskinτ ou⌠ it≤ MSB⌐ t∩ seσ iµ i⌠ meet≤á ß ì
- condition. These conditions are:
-
- èISALNUM -- Is Alphanumeric Char?
- ISALPHA -- Is Alphabetic Char?
- ISCTRL -- Is Control Char?
- ISDIGIT -- Is Digit Char?
- ISGRAPH -- Is Graphic Char?
- ISHEX -- Is Hexadecimal Char?
- ISPRINT -- Is Printable Char?
- ISPUN -- Is Punctuation Char?
- ISSP -- Is Space Char?
-
-
- Iε al∞ cases¼ thσ routine≤ conforφ t∩ thi≤ description:
-
- Routine: ISx
-
- Function║ T∩ tes⌠ t∩ seσ iµ thσ characte≥ iε ┴ meet≤ ß ì
- certaiεá conditioεá (thσ MS┬ i≤ maskeΣ ofµ oµ ┴á beforσá thσ ì
- test).
-
- Inputs: A = Char
- Outputs: Zero Flag is Set (Z) if Condition is TRUE;
- Zer∩ Flaτ i≤ Rese⌠ (NZ⌐ iµ ConΣ i≤ FALSE;
- A is not affected, only PSW
-
- Registers Affected: PSW (NOT including A)
-
- SYSLIB Routines Called: None
- Special Error Conditions: None
-
- The characters tested for by these routines are:
-
- 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,
- DEL, NOT 0-9,
- A-Z, or a-z
- ISSP -- Is Space Char? -- HT, LF, VT, FF, CR,
- and SP
-
-
- :Character Skip Routines
-
- Thesσá routine≤ arσ useΣ t∩ ski≡ ove≥ character≤ iε thσ ì
- strinτ pointeΣ t∩ b∙ H╠ unti∞ eithe≥ ß characte≥ oµ thσ typσ ì
- the∙á arσá no⌠á skippinτ i≤ encountereΣ o≥ thσá enΣá oµá thσ ì
- string (NULL character) is encountered.
-
- The 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
-
- ┴á Punctuatioε Characte≥ i≤ ß characte≥ betweeε S╨á anΣ ì
- DE╠ whicΦ i≤ no⌠ 0-9¼ A-Z¼ o≥ a-z« ┴ Spacσ Characte≥ i≤ an∙ ì
- of HT, LF, VT, FF, CR, or SP.
-
-
- All of these routines are characterized as follows:
-
- Routine: SKx
-
- Function║á T∩ ski≡ ove≥ ß certaiε clas≤ oµá character≤ ì
- iεá thσ strinτ pointeΣ t∩ b∙ H╠ unti∞ ß characte≥ NO╘ iε thσ ì
- ski≡á grou≡á i≤ encountereΣ o≥ thσ enΣ oµ thσá strinτá (NUL╠ ì
- character) is encountered.
-
- Inputs: HL pts to first character in string
- Outputs: HL pts to character which terminated the skip
-
- Registers Affected: HL
-
- SYSLIB Routines Called: ISPUN or ISSP, as appropriate
- Special Error Conditions: None
-