4 ; String handling routines (control terminated)
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Quartz library.
13 ; Quartz is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Quartz is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Quartz. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
40 ; All strings written by these routines are output as NULL-terminated,
41 ; regardless of the original terminator.
45 ; On entry: R0 == destination string
48 ; On exit: R0 == pointer to terminator of destination
50 ; Use: Copies a string from one block to another. It leaves the
51 ; destination pointer at the end of the string so that any
52 ; subsequent copies concatenate other bits on the same string.
53 ; Single characters can of course be appended with
62 ; On entry: R0 == pointer to string
64 ; On exit: R0 == length of the string
66 ; Use: Calculates the length of a string.
72 ; On entry: R0 == pointer to string A
73 ; R1 == pointer to string B
75 ; On exit: Flags as appropriate
77 ; Use: Case-sensitively compares two strings. You can use the
78 ; normal ARM conditio codes after the compare, so you can treat
79 ; this as a normal CMP type thing (except the arguments must
80 ; be in R0 and R1, and it mangles R14).
86 ; On entry: R0 == pointer to string A
87 ; R1 == pointer to string B
89 ; On exit: Flags as appropriate
91 ; Use: As for str_cmp above, but case-insensitive.
97 ; On entry: R0 == Pointer to skeleton
98 ; R1 == Pointer to output buffer
99 ; R2-R11 == Pointer to filler strings (optional)
101 ; On exit: R0 == Pointer to start of buffer
102 ; R1 == Pointer to terminating null
104 ; Use: Performs string substitution, filling in a skeleton string
105 ; containing placeholders with `filler' strings. The
106 ; placeholders are actually rather powerful. The syntax of
107 ; these is as follows:
109 ; `%' [<type>] <digit>
111 ; (spaces are for clarity -- in fact you must not include
112 ; spaces in the format string.)
114 ; <digit> is any charater between `0' and `9'. It refers to
115 ; registers R2-R11 (so `0' means R2, `5' is R7 etc.) How the
116 ; value is interpreted is determined by <type>.
120 ; s String. This is the default. The register is
121 ; considered to be a pointer to an ASCII string
122 ; (control terminated).
124 ; i Integer. The (signed) decimal representation is
125 ; inserted. Leading zeros are suppressed.
127 ; x Hex fullword. The hexadecimal representation of the
128 ; register is inserted. Leading zeros are included.
130 ; b Hex byte. The hexadecimal representation of the
131 ; least significant byte is inserted. Leading zeros
134 ; c Character. The ASCII character corresponding to the
135 ; least significant byte is inserted.
141 ; On entry: R0 == Pointer to skeleton
142 ; R2-R11 == Pointers to fillin strings
144 ; On exit: R0 == Pointer to error in buffer
145 ; R1 == Pointer to terminator
147 ; Use: Fills in an error skeleton (like a substitution skeleton in
148 ; str_subst above with an error number on the front) and
149 ; returns a pointer to it. The buffer used is found by calling
150 ; str_buffer (see below), so you can safely use the result of
151 ; one call as a filler string for the next.
153 ; Filler strings may be held in the scratchpad.
157 ; ---- str_buffer ---
161 ; On exit: R1 == pointer to the next free buffer
163 ; Use: Returns a pointer to a 256-byte buffer. There are at present
164 ; 2 buffers, which are returned alternately.
168 ;----- That's all folks -----------------------------------------------------