4 ; String handling routines (control terminated)
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire 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 ; Sapphire 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 Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
41 [ :LNOT::DEF:string__dfn
46 ; On entry: R0 == destination string
49 ; On exit: R0 == pointer to terminator of destination
51 ; Use: Copies a string from one block to another. It leaves the
52 ; destination pointer at the end of the string so that any
53 ; subsequent copies concatenate other bits on the same string.
54 ; Single characters can of course be appended with
63 ; On entry: R0 == pointer to string
65 ; On exit: R0 == length of the string
67 ; Use: Calculates the length of a string.
73 ; On entry: R0 == pointer to string A
74 ; R1 == pointer to string B
76 ; On exit: Flags as appropriate
78 ; Use: Case-sensitively compares two strings. You can use the
79 ; normal ARM condition codes after the compare, so you can
80 ; treat this fairly much like a normal CMP.
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 name table
98 ; R1 == index into name table
100 ; On exit: CS if index good, and
101 ; R0 == address of R0th string in table
105 ; Use: Finds an indexed string in a table. The table consists of
106 ; ctrl-terminated strings, with no separation. The table is
107 ; terminated by a zero-length entry.
113 ; On entry: R0 == pointer to name table
114 ; R1 == string to match in table
116 ; On exit: CS if match found, and
117 ; R0 == index of string matched
121 ; Use: Looks up a string in a table. The table consists of
122 ; ctrl-terminated strings, with no separation. The table is
123 ; terminated by a zero-length entry.
129 ; On entry: R0 == Pointer to skeleton
130 ; R1 == Pointer to output buffer
131 ; R2-R11 == Pointer to filler strings (optional)
133 ; On exit: R0 == Pointer to start of buffer
134 ; R1 == Pointer to terminating null
136 ; Use: Performs string substitution, filling in a skeleton string
137 ; containing placeholders with `filler' strings. The
138 ; placeholders are actually rather powerful. The syntax of
139 ; these is as follows:
141 ; `%' [<type>] <digit>
143 ; (spaces are for clarity -- in fact you must not include
144 ; spaces in the format string.)
146 ; <digit> is any charater between `0' and `9'. It refers to
147 ; registers R2-R11 (so `0' means R2, `5' is R7 etc.) How the
148 ; value is interpreted is determined by <type>.
152 ; s String. This is the default. The register is
153 ; considered to be a pointer to an ASCII string
154 ; (control terminated).
156 ; i Integer. The (signed) decimal representation is
157 ; inserted. Leading zeros are suppressed.
159 ; x Hex fullword. The hexadecimal representation of the
160 ; register is inserted. Leading zeros are included.
162 ; b Hex byte. The hexadecimal representation of the
163 ; least significant byte is inserted. Leading zeros
166 ; c Character. The ASCII character corresponding to the
167 ; least significant byte is inserted.
173 ; On entry: R0 == Pointer to skeleton
174 ; R2-R11 == Pointers to fillin strings
176 ; On exit: R0 == Pointer to error in buffer
177 ; R1 == Pointer to terminator
179 ; Use: Fills in an error skeleton (containing a 4 byte error number
180 ; and a control terminated skeleton string as for str_subst)
181 ; and returns the address of the filled in error block. The
182 ; error block is stored in a buffer obtained from str_buffer.
184 ; Filler strings may be held in the scratchpad.
192 ; On exit: R1 == pointer to the next free buffer
194 ; Use: Returns a pointer to a 256-byte buffer. There are at present
195 ; 2 buffers, which are returned alternately.
201 ;----- That's all, folks ----------------------------------------------------