1 2resource(1) 100; 3resource(1) "123"; // should be okay because types differ 4//resource(1) 123; // duplicate resource 1 5//resource(0x100000001) 100; // duplicate resource 1 6 7///* this is a /* nested */ comment */ 8 9resource(-1) 100; 10resource(0xFFFFFFFE) 101; // -2 11resource(- 0x7FFFFFFF) 102; // -2147483647 12resource(-0x80000000) 103; // -2147483648 13resource( 0x80000001) "104"; // -2147483647 14resource(-0x80000001) 105; // 2147483647 15resource(-3, "name") 106; 16 17resource(10, "nom") "hello"; 18resource(11, "") 123; // should ignore name 19 20//------------------------------------------------------------------------------ 21 22resource(20) true; 23resource(21) false; 24//resource(22) (int32) true; // invalid cast 25 26resource(30) 12345; 27resource(31) (int32) 12345; 28resource(32) (uint32) 12345; 29resource(33) (size_t) 12345; 30resource(34) (ssize_t) 12345; 31resource(35) (time_t) 12345; 32resource(36) (int64) 1234; 33resource(37) (uint64) 1234; 34resource(38) (off_t) 0xffaa; 35resource(39) (int8) 12345; 36resource(40) (uint8) 12345; 37resource(41) (int16) 12345; 38resource(42) (uint16) 12345; 39resource(43) (float) 12345; 40resource(44) (double) 12345; 41resource(44) (raw) 12345; 42 43resource(45) -123; 44resource(46) - 123; 45resource(47) -0xFFFF; // -65535 46resource(48) -0xFFFFFFFF; // 1 47resource(49) -0x7FFFFFFF; // -2147483647 48resource(50) -0x80000000; // -2147483648 49resource(51) 0x80000001; // -2147483647 50resource(52) -0x80000001; // 2147483647 51resource(53) (uint64) -0xFFFFFFFF; // 18446744069414584321 52resource(54) -1; 53resource(55) 'what'; // 2003329396 54resource(56) -'what'; // -2003329396 55resource(57) 0b1; 56resource(58) 0b11111111111111111111111111111111; // -1 57resource(59) (uint64) 0b1111111111111111111111111111111111111111111111111111111111111111; // 18446744073709551615 58//resource(59) - -123; // syntax error 59 60resource(60) 10.0; 61resource(61) (float) 10.0; 62resource(62) (double) 10.0; 63resource(63) -10.0; 64resource(64) - 10.0; 65resource(65) (raw) 10.0; 66//resource(69) - -10.0; // syntax error 67 68resource(70) "fancy"; 69resource(71) (string) "pants"; 70resource(72) "w00t\0dude"; 71resource(73) "fancy" "pants"; 72resource(74) ""; 73resource(75) "" "this" "wont" "" "scare" "" "me" ""; 74resource(76) (raw) "fancy"; 75//resource(79) "hi", "ho"; // , not allowed 76 77resource(80) $"4041"; 78resource(81) (buffer) $"4041"; 79resource(82) (raw) $"4041"; 80resource(83) $"4041" $"4243"; 81resource(84) $""; 82resource(85) $"" $"40" $"" $"41" $""; 83resource(86) (array) $"4041"; 84//resource(89) $"0"; // too few digits 85//resource(89) $"GA"; // invalid digit 86//resource(89) $"FF", $"AA"; // , not allowed 87 88resource(90) (#'blah') $"4041"; 89resource(91) (#'blah') (uint16) 1234; 90resource(92) #'blah' 1234; 91resource(93) #'blah' (uint16) 1234; 92//resource(95) (#'blah' uint16) 1234; // we don't allow this notation 93 94//------------------------------------------------------------------------------ 95 96enum { 97 R_Boolean = 100, 98 R_Int8 = 100, 99 R_Character = 100, 100 R_String = 100, 101 R_Double = 100, 102 R_Float = 100, 103 R_Int64 = 100, 104 R_Int32 = 100, 105 R_MIMEString = 100, 106 R_Offset = 100, 107 R_Pointer = 100, 108 R_Raw = 100, 109 R_Int16 = 100, 110 R_Size = 100, 111 R_Status = 100, 112 R_Time = 100, 113 R_UInt8 = 100, 114 R_UInt64 = 100, 115 R_UInt32 = 100, 116 R_UInt16 = 100 117}; 118 119resource(R_Boolean) false; 120resource(R_Int8) (int8)4; 121resource(R_Character) (#'CHAR') $"28"; 122resource(R_String) "Dance and song"; 123resource(R_Double) (double)0.0; 124resource(R_Float) 0.0; 125resource(R_Int64) (int64)-125829120; 126resource(R_Int32) -123450; 127resource(R_MIMEString) (#'MIMS') "application/octet-stream"; 128resource(R_Offset) (off_t)0; 129resource(R_Pointer) (#'PNTR') $"00000000"; 130resource(R_Raw) $""; 131resource(R_Int16) (int16)-1234; 132resource(R_Size) (size_t)0; 133resource(R_Status) (ssize_t)0; 134resource(R_Time) (time_t)0; 135resource(R_UInt8) (uint8)200; 136resource(R_UInt64) (uint64)17293822569102704640; 137resource(R_UInt32) (uint32)251658240; 138resource(R_UInt16) (uint16)61440; 139 140resource(120) $"40414243"; 141 142resource(121) (#200) 143 $"DE8765005507E15BC8033E2CD6BFB72620DD87F9780325D0BB2DAC7DAEE9AC9B" 144 $"6C7398DB05ADC01C5E41CBC0CCDA19DBE9FFEF7430BE3525C5FCBC419BB90000"; 145 146//------------------------------------------------------------------------------ 147 148// The decompile should escape the special characters, except \P, which 149// is not special (the \ is dropped). Unlike deres, rc does not split the 150// string literal into two parts at the newline. 151resource(200) "a \tshort string\nwith \bplenty\fof\r\vescapes\P"; 152 153// More stuff that should be escaped. 154resource(201) "some other \"special\" characters like \\ and \0x01 and \002"; 155 156// Decompiling should create a "#'CSTR' array" with two items, because the 157// string contains an embedded null character. By the way, beres does not 158// recognize \0 as null, but rc does. 159resource(202) "alongstring-alongstringg\000-alongstringg-alongstringg-alongstringgalongstringg-alongstringg-alongstringg-alongstringg-alongstring"; 160 161// Don't do the following in your own resource files. It should not crash 162// the compiler or decompiler, but pretending that non-string data is a 163// null-terminated string is A Bad Thing (tm). 164resource(210) (#'CSTR') $"4041"; 165resource(212) (#'CSTR') (uint64) 5678; 166 167// Should decompile as raw, not as string. 168resource(213) (#200) 100; 169 170// The decompiler sees this as a string literal. 171resource(214) (#200) $"6400"; 172 173// The decompiler creates the symbolic names R_BOOL_MyName and R_CSTR_MyName, 174// with values 215 and 216, respectively. 175resource(215, "MyName") true; 176resource(216, "MyName") "true"; 177 178// The decompiler creates the symbol R_200_MyName. 179resource(217, "MyName") (#200) 123; 180