2ee739cc |
1 | /* |
2 | * options.h |
3 | * |
4 | * [Generated from options, 08 November 1995] |
5 | */ |
6 | |
7 | #pragma include_only_once |
8 | #pragma force_top_level |
9 | |
10 | #ifndef __options_h |
11 | #define __options_h |
12 | |
13 | /*----- Overview ----------------------------------------------------------* |
14 | * |
15 | * Functions provided: |
16 | * |
17 | * options_read |
18 | * options_write |
19 | * optType_string |
20 | * optType_integer |
21 | * optType_literal |
22 | * optType_enum |
23 | * optType_bool |
24 | * optType_version |
25 | */ |
26 | |
27 | /* --- options_read --- * |
28 | * |
29 | * On entry: R0 == chunk file handle |
30 | * R1 == pointer to a chunk name |
31 | * R2 == pointer to options definition |
32 | * R3,R4 specify address of output block |
33 | * |
34 | * On exit: -- |
35 | * |
36 | * Use: Claims the specified options chunk, and reads the data in |
37 | * it into a binary block. Because the output data might be |
38 | * in a flex block, the two registers R3,R4 which define its |
39 | * address work as follows: |
40 | * |
41 | * R3 == address or offset of data |
42 | * R4 == -1 if R3 is address, else flex anchor address |
43 | */ |
44 | |
45 | extern routine options_read; |
46 | |
47 | /* --- options_write --- * |
48 | * |
49 | * On entry: R0 == terminator character to write, 0 for none, or -1 for |
50 | * quoting with 's |
51 | * R1 == pointer to name to save |
52 | * |
53 | * On exit: May return an error |
54 | * |
55 | * Use: Writes out an option name, terminated with the character |
56 | * given in R0 (which will normally be a space or an `=' sign). |
57 | */ |
58 | |
59 | extern routine options_write; |
60 | |
61 | /* --- optType_string --- * |
62 | * |
63 | * Flags: -- |
64 | * |
65 | * Data: (word) buffer size of string |
66 | * |
67 | * Use: Handles string data. The binary representation is a ctrl |
68 | * terminated string. The textual representation is a sequence |
69 | * of characters, which is always output in single quotes, |
70 | * although this is not necessary for the input. The string |
71 | * will be truncated to fit in the buffer during reading. |
72 | */ |
73 | |
74 | extern routine optType_string; |
75 | |
76 | /* --- optType_integer --- * |
77 | * |
78 | * Flags: bit 8 == use given default base |
79 | * |
80 | * Data: (word) default base, if bit 8 set |
81 | * |
82 | * Use: Handles integer data. The binary representation is a 32- |
83 | * bit integer value. The textual representation is the normal |
84 | * RISC OS style of numbers (i.e. the base_value notation is |
85 | * supported). Numbers are always output in the default base |
86 | * given (or in decimal if there is none given). Numbers |
87 | * being read may always have a sign; numbers will only be |
88 | * output with a sign if the default base is decimal. Uppercase |
89 | * letters will be used for output, but any case is acceptable |
90 | * for input. |
91 | * |
92 | * Special prefixes allowed are `%' for binary and `&' for hex. |
93 | * Such numbers are always output with these prefixes. |
94 | */ |
95 | |
96 | extern routine optType_integer; |
97 | |
98 | /* --- optType_literal --- * |
99 | * |
100 | * Flags: -- |
101 | * |
102 | * Data: (string) data to write out (*null* terminated) |
103 | * |
104 | * Use: Reads nothing; leave the name blank. Writes out the data |
105 | * literally. Note that an extra linefeed is added to the |
106 | * end, so don't overdo it. |
107 | */ |
108 | |
109 | extern routine optType_literal; |
110 | |
111 | /* --- optType_enum --- * |
112 | * |
113 | * Flags: bit 8 == quote output string |
114 | * bit 9 == don't put an `=' sign in output |
115 | * |
116 | * Data: See below |
117 | * |
118 | * Use: The data is a collection of ctrl-terminated strings, itself |
119 | * terminated by a zero-length entry. The textual |
120 | * representation is one of these strings, or an abbreviation |
121 | * of one. The binary representation is a word containing the |
122 | * index into the list. |
123 | */ |
124 | |
125 | extern routine optType_enum; |
126 | |
127 | /* --- optType_bool --- * |
128 | * |
129 | * Flags: bit 8 == make flag active low |
130 | * bit 9 == use `on'/`off' rather than `true'/`false'; also |
131 | * suppresses the `=' sign |
132 | * |
133 | * Data: (word) bit mask to OR or BIC within word |
134 | * |
135 | * Use: Handles a boolean option. It will translate between the |
136 | * strings `true' or `false' and a bit (or set of bits) within |
137 | * a word. |
138 | */ |
139 | |
140 | extern routine optType_bool; |
141 | |
142 | /* --- optType_version --- * |
143 | * |
144 | * Flags: -- |
145 | * |
146 | * Data: -- |
147 | * |
148 | * Use: Converts between version number strings (of the form |
149 | * <int>[.[<digit>[<digit>]]]) and integers. The version |
150 | * number is stored multiplied by 100. |
151 | */ |
152 | |
153 | extern routine optType_version; |
154 | |
155 | /*----- Data structures ---------------------------------------------------*/ |
156 | |
157 | /* --- Options definition block --- */ |
158 | |
159 | #define opt_flags 0 |
160 | #define opt_length 4 |
161 | #define opt_offset 8 |
162 | #define opt_type 12 |
163 | #define opt_name 16 |
164 | |
165 | /* --- Option block flags --- */ |
166 | |
167 | #define optFlag_last ((1<<0)) |
168 | #define optFlag_ignore ((1<<1)) |
169 | |
170 | /* --- Integer type flags --- */ |
171 | |
172 | #define intFlag_base ((1<<8)) |
173 | |
174 | /* --- Enumeration type flags --- */ |
175 | |
176 | #define enumFlag_quote ((1<<8)) |
177 | #define enumFlag_noEq ((1<<9)) |
178 | |
179 | /* --- Boolean type flags --- */ |
180 | |
181 | #define boolFlag_cpl ((1<<8)) |
182 | #define boolFlag_onOff ((1<<9)) |
183 | |
184 | /* --- Type handler reason codes --- * |
185 | * |
186 | * All enter with: |
187 | * |
188 | * R0 == reason code |
189 | * R7 == flags read from table |
190 | * R8 == address of option name |
191 | * R9 == address of type-specific data |
192 | * R10 == address of binary option |
193 | */ |
194 | |
195 | #define optReason_read 0 |
196 | |
197 | #define optReason_write 1 |
198 | |
199 | /*----- That's all, folks -------------------------------------------------*/ |
200 | |
201 | #endif |