2 type #'smpl' simple { int8 x };
3 resource(801) simple { 4 };
4 resource(802) simple { 257 };
5 resource(803) simple { (int64)-1 };
7 // Type codes do not have to be unique, so even though #'BYTE' is used
8 // for the int8 built-in type, we can also use it for our own types.
9 type #'BYTE' mybyte { int8 x };
10 resource(805) mybyte { 4 };
11 resource(806) mybyte { 257 };
12 resource(807) mybyte { (int64)-1 };
13 //resource(808) (mybyte) 123; // invalid cast
14 //resource(809) (mybyte) "yeah"; // invalid cast
16 type #'RAWT' myraw { array x };
17 resource(810) myraw { array { $"1234" } };
18 resource(811) myraw { x = array { $"1234" } };
19 resource(812) myraw { $"1234" };
20 resource(813) (raw) myraw { $"1234" };
21 resource(814) (myraw) myraw { $"1234" };
23 //resource(816) (myraw) array { $"1234" }; // invalid cast
25 // all resources become "0100000002000000000300"
26 type #'what' type1 { int32 a, int32 b, bool d, int16 e }; // size 11
27 resource(810) type1 { 1, 2, false, 3 };
28 resource(811) type1 { d = false, 1, 2, 3 };
29 resource(812) type1 { d = false, e = 3, b = 2, 1 };
30 resource(813) type1 { d = false, e = 3, 6, 7, a = 1, b = 2 };
31 resource(814) type1 { 6, 7, false, 9, d = false, e = 3, a = 1, b = 2 };
33 type #'RECT' myrect { float left, float top, float bottom, float right };
35 // becomes { 1.00000, 2.00000, 3.00000, 4.00000 }
36 resource(820) myrect { 1, 2, 3, 4 };
38 // becomes { 1.00000, 2.00000, 3.00000, 4.00000 }
39 resource(821) myrect { left = 1, 2, 3, 4 };
41 // becomes { 3.00000, 2.00000, 4.00000, 5.00000 }
42 resource(822) myrect { 1, 2, left = 3, 4, 5 };
44 // becomes { 3.00000, 2.00000, 4.00000, 0 }
45 resource(823) myrect { 1, 2, left = 3, 4 };
47 // becomes { 2.00000, 1.00000, 3.00000, 4.00000 }
48 resource(824) myrect { top = 1, 2, 3, 4 };
50 // becomes { 1.00000, 0.00000, 0.00000, 0.00000 }
51 resource(825) myrect { 1 };
53 // becomes $"0000803F000000400000404000008040"
54 resource(826) (raw) myrect { 1, 2, 3, 4 };
56 // becomes { 1.00000, 2.00000, 3.00000, 4.00000 }
57 resource(827) #'RECT' (raw) myrect { 1, 2, 3, 4 };
58 resource(828) #'RECT' $"0000803F000000400000404000008040";
60 //resource(829) myrect { left = 1, 2, 3, 4, 5 }; // too many fields
61 //resource(829) myrect { dude = 1, 2, 3, 4, 5 }; // unknown field
62 //resource(829) myrect { (float) top = 1, 2, 3, 4 }; // unknown type top
64 enum { NoConflict = 100 };
65 type #'RAWT' NoConflict { int32 a };
67 // Types are not identified by their type_code, but by their name, so the
68 // size of typ3 should be 5, even though typ1 and 2 have the same code.
69 type #'same' typ1 { int8 x };
70 type #'same' typ2 { int32 x };
71 type #'diff' typ3 { typ1 a, typ2 b };
72 resource(830) typ3 { typ1 { 1 }, typ2 { 2 } };
73 resource(831) typ3 { b = typ2 { 1 }, a = typ1 { 2 } };
74 resource(832) typ3 { b = typ2 1, a = typ1 2 };
75 resource(833) typ3 { typ1 1, typ2 2 };
76 //resource(834) typ3 { typ2 { 1 }, typ1 { 2 } }; // invalid cast
77 //resource(834) typ3 { a = typ2 { 1 }, b = typ1 { 2 } }; // invalid cast
78 //resource(834) typ3 { a = { 1 }, b = { 2 } }; // invalid cast
80 // Size of this type's data should still be 8, even though the default
81 // value for one of the fields is an int8.
82 type #'RAWT' rect2 { float a, float b = (int8) 12 };
83 resource(835) rect2 { 1 };
85 type #'cmpd' compound { int16 a = 100, int16 b = 0x80 };
86 type #'nest' nested { compound c = compound { 16, 32 }, int8 i = 4 };
87 type #'nst2' nested2 { compound c, int8 i };
88 resource(840) compound { };
89 resource(841) compound;
90 resource(842) nested { compound { }, 1 };
91 resource(843) nested2 { compound, 1 };
93 resource(845) nested2;
95 type #'CSTR' strings { string a, string b = "yo" };
96 resource(850) strings;
97 resource(851) strings { a = "long", b = "longer" };
98 resource(852) strings { b = "long" };
99 //resource(859) (string) strings { "long", "longer" }; // invalid cast
101 type #'RAWT' msgs { archive BBitmap a };
103 resource(861) msgs { a = archive BBitmap { "field" = "value" } };
105 type #'MSGG' msgs2 { message m = message('yeah') { "fld" = "val" } };
108 // When you decompile these, it only sees the first message.
109 type #'RAWT' msgs3 { message m, archive BBitmap a };
112 message m = message { "f" = "v" },
113 message n = message { "v" = "f" }
118 type #'zzzz' msgs5 { int8 x, message m, message n };
120 resource(866) msgs5 { 4, message('yoyo') { "f" = "v" } };
122 type #'what' onefield { int32 flags };
123 resource(870) onefield 100;
125 type ye_olde_raw { int32 a };
126 resource(871) ye_olde_raw 64;
128 //type #'what' sometype { UnKnOwN x }; // unknown type
129 //type #'what' B_INT8_TYPE { int8 x }; // duplicate type (built-in)
130 //type #'RECT' myrect { float x }; // duplicate type
131 //type #'RAWT' whoops { float x = "wrong" } // invalid cast
132 //type #'jump' jump { int8 x, jump j }; // unknown type jump
134 //resource(890) tooSoon 123; // unknown type (must
135 //type #'soon' tooSoon { int32 x }; // be defined first)
137 //resource(890) UnKnOwN { 123 }; // unknown type
138 //resource(890) (UnKnOwN) { 123 }; // unknown type
139 //resource(890) message('blah') { UnKnOwN x }; // unknown type
140 //resource(890) myraw { 123 }; // invalid cast
141 //resource(890) (myrect) { 123 }; // invalid cast
143 //------------------------------------------------------------------------------
151 resource(R_Point) point { -8.30573e+26, -1.0977e+37 };
154 resource(R_Rect) rect { 0.0, 0.0, -1.0, -1.0 };
157 resource(R_Color) rgb_color { 0xaa, 0xbb, 0x88, 0x80 };
158 resource(882) rgb_color;
160 resource app_signature "application/x-vnd.vendor.appname";
163 resource app_version;
167 resource file_types message
169 "types" = "text/plain",
170 "types" = "text/x-source-code"
173 //------------------------------------------------------------------------------
175 type #'CSTR' notfixed1 { string s };
176 resource(901) notfixed1; // empty string
177 resource(902) notfixed1 "hi"; // "hi"
178 resource(903) notfixed1 "hellotherepeeps"; // "hellotherepeeps"
180 type #'CSTR' notfixed2 { string s = "hello" };
181 resource(904) notfixed2; // "hello"
182 resource(905) notfixed2 "hi"; // "hi"
183 resource(906) notfixed2 "hellotherepeeps"; // "hellotherepeeps"
185 type notfixed3 { array a };
186 resource(907) notfixed3; // 0 bytes
187 resource(908) notfixed3 array { // 3 bytes
188 (uint8) 0x01, (uint8) 0x02, (uint8) 0x03 };
190 type #'CSTR' fixed1 { string s[10] };
191 resource(910) fixed1; // 10 null bytes
192 resource(911) fixed1 "hello"; // 5 chars, 5 nulls
193 resource(912) fixed1 "hellotherepeeps"; // 9 chars, 1 null
195 type #'CSTR' fixed2 { string s[10] = "hello" };
196 resource(913) fixed2; // 5 chars, 5 nulls
197 resource(914) fixed2 "hi"; // 2 chars, 8 nulls
198 resource(915) fixed2 "hellotherepeeps"; // 9 chars, 1 null
200 type #'CSTR' fixed3 { string s[2] = "hello" };
201 resource(916) fixed3; // 1 char, 1 null
202 resource(917) fixed3 "woot"; // 1 char, 1 null
204 type #'BYTE' fixed4 { int32 i[1] = 1026 };
205 resource(921) fixed4; // one byte with value 2
206 resource(922) fixed4 1027; // one byte with value 3
208 type #'BYTE' fixed5 { int32 i[1] };
209 resource(923) fixed5; // one byte with value 0
210 resource(924) fixed5 1026; // one byte with value 2
212 type fixed6 { int32 i[8] };
213 resource(925) fixed6; // eight bytes with value 0
214 resource(926) fixed6 0xDEADBEEF; // EFBEADDE00000000
216 type fixed7 { int32 i[4] }; // int32 is already 4 bytes,
217 resource(927) fixed7; // so the [4] is ignored
218 resource(928) fixed7 1234;
220 type fixed8 { array a[3] };
221 resource(930) fixed8; // 000000
222 resource(931) fixed8 array { // 112200
223 (uint8) 0x11, (uint8) 0x22 };
224 resource(932) fixed8 array { // 112233
225 (uint8) 0x11, (uint8) 0x22,
226 (uint8) 0x33, (uint8) 0x44 };
228 type fixed9 { array a[3] = array {
229 (uint8) 0x11, (uint8) 0x22, (uint8) 0x33 } };
230 resource(933) fixed9; // 112233
231 resource(934) fixed9 array { // 778800
232 (uint8) 0x77, (uint8) 0x88 };
233 resource(935) fixed9 array { // 667788
234 (uint8) 0x66, (uint8) 0x77,
235 (uint8) 0x88, (uint8) 0x99 };
237 type fixed10 { message msg[2] };
238 resource(936) fixed10;
240 type fixed11 { fixed10 f[1] };
241 resource(937) fixed11;
243 //type fixed0 { string s[0] }; // invalid size