Commit Graph

467 Commits

Author SHA1 Message Date
Bill Currie e05c12e16d Make linker_add_def take a pointer for the value.
While it looks like I might not use it for the type encodings, it should be
useful in the future.
2012-11-14 13:12:58 +09:00
Bill Currie 5b7b49b100 Add a QFO_TYPE macro to get a qfot_type_t pointer.
In the end, it wasn't used, but it could be handy in the future.
2012-11-13 21:45:54 +09:00
Bill Currie 93b007b1f8 Take care of relocs when defining external defs.
For most of the cases, some relocs may have been lost, but they were
certainly lost for type encodings. Now that all seems to be fixed.
2012-11-12 16:14:09 +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 d13ce81b4f Ensure the type's encoding string is valid.
When encoding a type to a qfo file, the type's encoding string is written
and thus needs to be valid prior to actually doing the encoding. The
problem occurs mostly in self-referential structs (particularly, obj_class)
because the struct is being encoded prior to the pointer to the struct.
2012-11-11 20:22:48 +09:00
Bill Currie 86091856be Revamp the static class creation.
Type names are cleaned up, as is the creation. Also, the class pointer in
the type encoding now gets emitted. However, Still need to actually create
_OBJ_CLASS_Class and fix the type encoding reloc handling in the linker.
2012-11-10 12:56:19 +09:00
Bill Currie 9095e1eabc Rework build_switch to use initialize_def.
This required support for label reference expressions, whose purpose is to
represent the address of a label.
2012-11-09 12:22:34 +09:00
Bill Currie afbab60c25 Create linker_find_def.
It turns out I didn't need it, but it could be useful in the future, so
I'll leave it in.
2012-11-09 11:57:06 +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 7e293a38e8 Check for double-chaining of types.
Chaining a type twice will form a loop in the type list, causing find_type
to go into an infinite loop.
2012-11-08 17:14:33 +09:00
Bill Currie a3a22f2a1b Add the ability to dump qfo type encoding. 2012-11-08 17:06:38 +09:00
Bill Currie ed4018fd8d Clear out the function overloading tables between compiles.
Fixes some issues with multiple compiles (especially mixed languages!).
2012-11-01 20:53:33 +09:00
Bill Currie f8bdd909cc Separate out C and html quoting into separate functions.
Dot sometimes wants normal C quotes, othertimes html. Quite annoying,
really, but this is cleaner anyway.
2012-10-30 12:31:22 +09:00
Bill Currie 034139b806 Move some code around so it's more accessible. 2012-10-27 11:43:29 +09:00
Bill Currie 144387c3e3 Add shared.h to the dist files. 2012-10-26 16:16:46 +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 23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie e866619de6 Output basic block flow diagrams to files.
The output can be controlled via --block-dot (not yet documented). The
files a named <sourcefile>.<function>.<stage>.dot. Currently, stage will be
one of "initial" (after expression to statement conversion), "thread"
(after jump threading), "dead" (after dead block removal), "final" (final
state before actual code emission).
2012-05-04 09:45:51 +09:00
Bill Currie 5f676c367f Add a non-error diagnostic that can't be silenced.
It is inteded for flagging buggy conditions in the compiler, particularly
after having fixed the original bug (in case something comes back from the
dead).
2012-05-03 13:24:24 +09:00
Bill Currie cb8fe4eb38 Correct a "spelling" error. 2012-05-03 11:54:36 +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 c8163fc0de Add an option to prevent the use of default paths.
Despair has things locked down such that running qfcc during a build fails
due to lack of read access to /usr/local/lib. This is actually a good
thing as accidentally hitting old includes/libs (when a file gets deleted
in the tree) hides bugs. Thus, --no-default-paths to turn off default
search paths.
2012-01-04 13:53:04 +09:00
Bill Currie d910c14935 Clean up some doxygen warnings. 2011-07-10 19:12:07 +09:00
Bill Currie 55cc0f9206 Bring back the unsigned type (PROGS version bump)
This is only low-level support (the unsigned keyword still does not work),
but sufficient to make switch statements using jump tables work.
2011-04-09 10:07:47 +09:00
Bill Currie c4a398850a Fix defs as constants for vectors and quaternions. 2011-04-04 21:31:59 +09:00
Bill Currie 8d3508cf20 Allocate space for temp defs using size rather than type.
Statement operands throw away the high level type information, so store
type size in the operand and use this size for allocating space for temps
rather than using the low-level type.
2011-03-23 21:32:14 +09:00
Bill Currie 9b62c8c126 Rename ty_type_e to ty_meta_e and type_t.ty to type_t.meta 2011-03-22 16:06:47 +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 8368f57fbf Close a potential buffer overflow. 2011-03-09 11:09:46 +09:00
Bill Currie 39278ba8cc Explicitly select between direct and indirect moves. 2011-03-09 10:30:57 +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 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 fe3d228658 Maintain a symbol table for entity fields. 2011-03-06 15:38:19 +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 8cfa80b5d4 Implement think expressions. 2011-03-05 18:01:37 +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 7fb22bd1e4 Make D_STRING() more useful and add D_GETSTR() 2011-03-04 21:28:12 +09:00
Bill Currie d6d8b5b49d Generate the debug symbol file. 2011-03-04 18:46:05 +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 c99f3aba0e Add the new header files for make dist. 2011-03-04 00:11:13 +09:00
Bill Currie c5ecc170b6 Give labels a usage count to detect unused labels. 2011-03-03 15:28:49 +09:00
Bill Currie d937172243 Create and use alias operands for alias expressions.
This avoids the alias expression modifying the operand used in other
expressions.
2011-03-03 13:46:07 +09:00
Bill Currie 45de7327dc Implement alias expressions (finally).
Alias expressions are like cast expressions, but never do any conversions.
2011-03-03 11:06:10 +09:00
Bill Currie c12211d8bb Support enum results for boolean expressions.
eg enum BOOL x = a && b;
2011-03-02 22:46:55 +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 29985efcef Expose some linker functions to the rest of the compiler.
They proved to be useful for cleaning up the final compilation stages.
2011-03-02 20:48:55 +09:00