Bill Currie
eb5581c7bd
Fix class type encoding.
...
First, the class def needed to be created before the class type, then the
def space indices had to be set early, otherwise the relocs wound up with
space 0 instead of the correct space.
2012-11-12 12:46:15 +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
edd381931e
Create obj_object after obj_class.
...
obj_class is self-referential,but obj_object refers to obj_class. This gets
obj_class encoded properly.
2012-11-11 19:08:15 +09:00
Bill Currie
96110a0f54
Treat messages to id and Class separately.
...
As id and Class do not point to real objects as such, trying to get the
class from their types doesn't work, so instead send the message to a
"null" class that skips the method checks.
2012-11-11 17:39:12 +09:00
Bill Currie
694b268f53
Correct the type of id.
...
It should be struct obj_object * rather than Object *.
2012-11-11 17:22:57 +09:00
Bill Currie
35a88d873c
Rework the builtin class creation once again.
...
Now the classes are built "properly" (using the same tools as the parser
itself), and the structs (obj_object, obj_class and obj_protocol) are built
separately, but using the class ivars.
2012-11-11 16:23:04 +09:00
Bill Currie
b36bd3a988
Remove the list offsets from the class ivars.
...
Even just before, type_obj_object, type_obj_class and type_obj_protocol
were a bit bogus (still are), but now the arrays used to list their ivars
are correct. I plan to create the above mentioned types using
class_to_struct to do it properly.
2012-11-11 09:52:55 +09:00
Bill Currie
0cf16ac558
Make _OBJ_CLASS_foo the correct type.
...
It needs to be type_obj_class, but I had gotten confused earlier when
rearranging the type names as I was having trouble with "not a class"
errors.
2012-11-10 13:45:38 +09:00
Bill Currie
06fd912a09
Make super_class for the internal Protocol and Class objects.
...
They're based on Object, and that needs to be represented properly.
2012-11-10 13:01:56 +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
d33d062bd1
Rearrange class_message_response.
...
Even if an object doesn't seem to respond to a message, return the message
so unrelated warnings or errors don't occur.
2012-11-09 19:18:09 +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
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
23a38738fc
Massive whitespace cleanup.
...
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +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
c6e0e094d8
Fix an unterminated array.
...
That was sneaky. It took building qfcc on an arm to trigger that bug.
2011-07-30 15:01:16 +09:00
Bill Currie
0f7390dd60
Clean up all the "set but not used" warnings.
...
gcc on my system is failing to treat this specific warning as an error :/
2011-06-19 10:48:02 +09:00
Bill Currie
71af121665
Detect missing @end tags.
...
Give a warning when @end is forgotten in class implementations.
2011-03-24 11:44:22 +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
a919e5f619
Make class_check_ivars() use class_add_ivars() to add the ivars.
...
This avoids implementation ivar blocks trashing the ivar offsets in
derived classes.
2011-03-20 13:35:59 +09:00
Bill Currie
b95cdc33d9
Set instace_size to the correct size.
2011-03-08 22:45:34 +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
90640614ef
Compare symbols using the right method.
...
That fixme was right :)
2011-03-03 15:02:26 +09:00
Bill Currie
cce6838e16
Ensure .ctor is declared static.
2011-03-01 11:08:32 +09:00
Bill Currie
9cf63dbbdf
Clean up the create of the obj_module_s structure.
2011-02-26 22:06:22 +09:00
Bill Currie
cbfbc0b01a
Ensure type_ClassPtr is chained before it is used.
2011-02-26 22:05:53 +09:00
Bill Currie
4336fc2c73
Move method function defs into the far data space.
...
As they are never referenced directly by instructions, there's no need for
them to be in the near data space, taking precious def locations.
2011-02-15 15:33:18 +09:00
Bill Currie
b2d4aee61e
Reimplement selector expressions to work with far data.
...
They currently execute a lea instruction every method call, but the
optimizer should take care of that once its written.
2011-02-15 10:48:05 +09:00
Bill Currie
5707888fcf
Fix some error-recovery segfaults.
2011-02-14 23:10:46 +09:00
Bill Currie
8a314e9e87
Class pointers need to be directly addressable.
2011-02-13 16:05: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
fa6b8d773c
Correctly emit class and category symtab references.
2011-02-13 13:21:00 +09:00
Bill Currie
1bcf434b20
Move _OBJ_MODULE to the far data space.
2011-02-12 23:00:04 +09:00
Bill Currie
181596f5bf
Make relocation records store the space of the relocation.
...
The space is meaningless for op_* relocations as they are always in the
code space, but def_* relocations need to know which space holds the
location to be adjusted.
2011-02-12 22:34:38 +09:00
Bill Currie
8c01497936
Give __obj_exec_class a sterner beating.
...
When linking a def into a defspace, ensure it can be removed. This fixes
the missing __obj_exec_class def in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
5f3c1872b9
Put class and category reference/name symbols in the symbol table.
...
This fixes the undefined defs in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
c185fbb782
Set the type of the super structure to the correct type.
2011-02-11 22:29:38 +09:00
Bill Currie
01a7af17e5
Beat __obj_exec_class into submission.
2011-02-10 00:15:19 +09:00
Bill Currie
1b8edc07c9
Adjust the offsets of ivars in derived classes.
...
As ivar structs are not independent, their starting offset is not
necessarily zero (almost never will be for derived classes).
2011-02-09 22:02:52 +09:00
Bill Currie
3e1b034aaf
Use EMIT_DEF correctly.
2011-02-09 15:58:32 +09:00
Bill Currie
81125cff3a
Creation of .ctor now mostly works.
...
There seems to be problems with the actual code generation using incorrect
addresses, but a very simple test file compiles successfully.
2011-02-08 22:38:34 +09:00
Bill Currie
1647b1e61d
Check for the correct type in emit_symtab_cat_def_cnt().
2011-02-08 22:31:09 +09:00
Bill Currie
9b52c590f8
Do not try to emit anything when there are no selector references.
2011-02-08 22:28:32 +09:00
Bill Currie
da14c95bb8
Initialize current_symtab in class_init() when necessary.
...
If an objective-qc symbol is the first token to be read, class_init() is
called before the parser gets a chance to perform the initialization
action. However, class_init() setting current_symtab if the first
objective-qc symbol is seen in a function body would be bad.
2011-02-08 22:26:35 +09:00
Bill Currie
c01f742b7b
Fix some Class vs ClassPtr confusion.
2011-02-08 18:25:23 +09:00
Bill Currie
6643c5dd98
Fix messages to super.
2011-02-08 17:09:27 +09:00