Commit graph

312 commits

Author SHA1 Message Date
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
e08efe036b Move the constant expression values into their own struct. 2011-01-19 08:43:24 +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
ffea505678 Cleanup QC's constant handling based on QP. 2011-01-14 12:10:28 +09:00
Bill Currie
c69ac1f56f Don't segfault when build_builtin_function detects an error. 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
fbdbcfada4 Remove deprecated @argc and @argv 2011-01-05 13:10:57 +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
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
28740bb57f Add unsigned integer constant support. 2010-12-23 19:32:28 +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
67beaf4487 Nil is a constant, so allow it in global initializers. 2010-11-24 17:01:18 +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
51a32f4f87 minor comment about scoping in traditional mode 2010-02-22 13:44:52 +00:00
Bill Currie
56d01ce267 found an uncontrollable warning 2010-02-20 12:01:49 +00:00
Bill Currie
8abb9a69aa remove support for an optional = in struct/union declarations 2010-01-13 06:34:32 +00:00
Bill Currie
ae4fc3147d allow '*pointer' expressions 2010-01-13 06:31:41 +00:00
Bill Currie
c2dcc20d2a allow (constant) expressions in array declarators 2010-01-13 06:23:32 +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
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
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
a521a78adb catch more uninitialized variables 2007-05-13 08:39:07 +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
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
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
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
48fdd0cb26 record the params for builtins, too. 2007-04-09 06:16:34 +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
a6388ee680 overload "break" and allow break to be used in --traditional 2007-04-06 11:46:21 +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
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
0edd694bac fix a default action type clash in some versions of bison 2005-03-31 08:23:11 +00:00
Bill Currie
66257e3a88 run in fear, function overloading is here
This is an imperfect revision of history.
2004-11-13 11:50:00 +00:00
Bill Currie
64cc8c60d2 compile time protocol support seems to be complete now. fortunatly, protocols had never been written out so the corrections to the protocol related stuctures do not need a progs version bump. runtime protocol support hasn't been fully tested yet.
+load runtime support seems to be working.

This is an imperfect revision of history.
2004-11-11 00:34:00 +00:00
Bill Currie
a3a2dd62e3 fix type of "self"
This is an imperfect revision of history.
2004-11-02 07:13:00 +00:00
Bill Currie
a4dbdb4d06 whitespace
This is an imperfect revision of history.
2004-11-02 07:08:00 +00:00
Bill Currie
fff41d664a detect re-declaring identifiers as different types (typedef, enum, var, etc)
This is an imperfect revision of history.
2004-11-02 07:02:00 +00:00
Bill Currie
332ec82495 update the scope of local defs to the parent scope when the creation scope
goes away (doesn't get updated to the global scope). fixes a bug where
local defs would be miscounted (and sometimes lost)
2004-04-09 03:47:41 +00:00
Bill Currie
25ac9cb07b fix "for (;;)" etc 2004-03-30 02:31:02 +00:00
Bill Currie
865b31caac make sure messages generated by issues within a function don't get
"At top level"
2004-02-13 04:57:15 +00:00
Bill Currie
69730cae8b fix some type classes in older bison 2004-02-12 01:37:27 +00:00
Bill Currie
02d89ee7d5 allow computed functions for "think" in state expressions 2004-02-11 08:09:10 +00:00
Bill Currie
1c090c38a3 allow non-const expressions for the frame number and make sure the time
step is a float (for state expressions)
2004-02-11 04:00:11 +00:00
Bill Currie
0fe4c2a600 catch redefined functions 2004-02-11 01:53:17 +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
1fc517f7db C style functions can now (optionally) be used (void foo ();) 2004-02-11 00:36:34 +00:00
Bill Currie
e2602bc9d5 fix misparse of void () foo; 2004-02-10 23:49:45 +00:00
Bill Currie
7af8f8a6f6 ; at the end of a function is no longer required. void () foo = {} and
void () foo = {}; are both valid now.
2004-02-10 23:20:44 +00:00
Bill Currie
6e4c6478a1 getting closer to optional ; at the end of functions. also gets rid of the
need for the context-sensitivity hack used for distinquishing frunction
inits from struct/array inits
2004-02-10 03:25:24 +00:00
Bill Currie
ddc44f33da compress the 4 method building rules into 2 2004-02-09 07:35:19 +00:00
Bill Currie
3f27042e8d forgot to look after current_storage with methods 2004-02-09 07:17:44 +00:00
Bill Currie
499dac6bb1 step one towards more flexible function declarations 2004-02-08 23:46:40 +00:00
Bill Currie
ab4f0e7ca9 warn on return foo (); where foo returns void 2004-02-04 01:30:12 +00:00
Bill Currie
0f94dd95d2 make @class foo work when foo is already defined 2004-02-03 07:29:20 +00:00
Bill Currie
ba901863d2 fix a missing ; 2004-01-27 04:41:20 +00:00
Bill Currie
897b49140a initialized locals are a little trickier... 2004-01-25 22:08:08 +00:00
Bill Currie
7423ee389d better timing for constant folding 2004-01-25 21:36:44 +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
802aacfaf4 allow constant expressions to be used for builtin numbers 2004-01-07 00:03:05 +00:00
Bill Currie
63414ea836 more gccisms in the error reporting (In function ...) 2003-10-25 04:35:47 +00:00
Bill Currie
58d0f188f1 recover from errors in bool expressions (ie, don't segfault) 2003-10-24 22:23:56 +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
99034fef27 initialized locals aren't constant 2003-09-25 02:05:43 +00:00
Bill Currie
4ce81b28d7 remove nested scopes for traditional mode 2003-09-23 17:59:46 +00:00
Bill Currie
651fa8ca12 correct the operator precendece to match C. hopefully won't cause any
problems :)
2003-09-19 20:50:05 +00:00
Bill Currie
7d830ffc1f make @defs work properly and don't do uninitialized checks on structs 2003-08-20 19:58:41 +00:00
Bill Currie
dd9ab1e050 get unsigned mostly working 2003-08-01 21:20:04 +00:00
Bill Currie
0361cb261f fix an incorrect inherited attribute access caused by my "no ivars" fix
(part of the struct re-work)
2003-08-01 02:43:11 +00:00
Bill Currie
cc0d8b364d fix a couple "value computed is not used" not used warnings 2003-07-31 02:16:26 +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
1366ad4661 fix <protocol_list> 2003-07-25 20:34:24 +00:00
Bill Currie
627c6f70f5 allow casting between function types 2003-03-10 21:23:05 +00:00
Bill Currie
90752b33fe make TYPE (void) NAME valid (no args) 2003-02-28 23:36:56 +00:00
Bill Currie
ef762e21eb allow initialized globals (since they're constant) to be used in most places
constants are required (switch, initializing globals, enums)
2003-02-28 04:54:07 +00:00
Bill Currie
05fb5fe08b make syntax errors a little easier to understand 2003-02-25 07:48:12 +00:00
Bill Currie
599ae15490 give the hash functions more unique names 2003-02-22 22:38:55 +00:00
Bill Currie
2d766710b6 detect multiple initializations of globals 2003-01-29 22:29:37 +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
a4dfef63c3 make all files with rcsid include config.h 2003-01-14 20:18:29 +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
cb81f17697 bah, bloody bison inconsistencies 2002-11-15 17:12:16 +00:00
Bill Currie
3c215ce13f getting closer to working categories 2002-11-14 18:17:43 +00:00
Bill Currie
da334413b8 re-write category handling so it has a better chance of working (category
using code now compiles)
2002-11-12 19:52:43 +00:00
Bill Currie
749b56aae7 forgot to fix these when I did the copyrights 2002-11-06 16:32:28 +00:00
Bill Currie
43fa6a4002 inherited attributes rock :) (thanks, aho, ulman and sethi:) 2002-11-04 17:54:31 +00:00