Commit graph

138 commits

Author SHA1 Message Date
Bill Currie
a47a4d8038 make print_expr's output readable by mere mortals 2001-07-23 06:15:33 +00:00
Bill Currie
d2c266775c fix a seg on return type mismatch 2001-07-23 05:46:00 +00:00
Bill Currie
4b744b6be5 fix numberous integer <-> float errors
type check function args in the correct order
2001-07-23 05:31:49 +00:00
Bill Currie
b8874cab1c function return checking 2001-07-23 02:27:46 +00:00
Bill Currie
50fadb6866 function arg type checking with int->float /constant/ cooecion. 2001-07-23 01:56:49 +00:00
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
Bill Currie
55ac55c7ac rename ev_int and ex_int to ev_integer and ex_integer. create type_integer
and def_integer (do I need that?), clean up and or coment on XXX and FIXME
2001-07-22 06:59:12 +00:00
Bill Currie
7c16afe7e9 add a --no-cpp command line option so that cpp enabled qfcc can still compile
qfpreqcc progs
2001-07-20 05:22:44 +00:00
Bill Currie
00d409e80c fix constant folding for | 2001-07-19 03:00:35 +00:00
Bill Currie
47a6f2c9b5 pr_debug.c:
capitolise CRC and add a \n to the message
sv_progs.c (both nq and qw):
	don't bother checking the progdefs.h crc: it's just not needed any more
pr_imm.c:
	use r instead of rep when checking the hash tables.
main.c (quaq):
	make developer work and set com_filesize (otherwise, progs crc doesn't
	get set properly (com_filesize, not developer:))
2001-07-18 21:28:41 +00:00
Bill Currie
5c31fbf366 fix debug crc generation 2001-07-18 20:31:55 +00:00
Bill Currie
10ad8bebbd Make files.dat actually useful. I really dislike the hardcoding, but it /is/
useful. Also, fix a bug in PrecacheModel where it was checking MAX_SOUNDS and
numsounds instead of models.
2001-07-18 17:23:42 +00:00
Bill Currie
c9af1575d3 fix emit_assign_expr to emit an explicit assignment statement whenever
emit_sub_expr returns a temporary def. this fixes a = b = c; expressions when
entities are involved.
2001-07-18 16:33:31 +00:00
Bill Currie
098305d649 fix (expr_type1 && expr_type2). this involed type completing expressions :/ 2001-07-18 06:37:14 +00:00
Jeff Teunissen
af366764de C preprocessor support for qfcc. Depends on the new parser. --enable-cpp
to activate.
2001-07-17 05:02:34 +00:00
Bill Currie
5d5d3f1416 well, that explains the loss of line number onfo on return statements :P 2001-07-16 03:53:45 +00:00
Bill Currie
cb80800732 fix debug line numbers for if and while. still `losing' them for return for
some reason.
2001-07-15 01:51:01 +00:00
Bill Currie
a0ba8e534c s/IMMEDIATE/.imm/ for name of immediate defs. the latter is both shorter and
impossible to generate from qc
2001-07-15 01:50:10 +00:00
Bill Currie
2818d720c2 move the full info opcocde table from qfcc to gamecode (<KURGON>There can be
only one!</KURGON>:) and use the table in PR_PrintStatement. This means that
qfcc now links against libQFgamecode as well as libQFutil
2001-07-14 02:34:16 +00:00
Bill Currie
ae9ee57666 change the type of opcode->type to etype_t, clean up the resulting mess, and
rename all of the opcodes to (eg) mul.f instead of MUL_F
2001-07-14 01:52:05 +00:00
Bill Currie
6c91ee29f0 fix a missed debug test 2001-07-14 01:47:45 +00:00
Bill Currie
7acbb3a0ea helps if I remember this :/ 2001-07-14 01:16:07 +00:00
Bill Currie
64e50e1ebd Basic debug info generation, just line numbers and local defs for each
function.
2001-07-14 01:15:40 +00:00
Bill Currie
8bbef35197 fix `a = b = b + c;' (probably d + c, too). Caused by forgetting to emit
an assignment for `a ='.
2001-07-12 18:56:43 +00:00
Bill Currie
8000c86e35 /much/ better type mismatch error reporting
eg:
./main.qc:55: type mismatch: float == entity
2001-07-09 18:17:04 +00:00
Bill Currie
1db6225ae7 make - - - - -2 work 2001-07-06 04:54:08 +00:00
Bill Currie
4673d701c9 fix the conflicts caused by -ve constants 2001-07-06 04:29:12 +00:00
Jeff Teunissen
35f5118803 warning/error message cleanups. Well, at least *I* think they make more
sense. :)
2001-07-06 02:43:39 +00:00
Bill Currie
b1f264b203 using qfpreqcc is now vewy vewy qwiet ('e's 'unting wabbits) 2001-07-03 21:17:02 +00:00
Bill Currie
1edf1e0b39 format checking for error and warning + needed fixes
try to give name of object when calling non-function
2001-07-03 20:53:49 +00:00
Bill Currie
ccc00b0608 fix segs on ondeclared identifiers 2001-07-03 20:42:07 +00:00
Bill Currie
f2bb7ace41 add an option (--warn=error) to treat warnings as errors 2001-06-28 23:15:10 +00:00
Bill Currie
9c2398d923 stop processing files after errors have occured 2001-06-28 23:08:52 +00:00
Bill Currie
6dfee9968b /much/ better error handling 2001-06-28 21:26:40 +00:00
Bill Currie
eef9e8e2dc be more accurate about the operator involved 2001-06-28 17:44:50 +00:00
Bill Currie
0271afbb10 warn about the dangers of (!foo & bar) 2001-06-28 15:20:31 +00:00
Bill Currie
01a9372add fix the corrupted locals problem (df->locals was getting set too early) 2001-06-28 02:58:45 +00:00
Bill Currie
daf5fc96ea reset temps after emitting a function. it helps :) (fixes the wierd entity
errors)
2001-06-27 23:36:03 +00:00
Bill Currie
59ff35558f create empty defs for vertex and quaternion compontents 2001-06-27 22:24:28 +00:00
Bill Currie
768c4a49d3 fix . type checking 2001-06-27 21:43:10 +00:00
Bill Currie
774a1fe6cd fix // comments at end of file (ie, no trailing \n) 2001-06-27 20:47:41 +00:00
Bill Currie
9c30c0c455 make simple assignments (a = b;) generate code 2001-06-27 20:32:27 +00:00
Bill Currie
1eef491c1c handle -ve constants 2001-06-27 19:40:43 +00:00
Bill Currie
1fd4590212 report file as well 2001-06-27 18:15:24 +00:00
Bill Currie
febb139a41 free temp defs at the end of each expr block. CustomTF has gone from 64 to 25
locals.
2001-06-27 17:11:21 +00:00
Bill Currie
9d2bf8df19 better function argument code generation 2001-06-27 16:43:56 +00:00
Bill Currie
504d03a21a expr.c:
fix a silly stanfu with goto
qc-parse.y:
	suffle the debug code
2001-06-27 05:45:20 +00:00
Bill Currie
673e6e66b7 turns out qcc wasn't so stupid about = vs ||/&& precedence after all (just
my interpretation of the code was:/) why oh why didn't John use bison or yacc
in the first place? :/
2001-06-27 00:10:34 +00:00
Bill Currie
ff42e81127 remove some debug info 2001-06-26 23:51:15 +00:00
Bill Currie
c629de9b3b function calls work now 2001-06-26 23:42:11 +00:00