Commit graph

10842 commits

Author SHA1 Message Date
Bill Currie
6b9d4a747d [ruamoko] Add a builtin to quote strings
All unprintable chars are converted to either standard escape sequences
or \xHH.
2020-04-01 21:28:25 +09:00
Bill Currie
a09eabeb4d [qfcc] Fix some const attribute warnings
Try to anticipate gcc's warnings and it one-ups you :P
2020-04-01 21:17:13 +09:00
Bill Currie
41184bd97d [gamecode] Document the format state machine 2020-04-01 20:50:42 +09:00
Bill Currie
0e7c7640f4 [qwaq] Right-justify def value display
Now that *printf("%*.*s") works :)
2020-04-01 19:57:24 +09:00
Bill Currie
535a2363bb [ruamoko] Create a va_copy for progs
In testing variable fw/precision in PR_Sprintf, I got a nasty reminder
of the limitations of the current progs ABI: passing @args to another QC
function does not work because the args list gets trampled but the
called function's locals. Thus, the need for a va_copy. It's not quite
the same as C's as it returns the destination args instead of copying
like memcpy, but it does copy the list from the source args to a
temporary buffer that is freed when the calling function returns.
2020-04-01 19:48:05 +09:00
Bill Currie
a36f72f7b4 [gamecode] Support variable field width and precision 2020-04-01 19:45:33 +09:00
Bill Currie
7f4d2215e2 [gamecode] Accept EOS at end of conversion specifier 2020-04-01 18:32:30 +09:00
Bill Currie
17bb408b57 [qfcc] Clean up stray dags edges
Killed nodes can leave stray (dangling) edges that cause some confusion
in the dot graphs and may cause problems later on down the track, so
ensure there are no dangling edges.
2020-04-01 16:06:45 +09:00
Bill Currie
199b3e82d9 [qfcc] Add killer node to replacement node's edges
When an operand refers to a killed node, it needs to be evaluated AFTER
the killing node is evaluated. This fixes the double-alias bug.
2020-04-01 16:05:26 +09:00
Bill Currie
4c79c9ffaf [qfcc] Do a dags pre-pass to give operands leafs
The reason double-alias fails is when the double assignment occurs, the
int operands don't yet have leaf nodes and thus the nodes cannot be
killed. This doesn't fix the bug.
2020-04-01 16:03:12 +09:00
Bill Currie
842125faf8 [qfcc] Add a failing test for aliased live vars
I'm not sure if it's due more to doubles or unions, but the bug was
found via double. It seems the dags code generator doesn't see that the
assignment to the union's double field kills the two int fields.

The test passes when NOT optimizing.
2020-04-01 13:49:58 +09:00
Bill Currie
7f86fb5529 [gamecode] Rework PR_Sprintf to use a state machine
This makes it much easier to extend. There are even stubs for variable
field width and precision (not set yet).
2020-04-01 13:32:07 +09:00
Bill Currie
a7956c7311 [gamecode] Move format state into a state struct
This is the first step in reworking PR_Sprintf to use a state machine.
The goal is to make it more robust against errors and easier to extend
(eg, * width and precision).
2020-04-01 11:19:56 +09:00
Bill Currie
e9733416f4 [gamecode] Hide trace messages when debugger is attached 2020-04-01 00:09:34 +09:00
Bill Currie
bd7212a411 [qwaq] Pass debug target into the def views
Needed for any views that have to fetch additional data (strings,
fields, etc).
2020-04-01 00:03:53 +09:00
Bill Currie
c515d63d97 [qwaq] Get the locals view working
All because I forgot I went the unixy way for qdb_get_data.
2020-03-31 23:23:18 +09:00
Bill Currie
beecdcadbf [qwaq] Support resizing the table view 2020-03-31 22:03:56 +09:00
Bill Currie
0da92e33f6 [qwaq] Use TableView to show locals
This is much nicer (even though things aren't quite right yet)
2020-03-31 21:15:57 +09:00
Bill Currie
58acc483fd [gamecode] Save new string ref in return slot
This plugs the memory leak that caused qwaq to crash after resizing the
locals window a "few" times (several seconds of playing with the size).
2020-03-31 20:38:41 +09:00
Bill Currie
e2d1a0f7d2 [ruamoko] Tag object memory with the class name
This makes it a lot easier to see what's leaking.
2020-03-31 16:43:10 +09:00
Bill Currie
7ca3dc9db1 [qwaq] Fix some missed retain/release messages 2020-03-31 14:40:22 +09:00
Bill Currie
59481bdf61 [ruamoko] Report class name in obj_verror 2020-03-31 14:40:22 +09:00
Bill Currie
a1f67b5d6f [qwaq] Implement a very simple table view class
It's nowhere near as sophisticated as NSTableView, but this is text, not
graphics.
2020-03-31 14:40:22 +09:00
Bill Currie
e15f2097df [qwaq] Move scroll bar management into View
Putting it in Editor worked as a proof of concept, but it seems those
always turn out to need tweaking like this because the concept proves
itself to be generally worthwhile :P
2020-03-31 14:28:38 +09:00
Bill Currie
4bc6aab7ec [qwaq] Resize the scrollbar's draw buffer 2020-03-31 14:28:38 +09:00
Bill Currie
34706906f5 [qwaq] Allow views to be moved/resized without redraw
The move is to a specified point and resize to a specified size rather
than a delta.
2020-03-31 14:28:38 +09:00
Bill Currie
17da19b979 [qwaq] Set view owner when setting proxy view
This fixes the debug editor's redraw issues.
2020-03-31 01:22:54 +09:00
Bill Currie
5bb71c2089 [qwaq] Clean up some debug prints 2020-03-31 01:18:16 +09:00
Bill Currie
af64e36653 [qwaq] Get the scrollbar working nicely 2020-03-30 23:42:06 +09:00
Bill Currie
655ec3e02b [qwaq] Set event.when for mouseauto events 2020-03-30 23:41:20 +09:00
Bill Currie
2e1bddb94c [qwaq] Catch adding bad messages to listeners
Better an informative error than a "null function" error.
2020-03-30 22:51:18 +09:00
Bill Currie
1a34f3663a [qwaq] Hook up the scroll bar
It's mostly working now, just some issues with clicking on the bar and
the thumb tab doesn't work.
2020-03-30 22:50:29 +09:00
Bill Currie
b8005a99c9 [qwaq] Add a scroll bar to the debug source window
It's not quite hooked up properly yet (Editor ignores the message), but
it did help get ScrollBar displaying properly.
2020-03-30 22:02:58 +09:00
Bill Currie
02f8cc9760 [qwaq] Fix a bunch of issues with the scrollbar
Leaking memory. And worse, it wasn't drawing its buttons (group wasn't
setting view contexts) and then the buttons were in the wrong place, so
had to add a backing buffer for the buttons.
2020-03-30 22:01:17 +09:00
Bill Currie
dbbdb31cb1 [qwaq] Add a synchronous printf command
This puts a print command (to Sys_Printf) into the queue making it
easier to check command sequences since regular printf is asynchronous
with the stream.
2020-03-30 21:58:06 +09:00
Bill Currie
5bc57518b7 [qwaq] Add a scrollbar view 2020-03-30 20:29:48 +09:00
Bill Currie
dff0fd983c [qfcc] Fix missed t enum cleanup 2020-03-30 19:02:54 +09:00
Bill Currie
0de9b02726 [qfcc] Catch declarations of arrays of class
They're still static instances.
2020-03-30 19:02:41 +09:00
Bill Currie
101574e697 [qwaq] Pretend to call super init in edit buffer
This fixes the early deallocation of the edit buffer.
2020-03-30 16:58:36 +09:00
Bill Currie
c23c68cf7f [ruamoko] Allow builtins to inc/dec retain count
Needed for classes that are implemented entirely in C.
2020-03-30 16:58:36 +09:00
Bill Currie
8a7fbdfc9f [qwaq] Rework allocation to use retain/release
It currently dies when single stepping or exiting due to EditBuffer's
retain count not getting incremented when initialized. This is because
EditBuffer is initialized in C and thus does not call Object's -init.
2020-03-30 16:58:36 +09:00
Bill Currie
d7df2fa63d [qwaq] Fix library dependencies
Forgot to add them.
2020-03-30 16:27:47 +09:00
Bill Currie
0a63d0a0de [libr] Fix loop counter in removeObjectNoRelease
It would do 4G iterations if count was 0.
2020-03-30 16:27:36 +09:00
Bill Currie
6d3fadfe6e [qwaq] Move local defs viewer to its own class
While trying to build a view without deriving from it was a neat idea,
it doesn't work so well because a view really needs to know how to draw
itself. This even fixes the segfault when stepping past the end of the
program.
2020-03-30 13:42:31 +09:00
Bill Currie
1c13339bbe [qwaq] Create a type encoding class
For now it just manages type encodings via their encoding string,
ensuring types are fetched from the target only once, if at all (may
already have the type due to it being common).
2020-03-30 12:43:02 +09:00
Bill Currie
ddec80edc1 [qfcc] Make type encoding union anonymous
I'd do more, but things get messy with direct access to unions that I
want to be anonymous.
2020-03-30 11:10:05 +09:00
Bill Currie
eccf1cb962 [qwaq] Move the debug builtin bindings 2020-03-30 09:38:22 +09:00
Bill Currie
6ff5b5c101 [qwaq] Clean up the qwaq directory
Things were getting rather cluttered with everything being qwaq-* and
all in one directory. Now most have lost the qwaq- prefix and have been
moved into subdirectories (non-recursive make).
2020-03-30 02:34:08 +09:00
Bill Currie
4c5ab07347 [qwaq] Remove obsolete screen class 2020-03-30 00:58:25 +09:00
Bill Currie
d4de1d7418 [qfcc] Do full type encoding relocation early
Because type aliases need to be unaliased, the type pointers in the type
encodings need to be correct when it comes to linking defs and
functions. This fixes the linking errors in ruamoko/game.
2020-03-29 18:19:36 +09:00