-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0712e36
commit e2db7d8
Showing
17 changed files
with
1,843 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <console> | ||
|
||
const global_const = 0; | ||
new stock global_var = 0; | ||
new stock global_array[2]; | ||
forward global_func(); public global_func() { return 0; } | ||
native global_native(const string[]) = print; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
'test_type': 'output_check', | ||
'errors': """ | ||
__emit_p1.pwn(56) : error 001: expected token: "-any value-", but found "-(-function-)" | ||
__emit_p1.pwn(57) : error 001: expected token: "-any value-", but found "-(-label-)" | ||
__emit_p1.pwn(58) : error 001: expected token: "-any value-", but found "--" | ||
__emit_p1.pwn(58) : warning 215: expression has no effect | ||
__emit_p1.pwn(59) : error 017: undefined symbol "local_label2" | ||
__emit_p1.pwn(60) : error 001: expected token: "-any value-", but found "-:" | ||
__emit_p1.pwn(60) : error 029: invalid expression, assumed zero | ||
__emit_p1.pwn(60) : warning 215: expression has no effect | ||
__emit_p1.pwn(83) : error 001: expected token: "-integer value-", but found "-data offset-" | ||
__emit_p1.pwn(84) : error 001: expected token: "-integer value-", but found "-function-" | ||
__emit_p1.pwn(85) : error 001: expected token: "-integer value-", but found "-reference-" | ||
__emit_p1.pwn(86) : error 001: expected token: "-integer value-", but found "-reference-" | ||
__emit_p1.pwn(87) : error 001: expected token: "-integer value-", but found "-local variable-" | ||
__emit_p1.pwn(88) : error 001: expected token: "-integer value-", but found "-data offset-" | ||
__emit_p1.pwn(89) : error 001: expected token: "-integer value-", but found "-label-" | ||
__emit_p1.pwn(115) : error 001: expected token: "-nonnegative integer-", but found "-data offset-" | ||
__emit_p1.pwn(116) : error 001: expected token: "-nonnegative integer-", but found "-function-" | ||
__emit_p1.pwn(117) : error 001: expected token: "-nonnegative integer-", but found "-reference-" | ||
__emit_p1.pwn(118) : error 001: expected token: "-nonnegative integer-", but found "-reference-" | ||
__emit_p1.pwn(119) : error 001: expected token: "-nonnegative integer-", but found "-local variable-" | ||
__emit_p1.pwn(120) : error 001: expected token: "-nonnegative integer-", but found "-data offset-" | ||
__emit_p1.pwn(121) : error 001: expected token: "-nonnegative integer-", but found "-label-" | ||
__emit_p1.pwn(122) : error 001: expected token: "-nonnegative integer-", but found "-1" | ||
__emit_p1.pwn(123) : error 001: expected token: "-nonnegative integer-", but found "-1" | ||
__emit_p1.pwn(127) : error 001: expected token: "-nonnegative integer-", but found "-2147483648" | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#include "__emit.inc" | ||
|
||
|
||
stock test__any(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit const.pri global_const; | ||
emit const.pri global_var; | ||
emit const.pri global_func; | ||
emit const.pri local_refvar; | ||
emit const.pri local_refarray; | ||
emit const.pri local_const; | ||
emit const.pri local_var; | ||
emit const.pri local_static_var; | ||
emit const.pri local_label; | ||
emit const.pri :local_label; | ||
emit const.pri :local_label2; | ||
emit const.pri 0; | ||
emit const.pri -0; | ||
emit const.pri 1; | ||
emit const.pri -1; | ||
emit const.pri 0x0; | ||
emit const.pri -0x0; | ||
emit const.pri 0x1; | ||
emit const.pri -0x1; | ||
#if cellbits == 16 | ||
emit const.pri 32767; | ||
emit const.pri -32768; | ||
emit const.pri 0x7FFF; | ||
emit const.pri -0x7FFF; | ||
emit const.pri 0x8000; | ||
emit const.pri -0x8000; | ||
#elseif cellbits == 32 | ||
emit const.pri 2147483647; | ||
emit const.pri -2147483648; | ||
emit const.pri 0x7FFFFFFF; | ||
emit const.pri -0x7FFFFFFF; | ||
emit const.pri 0x80000000; | ||
emit const.pri -0x80000000; | ||
#else // cellbits == 64 | ||
emit const.pri 9223372036854775807; | ||
emit const.pri -9223372036854775808; | ||
emit const.pri 0x7FFFFFFFFFFFFFFF; | ||
emit const.pri -0x7FFFFFFFFFFFFFFF; | ||
emit const.pri 0x8000000000000000; | ||
emit const.pri -0x8000000000000000; | ||
#endif | ||
emit const.pri (cellbits / charbits * 2); | ||
|
||
// should trigger an error | ||
emit const.pri -global_func; | ||
emit const.pri -local_label; | ||
emit const.pri --0; | ||
emit const.pri local_label2; | ||
emit const.pri -:local_label; | ||
|
||
local_label2: | ||
} | ||
|
||
stock test__integer(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit jrel global_const; | ||
emit jrel local_const; | ||
emit jrel 0; | ||
emit jrel 1; | ||
emit jrel -1; | ||
emit jrel 0x1; | ||
emit jrel -0x1; | ||
emit jrel (cellbits / charbits * 2); | ||
|
||
// should trigger an error | ||
emit jrel global_var; | ||
emit jrel global_func; | ||
emit jrel local_refvar; | ||
emit jrel local_refarray; | ||
emit jrel local_var; | ||
emit jrel local_static_var; | ||
emit jrel local_label; | ||
} | ||
|
||
stock test__nonneg(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit cmps global_const; | ||
emit cmps local_const; | ||
emit cmps 0; | ||
emit cmps 1; | ||
emit cmps 0x1; | ||
emit cmps (cellbits / charbits * 2); | ||
#if cellbits == 16 | ||
emit cmps 0x7FFF; | ||
#elseif cellbits == 32 | ||
emit cmps 0x7FFFFFFF; | ||
#else // cellbits == 64 | ||
emit cmps 0x7FFFFFFFFFFFFFFF; | ||
#endif | ||
|
||
// should trigger an error | ||
emit cmps global_var; | ||
emit cmps global_func; | ||
emit cmps local_refvar; | ||
emit cmps local_refarray; | ||
emit cmps local_var; | ||
emit cmps local_static_var; | ||
emit cmps local_label; | ||
emit cmps -1; | ||
emit cmps -0x1; | ||
#if cellbits == 16 | ||
emit cmps 0x8000; | ||
#elseif cellbits == 32 | ||
emit cmps 0x80000000; | ||
#else // cellbits == 64 | ||
emit cmps 0x8000000000000000; | ||
#endif | ||
} | ||
|
||
|
||
main() | ||
{ | ||
new t; | ||
static a[1]; | ||
test__any(t, a); // 4 | ||
test__integer(t, a); // 7 | ||
test__nonneg(t, a); // 10 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
'test_type': 'output_check', | ||
'errors': """ | ||
__emit_p2.pwn(30) : error 001: expected token: "-integer value-", but found "-data offset-" | ||
__emit_p2.pwn(31) : error 001: expected token: "-integer value-", but found "-function-" | ||
__emit_p2.pwn(32) : error 001: expected token: "-integer value-", but found "-reference-" | ||
__emit_p2.pwn(33) : error 001: expected token: "-integer value-", but found "-reference-" | ||
__emit_p2.pwn(34) : error 001: expected token: "-integer value-", but found "-local variable-" | ||
__emit_p2.pwn(35) : error 001: expected token: "-integer value-", but found "-data offset-" | ||
__emit_p2.pwn(36) : error 001: expected token: "-integer value-", but found "-label-" | ||
__emit_p2.pwn(37) : error 050: invalid range | ||
__emit_p2.pwn(38) : error 050: invalid range | ||
__emit_p2.pwn(43) : error 050: invalid range | ||
__emit_p2.pwn(44) : error 050: invalid range | ||
__emit_p2.pwn(65) : error 001: expected token: "-label-", but found "-numeric value-" | ||
__emit_p2.pwn(66) : error 001: expected token: "-label-", but found "-data offset-" | ||
__emit_p2.pwn(67) : error 001: expected token: "-label-", but found "-function-" | ||
__emit_p2.pwn(68) : error 001: expected token: "-label-", but found "-reference-" | ||
__emit_p2.pwn(69) : error 001: expected token: "-label-", but found "-reference-" | ||
__emit_p2.pwn(70) : error 001: expected token: "-label-", but found "-numeric value-" | ||
__emit_p2.pwn(71) : error 001: expected token: "-label-", but found "-local variable-" | ||
__emit_p2.pwn(72) : error 001: expected token: "-label-", but found "-data offset-" | ||
__emit_p2.pwn(73) : error 001: expected token: "-label-", but found "-integer value-" | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include "__emit.inc" | ||
|
||
|
||
stock test__shift(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit shl.c.pri global_const; | ||
emit shl.c.pri local_const; | ||
emit shl.c.pri 0; | ||
emit shl.c.pri 1; | ||
emit shl.c.pri 15; | ||
emit shl.c.pri (cellbits / charbits); | ||
#if cellbits == 16 | ||
emit shl.c.pri 15; | ||
emit shl.c.pri 0xF; | ||
#elseif cellbits == 32 | ||
emit shl.c.pri 31; | ||
emit shl.c.pri 0x1F; | ||
#else // cellbits == 64 | ||
emit shl.c.pri 63; | ||
emit shl.c.pri 0x3F; | ||
#endif | ||
|
||
// should trigger an error | ||
emit shl.c.pri global_var; | ||
emit shl.c.pri global_func; | ||
emit shl.c.pri local_refvar; | ||
emit shl.c.pri local_refarray; | ||
emit shl.c.pri local_var; | ||
emit shl.c.pri local_static_var; | ||
emit shl.c.pri local_label; | ||
emit shl.c.pri -1; | ||
emit shl.c.pri -0x1; | ||
#if cellbits == 16 | ||
emit shl.c.pri 16; | ||
emit shl.c.pri 0x10; | ||
#elseif cellbits == 32 | ||
emit shl.c.pri 32; | ||
emit shl.c.pri 0x20; | ||
#else // cellbits == 64 | ||
emit shl.c.pri 64; | ||
emit shl.c.pri 0x40; | ||
#endif | ||
} | ||
|
||
stock test__label(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit jump local_label; | ||
emit jump local_label2; | ||
emit jump :local_label2; | ||
local_label2: | ||
|
||
// should trigger an error | ||
emit jump global_const; | ||
emit jump global_var; | ||
emit jump global_func; | ||
emit jump local_refvar; | ||
emit jump local_refarray; | ||
emit jump local_const; | ||
emit jump local_var; | ||
emit jump local_static_var; | ||
emit jump 0; | ||
} | ||
|
||
|
||
main() | ||
{ | ||
new t, a[1]; | ||
test__shift(t, a); // 11 | ||
test__label(t, a); // 9 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
'test_type': 'output_check', | ||
'errors': """ | ||
__emit_p3.pwn(17) : error 001: expected token: "-function-", but found "-numeric value-" | ||
__emit_p3.pwn(18) : error 001: expected token: "-function-", but found "-data offset-" | ||
__emit_p3.pwn(19) : error 001: expected token: "-function-", but found "-reference-" | ||
__emit_p3.pwn(20) : error 001: expected token: "-function-", but found "-reference-" | ||
__emit_p3.pwn(21) : error 001: expected token: "-function-", but found "-numeric value-" | ||
__emit_p3.pwn(22) : error 001: expected token: "-function-", but found "-local variable-" | ||
__emit_p3.pwn(23) : error 001: expected token: "-function-", but found "-data offset-" | ||
__emit_p3.pwn(24) : error 001: expected token: "-function-", but found "-label-" | ||
__emit_p3.pwn(25) : error 001: expected token: "-function-", but found "-integer value-" | ||
__emit_p3.pwn(26) : error 001: expected token: "-native function-", but found "-numeric value-" | ||
__emit_p3.pwn(27) : error 001: expected token: "-native function-", but found "-data offset-" | ||
__emit_p3.pwn(28) : error 001: expected token: "-native function-", but found "-reference-" | ||
__emit_p3.pwn(29) : error 001: expected token: "-native function-", but found "-reference-" | ||
__emit_p3.pwn(30) : error 001: expected token: "-native function-", but found "-numeric value-" | ||
__emit_p3.pwn(31) : error 001: expected token: "-native function-", but found "-local variable-" | ||
__emit_p3.pwn(32) : error 001: expected token: "-native function-", but found "-data offset-" | ||
__emit_p3.pwn(33) : error 001: expected token: "-native function-", but found "-label-" | ||
__emit_p3.pwn(34) : error 001: expected token: "-native function-", but found "-integer value-" | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "__emit.inc" | ||
|
||
|
||
stock test__function(&local_refvar, local_refarray[]) | ||
{ | ||
const local_const = 0; | ||
new local_var = 0; | ||
static local_static_var = 0; | ||
local_label: | ||
|
||
// ok | ||
emit call global_func; | ||
emit sysreq.c global_native; | ||
emit sysreq.n global_native 0; | ||
|
||
// should trigger an error | ||
emit call global_const; | ||
emit call global_var; | ||
emit call local_refvar; | ||
emit call local_refarray; | ||
emit call local_const; | ||
emit call local_var; | ||
emit call local_static_var; | ||
emit call local_label; | ||
emit call 0; | ||
emit sysreq.c global_const; | ||
emit sysreq.c global_var; | ||
emit sysreq.c local_refvar; | ||
emit sysreq.c local_refarray; | ||
emit sysreq.c local_const; | ||
emit sysreq.c local_var; | ||
emit sysreq.c local_static_var; | ||
emit sysreq.c local_label; | ||
emit sysreq.c 0; | ||
} | ||
|
||
|
||
main() | ||
{ | ||
new t, a[1]; | ||
test__function(t, a); // 18 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
'test_type': 'output_check', | ||
'errors': """ | ||
__emit_p4.pwn(16) : error 001: expected token: "-data offset-", but found "-numeric value-" | ||
__emit_p4.pwn(17) : error 001: expected token: "-data offset-", but found "-function-" | ||
__emit_p4.pwn(18) : error 001: expected token: "-data offset-", but found "-reference-" | ||
__emit_p4.pwn(19) : error 001: expected token: "-data offset-", but found "-reference-" | ||
__emit_p4.pwn(20) : error 001: expected token: "-data offset-", but found "-numeric value-" | ||
__emit_p4.pwn(21) : error 001: expected token: "-data offset-", but found "-local variable-" | ||
__emit_p4.pwn(22) : error 001: expected token: "-data offset-", but found "-label-" | ||
__emit_p4.pwn(23) : error 001: expected token: "-data offset-", but found "-integer value-" | ||
__emit_p4.pwn(48) : error 001: expected token: "-local variable-", but found "-data offset-" | ||
__emit_p4.pwn(49) : error 001: expected token: "-local variable-", but found "-function-" | ||
__emit_p4.pwn(50) : error 001: expected token: "-local variable-", but found "-data offset-" | ||
__emit_p4.pwn(51) : error 001: expected token: "-local variable-", but found "-label-" | ||
__emit_p4.pwn(52) : error 001: expected token: "-local variable-", but found "-reference-" | ||
__emit_p4.pwn(53) : error 001: expected token: "-local variable-", but found "-reference-" | ||
__emit_p4.pwn(54) : error 001: expected token: "-local variable-", but found "-(-data offset-)" | ||
__emit_p4.pwn(55) : error 001: expected token: "-local variable-", but found "-(-function-)" | ||
__emit_p4.pwn(56) : error 001: expected token: "-local variable-", but found "-(-data offset-)" | ||
__emit_p4.pwn(57) : error 001: expected token: "-local variable-", but found "-(-label-)" | ||
__emit_p4.pwn(58) : error 001: expected token: "-local variable-", but found "-(-reference-)" | ||
__emit_p4.pwn(59) : error 001: expected token: "-local variable-", but found "-(-reference-)" | ||
""" | ||
} |
Oops, something went wrong.