Commit graph

263 commits

Author SHA1 Message Date
Adam Olsen
caeb31e6ca start of the support for chained function calls. Actually, they
should work fine now, there's just some extra temp vars we want to
remove before we can consider it "done" :)
2001-08-10 20:35:42 +00:00
Bill Currie
b44fd6ab91 move a var 2001-08-10 18:42:13 +00:00
Bill Currie
4388bf0519 good bye, old parser 2001-08-10 18:35:55 +00:00
Bill Currie
9e46265046 fix a silly error causing integer constants to not be re-used 2001-08-10 17:41:08 +00:00
Bill Currie
a33c834a39 move SHL and SHR down in expr 2001-08-10 17:00:53 +00:00
Adam Olsen
6414897dae got a few new operators for qc :)
<< >> % which all act like their C counterparts
+= -= *= /= &= ^= |= <<= >>= %= which just expand into the obvious,
also like the C versions.
2001-08-10 16:17:00 +00:00
Bill Currie
27ccfa67c5 fix the efficiency of unary expressions as args to a function 2001-08-09 17:05:30 +00:00
Bill Currie
2774260898 test ^ 2001-08-09 16:39:08 +00:00
Bill Currie
081d8f3c47 ^ and ~ operators for qc (^ from Rhamphoryncus) and clean up the punctuation
line in qc-lex.l (why didn't I think to do that in the first place?!?)
2001-08-09 16:34:46 +00:00
Bill Currie
b341529fce more --id support 2001-08-07 16:50:22 +00:00
Adam Olsen
c218ede288 Add support for checkfunction, which is a builtin that searches for
another builtin by name, and returns it.

Soon I'll change all our new builtins to by allocated dynamically, as
well as changing the number checkfunction uses, and happily break
everything that uses them :D
2001-08-04 09:11:50 +00:00
Bill Currie
1e1cb06a1f disable integers for --id. probably not thorough enough yet :/ 2001-08-03 07:47:15 +00:00
Adam Olsen
ae133d0a90 Modify progs to add builtins at runtime. It should be trivial to
lookup functions by name, and make all our new QC builtins allocate
numbers automatically.
2001-08-03 06:40:28 +00:00
Bill Currie
d89cd91e4b make the expressions in for (a;b;c) optional 2001-08-01 06:29:09 +00:00
Bill Currie
f9d4351515 more jobs 2001-08-01 00:19:05 +00:00
Bill Currie
bfb8eff2f0 signed_const isn't needed any more 2001-07-27 21:01:01 +00:00
Bill Currie
89da47335b tests, tests, tests 2001-07-27 20:56:16 +00:00
Bill Currie
ecc71c4a60 local var = expr; now works (globals must still be consants) 2001-07-27 20:55:14 +00:00
Bill Currie
28b1598e7e break the emit_* functions out of expr.c into emit.c 2001-07-26 05:15:34 +00:00
Bill Currie
7718ca4c96 various little cleanups 2001-07-26 05:08:27 +00:00
Bill Currie
95ad5aa329 integer type done 2001-07-26 04:34:10 +00:00
Bill Currie
c553917c53 various tests 2001-07-25 21:48:20 +00:00
Bill Currie
d44f60f17c drasticly simplify emit_assign_expr now that I have a much better
understanding of when an explicit assigment is needed. seems to work for
everything I throw at it.
Also, fix ! unary ops (caused by the - unary op fix:/)
2001-07-25 21:47:05 +00:00
Bill Currie
0c2cd8633c fix -expr handling. generates sucky code atm, but at least it's generating
code now:P
2001-07-25 18:36:36 +00:00
Bill Currie
638cd005b0 return type testing 2001-07-25 02:28:04 +00:00
Bill Currie
620063628c typecheck values for [frame, think] on thost functions and fix some misplaced
immediate defs
2001-07-24 23:53:35 +00:00
Bill Currie
9ad075b02e make if/while/for use test_expr, make test_expr fix the new exp line/file,
fix some string const issues
2001-07-24 22:30:31 +00:00
Bill Currie
07fbe47294 tests for if (simple expression) 2001-07-24 22:29:16 +00:00
Bill Currie
576123060a warn on passing integer constants into ... functions. Again, this will need
an option later
2001-07-24 20:43:18 +00:00
Bill Currie
d9cde786b3 use ev_type_count instead of ev_void for bad types so things like void
functions being used in expressions don't cause ICEs
2001-07-24 19:51:44 +00:00
Bill Currie
6d1671950a expr.c:
warn for int const / int const. this will probably want an option for newer
	games
qfcc.c:
	clean up temp files when errors have occured
2001-07-24 04:45:53 +00:00
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
1fca85ee0a kill some unneeded tests 2001-07-20 23:18:03 +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
edcc313501 debug info for local variables is now used. only works when tracing atm:/ 2001-07-19 07:27:14 +00:00
Bill Currie
00d409e80c fix constant folding for | 2001-07-19 03:00:35 +00:00
Bill Currie
09ae07f64e make --enable-cpp work when new-parser is left to default (which is on) 2001-07-19 03:00:08 +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
3eedd3d8fc more tests 2001-07-18 19:04:47 +00:00
Bill Currie
144eba8b3c it seems that the qcc variants that strip global defs only strip the name, so
don't bother fixing missing defs (but /do/ complain if any are missing). I
suspect full def striping would have seriously broken things.
2001-07-18 18:03:53 +00:00
Bill Currie
152114f1cd works now, though I don't imagine save games will work too well :) 2001-07-18 17:59:16 +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