Commit Graph

228 Commits

Author SHA1 Message Date
Bill Currie f14d8060e0 Merge qfpc into qfcc.
Since gnu bison and flex are required anyway, no harm in using their api
prefix options. Now, qfcc can compile both QC/Ruamoko and Pascal files
(Pascal is (currently?) NOT supported in progs.src mode), selecting the
language based on the extension: .r, .qc and .c select QC/Ruamoko, .pas and
.p select Pascal, while anything else is treated as an object file (as
before).
2012-10-26 16:01:41 +09:00
Bill Currie 23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie e267e0a664 Allow control of progdefs.h CRC writing.
CRC writing defaults to off for non-v6 progs, but on for v6 progs. The
--progdefs option forces CRC writing.
2012-05-03 00:22:24 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie f1d9570dc8 Fix constant value type handling.
Rename immediate.[ch] to value.[ch] and clean up the mess.

Add convert_value() to convert the type of a value (only scalar types).
2011-03-22 12:24:39 +09:00
Bill Currie cbbbf87e20 Resurrect the stats output. 2011-03-09 15:51:17 +09:00
Bill Currie 8368f57fbf Close a potential buffer overflow. 2011-03-09 11:09:46 +09:00
Bill Currie 4d90eba2ad Remove some unused globals. 2011-03-09 11:08:30 +09:00
Bill Currie fe3d228658 Maintain a symbol table for entity fields. 2011-03-06 15:38:19 +09:00
Bill Currie 7bfaf107ce Set the output file name as early as possible. 2011-03-06 13:40:24 +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 af7bc81e16 Chain the types for the linker. 2011-03-05 08:35:56 +09:00
Bill Currie d6d8b5b49d Generate the debug symbol file. 2011-03-04 18:46:05 +09:00
Bill Currie 4a99f8dcbd Write the linker output to progs.dat.
There is much breakage, but qfcc now produces a progs.dat from either
progs.src or object files. Better yet, the progs.src result is passed
through the linker, removing much duplicate code.
2011-03-02 20:51:00 +09:00
Bill Currie ecb995a8f7 Rewrite qfo_to_progs() to go direct from qfo to progs.dat.
Relocs and debug info is currently broken.
2011-03-02 19:06:43 +09:00
Bill Currie c10a551c84 Rename new_defspace() and defspace_new_loc(). 2011-02-24 13:07:36 +09:00
Bill Currie c585a17db9 Give type data a null pointer.
Pointers to the void type descriptor looked just like null pointers and
that was terribly confusing. Avoid that confusion by pre-allocating a
small amount of data in order to reserve space for a null descriptor.
2011-02-23 08:08:26 +09:00
Bill Currie 64cf07351f Encode types to string and qfo representation on creation. 2011-02-22 13:36:16 +09:00
Bill Currie 3505de6868 Point the near and far data spaced into the merged data space.
This lets the relocations work on the final data without having to adjust
their locations.
2011-02-12 22:35:44 +09:00
Bill Currie d66a441867 Write out the far data space as well as the near.
This causes the Objective-QC structs to be emitted now that they havve been
moved to the far data space. Relocs are broken, though.
2011-02-09 21:45:29 +09:00
Bill Currie 244d969ae3 Ensure any tail bytes in the strings data are zeroed. 2011-02-09 18:32:37 +09:00
Bill Currie 5eff00fdeb Fix debug information. 2011-02-09 08:47:01 +09:00
Bill Currie 4837e0bd18 Fix most of the FIXMEs in qfcc.c.
Functions and defs seem to be relocated correctly. Constants are very
broken, however.
2011-01-28 15:17:30 +09:00
Bill Currie c158b14286 Remove the labels list from the pr struct.
I'm not sure they were ever needed.
2011-01-28 11:40:25 +09:00
Bill Currie bd78b8a7ee Enable more end-of-compilation code. 2011-01-27 15:44:12 +09:00
Bill Currie cdea1d07aa Produce code for progs.src mode.
Separate compilation will take fixing object files.

The generated code is broken due to various relocation fixups being
broken, and float immediates seem to be badly broken.

Debug information is broken too.
2011-01-27 15:44:11 +09:00
Bill Currie 5231e8e9f8 Handle .zero, .return and .param* properly. 2011-01-26 08:01:24 +09:00
Bill Currie a648f043de Give functions their own defspace.
The defspace is propogated through the function's sub-scopes.
2011-01-25 12:34:45 +09:00
Bill Currie d618e51dc8 Move save_string and make_string into strpool
Might not be the perfect place, but at least they're strongly related.
2011-01-24 21:32:48 +09:00
Bill Currie afc5b2827d Simplify def handling, use far data.
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.

Also, start using far data for ObjQC structures.

The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie 4ac80c2932 Get qfcc running again.
It segs when it tries to link, but that's because a real object file has
not been created yet. However, I can get my tree and flow diagrams :)
2011-01-22 15:52:57 +09:00
Bill Currie 5deda9c9b9 Clean out ex_def as ex_symbol replaces it. 2011-01-19 22:25:04 +09:00
Bill Currie b5424bca7d Start work on getting expressions converted to internal statements. 2011-01-19 15:47:45 +09:00
Bill Currie e08efe036b Move the constant expression values into their own struct. 2011-01-19 08:43:24 +09:00
Bill Currie 87ce9f5333 Get basic function creation working.
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +09:00
Bill Currie 21c0c960ae Initialize data before types.
This is needed for string data. It might be better to init saved strings
separately, but this works for now.
2011-01-18 08:58:43 +09:00
Bill Currie ea3895805b Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.

emit.c has been gutted in the spirit of "throw one away".

There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
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 a09f02db1a Break out the debug and string functions from qc-lex.l. 2011-01-10 12:25:30 +09:00
Bill Currie ac88c86dd3 Scripts now treat {}()': as single character tokens. 2010-11-28 15:31:30 +09:00
Bill Currie c542138300 more not-really initialized data 2009-12-20 11:54:19 +00:00
Bill Currie ac99aaf0d3 use "#line N file" instead of "# N file" (seems to be more portable) 2007-09-16 07:03:12 +00:00
Bill Currie 3431fea56d Make sure initialized locals that are treated as constants don't get relocated. Fixes the airfist bug in prozac 2007-09-15 07:58:39 +00:00
Bill Currie 01b71c40d2 fix some issues when using --advanced with v6only 2007-09-15 07:44:31 +00:00
Bill Currie 79fdf8db80 allow .imm symbols to be written in traditional mode 2007-05-15 07:25:47 +00:00
Bill Currie a376e6f86d make control of progdefs.h generation saner 2007-04-28 05:40:22 +00:00
Bill Currie 93ee2e489b more vc2005 patches from phrosty 2007-04-11 22:03:36 +00:00
Bill Currie 992aa04994 Forgot to coorect the adjustment of the def's offset (yet I knew I was supposed to :P) 2007-04-10 14:03:34 +00:00
Bill Currie 52d178b3be Add a code generation option, "local-merging", to control qfcc's merging of local variable blocks into one block. Defaults to on for advanced mode and off for traditional. 2007-04-10 13:00:21 +00:00
Bill Currie 2399e79ca0 open all files in binary mode. ^Z is evil :P 2007-04-07 10:24:34 +00:00