comparison mde/file/mergetag/DefaultData.d @ 88:01f4f5f1acc9

Changes to init and to allow compiling with gdc. Tweaked init code to allow using circular iterators (disabled until my patch makes it into tango). Changes to allow compiling with gdc. Building is successful and unittests complete, but in my experience a SIGSEGV occurs within SDL.
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 29 Sep 2008 12:09:44 +0100
parents d8fccaa45d5f
children
comparison
equal deleted inserted replaced
87:2212285f714c 88:01f4f5f1acc9
124 * names are created dynamically at compile-time based on the dataTypes list. 124 * names are created dynamically at compile-time based on the dataTypes list.
125 * ------------------ 125 * ------------------
126 * int[ID] _int; // name is type prefixed by _ 126 * int[ID] _int; // name is type prefixed by _
127 * char[][ID] _charA; // [] is replaced by A 127 * char[][ID] _charA; // [] is replaced by A
128 * ------------------ 128 * ------------------
129 *
130 * An alternative access method is to use the provided templates:
131 * --------------------
132 * template Arg(T) {
133 * alias Name Arg;
134 * }
135 *
136 * type y = Arg!(type).Arg; // example of use
137 * --------------------
138 * Note: trying to use Arg!(type) to implicitly refer to Arg!(type).Arg causes compiler errors
139 * due to the "alias Name Arg;" statement actually being a mixin.
140 */ 129 */
141 /+ All types previously supported. Most of these weren't used. 130 /+ All types previously supported. Most of these weren't used.
142 const char[][] dataTypes = ["bool","bool[]", 131 const char[][] dataTypes = ["bool","bool[]",
143 "byte","byte[]", 132 "byte","byte[]",
144 "char","char[]","char[][]", 133 "char","char[]","char[][]",
162 } 151 }
163 152
164 void writeAll (ItemDelg itemdlg) { /// Supports all types listed in dataTypes. 153 void writeAll (ItemDelg itemdlg) { /// Supports all types listed in dataTypes.
165 mixin (writeVars ()); 154 mixin (writeVars ());
166 } 155 }
167
168 /* These make no attempt to check Arg is valid.
169 * But if the symbol doesn't exist the complier will throw an error anyway, e.g.:
170 * Error: identifier '_boolAA' is not defined
171 */
172 template ArgName (T : T[]) {
173 const char[] ArgName = ArgName!(T)~`A`;
174 }
175 template ArgName (T) {
176 const char[] ArgName = `_`~T.stringof;
177 }
178 template Arg(T) {
179 mixin(`alias `~ArgName!(T)~` Arg;`);
180 }
181 } 156 }