quakeforge/tools/qwaq/main.qc
Bill Currie c248372e20 Initial integer type support. qfcc /is/ partially broken when it comes to
integer constants and float function args/return values.

pr_comp.h:
	o  add the integer opcodes to pr_opcode_e
pr_edict.c:
	o  add "quaternion" and "integer" to type_name[]
	o  support quatnernion and integers types when printing values
	o  support the integer opcodes when bounds checking
pr_exec.c
	o  enable the integer opcodes
pr_opcode:
	o  add the integer opcodes to the opcode table
	o  logical operators all result in an integer rather than a value
expr.h:
	o  rename int_val to integer_val
qfcc.h:
	o  kill another magic number
expr.c:
	o  move the opcode to string conversion out of type_mismatch and into
	   get_op_string
	o  rename int_val to integer_val
	o  general integer type support.
	o  generate an internal comipiler error for null opcodes rather than
	   segging.
pr_imm.c:
	o  rename int_val to integer_val
	o  support integer constants, converting to float when needed.
pr_lex.c:
	o  magic number death and support quaternions and integers in type_size[]
qc-lex.l
	o  rename int_val to integer_val
	o  support quaternion and integer type keywords
qc-parse.y:
	o  rename int_val to integer_val
	o  use binary_expr instead of new_binary_expr for local initialized
	   variables
builtins.c:
	o  rename int_val to integer_val
	o  fix most (all?) of the INT related FIXMEs
defs.qc:
	o  use integer instead of float where it makes sense
main.c:
	o  read_result is now integer rather than float
main.qc:
	o  float -> integer where appropriate
	o  new test for int const to float arg
2001-07-23 01:31:22 +00:00

98 lines
1.6 KiB
C++

#define NIT_TESLA 32768 //The *real* bug zapper!
#define NIT_SECURITY_CAMERA 65536 //CH Security Camera
#define NIT_TELEPORTER 131072 //CH Teleporter
#define PC_ENGINEER_TF_ITEMS NIT_TESLA | NIT_SECURITY_CAMERA | NIT_TELEPORTER
//float messed_or = PC_ENGINEER_TF_ITEMS;
float foo = 1;
float bar = 1;
float snafu = 2;
float negative = -------2;
void () eek;
float () main =
{
local float messed_or;
local integer handle;
local string buffer;
traceon();
messed_or = PC_ENGINEER_TF_ITEMS;
handle = open ("main.qc", 0);
if (handle == -1) {
print (strerror (errno ()) + "\n");
return 1;
}
do {
buffer = read (handle, 1024);
if (read_result == -1) {
print (strerror (errno ()) + "\n");
return 1;
}
print (buffer);
} while (read_result == 1024);
close (handle);
eek ();
return 0;
};
float () baz =
{
return foo + bar;
};
void (float x) test =
{
local string str;
local integer urk = 0;
if (urk) {
urk = foo || snafu;
} else {
print ("owie");
}
};
void () blarg =
{
local float foo = -1;
local float bar;
do {
foo = 1;
} while (foo);
if (bar = foo);
foo = 2;
while (foo) {
bar = foo;
}
};
float (float baz) test_int =
{
return baz;
};
.entity owner;
entity sent;
void () eek =
{
traceon();
if (sent && sent.owner != self )
self.origin = '0 0 0';
self.origin = self.origin + '1 2 3';
test_int (1);
traceoff();
};
void () assign =
{
local float foo;
local float bar;
foo = bar;
foo = bar = 1;
foo = bar = bar + 1;
foo = self.nextthink = self.nextthink + 1.0;
self.frame = self.nextthink = self.nextthink + 1.0;
};