mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
fc7c96d208
Along with QuakeC's, of course. This fixes type typeredef2 test (a lot of work for one little syntax error). Unfortunately, it came at the cost of requiring `>>` in front of state expressions on C-style functions (QuakeC-style functions are unaffected). Also, there are now two shift/reduce conflicts with structs and unions (but these same conflicts are in gcc 3.4). This has highlighted the need for having the equivalent of the expression tree for the declaration system as there are now several hacks to deal with the separation of types and declarators. But that's a job for another week. The grammar constructs for declarations come from gcc 3.4's parser (I think it's the last version of gcc that used bison. Also, 3.4 is still GPL 2, so no chance of an issue there).
53 lines
901 B
R
53 lines
901 B
R
#include "test-harness.h"
|
|
|
|
.void() think;
|
|
.float nextthink;
|
|
.float frame;
|
|
entity self;
|
|
float time;
|
|
|
|
$frame frame0 frame1 frame2 frame3
|
|
|
|
void
|
|
state0 (void)
|
|
>> [$frame1, state1]
|
|
{
|
|
if (self.frame != $frame1 || self.think != state1
|
|
|| self.nextthink != 0.1f) {
|
|
printf ("state0: %g %x %g\n", self.frame, self.think, self.nextthink);
|
|
exit (1);
|
|
}
|
|
}
|
|
|
|
void
|
|
state1 (void)
|
|
>> [$frame2, state2, 0.2f]
|
|
{
|
|
if (self.frame != $frame2 || self.think != state2
|
|
|| self.nextthink != 0.2f) {
|
|
printf ("state1: %g %x %g\n", self.frame, self.think, self.nextthink);
|
|
exit (1);
|
|
}
|
|
}
|
|
|
|
void
|
|
state2 (void)
|
|
>> [$frame0, state0, 0.5f]
|
|
{
|
|
if (self.frame != $frame0 || self.think != state0
|
|
|| self.nextthink != 0.5f) {
|
|
printf ("state2: %g %x %g\n", self.frame, self.think, self.nextthink);
|
|
exit (1);
|
|
}
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
self = spawn ();
|
|
state0();
|
|
while (self.frame != $frame0) {
|
|
self.think();
|
|
}
|
|
return 0;
|
|
}
|