+++ /dev/null
-float constant_1 = 1;
-string constant_2 = "hello world";
-vector constant_3 = { -0, +0, 0 };
-entity constant_4 = 0
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-
-float CONST_1 = 1;
-float CONST_2 = CONST_1 + 1;
-
-void() main = {
- print3("CONST_1 = ", ftos(CONST_1), "\n");
- print3("CONST_2 = ", ftos(CONST_2), "\n");
-};
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-entity() spawn = #3;
-void(entity) kill = #4;
-
-.float mema;
-.float memb;
-.vector memv;
-
-.void() fun;
-
-void(entity a, .float f) printfield = {
- print3("The field is ", ftos(a.f), "\n");
-};
-
-void() funny = {
- print("FUNNY\n");
-};
-
-void() main = {
- local entity pawn;
-
- pawn = spawn();
-
- pawn.mema = 9;
- pawn.memv = '1 2 3';
- pawn.memb = 10;
-
- print3("x = ", ftos(pawn.memv_x), "\n");
- print3("y = ", ftos(pawn.memv_y), "\n");
- print3("z = ", ftos(pawn.memv_z), "\n");
- print3("a = ", ftos(pawn.mema), "\n");
- print3("b = ", ftos(pawn.memb), "\n");
- pawn.memv_y += 3;
- print3("x = ", ftos(pawn.memv_x), "\n");
- print3("y = ", ftos(pawn.memv_y), "\n");
- print3("z = ", ftos(pawn.memv_z), "\n");
- printfield(pawn, memv_z);
-
- pawn.fun = funny;
-
- pawn.fun();
-};
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-entity() spawn = #3;
-void(entity) kill = #4;
-
-$frame stand1 stand2 standX
-.float frame;
-.float nextthink;
-.void() think;
-
-entity self;
-float time;
-
-// void() stand2; this is auto-prototyped
-void() stand1 = [ 0, stand2 ] {
- // expands to:
- //self.frame = 0;
- //self.nextthink = time + 0.1;
- //self.think = stand2
- print("In stand 1...\n");
- print3("--> self.frame should be 0, is ", ftos(self.frame), "\n");
-};
-
-void() stand2 = [ 1, stand1 ] {
- print("In stand 2...\n");
- print3("--> self.frame should be 1, is ", ftos(self.frame), "\n");
-};
-
-void() standm = {
- local string bar;
- bar = ftos(self);
- print3("Foo ", ftos(self), "\n");
- self.frame = 0;
- self.nextthink = time + 0.1;
-};
-
-void() main = {
- self = spawn();
-
- time = 10;
-
- print("Setting think\n");
- self.think = stand1;
-
- print("Running think\n");
- standm();
- print("Running from 'self'\n");
- self.think();
- self.think();
- self.think();
-};
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-entity() spawn = #3;
-void(entity) kill = #4;
-
-.float vis;
-.entity other;
-
-float(entity targ) visible = {
- return targ.vis;
-};
-
-void() printworking = {
- print("Working\n");
-};
-
-void(void() callback) testcallback = {
- callback();
-};
-
-void(float) has1param = {};
-
-void() main = {
- local entity pawn, pawn2;
-
- pawn = spawn();
- pawn2 = spawn();
-
- pawn.other = pawn2;
- pawn.other.vis = 0;
-
- if (!visible(pawn.other))
- print("Yes\n");
-
- testcallback(printworking);
-
- has1param();
-};
+++ /dev/null
-/*
- * all of these includes should work. No matter what the spacing
- * is, we rely on it.
- */
-#include "test/include2.qc"
+++ /dev/null
-float foo;
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-
-void() main = {
- float a, b, c;
- a = 3 + 4 + 5;
- b = (5 * 2) + 1;
- c = 3 & 1;
- c = 1 | 2;
- a = 3 && 4;
- b = 0 && 4;
- c = 4 && 0;
- a = 1 || 1;
- b = 1 || 0;
- c = 0 || 1;
- a = 0 || 0;
-};
+++ /dev/null
-/* 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 */
-}
+++ /dev/null
-void test_parth() {
- if (1) { }
- if (2) { }
- if (3) { }
- if (4) { }
- if (5) { }
- if (6) { }
- if (7) { }
- if (8) { }
-}
+++ /dev/null
-void(string) print = #1;
-
-void() correct;
-void(string) incorrect;
-
-void() correct = {
- print("Hello\n");
-}
-
-void() incorrect = {
- printf("The compiler should error about this function having a wrong type\n");
-}
+++ /dev/null
-; these are builtin functions
-FUNCTION: makevectors, $1
-FUNCTION: setorigin, $2
-FUNCTION: setmodel, $3
-FUNCTION: setsize, $4
-
-FUNCTION: break, $6
-FUNCTION: random, $7
-FUNCTION: sound, $8
-FUNCTION: normalize, $9
-FUNCTION: error, $10
-FUNCTION: objerror, $11
-FUNCTION: vlen, $12
-FUNCTION: vectoyaw, $13
-FUNCTION: spawn, $14
-FUNCTION: remove, $15
-FUNCTION: traceline, $16
-
-FUNCTION: find, $18
-FUNCTION: precache_sound, $19
-FUNCTION: precache_model, $20
-
-FUNCTION: findradius, $22
-
-FUNCTION: dprint, $25
-FUNCTION: ftos, $26
-FUNCTION: vtos, $27
-FUNCTION: coredump, $28
-FUNCTION: traceon, $29
-FUNCTION: traceoff, $30
-FUNCTION: eprint, $31
-FUNCTION: walkmove, $32
-
-FUNCTION: droptofloor, $34
-FUNCTION: lightstyle, $35
-FUNCTION: rint, $36
-FUNCTION: floor, $37
-FUNCTION: ceil, $38
-
-FUNCTION: checkbottom, $40
-FUNCTION: pointcontents, $41
-
-FUNCTION: fabs, $43
-
-FUNCTION: cvar, $45
-FUNCTION: localcmd, $46
-FUNCTION: nextent, $47
-FUNCTION: particle, $48
-FUNCTION: ChangeYaw, $49
-
-FUNCTION: vectoangles, $51
-FUNCTION: vectoangles2, $51
-
-FUNCTION: sin, $60
-FUNCTION: cos, $61
-FUNCTION: sqrt, $62
-FUNCTION: changepitch, $63
-FUNCTION: tracetoss, $64
-FUNCTION: etos, $65
-
-FUNCTION: precache_file, $68
-FUNCTION: makestatic, $69
-
-FUNCTION: cvar_set, $72
-
-FUNCTION: ambientsound, $74
-FUNCTION: precache_model2,$75
-FUNCTION: precache_sound2,$76
-FUNCTION: precache_file2, $77
-
-FUNCTION: stof, $81
-
-FUNCTION: tracebox, $90
-FUNCTION: randomvec, $91
-FUNCTION: getlight, $92
-FUNCTION: getlight2, $92
-FUNCTION: registercvar, $93
-FUNCTION: min, $94
-FUNCTION: max, $95
-FUNCTION: bound, $96
-FUNCTION: pow, $97
-FUNCTION: findfloat, $98
-FUNCTION: checkextension, $99
-
-FUNCTION: test #0
- FLOAT: x, 100
- FLOAT: y, 200
-
- FLOAT: r_mul
- FLOAT: r_div
- FLOAT: r_add
- FLOAT: r_sub
-
- MUL_V x,y,r_mul
- DIV_V x,y,r_div
- ADD_V x,y,r_add
- SUV_V x,y,r_sub
-
- STORE_V r_mul
- CALL0 dprint
-
- STORE_V
-END
+++ /dev/null
-typedef float my_float;
-typedef vector my_vector;
-typedef string my_string;
-typedef entity my_entity;
-typedef void my_void;
-
-my_float type_float;
-my_vector type_vector;
-my_string type_string;
-my_entity type_entity;
-my_void type_void;
+++ /dev/null
-float typef;
-vector typev;
-string types;
-entity typee;
-void typev;
+++ /dev/null
-void(string) print = #1;
-void(float) ftos = #2;
-void() main = {
- local float uninit, unused, setonly;
- local vector invec;
- print("foo\n");
-
- setonly = 3;
- invec = '1 2 3';
-
- if (0)
- uninit = 3;
- ftos(uninit);
- ftos(invec_x);
-};
-
-void(float par) partest = {
- ftos(par);
-};
+++ /dev/null
-/* this is the WIP test for the parser...
- * constantly adding stuff here to see if things break
- */
-void(string) print = #1;
-void(string,string) print2 = #1;
-void(string,string,string) print3 = #1;
-string(float) ftos = #2;
-entity() spawn = #3;
-void(entity) kill = #4;
-
-float multi, decla, ration;
-.vector memvec;
-
-.void(string x) printit;
-
-float(vector different_name, vector b) dot;
-
-float(vector a, vector b) dot = {
- return a * b;
-};
-
-void(string x) myprintit = {
- print3("-> ", x, "\n");
-};
-
-void(vector par) vecpar = {
- // vector-parameters need _x, _y, _z as well
- print3("par_y should be 5... = ", ftos(par_y), "\n");
-};
-
-void() main = {
- local entity pawn;
- local vector foovec;
- print3("should be 1: ", ftos(dot('1 1 0', '1 0 0')), "\n");
-
- foovec = '3 4 5';
- foovec_y = 9;
- pawn = spawn();
- pawn.printit = myprintit;
- pawn.printit("Hello");
-
- vecpar('1 5 9');
-};
+++ /dev/null
-vector vec1 = {-0 +0 0 };
-vector vec2 = {.0 .0 .0 };
-vector vec3 = {-.0 +.0 +0.1 };
-vector vec4 = {1.1 2.2 3.3 };
-vector vec5 = {2. 3. 4. };
-vector vec6 = {-2. +3. -4. };
-/*
- * These are just comments: Ideally there is still some broken things
- * for the vector yet. which sort of sucks.
- */