Commit Graph

10149 Commits

Author SHA1 Message Date
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
Bill Currie 0e40366c7f [ruamoko] Implement class conformsToProtocol
Seems to work nicely, too :)
2020-03-02 15:21:10 +09:00
Bill Currie a906efac47 [ruamoko] Register protocols and their selectors 2020-03-02 15:20:34 +09:00
Bill Currie 5893bd7501 [qfcc] Catch erroneous negative builtin numbers
Setting a builtin number negative makes it a non-builtin function, but
possibly in the middle of another function. Not good.
2020-03-02 13:47:46 +09:00
Bill Currie 0db617719e [qfcc] Improve error messages for bad qc builtins
While global quakec functions could not be initialized to another
function, the error messages were rather obscure.
2020-03-02 13:47:46 +09:00
Bill Currie 78f552aa87 [ruamoko] Initialize static instances
This is one step closer to implementing conformsToProtocol. However,
protocols are not yet initialized correctly: they are not registered,
nor are their selectors.

While the static initializer list pointer was not written previously,
the module struct always came immediately after the symbols struct, and
the module version has so far always been 0. Thus, the list pointer is
correctly 0 for older progs and there's no need for a version bump.
2020-03-02 13:45:47 +09:00
Bill Currie bc4bea79cb [ruamoko] Remove a stale FIXME
This was fixed when pr_def_t was introduced. I missed the comment at the
time.
2020-03-02 13:00:33 +09:00
Bill Currie 9ccff74fcf [qfcc] Emit only one instance per protocol per module
This is actually a double issue: when a class implementing a protocol
used the protocol in @protocol(), not only would the protocol get
emitted as part of the class data specifying that the class conforms to
the protocol, a second instance would be emitted again when @protocol()
was used. On top of that, only the instance referenced by @protocol()
would be initialized. Now, both class emission and @protocol() get their
protocol def from the same place and thus only one, properly
initialized, protocol instance is emitted.
2020-03-02 10:55:46 +09:00
Bill Currie 8021613b79 [qfcc] Fix missing protocol method lists
The problem was an erroneous assumption that the methods had to be
defined. Any class implementing a protocol must implement (and thus
define) the methods, but a protocol declaration cannot: it merely
declares the methods, and it's entirely possible for a module to see
only the protocol definition and not any classes implementing the
protocol.
2020-03-02 10:52:09 +09:00
Bill Currie b6b7f9675f [qfcc] Emit static instance lists
For now, only protocols are in the list (gcc adds only static string
objects and qfcc doesn't do those yet, so not so far behind). qfprogs
dumps them.
2020-03-02 10:48:51 +09:00
Bill Currie 544d7de1ec [qfcc] Implement @protocol(foo)
Unlike gcc, qfcc requires foo to be defined, not just declared (I
suspect this is a bug in gcc, or even the ObjC spec), because allowing
forward declarations causes an empty (no methods) protocol to be
emitted, and then when the protocol is actually defined, one with
methods, resulting in two different versions of the same protocol, which
comments in the gnu objc runtime specifically state is a problem but is
not checked because it "never happens in practice" (found while
investigating gcc's behavior with @protocol and just what some of the
comments about static instance lists meant).
2020-03-02 10:42:26 +09:00
Bill Currie 254bf29bd4 [qfcc] Handle protocol forward declarations 2020-03-01 19:37:40 +09:00
Bill Currie 92cb3a5285 [qwaq] Flatten the hierarchy and do some cleanup 2020-03-01 18:25:02 +09:00
Bill Currie 80d9401eee [qfcc] Report errors for objects in function decls
The number of time's I've forgotten the * in a declaration in objective
code (probably thanks to C#'s lack of them).
2020-03-01 17:44:13 +09:00
Bill Currie b544321609 [qfcc] Catch deferences to incomplete types
Reporting an error is so much more helpful than segmentation fault.
2020-03-01 17:43:28 +09:00
Bill Currie 277c64a460 [qfcc] Correct a typo 2020-03-01 17:28:51 +09:00
Bill Currie 4e4b553cc3 [gamecode] Take care of missed type alias stuff 2020-03-01 16:20:23 +09:00
Bill Currie 4d076da4b6 [qwaq] Fix warning hidden by type alias bug 2020-03-01 16:15:33 +09:00
Bill Currie caa297b756 [qfcc] Remove type alias encoding
It proved to be too fragile in its current implementation. It broke
pointers to incomplete structs and switch enum checking, and getting it
to work for other things was overly invasive. I still want the encoding,
but need to come up with something more robust.a
2020-03-01 16:13:18 +09:00
Bill Currie 1033716b2b [qfcc] Fix some curly space 2020-03-01 13:53:18 +09:00
Bill Currie df2ed4b086 [qwaq] Move from tools to ruamoko
This fixes the dependency issues between qwaq and ruamoko. qwaq is
actually older than ruamoko. That little language feature test has come
a long way.

However, I'm considering moving to non-recursive make, but...
2020-03-01 00:55:15 +09:00
Bill Currie c079eb851b [qwaq] Start work on the actual app
It doesn't look good, but it does have panel based windows working, and
using objects. Won't build reliably right now due to qwaq being in tools
and thus building before ruamoko, but I'll fix that next.
2020-03-01 00:40:55 +09:00
Bill Currie 271d836cd2 [qfcc] Catch static class instances in structs 2020-02-29 21:09:24 +09:00
Bill Currie e93ca9d828 [qfcc] Fix infinite loop in linker 2020-02-29 20:13:25 +09:00
Bill Currie 8b6d05a4dd [qwaq] Ensure mouse motion reporting gets turned off
It seems that xterm automatically disables it when ncurses shuts down and
mate-terminal does not, or maybe a different version of something. Still,
good to clean up properly.
2020-02-29 16:36:23 +09:00
Bill Currie 75f4cebf0e Clean up after removal of uint32.h
I guess I forgot to check for its usage in header files, and the fact that
it didn't get cleaned out from being installed hid the error.
2020-02-29 16:11:07 +09:00
Bill Currie ae532870c4 [qwaq] Implement basic color support 2020-02-29 14:48:18 +09:00
Bill Currie ec4e9b326d [qwaq] Don't call wrefresh in cmd_mvwaddstr
There is now an implementation for wrefresh.
2020-02-29 14:43:08 +09:00
Bill Currie f5f50ae231 [qwaq] Make stdscr available to progs 2020-02-29 14:38:54 +09:00
Bill Currie 5e4677f8d5 [qwaq] Implement the immediately useful panel functions 2020-02-29 13:06:58 +09:00
Bill Currie 17005637ca [qwaq] Rename the internal function names
Now they reflect the curses functions they wrap. The externally visible
builtin names are not changed because the parameters are in x, y order
rather than curses' y, x order.
2020-02-29 12:52:13 +09:00
Bill Currie ea69921e6a [qwaq] Validate window before acquiring string
If the window is invalid and recovery is done, string ids will leak if
acquired before validation.

Afterwards, make the rest of the builtin wrappers consistent: extract
parameters, validate, [acquire resources], generate command.
2020-02-29 12:33:45 +09:00