Commit graph

1104 commits

Author SHA1 Message Date
Bill Currie
c69ac1f56f Don't segfault when build_builtin_function detects an error. 2011-01-10 12:25:31 +09:00
Bill Currie
806d9110a2 Support both (* *) and // style comments. 2011-01-10 12:25:31 +09:00
Bill Currie
a17e73c863 Generate code.
It's now time to work on the revamp of the symbols, trees, etc.
2011-01-10 12:25:31 +09:00
Bill Currie
e34f7caeb0 Use op instead of integer_val for ADDOP etc. 2011-01-10 12:25:31 +09:00
Bill Currie
edaa6235e7 Get functions/procedures emitted.
No actual code is emitted, though.
2011-01-10 12:25:31 +09:00
Bill Currie
74016573b4 Need frame grabbing after all. 2011-01-10 12:25:31 +09:00
Bill Currie
129a36064f Fix a typo that broke procedure declarations. 2011-01-10 12:25:31 +09:00
Bill Currie
7971b0868e Break out the begin_function code into its own function. 2011-01-10 12:25:31 +09:00
Bill Currie
c5d0acf0fa Allow arrays to have ranges (not fully implmented) 2011-01-10 12:25:31 +09:00
Bill Currie
25c36a51a8 -f and -F were reversed in the usage. 2011-01-10 12:25:31 +09:00
Bill Currie
fed82466cc The first stages of Quake-Pascal.
At present, this parses a subset of the pascal language with a few type
extensions. There is already work on the type system.
2011-01-10 12:25:31 +09:00
Bill Currie
66ac56063f Break out the frame macro code from qc-lex.l 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
782a4c9a8d New symbol table code. 2011-01-10 12:25:30 +09:00
Bill Currie
fbdbcfada4 Remove deprecated @argc and @argv 2011-01-05 13:10:57 +09:00
Bill Currie
02f78e46f8 More expression docs. 2011-01-03 16:25:59 +09:00
Bill Currie
5627e43465 Use the method's selector rather than its def name in error messages. 2011-01-03 16:25:29 +09:00
Bill Currie
a1f36a9944 Make new_function take a def rather than a name.
Moves into new_function some code that should have been there in the first
place.
2011-01-03 16:25:29 +09:00
Bill Currie
4c69a97ac7 Allow normal declarations within a class implementation.
I had always been under the assumption that such was illegal in
Objective-C, but after working on Forge, I now know otherwise.
2011-01-03 16:25:29 +09:00
Bill Currie
dc5bafb8fb Minimal error recovery.
No more bailing on the first syntax error. While the recovery is not
perfect (things can get right twisted), qfcc will now continue parsing
after a syntax error.
2011-01-03 16:25:29 +09:00
Bill Currie
a4635d79e8 Slightly more informative error locations.
Inside a class or protocol definition is not "at top level" ;)
2011-01-03 16:25:29 +09:00
Bill Currie
530e8fae34 Rework class_type_t to be more useful.
This allows current_class to refer to procols as well (for error
reporting).
2011-01-03 16:25:29 +09:00
Bill Currie
f738ef5dba Remove redundant RETURN statement rule.
The same effect can be achieved with one rule using opt_expr.
2011-01-03 16:19:28 +09:00
Bill Currie
1a767849ab Sort the options in the switch.
Should make finding them a little easier.
2010-12-24 17:35:33 +09:00
Bill Currie
d6b3d4891a Finally, help output for qfprogs.
Nothing great, but better than nothing.
2010-12-24 17:33:57 +09:00
Bill Currie
f4d8b82115 Rearrange the options into alpha order. 2010-12-24 17:08:48 +09:00
Bill Currie
28740bb57f Add unsigned integer constant support. 2010-12-23 19:32:28 +09:00
Bill Currie
52e844ee48 Produce slightly better v6 modulo code for complex inputs.
I'm having problems with temp defs, but I imagine this code is rarely used
so I won't worry about it for now. It will, however, make a good test case
for when I rework emit.c after I do some reading.
2010-12-19 11:23:33 +09:00
Bill Currie
fa08e4afb7 Print users info when dumping statements. 2010-12-19 11:16:04 +09:00
Bill Currie
f5706f9c44 Make control of expression dumping less of a hassle. 2010-12-19 11:15:13 +09:00
Bill Currie
d981968208 v6 modulo implementation now produces good code.
At least for simple inputs, anyway. That needs to be tested next.
2010-12-18 22:21:55 +09:00
Bill Currie
00e50c0ad3 Rewrite the v6 modulo implementation.
While trying to understand bind expressions, I discovered that the v6
modulo code was incorrect. This version is correct but uses one too many
temps. That's next.
2010-12-18 22:21:55 +09:00
Bill Currie
699799bfc8 Don't warn when adding a new method to an implementation.
Methods defined in the implementation but not declared in the interface are
just fine.
2010-12-16 20:04:08 +09:00
Bill Currie
eace5b3c81 Get message checking working properly. 2010-12-16 16:41:16 +09:00
Bill Currie
4481ba9b0d Allow explicit references to classes and categories.
Use "@reference ClassName;" or "@reference ClassName(CategoryName);" to
create a refence to the class or category, forcing the defining object file
to be linked into the program when the object file is part of a library.
2010-12-12 20:27:56 +09:00
Bill Currie
2c84ae4898 Don't let casting in constfold increment users.
This fixes Deek's temp notice. No new notices have shown up, so this should
be the correct fix. The constant folding code no longer calls cast_expr
directly, but rather uses an internal wrapper that decrements users after
cast_expr increments it, resulting in a no-op.
2010-12-12 15:37:26 +09:00
Bill Currie
ac88c86dd3 Scripts now treat {}()': as single character tokens. 2010-11-28 15:31:30 +09:00
Bill Currie
023d3c89ec Source formatting. 2010-11-24 17:01:18 +09:00
Bill Currie
9a3f4d5a01 Handle method parameters that use incomplete types.
Compare the method's type pointers rather than the type strings as the pointer
won't change with the struct is completed.
2010-11-24 17:01:18 +09:00
Bill Currie
e28ee0378f Gracefully handle returning NIL though a bad type. 2010-11-24 17:01:18 +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
799d46f83d Check for incomplete types and better param/return size checking. 2010-11-24 17:01:17 +09:00
Bill Currie
a623fb53a7 Proper support for empty structs and unions.
They now have a single private, void, unnamed member, resulting in a size of
1 word. This makes empty structs useful for typed opaque handles.
2010-11-24 17:01:17 +09:00
Bill Currie
e5e560cbaf Ensure struct params are small enough to fit in the param slots. 2010-11-24 17:01:17 +09:00
Bill Currie
669771681a split up and modernize configure.ac
Most of the guts of configure.ac have been moved to config.d and are then
brought in by m4_include. This will make maintaining configure.ac much easier.

Also drop use of PROGRAM and VERSION, using PACKAGE_NAME, PACKAGE_VERSION, and
on occasion, PACKAGE_STRING instead, and clean out some old files we no longer
need.
2010-08-19 15:01:43 +09:00
Bill Currie
0dfff8fd58 ignore stuff 2010-08-07 10:42:09 +00:00
Bill Currie
51a32f4f87 minor comment about scoping in traditional mode 2010-02-22 13:44:52 +00:00
Bill Currie
fac98536f0 make sure def->space points to the space the def's location is allocated from to ensure that freeing the location works properly (fixes the bogus address triggered by prozaccoop: thanks, phrosty) 2010-02-22 13:11:41 +00:00
Bill Currie
56d01ce267 found an uncontrollable warning 2010-02-20 12:01:49 +00:00
Bill Currie
7b9a682942 Make qfpreqcc a little noisier when qfcc can't be run. 2010-01-16 02:05:05 +00:00
Bill Currie
997102fea8 audit the usage of "only"
There are still a few iffy places (notably around certain prepositions), but
the relevant sentences are now much easier to read.
2010-01-13 06:42:26 +00:00
Bill Currie
8abb9a69aa remove support for an optional = in struct/union declarations 2010-01-13 06:34:32 +00:00
Bill Currie
0d4a2938a2 forgot to check for errors 2010-01-13 06:32:10 +00:00
Bill Currie
ae4fc3147d allow '*pointer' expressions 2010-01-13 06:31:41 +00: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
ccb8faf6ef produce a warning for the likes of "x - x & y" 2010-01-13 06:26:18 +00:00
Bill Currie
40fefff847 fix incorrect users for temps resulting from casting the result of ?:
There are probably other situations, but I'll fix them as they show up.
2010-01-13 06:25:06 +00:00
Bill Currie
d558444b77 make temp def problems a little easier to understand
o  set return_address whenever a temp def is requested, no only when it is
    actually created.
 o  make the notices about temp reference counting problems a little more
    readable and include the name of the temp
2010-01-13 06:24:29 +00:00
Bill Currie
c2dcc20d2a allow (constant) expressions in array declarators 2010-01-13 06:23:32 +00:00
Bill Currie
a6c504936c get \8 and \9 right 2010-01-13 06:23:02 +00:00
Bill Currie
07b61aa23f missed \0-9 for the gold numbers from qccx 2010-01-13 06:22:01 +00:00
Bill Currie
36fe939ea5 don't hang when processing \{N} escape sequences and fix a comment 2010-01-13 06:21:29 +00:00
Bill Currie
090527eaec silence some debug output 2010-01-13 06:20:22 +00:00
Bill Currie
c3f47efb07 add --qccx-escapes to resolve the conflicts in escape sequences and document the escape sequences supported by qfcc. 2009-12-25 07:59:25 +00:00
Bill Currie
dcf593291d fix for new bison (must be explicit with the type of $$ in mid-rule actions) 2009-12-21 05:53:00 +00:00
Bill Currie
c8b7622e0e reduce the amount of memory wasted when generating the output file 2009-12-20 12:19:16 +00:00
Bill Currie
c542138300 more not-really initialized data 2009-12-20 11:54:19 +00:00
Bill Currie
1dc4683961 ensure all instructions are fully initialized. 2009-12-20 11:09:58 +00:00
Bill Currie
bfee029249 set current_func while building the init function to avoid issues with code expecting current_func to be set. 2008-08-01 22:55:10 +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
fe95805d86 various gcc 4.3 fixes 2008-07-19 05:40:57 +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
3e50aae01f "print" command for dumping values in the progs and add return type info to the debugging information 2007-09-15 07:47:31 +00:00
Bill Currie
01b71c40d2 fix some issues when using --advanced with v6only 2007-09-15 07:44:31 +00:00
Bill Currie
411d6517cb make duplicate macros behave the same as qcc in traditional mode (ie, bump the number anyway) 2007-05-15 07:51:04 +00:00
Bill Currie
fee656eb68 warn about (and otherwise ignore) duplicate frame macros 2007-05-15 07:36:56 +00:00
Bill Currie
79fdf8db80 allow .imm symbols to be written in traditional mode 2007-05-15 07:25:47 +00:00
Bill Currie
680bc22697 better error reporting for redefines 2007-05-13 09:02:51 +00:00
Bill Currie
a521a78adb catch more uninitialized variables 2007-05-13 08:39:07 +00:00
Bill Currie
c81c074660 mark used constants as used 2007-05-13 08:20:19 +00:00
Bill Currie
b356f1cbd4 remove some debug 2007-05-13 07:06:59 +00:00
Bill Currie
f4d40650f5 make initialized locals behave similarly to qcc in traditional mode (note, they're not exactly the same) 2007-05-13 06:21:54 +00:00
Bill Currie
2149aefe67 not so sure that one's needed 2007-05-08 03:24:49 +00:00
Bill Currie
5798c9d67a wasn't catching the precedence inversion in (x - x & y) even though it was caught for (x & y - x). 2007-05-08 02:54:50 +00:00
Bill Currie
0e78c3f6da make STORAGEX lower priority than UNARY so casts work 2007-05-07 23:44:45 +00:00
Bill Currie
9609fe8ca4 bloody hell 2007-05-07 15:04:06 +00:00
Bill Currie
839c00b97b back out the large packet/entity related patches. they've provent to be troublesome and it seems FTE has a better solution. 2007-05-07 14:58:53 +00:00
Bill Currie
8f365c4512 that wasn't supposed to go in 2007-05-07 12:18:54 +00:00
Bill Currie
72daa2fd2b add some sounds to the menus (not yet finished) 2007-05-07 12:17:12 +00:00
Bill Currie
7ba41632d9 snax's fixes to clean up most of the shift/reduce conflicts 2007-04-28 08:49:07 +00:00
Bill Currie
3deee307a8 check for uninitialized variables in return statements 2007-04-28 08:48:01 +00:00
Bill Currie
a376e6f86d make control of progdefs.h generation saner 2007-04-28 05:40:22 +00:00
Bill Currie
e8e2d3a6e5 make "local" optional 2007-04-28 05:20:47 +00:00
Bill Currie
cfeb14fecf warn when local variables are redecalred in the same scope. This won't normally cause problems, but it can save a lot of grief when converting traditional quakec code. 2007-04-12 09:39:42 +00:00
Bill Currie
93ee2e489b more vc2005 patches from phrosty 2007-04-11 22:03:36 +00:00
Bill Currie
bac4096708 some doc improvements as pointed out by Hikaru and add --relocatable to the long options 2007-04-11 10:48:04 +00:00
Bill Currie
82aaa87b6b fast access to code, warning and notice help. 2007-04-10 14:53:44 +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
f48d41848a *sigh* 2007-04-10 13:11:42 +00:00
Bill Currie
15dc16ff64 put in stubs for help for -C, -W and -N 2007-04-10 13:10:53 +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
4c4281c512 because builtin functions now get their params dumped to the debug symbols, @va_list needs to be initialized. 2007-04-10 09:10:09 +00:00
Bill Currie
30744a555e find the other place def_func relocs get emitted. I keep forgetting about the .y file when grepping source :P 2007-04-10 07:40:03 +00:00
Bill Currie
3b7c83a96f uncomment some lines that shouldn't have been commented (doesn't fix the bug, though) 2007-04-09 14:32:47 +00:00
Bill Currie
845b5ab2e2 don't write alias defs to the qfo 2007-04-09 14:25:44 +00:00
Bill Currie
642bb0f810 don't create a reloc for an external function 2007-04-09 14:06:12 +00:00
Bill Currie
e53e9944b6 spew a lot of guff about relocs 2007-04-09 13:33:59 +00:00
Bill Currie
3cd01223dd don't try to fix up function refs too early. fixes klik's segfault on firing 2007-04-09 08:56:23 +00:00
Bill Currie
a9678f1c06 dump globals direct from qfo 2007-04-09 07:47:51 +00:00
Bill Currie
48fdd0cb26 record the params for builtins, too. 2007-04-09 06:16:34 +00:00
Bill Currie
9509d0fd5e make qfo files typesize safe 2007-04-07 12:35:03 +00:00
Bill Currie
2399e79ca0 open all files in binary mode. ^Z is evil :P 2007-04-07 10:24:34 +00:00
Bill Currie
a6104bc0fc open input and output files in binary mode so ^Z doesn't bite us on windows 2007-04-07 10:15:17 +00:00
Bill Currie
25bf40a71a finish the break overloading and add some more tests (really need to get these automated) 2007-04-07 04:58:27 +00:00
Bill Currie
124506fda2 Fix the access alignment bug on 64 bit archs. 2007-04-07 01:41:23 +00:00
Bill Currie
c4d81cda19 use a proper charset instead of \w (too iffy on what it is) 2007-04-06 23:13:29 +00:00
Bill Currie
5baa6057cb give windows spawn*p* :P 2007-04-06 22:25:16 +00:00
Bill Currie
9e9318a3f1 use spawn instead of fork/exec/wait 2007-04-06 22:03:28 +00:00
Bill Currie
3f3450df2c fix a wrong name 2007-04-06 14:13:25 +00:00
Bill Currie
f6924f35e5 report the line of the previous declaration of the function 2007-04-06 12:02:34 +00:00
Bill Currie
a6388ee680 overload "break" and allow break to be used in --traditional 2007-04-06 11:46:21 +00:00
Bill Currie
6d21c50dee handle #line (hopefully) 2007-04-06 11:27:03 +00:00
Bill Currie
966c337bf5 use the def's declaration line rather than the function's when reporting auto-initialization 2007-04-06 11:05:52 +00:00
Bill Currie
c560744270 "use" parent defs 2007-04-06 11:01:34 +00:00
Bill Currie
240eab4b09 cleanup the tempfile from a failed preprocessor run on progs.src 2007-04-06 09:44:08 +00:00
Bill Currie
26e15db4ba handle comments and conditionals in preprogs.src 2007-04-06 09:27:56 +00:00
Bill Currie
04765083aa really warn only once for each uninitialized variable 2007-04-06 08:56:37 +00:00
Bill Currie
e7f478b197 by default, don't use cpp when compiling the output of qfpreqcc 2007-04-06 08:41:33 +00:00
Bill Currie
5a8143a9c7 support float = vector and vector = float for traditional 2007-04-06 08:23:07 +00:00
Bill Currie
eb9943973b handle . in frame macro names 2007-04-06 08:19:58 +00:00
Bill Currie
bff92d9d32 properly handle strings in comments and comments in strings 2007-04-06 08:19:20 +00:00
Bill Currie
6bbf54c7cd handle /* */ comments better 2007-04-06 07:12:47 +00:00
Bill Currie
0e4fb6c01a no-cpp implies no-single-cpp 2007-04-06 07:11:38 +00:00
Bill Currie
8079c9951c catch nested /* in comments 2007-04-06 06:31:47 +00:00
Bill Currie
ff0144f870 bring in the cleanups from my start at preqcc stuff (I don't know if that will ever go in, though, I'm thinking maybe it should be external) 2007-04-06 05:52:20 +00:00
Bill Currie
df2bebde7e more vc build patches from phrosy 2007-04-06 01:09:58 +00:00
Bill Currie
0382b05780 various unsigned long -> uintptr_t conversions 2007-04-04 11:22:48 +00:00
Bill Currie
72af804b31 nested include reporting 2007-03-31 15:27:36 +00:00
Bill Currie
5e98c49188 chase down a runaway else 2007-03-31 15:26:58 +00:00
Bill Currie
90129fc4ec add $frame_reset grab command to reset the frame macro counter and sneak the command in before each file in the single-cpp script. This fixes the bogus animations in nq (and anything else, for that matter) 2007-03-31 13:54:09 +00:00
Bill Currie
03e1d6c3bf re-implement the comment lexer using states to re-learn how things work prior to implementing preqcc support 2007-03-30 09:02:36 +00:00
Bill Currie
e52633c492 make protocol dump info more readable 2006-12-19 11:53:18 +00:00
Bill Currie
0bd92e439a fix an interal error caused by losing the error state 2006-12-16 11:45:47 +00:00
Bill Currie
48d9d96005 don't try to create multiple objects for the same protocol 2006-12-16 08:09:10 +00:00
Bill Currie
904197c70e allow assignment of arrays to poitners 2006-12-11 09:26:45 +00:00
Bill Currie
e9f49ca816 allow static local vars 2006-12-11 09:26:07 +00:00
Bill Currie
48f8bbd12e group the struct rules together 2006-12-02 06:49:55 +00:00
Bill Currie
b6a4a520d5 silence bison's new warnings 2006-12-01 08:17:55 +00:00
Bill Currie
1925bef0c1 fix a bunch of bugs with single-cpp processing when not keeping temps 2006-08-20 06:20:30 +00:00