Commit Graph

148 Commits

Author SHA1 Message Date
Bill Currie 2329fb1885 Fix some warnings and bitrot. 2016-10-25 00:10:30 +09:00
Bill Currie 8d34d33055 Implement "if not (foo)" syntax.
It is syntactic sugar for if (!(foo)), but is useful for avoiding
inconsistencies between such things as if (string) and if (!string), even
though qcc can't parse if not (string). It also makes for easier to read
code when the logic in the condition is complex.
2013-06-26 23:02:55 +09:00
Bill Currie 737347b0f6 Remove the prototypes hack.
While configure isn't testing yet, we need recent bison and flex, so many
of the old hacks are no longer necessary.
2013-01-10 19:27:22 +09:00
Bill Currie 76a69d9a53 Implement fteqcc's "nosave" specifier.
Of course, it's "@nosave" for traditional progs, but that's only a define
away.
2013-01-07 14:35:34 +09:00
Bill Currie 34c0c82408 Add support for binary constants using the 0b prefix.
Just because :P (now that gcc support it, it seems worthwhile, I guess)
2013-01-04 19:32:04 +09:00
Bill Currie 513d67c6c3 Splut up the keywrods table into categories.
The keywords table was rather awkward to edit (and sometimes confusing).
Worse, because the hash table used to look up the keywords was initialized
only once, changing modes in the same execution of qfcc would not work
properly as keywords would not be added or removed as appropriate.

Now there are four categories of keywords:
 o  "core"  Always available. They form the core of QuakeC except for two
            extensions.
 o  "@"     In extended and advanced modes, the preceeding @ is optional,
            but tranditional mode requires the keywords to be preceeded by
            an @. They are the C keywords that QuakeC did not use, but can
            be implemented in v6 progs under certain circumstances.
 o  "QF"    These keywords require the QuakeForge VM to be usable.
 o  "Obj"   These keywords form Ruamoko/Objective-QuakeC and require both
            advanced mode and the QuakeForge VM.
2012-12-22 16:31:14 +09:00
Bill Currie c68578d15d Rename CONST to VALUE.
VALUE is a much more accurate name, and this allows for "const" to be
implemented at some stage.
2012-12-20 10:10:41 +09:00
Bill Currie cd7c53d223 Parse id <protocol> and classname <protocol>.
This is needed to allow compile-time protocol conformance checks, though
nothing along those lines has been implemented yet.

id has been changed from TYPE to OBJECT, required to allow id <proto> to be
parsed. OBJECT uses symbol, allowing id to be redefined once suitable work
has been done on the parser.
2012-12-20 10:10:41 +09:00
Bill Currie 3e38c4aa48 Merge branch 'qfcc-cse'
qfcc now does local common subexpression elimination. It seems to work, but
is optional (default off): use -O to enable. Also, uninitialized variable
detection is finally back :)

The progs engine now has very basic valgrind-like functionality for
checking pointer accesses. Enable with pr_boundscheck 2
2012-12-13 20:17:28 +09:00
Bill Currie 0872961269 Do a little bit of cleanup. 2012-12-04 12:48:52 +09:00
Bill Currie a91f4cedeb Add the @nil keyword.
@nil is exactly the same as nil, but it is always available.
2012-11-27 18:33:42 +09:00
Bill Currie edeffd64e9 Fix a missed obj_module_s/_t from the class cleanup.
Doesn't seem to have caused any problems, but still :)
2012-11-27 18:33:42 +09:00
Bill Currie eef399209d Add some very evil pragmas.
The evil comment is not just "pragmas are bad, ok?", but switching between
advanced, extended and tradtitional modes when compiling truly is evil and
not guaranteed to work. However, I needed it to make building test cases
easier (it's mostly ok to go from advanced to extended or tradtional, but
going the other way will probably cause all sorts of fun).

In the process, opcode_init now copies the opcode table data rather than
modifying it.
2012-11-22 21:59:01 +09:00
Bill Currie 1d34da26f7 Add an option to dump frame files.
After running across a question about lists of animation frames and states,
I decided giving qfcc the ability to generate such lists might be a nice
distraction from the optimizer :) Works for both progs.src and separate
compilation. No frame file is generated if no macros have been created.
2012-11-21 20:50:45 +09:00
Bill Currie c96718493a A bit of a cleanup before fixing class type defs.
All internal structs now have "proper" names, and fit the naming convention
(eg, obj_module (like objective-c's types, but obj instead of objc). Some
redundant types got removed (holdovers from before proper struct tag
handling).

Also, it has proven to be unnecessary to build internal classes, so
make_class and make_class_struct are gone, too.
2012-11-12 11:12:33 +09:00
Bill Currie eb86a66ce5 Do some class object type renaming.
type_object -> type_obj_object
type_Class -> type_obj_class
type_ClassPtr -> type_Class

In the process, one more FIXME is gone :)
2012-11-08 20:58:48 +09:00
Bill Currie 377f8f9d56 Use an explicit flag for class initialization.
Much cleaner than messing with class_Class, which is about to go away.
2012-11-08 17:14:33 +09:00
Bill Currie ec42bde527 Make hash tables more const correct.
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
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 1364bff91b Add an extended mode to qfcc.
Extended mode allows extra keywords (switch, for, etc) that are compatible
with v6 progs.
2012-07-14 17:16:33 +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 896791b209 Correct the spelling of "int" and clean up the mess. 2011-03-25 16:53:04 +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 4192ef835c Delay initialization of obj_module_t as long as possible.
This keeps the type descriptor out of progs that never use any
Objective-QC features.
2011-03-04 08:25:50 +09:00
Bill Currie 0b5565396b Add a class type to symbols and rework the CLASS_NAME handling.
This fixes the problem with [Array alloc] producing a warning about Class
not repsonding to -alloc.
2011-02-13 16:05:09 +09:00
Bill Currie acb3c0da11 Fix class initialization. 2011-02-04 14:29:47 +09:00
Bill Currie 7b22bfba63 Better Objective-QC keyword detection.
Use a flag in the keyword struct rather than checking for "@" in the
keyword. This catches such keywords as "id" and "Protocol" as well.
2011-02-04 08:38:58 +09:00
Bill Currie 0624408317 Move the diagnostic functions into their own file. 2011-01-24 21:54:57 +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 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 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 c38ea0b1bc Correct the spelling of "nil". 2011-01-14 12:07:40 +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 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 fbdbcfada4 Remove deprecated @argc and @argv 2011-01-05 13:10:57 +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 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 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 fe95805d86 various gcc 4.3 fixes 2008-07-19 05:40:57 +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 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