mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
77 lines
1.4 KiB
C++
77 lines
1.4 KiB
C++
/* this is the WIP test for the parser...
|
|
* constantly adding stuff here to see if things break
|
|
*/
|
|
void(string,...) print = #1;
|
|
string(float) ftos = #2;
|
|
entity() spawn = #3;
|
|
void(entity) kill = #4;
|
|
|
|
.float mema;
|
|
.float memb;
|
|
|
|
$framevalue 0
|
|
$frame stand1 stand2 standX
|
|
$framerestore stand2
|
|
$frame stand3
|
|
$modelname foobar
|
|
$modelname foobar3
|
|
|
|
void(string a, ...) hasvaria = {
|
|
};
|
|
|
|
void() main = {
|
|
entity pawn;
|
|
vector vec;
|
|
float a;
|
|
|
|
vec = '3 4 5';
|
|
vec_z = 5;
|
|
|
|
a = 5;
|
|
|
|
if (a) {
|
|
print("a != 0\n");
|
|
} else {
|
|
print("not a\n");
|
|
}
|
|
|
|
a = 19;
|
|
print("Hello, World\n");
|
|
|
|
pawn = spawn();
|
|
pawn.mema = 3;
|
|
pawn.memb = 5;
|
|
print(ftos(pawn.mema), "\n");
|
|
print(ftos(pawn.memb), "\n");
|
|
|
|
print("SECOND TEST\n");
|
|
for (a = 0; a < 3; a = a + 1) {
|
|
print("LOOP ", ftos(a), "\n");
|
|
}
|
|
|
|
print("DO-WHILE test\n");
|
|
a = 2;
|
|
do {
|
|
print("Foo\n");
|
|
a = a - 1;
|
|
} while (a);
|
|
|
|
float b;
|
|
a = 5;
|
|
print("a = ", ftos(a), "\n");
|
|
b = a += 7;
|
|
print("adding\n");
|
|
print("a = ", ftos(a), "\n");
|
|
print("b = ", ftos(b), "\n");
|
|
|
|
print("memb = ", ftos(pawn.memb), "\n");
|
|
pawn.memb += -1;
|
|
print("memb = ", ftos(pawn.memb), "\n");
|
|
print("Frame stand3 is ", ftos($stand3), " wooh\n");
|
|
};
|
|
|
|
float() exprtest = {
|
|
local float x;
|
|
x = 3;
|
|
return (x); /* parens */
|
|
}
|