More tests and fix vector/quaternion global dumps.

This commit is contained in:
Bill Currie 2011-08-11 14:58:13 +09:00
parent 5d52810b9c
commit e42c5a4272
8 changed files with 73 additions and 2 deletions

View file

@ -89,7 +89,7 @@ dump_def (progs_t *pr, ddef_t *def, int indent)
comment = va (" %g", G_FLOAT (pr, offset));
break;
case ev_vector:
comment = va (" '%g %g %g",
comment = va (" '%g %g %g'",
G_VECTOR (pr, offset)[0],
G_VECTOR (pr, offset)[1],
G_VECTOR (pr, offset)[2]);
@ -118,7 +118,7 @@ dump_def (progs_t *pr, ddef_t *def, int indent)
comment = va (" %x", G_INT (pr, offset));
break;
case ev_quat:
comment = va (" '%g %g %g %g",
comment = va (" '%g %g %g %g'",
G_QUAT (pr, offset)[0],
G_QUAT (pr, offset)[1],
G_QUAT (pr, offset)[2],

9
tools/qfcc/test/cast2.r Normal file
View file

@ -0,0 +1,9 @@
void foo (vector x)
{
entity *ep;
int d;
//d = (int) x.y;
//ep = (entity *) d;
ep = (entity *) (int) x.y;
}

View file

@ -0,0 +1,23 @@
@interface foo
-init;
@end
@implementation foo
-init
{
return self;
}
@protocol baz
-blah;
@end
@interface bar
-init;
@end
@implementation bar
-init
{
return self;
}

2
tools/qfcc/test/const.r Normal file
View file

@ -0,0 +1,2 @@
int x = 3;
float y = 4;

View file

@ -0,0 +1,11 @@
.int blah;
.void () think;
.SEL thinkMethod = think;
void foo (entity e)
{
*(SEL *)&e.think = @selector(foo:);
e.thinkMethod = @selector(foo:);
}
void __obj_exec_class (obj_module_t *msg) = #0;

View file

@ -0,0 +1,6 @@
.int a;
void f(void)
{
@self.@this = nil;
}

View file

@ -1,9 +1,16 @@
float VAL1 = 4;
float VAL2 = 6;
vector VMIN = '-16 -16 -24';
vector VMAX = '16 16 32';
vector v;
void send (float to, ...) = #0;
void do_something ()
{
vector a;
a = VMIN;
a = VMAX;
send (VAL1, VAL2);
}

13
tools/qfcc/test/vector2.r Normal file
View file

@ -0,0 +1,13 @@
vector a;
entity e;
.vector v;
float foo (void)
{
a.z += 3;
a_z += 3;
e.v = a;
e.v.y = 2;
e.v_y = 2;
return e.v.z;
}