Commit Graph

69 Commits

Author SHA1 Message Date
Bill Currie 779174cb33 get object pointer assignmets working and some static typing as well 2002-05-16 20:20:23 +00:00
Bill Currie 73f4cb4c03 it seems object info emition works (needs more testing) 2002-05-15 23:24:19 +00:00
Bill Currie 55e54bd9f9 move the type and def externs to type.h 2002-05-09 17:11:14 +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 7f47447492 getting closer to emiting ObjQC code 2002-05-08 21:24:24 +00:00
Bill Currie b226d24b52 rework the param parsing to make selectors easier to handle 2002-05-08 05:15:19 +00:00
Bill Currie 962dc8e46e rewrite the type and def parsing to allow more flexible types 2002-05-01 21:35:39 +00:00
Bill Currie 03ab75704f -p N or --strip-path N will strip up to N leading path elements for a
source file's path.
2002-04-10 19:52:48 +00:00
Bill Currie d1fcfd1939 Implement --traditional so qfcc can be a nicer qcc. This disables several
keywords (quaternion integer function for break continue switch case default
NIL struct enum typedef) and converts some errors to warnings (assignment to
constants, insufficient function arguments, return; from non-void function,
anal function `pointer' type checks)
2002-02-18 06:23:59 +00:00
Bill Currie cb0db8b8d1 disable debug putout and allow the cpp command line to be specified. 2002-02-05 19:35:45 +00:00
Bill Currie f1f2dd713d generate progdefs.h only for v6only
generate files.dat only if -F or --files is given on the command line
2002-01-21 23:30:54 +00:00
Jeff Teunissen 9f6dcec9dd --save-temps support for qfcc. It'll leave files with the same filenames
they're generated from, with the exception that they will have an
extension of .p. Obviously, depends on cpp support.
2002-01-05 19:13:20 +00:00
Bill Currie 718a64343b more old-code cleanup. move PR_LexString into make_string 2002-01-04 18:27:01 +00:00
Bill Currie 112f74a357 make integer constant division warnings optional 2001-12-12 22:00:42 +00:00
Bill Currie 6d65fe853d spontaneous temp defs need to have their users incremented when an
assignment is part of a sub expression
2001-12-12 21:29:04 +00:00
Bill Currie e976211faf header block fixes 2001-12-08 20:40:50 +00:00
Bill Currie a184199146 get arrays of structures working 2001-12-08 17:36:58 +00:00
Bill Currie b03a1bee42 ok, structures seem to generate correct code now 2001-12-08 08:19:48 +00:00
Bill Currie 1767ad435f use the new immediate indeces to make small array indeces not use a global 2001-12-07 20:10:30 +00:00
Bill Currie 40d47e91cb win32 portability fixes 2001-11-15 03:54:35 +00:00
Bill Currie ad5deea582 missed this in the cleanup 2001-11-13 23:14:59 +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
Bill Currie 3f45a8305c *taniwha inflicts more carnage on extern 2001-10-28 04:29:30 +00:00
Bill Currie 5eba9f155e clean up some duplicate symbols 2001-10-26 17:49:23 +00:00
Bill Currie d8e6bf9cb6 fix the verbosity levels to what they were
--no-cpp is now cpp or no-cpp in code
add cpp to code_options_t
2001-10-26 16:04:38 +00:00
Jeff Teunissen 581411e9e2 qfcc: Preparation for getopt. 2001-10-26 06:43:56 +00:00
Bill Currie f8a41cb1bc completely nuke the concept of "priority" from opcodes and use get_op_string
in emit_sub_expr instead of a redundant switch.
2001-10-25 17:48:35 +00:00
Bill Currie 09405469f6 throw PR_BeginCompilation's arguments out the nearest airlock 2001-10-24 22:53:27 +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 96e4e1a232 the beginning of unititialized var detection. first victim: functions.
--undefined-function-warning is now --no-undefined-function-warning and
the default is to detect called but undefined functions.
2001-10-18 17:41:22 +00:00
Bill Currie 952f029e6d rename def_t.initialized to def_t.constant 2001-10-18 17:15:05 +00:00
Bill Currie 7aec6e253a unused local variable detection 2001-09-22 23:41:47 +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
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 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 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 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 64e50e1ebd Basic debug info generation, just line numbers and local defs for each
function.
2001-07-14 01:15:40 +00:00
Bill Currie eae97539c2 beginnings of debug info for progs 2001-07-13 06:08:50 +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 05db0ed9d0 more format attributes 2001-07-03 20:56:01 +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 c1753046a9 start on actually generating code. doesn't work yet (getting a weird type
redeclaration error and not all expressions are handled yet).
2001-06-26 07:21:20 +00:00
Bill Currie 53b66ef2e0 better label handling and strings are now completely parsed (including escapes) 2001-06-25 22:11:20 +00:00