Commit graph

49 commits

Author SHA1 Message Date
Bill Currie
c4d0c574ee clean up qfcc.h a bit 2002-06-01 05:06:19 +00:00
Bill Currie
8f2d1fa2d9 more cmdlib cleanup 2002-06-01 04:41:25 +00:00
Bill Currie
ccf2a0b34a allocate defs using the correct size from the type 2002-05-31 05:04:16 +00:00
Bill Currie
34ec521198 vararg functions can now be imlemented in qc using @argc (number of params
passed through ...) and @argv (array of vectors, one for each ... param)
2002-05-22 20:43:29 +00:00
Bill Currie
ef9f9cda2f pr_obj.h:
define the class info stuff
expr.h pr_def.c:
	fix a FIXME
class.c expr.c type.c:
	make id ev_pointer.ev_object rather than ev_pointer.ev_class
2002-05-17 17:37:44 +00:00
Bill Currie
73f4cb4c03 it seems object info emition works (needs more testing) 2002-05-15 23:24:19 +00:00
Bill Currie
6a5bbf6f0a memory allocation checking cleanup 2002-05-14 06:37:28 +00:00
Bill Currie
44dcf74627 strip the \n from all(?) of the Sys_Error calls (Sys_Error itself will be
adding \n).
2002-05-14 06:12:29 +00:00
Bill Currie
961d84e569 clean up of qfcc.h and shuffle around the predefined types 2002-05-09 06:34:48 +00:00
Bill Currie
655fe17e18 fix handling of pointers in function params and local vars for qc functions 2002-03-18 07:30:21 +00:00
Bill Currie
80723fdec7 o don't ice when ex_name or ex_nil expressions show up in emit_expr.
instead, treat as useless epxression.
 o  mark rvalue expressions as such
 o  increment the users of a managed temp def when in an rvalue expr
2002-02-21 20:34:04 +00:00
Bill Currie
ad6d847728 fix qfcc's incorrect allocation/initialization for pointers (eg, float [] foo) 2002-01-30 22:57:48 +00:00
Bill Currie
64c5983742 enum support 2002-01-21 19:03:29 +00:00
Bill Currie
cef918df83 get array initialisation worrking 2002-01-18 08:26:37 +00:00
Bill Currie
f9149a0d6c finally get around to renaming type_name to pr_type_name 2001-12-12 17:15:09 +00:00
Bill Currie
cc34e5954f lots of work on better array/pointer/struct handline. doesn't quite work yet 2001-12-12 08:39:47 +00:00
Bill Currie
b03a1bee42 ok, structures seem to generate correct code now 2001-12-08 08:19:48 +00:00
Bill Currie
3c2c4aa9e6 indent whitespace cleanup. not perfect, but a bit more consistent now 2001-12-06 19:49:40 +00:00
Bill Currie
3f7c4f146e allocate space for field arrays and report entity size 2001-11-15 05:31:15 +00:00
Bill Currie
40d47e91cb win32 portability fixes 2001-11-15 03:54:35 +00:00
Bill Currie
7d9266a3f0 beginnings of array support. no array initialization yet and foo[i] = bar is
broken.
2001-11-15 00:46:36 +00:00
Bill Currie
da36feff7f oops, failed to notice that relocs on temp defs weren't being done correctly
memset wasn't such a good idea :P
2001-11-13 23:21:23 +00:00
Bill Currie
cfa47717c6 expr.c:
once again, temp def ref counts seem to be correct
pr_def.c:
	reset recycled temp defs
2001-11-13 23:17:32 +00:00
Bill Currie
4291f9c711 create new_bind_expr and more tweeks to temp def ref counting 2001-11-13 18:49:27 +00:00
Bill Currie
f2f8e096f3 qfcc.h:
o	add a "freed" marker to def_t to prevent double freeing of
		temp def offsets
emit.c:
	o	break out the bind code into emit_bind_expr (doesn't /really/
		emit code, but still:)
	o	make bind work with disparate types (forces def_t->freed 1)
pr_def.c:
	o	mark array pointers as initialized and constant.
	o	don't free the offset for already freed temp defs
pr_imm.c
	o	fix a bug in uinteger support
	o	support disparate types for immediates
switch:
	o	fix a bug where gt.i was being used instead of gt.ui
	o	remove some debug code
2001-11-13 18:11:19 +00:00
Bill Currie
07b59d2f07 pr_comp.h:
o	add OP_JUMPB
	o	OP_JUMPB renumberd some opcodes, so up PROG_VERSION
pr_edict.c:
	o	make the version error reporting more informative
pr_exec.c:
	o	implement OP_JUMPB (goto *(ptr + index))
pr_opcode.c: (libs/gamecode/engine)
	o	add OP_JUMPB to the table
expr.h:
	o	ex_uinteger support
	o	some const correctness
	o	prototype new_label_expr
qfcc.h:
	o	uinteger ussport
	o	add pointers for op_jump and op_jumpb
	o	prototype PR_GetArray
emit.c:
	o	general uinteger support
	o	new reference/reloc type 3: absolute statement address
	o	jumpb support (binary goto)
expr.c:
	o	uinteger support
	o	break the label name creation out of new_label_expr into
		new_label_name
	o	some const correctness
pr_def.c:
	o	add PR_GetArray to allocate an array in global space
	o	factor out some code common to PR_GetDef and PR_GetArray that would
		otherwise be duplicated
pr_imm.c:
	o	some const correctness
	o	uinteger support
pr_lex.c:
	o	uinteger support
pr_opcode.c: (tools/qfcc/source)
	o	support jump and jumpb
switch.c:
	o	rewrite the binary search code to support ranges.
2001-11-13 08:58:54 +00:00
Bill Currie
d27cd9cc21 s/type_size/pr_type_size/
remove the redundant type_size from qfcc
2001-11-12 23:56:46 +00:00
Bill Currie
928d343295 pr_comp.h:
o	add ev_uniteger to the types enum
	o	add opcodes for ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
progs.h:
	o	add uinteger accessors
pr_exec.c:
	o	implement ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
pr_opcode.c:
	o	add opcodes for ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
expr.h:
	o	prototype inc_users
qfcc.h:
	o	add externs for op_ifbe, op_ifb, op_ifae and op_ifa
emit.c:
	o	don't bother emiting an assignment to a temp def that's only used once
		(ie, it's never read, only written to)
	o	support the new if* instructions
expr.c:
	o	support the new if* insructions
	o	dectect expression loops in append_expr
	o	support unsigned integers
	o	re-work temp def usage counting
pr_def.c
	o	debugging for temp def usage counts
pr_opcode.c:
	o	support the new if* instructions
qc-parse.y:
	o	provide defines for IFBE IFB IFAE IFA
switch.c:
	o	do binary searches for strings, floats and ints if there are more than
		8 cases in a switch. Strings need more testing.
2001-11-09 00:58:16 +00:00
Adam Olsen
3bba5398ba - audit malloc usage. now everything checks the return value :) 2001-10-24 22:50:06 +00:00
Bill Currie
6553c81a41 proper scoping for QC ala C. 2001-10-24 06:39:49 +00:00
Bill Currie
5ca785e7e8 uninitialized variable detection. not perfect (lots of false negatives, but
fewer than before;) but prozac isn't giving any false positives.
2001-10-18 20:05:26 +00:00
Bill Currie
7407e4f1b7 and some more 2001-09-28 07:09:38 +00:00
Bill Currie
c74fc1c0df make the unused var warning like gcc's 2001-09-24 17:51:15 +00:00
Bill Currie
7aec6e253a unused local variable detection 2001-09-22 23:41:47 +00:00
Bill Currie
9f715ae9f8 more small old-parser cleanups 2001-09-15 20:31:17 +00:00
Bill Currie
4c48851096 fix a buffer overflow in new_label_expr
use reference counting for temp defs and call PR_FreeTempDefs at the end
of emit_sub_expr as well as emit_expr.
fix a (relatively harmless) bug in type processesing of foo.bar =
2001-08-22 21:55:01 +00:00
Bill Currie
4388bf0519 good bye, old parser 2001-08-10 18:35:55 +00:00
Bill Currie
56aafce20c qfcc.h:
rearrange def_t a little and add def_next (leaving next free for other
	uses)
pr_def.c:
	use def_next instead of next to link /all/ of the named defs
qfcc.c:
	ditto
2001-06-20 03:05:50 +00:00
Bill Currie
2647e63810 finally fix the tupe corruption. 2001-06-19 16:01:38 +00:00
Bill Currie
7ef4c2776e Immidiate sharing now /works/ (shaved off two pr_globals from CustomTF, too:).
Detect assignments to initialized globals and give an error, unless the --cow
(copy on write) option is given, and then allocate a new global for the var,
clear its initialized flag.
Relocate all globals.
2001-06-08 06:32:15 +00:00
Bill Currie
bbb37d0080 customTF is now down to 4989 pr_globals. all parameters, local veriables and
termporary variables sit in one pool of memory (at the end of the globals)
thus drasticly reducing globals requirements. This works because the whole
lot is declared to be in the function's local variable space which is copied
to the locals stack in the progs engine.
2001-06-05 08:09:12 +00:00
Bill Currie
a26f799de4 allocate temps based on size rather than type (get better re-usage this way)
put temps onto the local scope.
2001-06-05 05:22:11 +00:00
Bill Currie
17e19f3892 regain about 5000 globals for customTF, but this fixes possible breakage with
premature temp var re-usage (ie, it puts the temps back into the locals space).
2001-06-04 22:35:54 +00:00
Bill Currie
e090f3c9e3 do proper temp def handling so we don'e use any where near as many defs for
temporary variables (customTF went from 35941 to 12587 pr_globals).
2001-06-04 17:52:50 +00:00
Bill Currie
53e9fb65d1 prepare PR_Statement for proper temporary usage 2001-06-04 05:45:51 +00:00
Bill Currie
e339e82c01 hash.h is now const correct as is a lot of qfcc 2001-06-04 04:52:14 +00:00
Bill Currie
02b09f4e5c no more redundant strings. costs ~7ms, though, but HALVING the strofs size
in frikbot seems worth it.
2001-04-01 06:40:51 +00:00
Bill Currie
59e55834ed Another massive speadup caused by using hash tables to lookup already
generated immediate values. frikbot now compiles in just over 1s on my
machine.
2001-04-01 06:01:02 +00:00
Bill Currie
ec16ffaa65 move to using hash tables for variable lookups.
WARNING: this fixes a scope bug in qcc and thus you WILL get different (but
now correct) code for the following:

float foo;

void () bar =
{
	local float foo;
	foo = 0;
}

ie, the local foo will, as is correct, now be a separate var to the global
foo.
2001-04-01 02:12:57 +00:00