Bill Currie
75ec6bf244
Clean out some unnecessary types from the progs engine and clean up the mess.
...
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
fa08e4afb7
Print users info when dumping statements.
2010-12-19 11:16:04 +09:00
Bill Currie
67beaf4487
Nil is a constant, so allow it in global initializers.
2010-11-24 17:01:18 +09:00
Bill Currie
22776f9ffd
get double indirection working
...
do not try to optimize the output of the sub-dereference in a dereference
2010-01-13 06:31:06 +00:00
Bill Currie
1dc4683961
ensure all instructions are fully initialized.
2009-12-20 11:09:58 +00:00
Bill Currie
9ac15436d9
More docs.
...
Enhance qfprogs qfo debugging.
Make sure functions marked as extern don't emit anything. Fixes the segfault
when building klik.
2008-08-01 13:54:24 +00:00
Bill Currie
9509d0fd5e
make qfo files typesize safe
2007-04-07 12:35:03 +00:00
Bill Currie
c560744270
"use" parent defs
2007-04-06 11:01:34 +00:00
Bill Currie
f7df6fea17
instead of having cpp args in progs.src, potentially breaking some mods, generate progs.i as a series of #includes and then compile everything in one pass
2006-05-24 14:35:39 +00:00
Bill Currie
3fb03fc2be
hah, should have been using __attribute__((used)) all that time (rather
...
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
3f58823fed
vector-calls now works with rcall :)
2005-06-12 11:37:28 +00:00
Bill Currie
762aefc9b1
implement Raven's calling convention (rcall: first 2 params in opb and
...
opc). should give a general speedup to most progs.
2005-06-12 09:54:01 +00:00
Bill Currie
66cabb587f
add the vector-calls "optimisation" from fteqcc. makes it possible to
...
compile the version of frogbot with waypoints for almost 300 maps.
2005-06-10 07:31:25 +00:00
Bill Currie
9f662787e0
get struct copy to/from struct fields via pointers. fixes a bug found by
...
snax
2005-06-09 10:34:03 +00:00
Bill Currie
0360859a0f
all warnings (except for @self and self) are now fully controllable
2004-02-17 00:39:21 +00:00
Bill Currie
c3f41e3e69
new opcode: state.f. same as state, but takes a 3rd float operand to
...
specify the step for calculating nextthink. accessed using
[frame, think, step] (state is [frame, think])
2004-02-11 01:43:33 +00:00
Bill Currie
39c7ff1e90
disable debug output
2004-01-25 08:59:55 +00:00
Bill Currie
51b0a66ac7
better constant folding with auto-conversion between scalar types (might
...
make that optional for non-constants)
2004-01-25 08:55:03 +00:00
Bill Currie
5f97de56d1
fix a few bugs
2003-10-22 09:14:53 +00:00
Bill Currie
945006494f
short circuit logic for && and || (as per C). forces standard precedence
...
(ie, breaks --traditional) when enabled (no choice at the moment, next fix)
2003-10-22 08:05:17 +00:00
Bill Currie
23b525059f
cast between integer and unsigned just by changing access method
...
effectively deprecating conv.ui and conv.iu (they'll die eventually:)
2003-09-02 16:45:36 +00:00
Bill Currie
3a6c8b8b16
wrong place to decrement uses. now have a problem in switch :/
2003-09-02 06:23:57 +00:00
Bill Currie
b01d4d4589
get the type for the destination from the right place (hope that wasn't
...
a bugfix for something else:)
2003-08-24 20:38:32 +00:00
Bill Currie
7cffeb27bf
correct the temp def counting when casting
2003-08-24 08:17:31 +00:00
Bill Currie
6086aa2b99
allow casts between pointers and integers
2003-08-24 08:03:25 +00:00
Bill Currie
b38486d405
make rel_def_op work properly
2003-08-22 19:48:14 +00:00
Bill Currie
e9ca03416a
create the temp def for bound defs properly
2003-08-22 18:16:30 +00:00
Bill Currie
11c7c27f70
better relocations: pointers to structure members now work
2003-08-21 02:21:30 +00:00
Bill Currie
448b6f24be
make the useless expression warning more interesting
2003-08-05 21:41:48 +00:00
Bill Currie
8099f0d8f2
handle addresses of void defs
2003-07-30 20:57:50 +00:00
Bill Currie
6ecb707257
revamp the struct system so "struct foo;" does the right thing (ala C)
2003-07-30 04:11:45 +00:00
Bill Currie
dedb2fa6bf
get [super ...] working correctly
2003-05-15 05:58:31 +00:00
Bill Currie
f59f766af1
use the correct type when taking the address of a pointer derefernece
2003-05-13 19:42:14 +00:00
Bill Currie
b6b5089ccc
add a "nosave" flag to defs making it easier to make defs that don't get
...
saved automaticly
2003-04-25 17:00:22 +00:00
Bill Currie
a21054fdfc
handle def aliases properly in emit_move_expr
2003-04-22 17:26:49 +00:00
Bill Currie
2f6fc5d80c
general revamp so params and the return value use proper defs rather than
...
hardcoded locations. this will allow use of quaternions in the future.
2003-04-22 15:29:32 +00:00
Bill Currie
eb099ae0d3
make qf gcc 3.3 clean
2003-04-17 00:01:48 +00:00
Bill Currie
627c6f70f5
allow casting between function types
2003-03-10 21:23:05 +00:00
Bill Currie
761a7546dd
re-arrange things so __attribute__ and __builtin_expect are properly
...
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
71196fedf6
make gcc more anal about prototypes, string constants and function
...
visibility (ie, global functions must have a prototype)
2003-01-06 18:28:13 +00:00
Bill Currie
567b905590
copyright block work
2002-10-22 14:53:18 +00:00
Bill Currie
262baccd0e
remove debug code :P
2002-10-20 03:31:08 +00:00
Bill Currie
7bb6dd7197
make chained structure assignments (mostly) work. found a bug in the
...
handling of pointer immediates which needs fixing before this will work in
general
2002-10-20 02:35:12 +00:00
Bill Currie
54564a4726
structure copies now seem to work
2002-10-16 17:07:01 +00:00
Bill Currie
0c0e4b23de
d'oh, temps are never global
2002-10-16 06:39:49 +00:00
Bill Currie
6af57049d5
make pointers work a bit better
2002-10-16 02:04:06 +00:00
Bill Currie
823822301f
support emitting bind sub-expressions
2002-10-09 19:16:55 +00:00
Bill Currie
308ff7163f
emit.c:
...
implement % for v6 code. hacky, but it works :) (Closes : #29 )
expr.c:
emit the body of a block expresion before emitting its result (needed
for v6 %)
2002-09-13 17:12:26 +00:00
Bill Currie
882d0f25ce
the code memory block can move around so take the address of a statement
...
after statments have been emitted, not before.
2002-08-30 05:33:34 +00:00
Bill Currie
c927b2e834
quakefs.c:
...
allow . and .. in a path so long as the result doesn't escape from the
game directory
cl_menu/Makefile.am:
don't strip source paths
optoins.qc:
use InputLine object
def.c:
use notice to show stray temps
emit.c:
make sure expression args get emitted for function calls
expr.c:
'C' is a cast
rewrite cast_expr to handle casted pointere derefs
2002-08-20 06:11:10 +00:00
Bill Currie
8d6c491390
fix branches (been broken for a while :/)
2002-07-17 18:45:17 +00:00
Bill Currie
34da93f251
get line numbers working on link and fix a bug in the creation of aux
...
functions
2002-07-17 14:19:30 +00:00
Bill Currie
b9b9f03e82
keep short defs out too
2002-07-12 16:01:40 +00:00
Bill Currie
2cb6138f2b
fix a silly segfault and make statement allocation saner
2002-07-08 20:31:59 +00:00
Bill Currie
c1894db59f
split the emit stuf out of expr.h into emit.h
2002-07-08 18:53:07 +00:00
Bill Currie
4c8e157db2
nuke pr.statement_linenums as it was redundant and the info never used anyway
2002-07-08 03:05:44 +00:00
Bill Currie
46bad45c7a
move s_file, pr_source_line and pr_error_count into pr, make the linker
...
errors more meaningful, and fix a blasted string.h issue (damn old gcc;P)
2002-07-03 21:32:03 +00:00
Bill Currie
fb0318621d
and for my next amazing feat, I'll remove the debug code :P
2002-06-13 07:22:53 +00:00
Bill Currie
5bbcbe0185
arrays seem to be working nicely now (menus work:)
2002-06-13 07:20:15 +00:00
Bill Currie
88fc0be127
arrays are /almost/ working again
2002-06-12 22:37:18 +00:00
Bill Currie
f7d8c2968f
better global (and other space) def re-use
2002-06-10 23:14:32 +00:00
Bill Currie
1f67ea412d
add a global flag to def_t to make checking easier
...
rename pr.globals to pr.near_data and add pr.far_data
2002-06-10 20:54:22 +00:00
Bill Currie
1e57351be1
there, no more PR_* functions or pr_* files :)
2002-06-09 04:30:02 +00:00
Bill Currie
943c2eefb3
redo def allocation to come from configurable `spaces' (locals, globals, far
...
globals, etc).
2002-06-09 03:57:20 +00:00
Bill Currie
dc0e31916f
fix a minor oopsie with the relocations
2002-06-07 17:39:57 +00:00
Bill Currie
00a54ad918
redo relocations
2002-06-07 17:29:30 +00:00
Bill Currie
38d3a15413
d'oh, forgot to compile test :P
2002-06-05 19:31:43 +00:00
Bill Currie
cb395c5469
misc def improvments
2002-06-05 19:03:51 +00:00
Bill Currie
e17604f9c2
remove all arbitrary limits except for globals. they'll need a little more
...
work. Once they're done, it should take quite a big mod to crash qfcc due
to too many strings/statements/etc :)
2002-06-05 17:12:55 +00:00
Bill Currie
69605d0b19
even more cleanup
2002-06-04 21:23:39 +00:00
Bill Currie
06bddd3ee6
more cleanup
2002-06-04 18:44:03 +00:00
Bill Currie
7b993f97d2
more cleanups
2002-06-01 05:30:16 +00:00
Bill Currie
8f2d1fa2d9
more cmdlib cleanup
2002-06-01 04:41:25 +00:00
Bill Currie
3967f5cf95
type.h:
...
*type_method to type_Method
emit.c:
support casting between pointers
expr.c:
support casting between pointers
method.c:
correct the type for _cmd
type_method to type_Method.aux_type
qc-lex.l:
Method type is a poniter to a method
qc-parse.y:
support , args to messages (not fully implemented yet)
type.c:
*type_method to type_Method and make type_Method a pointer to a method
2002-05-22 05:03:36 +00:00
Bill Currie
9b516ff84f
mild namespace cleanup
2002-05-11 03:37:36 +00:00
Bill Currie
55e54bd9f9
move the type and def externs to type.h
2002-05-09 17:11:14 +00:00
Bill Currie
05788e55e5
don't generate useless expression warnings when that expression was caused
...
by an error
2002-05-01 22:08:59 +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
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
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
d69762facd
integer() and float() casts seem to work
2002-01-17 19:32:04 +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
7e38a8d9a0
clean up the return def selection for emit_assign_expr
2001-12-12 20:55:55 +00:00
Bill Currie
8ddce20949
pr_*: add storep.p so pointers can be stored into entities
...
emit.c: convert & (address) to . in unary .
rewrite emit_assign_expr
expr.c: remove debug code and make unary . less agressive on address calcs
also convert & (address) to . for lvals
2001-12-12 20:35:58 +00:00
Bill Currie
b56d7f3248
emit.c:
...
fix a missing else (should convert to switch)
expr.c:
fix address_expr for binary expressions
fix unary .
2001-12-12 18:34:41 +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
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
3c2c4aa9e6
indent whitespace cleanup. not perfect, but a bit more consistent now
2001-12-06 19:49:40 +00:00
Bill Currie
61786182d2
whitespace
2001-12-06 18:14:44 +00:00
Bill Currie
e45bb62f23
ok, correct code seems to be getting generated for both array access and
...
entity field access
2001-11-15 04:32:50 +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
5f5060cbf0
move the users and used setting code from emit_statement to
...
PR_AddStatementRef. This removes essentially duplicate code and 3 ifs :)
2001-10-31 18:40:02 +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
952f029e6d
rename def_t.initialized to def_t.constant
2001-10-18 17:15:05 +00:00
Bill Currie
85834ab8c3
handle a couple of missed ex_nil cases
2001-10-17 18:36:19 +00:00