quakeforge/tools/qfcc/test/iterfunc.r
Bill Currie 9b81d27f1a [qfcc] Add test for var = func(var)
That is, updating a variable using a function that takes the same
variable, probably very common in iterators, thus the name. It happens
to be the first qfcc test specific to Ruamoko. It's really just the
typedef, zerolinker, and vkgen type encoding loop stripped down for ease
of debugging.

Of course, it fails :)
2022-02-01 21:40:59 +09:00

33 lines
658 B
R

#include <types.h>
// can't link against libr.a (may not be built)
void *PR_FindGlobal (string name) = #0;
void printf (string fmt, ...) = #0;
qfot_type_encodings_t *encodings;
qfot_type_t *next_type (qfot_type_t *type);
int
main (void)
{
int found_param = 0;
int found_zero = 0;
qfot_type_t *type;
encodings = PR_FindGlobal (".type_encodings");
for (type = encodings.types;
((int *)type - (int *) encodings.types) < encodings.size;
type = next_type (type)) {
}
return 0;
}
qfot_type_t *
next_type (qfot_type_t *type)
{
int size = type.size;
if (!size)
size = 4;
return (qfot_type_t *) ((int *) type + size);
}