Commit graph

1459 commits

Author SHA1 Message Date
Bill Currie
4db8ebb6af Support qcc style local function variables. 2011-03-07 20:04:05 +09:00
Bill Currie
853cc53d0f FIx the handling of storage class. 2011-03-07 17:49:01 +09:00
Bill Currie
7649549de6 Handle external field declarations. 2011-03-07 17:23:52 +09:00
Bill Currie
49e446b637 Make field defs global.
It turns out that field defs need to be global after all, so use separate
field def tables in the linker.
2011-03-07 14:45:50 +09:00
Bill Currie
041c5d53b8 Check for the vector being a constant before trying to get its value. 2011-03-07 14:04:36 +09:00
Bill Currie
c069bafad8 Support casting from enum to float. 2011-03-07 14:04:05 +09:00
Bill Currie
5a78758781 Support return in void functions in v6 code. 2011-03-07 13:52:28 +09:00
Bill Currie
1246fd9e30 Use the correct size when growing a data space. 2011-03-07 13:36:00 +09:00
Bill Currie
02a70ebe1c Remove the auxfunction manipulation from the compiler proper.
It was broken code in the first place (realloc and pointers), and is
redundant with the new linking process.
2011-03-07 13:33:02 +09:00
Bill Currie
16103f9018 Fix param mangling for qc style functions. 2011-03-07 10:43:38 +09:00
Bill Currie
29cac0fe3a Optionally create *_[xyz] symbols for accessing vector components.
"vector-components" in code options controls this feature. The default is
off for advanced code and on for traditional code. Disabling
vector-components prevents the comonent names polluting the namespace and
reduces the number of globals needed for vector fields if the components
of that field are never used.
2011-03-07 10:21:40 +09:00
Bill Currie
0b3d0011c5 Implement vector and quaternion component access. 2011-03-07 10:02:20 +09:00
Bill Currie
f0e47f2334 Clean up some code duplication. 2011-03-07 10:01:21 +09:00
Bill Currie
a6f222106e Fix taking the address of normal variables.
Treat them the same as structure variables.
2011-03-07 09:58:51 +09:00
Bill Currie
3c1784d46c Fold constants on both sides of = to ensure correct expression types. 2011-03-07 08:33:30 +09:00
Bill Currie
66447df6b3 Undo the offset relocation of local defs.
The debug info expects local defs to be 0 based, so once relocations in
the progs data have been completed, undo the local def offset relocation
so that the correct offsets will be written to the debug info.
2011-03-06 21:05:25 +09:00
Bill Currie
b2f0c9a127 Dump the local defs for functions when debug info is available. 2011-03-06 21:03:12 +09:00
Bill Currie
b49d90e769 Do not lose the block expression when taking its address. 2011-03-06 16:32:51 +09:00
Bill Currie
c78d15b331 Support taking the address of block expressions that have a result. 2011-03-06 16:05:38 +09:00
Bill Currie
993d05b3d3 Support taking the address of alias expressions.
Taking the address of an alias expression undoes the alias but uses the
aliased type.
2011-03-06 15:58:49 +09:00
Bill Currie
b74c644a10 Perform offset field relocations. 2011-03-06 15:41:38 +09:00
Bill Currie
8712d30d1a Make entity field defs static.
Entity field defs need to be static in order to avoid clashing with their
field variables.
2011-03-06 15:41:15 +09:00
Bill Currie
c4e9a45d91 Do not lose the entity field defs. 2011-03-06 15:40:07 +09:00
Bill Currie
b7aa2f6786 Support access to struct fields in a structure in an entity. 2011-03-06 15:39:27 +09:00
Bill Currie
fe3d228658 Maintain a symbol table for entity fields. 2011-03-06 15:38:19 +09:00
Bill Currie
c29e0250e4 Make def_field_Ofs reloc dumps more informative. 2011-03-06 15:34:53 +09:00
Bill Currie
02766f0795 Do not try to dump def values from spaces with no data. 2011-03-06 15:33:53 +09:00
Bill Currie
1eb759bb8a Update reloc_names.
I really need to get reloc_names unduplicated.
2011-03-06 15:33:10 +09:00
Bill Currie
d1187f0857 Set the edict area size when dumping qfo files. 2011-03-06 13:41:00 +09:00
Bill Currie
7bfaf107ce Set the output file name as early as possible. 2011-03-06 13:40:24 +09:00
Bill Currie
417d1b4442 Fix structure copy into and out of entities. 2011-03-06 13:19:20 +09:00
Bill Currie
dc7a78b2ff Fix case label type conversions.
The previous method made too many assumptions.
2011-03-06 11:41:01 +09:00
Bill Currie
fe4df03896 Add is_float ().
For now, it checks just floats, but I might one day add doubles.
2011-03-06 11:35:15 +09:00
Bill Currie
85bffbcad0 Add is_integral() to check for integral types (integer, short, enum). 2011-03-06 11:25:12 +09:00
Bill Currie
17a9dff769 Avoid freeing an operand twice.
Due to the way operands are used, they can be freed twice in dead-statement
removal. Detect the double-free and ignore it.
2011-03-06 11:19:09 +09:00
Bill Currie
28f4de94d2 Fix switch statements so the work in the new scheme.
Convert case labels to be the same type as the switch expression.
Use alias expressions for the various test expressions.
2011-03-06 00:29:29 +09:00
Bill Currie
8cfa80b5d4 Implement think expressions. 2011-03-05 18:01:37 +09:00
Bill Currie
7209c61912 Fix initializing local float variables with an integer constant.
Run the assignment expression through fold_constants to handle any
necessary conversions and error checking.
2011-03-05 17:23:58 +09:00
Bill Currie
a3c1f339fc Gracefully handle undefined symbols in entity field expressions. 2011-03-05 17:22:04 +09:00
Bill Currie
7314b944d5 Bring back the offset alias support.
Accidently nuked it when fixing .return etc.
2011-03-05 16:31:32 +09:00
Bill Currie
e7e8220246 Dump code addresses as hex, too. 2011-03-05 16:25:56 +09:00
Bill Currie
2f74e6e4bf Nuke the old progs global.
It is no longer needed thanks to the new qfo conversion functions.
2011-03-05 16:24:53 +09:00
Bill Currie
fcb567fc98 Use the correct function number when updating the function def.
Functions are 1 based in progs bug 0 based in qfo files.
2011-03-05 16:00:39 +09:00
Bill Currie
535dfad305 Emit defs for far data.
They will break when the offsets exceed 64k, but they are needed for
debugging.
2011-03-05 15:59:14 +09:00
Bill Currie
97b1ceceb0 Fix line number info.
line number info is now 1 based rather than 0 based (to better detect when
a function does not have line number info).
2011-03-05 15:40:08 +09:00
Bill Currie
1dea86a3e4 Update debug info loading when dumping qfo files. 2011-03-05 14:53:41 +09:00
Bill Currie
cfefd79e07 Fix the source of bogus string relocs.
Nested aggregate initializers were corrupting themselves.
2011-03-05 09:21:12 +09:00
Bill Currie
7c95913c61 Avoid segfaulting with bad string relocs. 2011-03-05 09:07:16 +09:00
Bill Currie
8eb5fd653a Perform the relocations!!!
line numbers seem to be broken, but the code itself looks good.
2011-03-05 08:41:14 +09:00
Bill Currie
fe7be543f8 Correctly update the offset of code relocs. 2011-03-05 08:39:47 +09:00