Commit Graph

10180 Commits

Author SHA1 Message Date
Bill Currie 59db90d177 [qfcc] Fix method not found warnings
It turns out they should not be optional, but do need to be smarter
about when and which. So another two FIXMEs gone :)
2020-03-05 14:48:53 +09:00
Bill Currie 669c8f43d8 whitespace 2020-03-05 14:48:49 +09:00
Bill Currie ccaa4ad3d2 [qfcc] Catch assignment of void* to class pointers
id and other class pointers imply that the object can receive messages,
but void * has no such implication, so treat it as a mismatch.
2020-03-05 14:14:20 +09:00
Bill Currie 65a5e4f2a4 [qfcc] Allow inherited methods to satisfy protocols
I suspect that the current state of things will produce problems later
on, but this works for now.
2020-03-05 12:52:37 +09:00
Bill Currie 1459361cbd [qfcc] Set builtin function def flags
This fixes the missing redefinition error when a builtin is defined
twice (and thus corrupting the function chain).
2020-03-05 11:48:15 +09:00
Bill Currie 9ccfe8aefc [qfcc] Rewrite init_elements
The end goal was to fix erroneous non-constant initializer errors for
the following (ie, nested initializer blocks):

    typedef struct { int x; int y; } Point;
    typedef struct { int width; int height; } Extent;
    typedef struct Rect_s { Point offset; Extent extent; } Rect;
    Rect makeRect (int xpos, int ypos, int xlen, int ylen)
    {
	Rect rect = {{xpos, ypos}, {xlen, ylen}};
	return rect;
    }

However, it turned out that nested initializer blocks for local
variables did not work at all in that the relocations were lost because
fake defs were being created for the generated instructions.

Thus, instead of creating fake defs, simply record the offset relative
to the base def, the type, and the basic type initializer expression,
then generate instructions that all refer to the correct def but with a
relative offset.

Other than using the new element system, static initializers are largely
unaffected.
2020-03-05 11:05:13 +09:00
Bill Currie 1b2a806f28 [qfcc] Fix test that failed due to improved warnings 2020-03-05 11:04:22 +09:00
Bill Currie 78b71c28fe [qfcc] Make reloc functions const-correct 2020-03-05 11:03:23 +09:00
Bill Currie efcbbbb641 [qfcc] Catch use of missing superclass interfaces 2020-03-05 08:50:29 +09:00
Bill Currie 896c14f33a [qfcc] Support anonymous structs in ivars
Missed this earlier.
2020-03-05 08:47:21 +09:00
Bill Currie 0bb4279a9f [qfcc] Handle bitwise not of enums
It looks like I need to handle other unary expressions too, but another
time.
2020-03-05 01:45:38 +09:00
Bill Currie f3236410d0 [qwaq] Make the event system more informative
Doesn't have timestamps at this stage, but otherwise it reflects the
event system I had in my old text UI which was heavily based on
TurboVision. TV is pretty good (after looking at things a bit closer I
found it wasn't as deep as I thought), and better yet, Borland released
it to the public domain 23 years ago! (wish I'd known that).

Anyway, this commit gets something happening on the screen, even though
the current hierarchy is still a mess.
2020-03-04 22:09:40 +09:00
Bill Currie 815ae02121 [qwaq] Allocate enough bytes for the args list
d'oh
2020-03-04 21:17:17 +09:00
Bill Currie 68fc11857a [gamecode] Fix a string splitting error 2020-03-04 21:10:23 +09:00
Bill Currie c214797e97 [gamecode] Fix some curly space
and add some comments. took a bit to figure out what i was doing
2020-03-04 21:09:36 +09:00
Bill Currie d57e05258c [qwaq] Remove now unnecessary union field name
\o/
2020-03-04 19:10:09 +09:00
Bill Currie 269a8a558a [qfcc] Allow bare enum and named struct declarations
Got a little overzealous there
2020-03-04 18:39:41 +09:00
Bill Currie f532780dbe [qfcc] Treat opaque structs as not anonymous
I don't know why the segfault happened where it did, but
forward-declared structs certainly can't be used as anonymous structs.
2020-03-04 18:38:04 +09:00
Bill Currie 7a2335e9f4 [qfcc] Catch useless specifiers in function scope 2020-03-04 18:07:10 +09:00
Bill Currie 4c82114547 [qfcc] Catch several useless specifier expressions 2020-03-04 17:40:49 +09:00
Bill Currie 597890dda1 [qfcc] Catch duplicate field definitions 2020-03-04 16:32:04 +09:00
Bill Currie e298904dc0 [qfcc] Implement anonymous structs and unions
For struct/union scope
2020-03-04 16:31:28 +09:00
Bill Currie 4fa203852a [qfcc] Use offset alias offset when creating alias of offset alias
Yes, that's correct. It happens when casting the address of a structure
field (for the test case this fixes, vector field).
2020-03-04 00:55:31 +09:00
Bill Currie 57b2751732 [qfcc] Add failing vector element address test
It's an evil thing to do, but it should at least work.
2020-03-04 00:37:10 +09:00
Bill Currie de01cff70e [build] Install QF/keys.h into qfcc's include directory
As well as $prefix/include, of course. This fixes the problem with
external ruamoko builds failing due to keys.h and qfcc's "lockdown" on
system headers.
2020-03-03 22:22:53 +09:00
Bill Currie c58cf2c2d0 [qwaq] Fail at object oriented design 101
This is horrible, doesn't work, isn't really the direction I want to go
(that became apparent while implementing Screen's handleEvent) and
crashes anyway (Array and not-id...)

*sigh*

Still, this does have some good stuff in it, and it pushed qfcc along
some more.
2020-03-03 21:32:19 +09:00
Bill Currie 7976eec2ce [scheme] Clean up a pile of rotten bits 2020-03-03 17:35:14 +09:00
Bill Currie b186332da0 [qfcc] Make initialization of external vars an error 2020-03-03 17:33:56 +09:00
Bill Currie 051a572bcc [build] Dependency checking for all ruamoko code
Including dependency on qfcc itself. Getting automake to chooch the way
I want it to chooch can be a pain in the... see AvE
2020-03-03 17:24:53 +09:00
Bill Currie 6def1fc01c [qfcc] Fix a bootstrap warning 2020-03-03 15:26:33 +09:00
Bill Currie cdc1f0c5e7 [libr] Treat ruamoko headers as system headers
Now that qfcc actually supports them properly.
2020-03-03 15:24:41 +09:00
Bill Currie b8984e5f66 [qfcc] Fix another infinite loop in the linker
I think this should be it for infinite loops caused by undefined
symbols. I don't know why I didn't remove this continue when I removed
the other.
2020-03-03 13:39:24 +09:00
Bill Currie c7cde5f409 [qfcc] Pass gcc's purity test
*sigh*
2020-03-03 10:59:01 +09:00
Bill Currie bb25057feb [qwaq] Quickly Workaround Access Qualifications
:)
2020-03-03 10:47:34 +09:00
Bill Currie c2138183dd [libr] Initialize SetIterator the right way
I'd written Set.[rh] after the big rewrite so never noticed the access
error.
2020-03-03 10:43:29 +09:00
Bill Currie 16223098e5 [qfcc] Fix ivar visibility
It was broken by the big rewrite and I forgot to fix it.
2020-03-03 10:42:05 +09:00
Bill Currie 50d39d64cb [qwaq] Link against build ruamoko libs, not installed 2020-03-03 09:30:20 +09:00
Bill Currie ed04e6fc23 [qfcc] Merge method lists instead of copying
This is for adding methods to classes and protocols via their interface,
not for adding methods by adding protocols (they still get copied).
Slightly more memory efficient.
2020-03-03 00:11:54 +09:00
Bill Currie 679744fc7d [libr] Fix incorrect bounds check on array insert 2020-03-03 00:11:07 +09:00
Bill Currie f025bd96d4 [qfcc] Copy self param when copying methods
Copying methods is done when adding protocols to classes (the current
use for adding regular methods is an incorrect solution to a different
problem). However, when a method is added to a class, the type of its
self parameter is set to be a pointer to the class. Thus, not only does
the method need to be copied, the self parameter does too, otherwise
the self parameter of methods added via protocols will have their type
set to be a pointer to the last class seen adding the protocol.

That is, if, while compiling the implementation for class A, but the
interface for class B is comes after the interface for class A, and both
A and B add protocol P, then all methods in protocol P will have self
pointing to B rather than A.

@protocol P
-method;
@end

@interface A <P>
@end

@interface B <P>
@end

@implementation A
-method	{} // self is B, not A!
@end
2020-03-02 23:46:26 +09:00
Bill Currie 8a4de6fea6 [qfcc] Fix segmentation fault for parameter errors 2020-03-02 22:38:12 +09:00
Bill Currie f6d650d473 [qfcc] Merge duplicate methods in interfaces
Duplicate methods in an interface (especially across protocols and
between protocols and the interface) are both harmless and even to be
expected. They certainly should not cause the compiler to demand
duplicate method implementations :)
2020-03-02 21:15:21 +09:00
Bill Currie e33d83fc9e [qfcc] Accept "struct foo; struct foo { ... };"
That is, do not treat structure definition after declaration to be a
redefinition.
2020-03-02 20:16:29 +09:00
Bill Currie d91289ea1b [qwaq] Remove unnecessary wrefresh calls 2020-03-02 18:43:27 +09:00
Bill Currie 33a07c0f6b [qwaq] Make command buffer larger for now
A small one should be fine once threading is working.
2020-03-02 18:30:58 +09:00
Bill Currie 6f1386fa0d [qwaq] Test out acs chars and the classes
Crashes due to flooding the command buffer, but otherwise works (with
larger buffer).
2020-03-02 18:29:31 +09:00
Bill Currie b9ab30ff59 [qwaq] Add mvwaddch and ACS support 2020-03-02 18:27:08 +09:00
Bill Currie a0c4d56668 [qwaq] Continue processing on void commands
If the last command in the buffer had no parameters, its length would be
only 2 and thus processing would stop before reading the command from
the buffer.
2020-03-02 18:19:41 +09:00
Bill Currie fa66e9fc2f [qwaq] Move queue handling into separate functions
This makes it so I need to edit only one place when I get threads
working. Also, it fixes some bugs (eg, panel creation wasn't implemented
correctly).
2020-03-02 18:15:31 +09:00
Bill Currie d88a091fc6 [qwaq] Use protocols to distinguish object abilities
Well, that took a fair bit more than it should have to get working: had
to implement the protocol support in qfcc and engine-side ruamoko.
2020-03-02 15:22:54 +09:00