Oolite
Loading...
Searching...
No Matches
OOStringExpander.h
Go to the documentation of this file.
1/*
2
3OOStringExpander.h
4
5Functions for expanding escape codes and key references in strings.
6
7
8Oolite
9Copyright (C) 2004-2013 Giles C Williams and contributors
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the impllied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24MA 02110-1301, USA.
25
26*/
27
28#import "OOFoundation.h"
29#import "OOMaths.h"
30
31// Option flags for OOExpandDescriptionString().
32enum {
34 kOOExpandBackslashN = 0x00000002,
35 kOOExpandGoodRNG = 0x00000004,
36 kOOExpandReseedRNG = 0x00000008,
37 kOOExpandKey = 0x00000010,
39
41};
42typedef NSUInteger OOExpandOptions;
43
44/*
45 OOExpandDescriptionString(string, seed, overrides, locals, systemName, recurse, options)
46
47 Apply the following transformations to a string:
48 * [commander_name] is replaced with the player character's name.
49 * [commander_shipname] is replaced with the player ship's name.
50 * [commander_shipdisplayname] is replaced with the player ship's display
51 name.
52 * [commander_rank] is replaced with the descriptive name of the player's
53 kill rank.
54 * [commander_legal_status] is replaced with the descriptive name for the
55 player's bounty ("Clean" etc)
56 * [commander_bounty] is replaced with the player's numerical bounty.
57 * [credits_number] is replaced with the player's formatted credit balance.
58 * [_oo_legacy_credits_number] is replaced with the player's credit balance
59 in simple #.0 format (this is substituted for [credits_number] by the
60 legacy script engine).
61 * [N], where N is an integer, is looked up in system_description in
62 descriptions.plist. This is an array of arrays of five strings each.
63 Each [N] lookup selects entry N of the outer array, then selects a
64 string from the Nth inner array at pseudo-random. The result is then
65 expanded recursively.
66 * [key], where key is any string not specified above, is handled as
67 follows:
68 - If it is found in <overrides>, use the corresponding value.
69 - Otherwise, look it up in descriptions.plist. If a string or number
70 is found, use that; if an array is found, select an item from it
71 at random.
72 - Otherwise, if it is a mission variable name (prefixed with
73 mission_), use the value of the mission variable.
74 - Otherwise, if it is found in <legacyLocals>, use the corresponding
75 value.
76 - Otherwise, if it is a whitelisted legacy script property, look it
77 up and insert the value.
78 The resulting string is then recursively expanded.
79 * %H is replaced with <planetName>. If systemName is nil, a planet name
80 is retrieved through -[Universe getSystemName:], treating <seed> as a
81 system seed.
82 * %I is equivalent to "%H[planetname-derivative-suffix]".
83 * %N is replaced with a random "alien" name using the planet name
84 digraphs. If used more than once in the same string, it will produce
85 the same name on each occurence.
86 * %R is like %N but, due to a bug, misses some possibilities. Deprecated.
87 * %JNNN, where NNN is a three-digit integer, is replaced with the name
88 of system ID NNN in the current galaxy.
89 * %GNNNNNN, where NNNNNN is a six-digit integer, is replaced with the
90 name of system ID NNN (first triplet) in the specified galaxy
91 (second triplet).
92 * %% is replaced with %.
93 * %[ is replaced with [.
94 * %] is replaced with ].
95
96 Syntax errors and, in non-Deployment builds, warnings may be generated. If
97 <options & kOOExpandForJavaScript>, warnings are sent through
98 OOJSReportWarning, otherwise they are logged.
99
100 If <options & kOOExpandBackslashN>, literal \n in strings (i.e., "\\n") are
101 converted to line breaks. This is used for expanding missiontext.plist
102 entries, which may have literal \n especially in XML format.
103*/
104NSString* OOExpandDescriptionString(Random_Seed seed, NSString* string, NSDictionary* overrides, NSDictionary* legacyLocals, NSString* systemName, OOExpandOptions options);
105
106/*
107 OOGenerateSystemDescription(seed, name)
108
109 Generates the default system description for the specified system seed.
110 Equivalent to OOExpand(@"[system-description-string]"), except that it
111 uses a special PRNG setting to tie the description to the seed.
112
113 NOTE: this does not apply planetinfo overrides. To get the actual system
114 description, use [UNIVERSE generateSystemData:].
115*/
116NSString* OOGenerateSystemDescription(Random_Seed seed, NSString* name);
117
121#define OOExpand(string, ...) OOExpandWithSeed(OOStringExpanderDefaultRandomSeed(), string, __VA_ARGS__)
122
127#define OOExpandKey(key, ...) OOExpandKeyWithSeed(OOStringExpanderDefaultRandomSeed(), key, __VA_ARGS__)
128
132#define OOExpandKeyRandomized(key, ...) OOExpandWithOptions(OOStringExpanderDefaultRandomSeed(), kOOExpandKey | kOOExpandGoodRNG | kOOExpandReseedRNG, key, __VA_ARGS__)
133
134#define OOExpandWithSeed(seed, string, ...) OOExpandWithOptions(seed, kOOExpandNoOptions, string, __VA_ARGS__)
135
136#define OOExpandKeyWithSeed(seed, key, ...) OOExpandWithOptions(seed, kOOExpandKey, key, __VA_ARGS__)
137
138#define OOExpandWithOptions(seed, options, string, ...) \
139 OOExpandDescriptionString(seed, string, OOEXPAND_ARG_DICTIONARY(__VA_ARGS__), nil, nil, options)
140
141// Equivalent to [[UNIVERSE systemManager] getRandomSeedForCurrentSystem], without pulling in Universe.h.
143
144// MARK: Danger zone! Everything beyond this point is scary.
145
146/* Given an argument list, return a dictionary whose keys are the literal
147 arguments and whose values are objects representing the arguments' values
148 (as per OO_CAST_PARAMETER() below).
149
150 Note that the argument list will be preprocessor-expanded at this point.
151 */
152#define OOEXPAND_ARG_DICTIONARY(...) ( \
153 (OOEXPAND_ARGUMENT_COUNT(__VA_ARGS__) == 0) ? nil : [NSDictionary dictionaryWithObjects:OOEXPAND_OBJECTS_FROM_ARGS(__VA_ARGS__) \
154 forKeys:OOEXPAND_NAMES_FROM_ARGS(__VA_ARGS__) \
155 count:OOEXPAND_ARGUMENT_COUNT(__VA_ARGS__)])
156
157#define OOEXPAND_NAME_FROM_ARG(ITEM) @ #ITEM
158#define OOEXPAND_NAMES_FROM_ARGS(...) \
159 (NSString*[]) { OOEXPAND_MAP(OOEXPAND_NAME_FROM_ARG, __VA_ARGS__) }
160
161#define OOEXPAND_OBJECTS_FROM_ARGS(...) \
162 (id[]) { OOEXPAND_MAP(OO_CAST_PARAMETER, __VA_ARGS__) }
163
164/* Limited boxing mechanism. ITEM may be an NSString *, NSNumber *, any
165 integer type or any floating point type; the result is an NSNumber *,
166 except if the parameter is an NSString * in which case it is returned
167 unmodified.
168 */
169#define OO_CAST_PARAMETER(ITEM) \
170 __builtin_choose_expr( \
171 OOEXPAND_IS_OBJECT(ITEM), \
172 OOCastParamObject, \
173 __builtin_choose_expr( \
174 OOEXPAND_IS_SIGNED_INTEGER(ITEM), \
175 OOCastParamSignedInteger, \
176 __builtin_choose_expr( \
177 OOEXPAND_IS_UNSIGNED_INTEGER(ITEM), \
178 OOCastParamUnsignedInteger, \
179 __builtin_choose_expr( \
180 OOEXPAND_IS_FLOAT(ITEM), \
181 OOCastParamFloat, \
182 __builtin_choose_expr( \
183 OOEXPAND_IS_UNSIGNED_INTEGER(ITEM), \
184 OOCastParamUnsignedInteger, \
185 __builtin_choose_expr( \
186 OOEXPAND_IS_DOUBLE(ITEM), \
187 OOCastParamDouble, \
188 (void)0))))))(ITEM)
189
190// Test whether ITEM is a known object type.
191// NOTE: id works here in clang, but not gcc.
192#define OOEXPAND_IS_OBJECT(ITEM) ( \
193 __builtin_types_compatible_p(typeof(ITEM), NSString*) || __builtin_types_compatible_p(typeof(ITEM), NSNumber*))
194
195// Test whether ITEM is a signed integer type.
196// Some redundancy to avoid silliness across platforms; probably not necessary.
197#define OOEXPAND_IS_SIGNED_INTEGER(ITEM) ( \
198 __builtin_types_compatible_p(typeof(ITEM), char) || __builtin_types_compatible_p(typeof(ITEM), short) || __builtin_types_compatible_p(typeof(ITEM), int) || __builtin_types_compatible_p(typeof(ITEM), long) || __builtin_types_compatible_p(typeof(ITEM), long long) || __builtin_types_compatible_p(typeof(ITEM), NSInteger) || __builtin_types_compatible_p(typeof(ITEM), intptr_t) || __builtin_types_compatible_p(typeof(ITEM), ssize_t) || __builtin_types_compatible_p(typeof(ITEM), off_t))
199
200// Test whether ITEM is an unsigned integer type.
201// Some redundancy to avoid silliness across platforms; probably not necessary.
202#define OOEXPAND_IS_UNSIGNED_INTEGER(ITEM) ( \
203 __builtin_types_compatible_p(typeof(ITEM), unsigned char) || __builtin_types_compatible_p(typeof(ITEM), unsigned short) || __builtin_types_compatible_p(typeof(ITEM), unsigned int) || __builtin_types_compatible_p(typeof(ITEM), unsigned long) || __builtin_types_compatible_p(typeof(ITEM), unsigned long long) || __builtin_types_compatible_p(typeof(ITEM), NSUInteger) || __builtin_types_compatible_p(typeof(ITEM), uintptr_t) || __builtin_types_compatible_p(typeof(ITEM), size_t))
204
205// Test whether ITEM is a float.
206// This is distinguished from double to expose optimization opportunities.
207#define OOEXPAND_IS_FLOAT(ITEM) ( \
208 __builtin_types_compatible_p(typeof(ITEM), float))
209
210// Test whether ITEM is any other floating-point type.
211#define OOEXPAND_IS_DOUBLE(ITEM) ( \
212 __builtin_types_compatible_p(typeof(ITEM), double) || __builtin_types_compatible_p(typeof(ITEM), long double))
213
214// OO_CAST_PARAMETER() boils down to one of these.
215static inline id OOCastParamObject(id object) { return object; }
216static inline id OOCastParamSignedInteger(long long value) { return [NSNumber numberWithLongLong:value]; }
217static inline id OOCastParamUnsignedInteger(unsigned long long value) { return [NSNumber numberWithUnsignedLongLong:value]; }
218static inline id OOCastParamFloat(float value) { return [NSNumber numberWithFloat:value]; }
219static inline id OOCastParamDouble(double value) { return [NSNumber numberWithDouble:value]; }
220
221/*
222 Evil macro magic.
223
224 OOEXPAND_ARGUMENT_COUNT returns the number of elements in a __VA_ARGS__
225 list. Trivially modified from code by Laurent Deniau and
226 "arpad.goret...@gmail.com" (full name not available). Source:
227 https://groups.google.com/forum/?fromgroups=#!topic/comp.std.c/d-6Mj5Lko_s
228
229 This version relies on the GCC/Clang ##__VA_ARGS__ extension to handle
230 zero-length lists. It supports up to 62 arguments.
231
232 OOEXPAND_MAP applies a unary macro or function to each element of a
233 parameter or initializer list. For example, "OOEXPAND_MAP(foo, 1, 2, 3)"
234 is equivalent to "foo(1), foo(2), foo(3)".
235*/
236
237#define OOEXPAND_ARGUMENT_COUNT(...) \
238 OOEXPAND_ARGUMENT_COUNT_INNER(_0, ##__VA_ARGS__, OOEXPAND_ARGUMENT_COUNT_63_VALUES())
239#define OOEXPAND_ARGUMENT_COUNT_INNER(...) \
240 OOEXPAND_ARGUMENT_COUNT_EXTRACT_64TH_ARG(__VA_ARGS__)
241#define OOEXPAND_ARGUMENT_COUNT_EXTRACT_64TH_ARG( \
242 _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
243 _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
244 _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
245 _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
246 _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
247 _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
248 _61, _62, _63, N, ...) N
249#define OOEXPAND_ARGUMENT_COUNT_63_VALUES() \
250 62, 61, 60, \
251 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
252 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
253 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
254 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
255 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
256 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
257
258#define OOEXPAND_MAP(F, ...) \
259 OOEXPAND_MAP_INNER(F, OOEXPAND_ARGUMENT_COUNT(__VA_ARGS__), __VA_ARGS__)
260#define OOEXPAND_MAP_INNER(F, COUNTEXPR, ...) \
261 OOEXPAND_MAP_INNER2(F, COUNTEXPR, __VA_ARGS__)
262#define OOEXPAND_MAP_INNER2(F, COUNT, ...) \
263 OOEXPAND_MAP_INNER3(F, OOEXPAND_MAP_IMPL_##COUNT, __VA_ARGS__)
264#define OOEXPAND_MAP_INNER3(F, IMPL, ...) \
265 IMPL(F, __VA_ARGS__)
266
267#define OOEXPAND_MAP_IMPL_0(F, HEAD)
268#define OOEXPAND_MAP_IMPL_1(F, HEAD) F(HEAD)
269#define OOEXPAND_MAP_IMPL_2(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_1(F, __VA_ARGS__)
270#define OOEXPAND_MAP_IMPL_3(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_2(F, __VA_ARGS__)
271#define OOEXPAND_MAP_IMPL_4(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_3(F, __VA_ARGS__)
272#define OOEXPAND_MAP_IMPL_5(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_4(F, __VA_ARGS__)
273#define OOEXPAND_MAP_IMPL_6(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_5(F, __VA_ARGS__)
274#define OOEXPAND_MAP_IMPL_7(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_6(F, __VA_ARGS__)
275#define OOEXPAND_MAP_IMPL_8(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_7(F, __VA_ARGS__)
276#define OOEXPAND_MAP_IMPL_9(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_8(F, __VA_ARGS__)
277#define OOEXPAND_MAP_IMPL_10(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_9(F, __VA_ARGS__)
278#define OOEXPAND_MAP_IMPL_11(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_10(F, __VA_ARGS__)
279#define OOEXPAND_MAP_IMPL_12(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_11(F, __VA_ARGS__)
280#define OOEXPAND_MAP_IMPL_13(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_12(F, __VA_ARGS__)
281#define OOEXPAND_MAP_IMPL_14(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_13(F, __VA_ARGS__)
282#define OOEXPAND_MAP_IMPL_15(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_14(F, __VA_ARGS__)
283#define OOEXPAND_MAP_IMPL_16(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_15(F, __VA_ARGS__)
284#define OOEXPAND_MAP_IMPL_17(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_16(F, __VA_ARGS__)
285#define OOEXPAND_MAP_IMPL_18(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_17(F, __VA_ARGS__)
286#define OOEXPAND_MAP_IMPL_19(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_18(F, __VA_ARGS__)
287#define OOEXPAND_MAP_IMPL_20(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_19(F, __VA_ARGS__)
288#define OOEXPAND_MAP_IMPL_21(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_20(F, __VA_ARGS__)
289#define OOEXPAND_MAP_IMPL_22(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_21(F, __VA_ARGS__)
290#define OOEXPAND_MAP_IMPL_23(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_22(F, __VA_ARGS__)
291#define OOEXPAND_MAP_IMPL_24(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_23(F, __VA_ARGS__)
292#define OOEXPAND_MAP_IMPL_25(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_24(F, __VA_ARGS__)
293#define OOEXPAND_MAP_IMPL_26(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_25(F, __VA_ARGS__)
294#define OOEXPAND_MAP_IMPL_27(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_26(F, __VA_ARGS__)
295#define OOEXPAND_MAP_IMPL_28(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_27(F, __VA_ARGS__)
296#define OOEXPAND_MAP_IMPL_29(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_28(F, __VA_ARGS__)
297#define OOEXPAND_MAP_IMPL_30(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_29(F, __VA_ARGS__)
298#define OOEXPAND_MAP_IMPL_31(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_30(F, __VA_ARGS__)
299#define OOEXPAND_MAP_IMPL_32(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_31(F, __VA_ARGS__)
300#define OOEXPAND_MAP_IMPL_33(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_32(F, __VA_ARGS__)
301#define OOEXPAND_MAP_IMPL_34(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_33(F, __VA_ARGS__)
302#define OOEXPAND_MAP_IMPL_35(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_34(F, __VA_ARGS__)
303#define OOEXPAND_MAP_IMPL_36(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_35(F, __VA_ARGS__)
304#define OOEXPAND_MAP_IMPL_37(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_36(F, __VA_ARGS__)
305#define OOEXPAND_MAP_IMPL_38(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_37(F, __VA_ARGS__)
306#define OOEXPAND_MAP_IMPL_39(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_38(F, __VA_ARGS__)
307#define OOEXPAND_MAP_IMPL_40(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_39(F, __VA_ARGS__)
308#define OOEXPAND_MAP_IMPL_41(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_40(F, __VA_ARGS__)
309#define OOEXPAND_MAP_IMPL_42(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_41(F, __VA_ARGS__)
310#define OOEXPAND_MAP_IMPL_43(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_42(F, __VA_ARGS__)
311#define OOEXPAND_MAP_IMPL_44(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_43(F, __VA_ARGS__)
312#define OOEXPAND_MAP_IMPL_45(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_44(F, __VA_ARGS__)
313#define OOEXPAND_MAP_IMPL_46(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_45(F, __VA_ARGS__)
314#define OOEXPAND_MAP_IMPL_47(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_46(F, __VA_ARGS__)
315#define OOEXPAND_MAP_IMPL_48(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_47(F, __VA_ARGS__)
316#define OOEXPAND_MAP_IMPL_49(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_48(F, __VA_ARGS__)
317#define OOEXPAND_MAP_IMPL_50(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_49(F, __VA_ARGS__)
318#define OOEXPAND_MAP_IMPL_51(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_50(F, __VA_ARGS__)
319#define OOEXPAND_MAP_IMPL_52(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_51(F, __VA_ARGS__)
320#define OOEXPAND_MAP_IMPL_53(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_52(F, __VA_ARGS__)
321#define OOEXPAND_MAP_IMPL_54(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_53(F, __VA_ARGS__)
322#define OOEXPAND_MAP_IMPL_55(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_54(F, __VA_ARGS__)
323#define OOEXPAND_MAP_IMPL_56(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_55(F, __VA_ARGS__)
324#define OOEXPAND_MAP_IMPL_57(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_56(F, __VA_ARGS__)
325#define OOEXPAND_MAP_IMPL_58(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_57(F, __VA_ARGS__)
326#define OOEXPAND_MAP_IMPL_59(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_58(F, __VA_ARGS__)
327#define OOEXPAND_MAP_IMPL_60(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_59(F, __VA_ARGS__)
328#define OOEXPAND_MAP_IMPL_61(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_60(F, __VA_ARGS__)
329#define OOEXPAND_MAP_IMPL_62(F, HEAD, ...) F(HEAD), OOEXPAND_MAP_IMPL_61(F, __VA_ARGS__)
NSUInteger OOExpandOptions
NSString * OOGenerateSystemDescription(Random_Seed seed, NSString *name)
@ kOOExpandForJavaScript
Report warnings through JavaScript runtime system instead of normal logging.
@ kOOExpandDisallowPercentI
Disallow I expansion (used when expanding I itself).
@ kOOExpandKey
Treat string as a key. Expand("foo", kOOExpandKey) == Expand(@"[foo]", kOOExpandNoOptions).
@ kOOExpandBackslashN
Convert literal "\\n"s to line breaks (used for missiontext.plist for historical reasons).
@ kOOExpandNoOptions
@ kOOExpandGoodRNG
Use RANDROT for selecting from description arrays and for N expansion.
@ kOOExpandReseedRNG
Set "really random" seeds while expanding.
static id OOCastParamFloat(float value)
static id OOCastParamObject(id object)
Random_Seed OOStringExpanderDefaultRandomSeed(void)
static id OOCastParamUnsignedInteger(unsigned long long value)
NSString * OOExpandDescriptionString(Random_Seed seed, NSString *string, NSDictionary *overrides, NSDictionary *legacyLocals, NSString *systemName, OOExpandOptions options)
static id OOCastParamSignedInteger(long long value)
static id OOCastParamDouble(double value)