Commit graph

665 commits

Author SHA1 Message Date
Bill Currie
6e636a27d0 [renderer] Continue the job of merging SCR_UpdateScreen
I think this is probably as merged as it will get (though the update
callbacks can probably do with some merging).
2021-01-11 16:57:31 +09:00
Bill Currie
37b6d11c01 [ruamoko] Add binding for str_upper
I can't believe I didn't do that when I did str_lower.
2021-01-05 18:24:18 +09:00
Bill Currie
e1e2a0e712 [ruamoko] Add a wrapper for PL_Line
Makes error reporting in rua code easier.
2020-12-23 21:52:42 +09:00
Bill Currie
ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie
8290e3800f [qwaq] Ensure main thread return code gets returned
Needed for catching vkgen errors during the build.
2020-07-16 22:14:19 +09:00
Bill Currie
7a478b4ce7 [libr] Make PLItem more useful
I can't say that I like what's there even now, but at least PLItem can
be used without a lot of casting. Really, Ruamoko needs dictionary and
string classes so reading a property list can build more natural object
trees rather than this mess from when I knew too little.
2020-07-05 16:53:35 +09:00
Bill Currie
1914fa2756 [qwaq] Use full file path for file search
Fixes the memory leak (over 300 editors...)
2020-07-05 16:53:35 +09:00
Bill Currie
225ee0ed3c [qwaq] Use an actual condition variable for control
I think I wasn't sure at the time whether the simple variable was
required for pthread_cond_wait (and friends) to work properly, but it
is: the time between the target posting the debug event and the target
waiting on the condition variable turns out to sometimes be enough for
the debugger to handle the event and signal the target to continue,
resulting in the target waiting on a signal that will never come because
another debug event will not be sent by the target until AFTER it has
exited from the debug handler.
2020-07-05 16:53:35 +09:00
Bill Currie
1910941426 [qwaq] Handle key events differently when running
Pressing F8 (or n) while the debug target was running would cause it to
stop at that point. While it's certainly desirable to stop a runaway
target on demand, that should be with a different input. Now, commands
that start the target running are ignored while the target is running.
No commands for when the target is running have been implemented yet,
but the provision is there.
2020-07-05 16:53:35 +09:00
Bill Currie
64100efe78 [qwaq] Fix a typo 2020-07-05 16:53:35 +09:00
Bill Currie
7f96b0fbed [qwaq] Fix incorrect setting of progs argc/argv 2020-06-28 18:30:01 +09:00
Bill Currie
aa8aaaaca9 [build] Support silent rules for qfcc 2020-06-26 10:52:06 +09:00
Bill Currie
c2559c7511 [qwaq] PR_RunPostLoadFuncs for qwaq-x11
Same issue as for the menus. But now I know why PR_LoadProgsFile is used
instead of PR_LoadProgs (at least for qwaq): avoidance of the gamedir
restriction (however, the menus are supposed to be restricted).
2020-06-25 19:38:33 +09:00
Bill Currie
86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie
6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie
54f2e417dc [ruamoko] Fix daft str_str abi
Returning a string was a bad idea as it makes str_str difficult to use
with str_mid. (actually, iirc, it was the only reason I moved all
strings into progs memory... hmm).
2020-04-08 21:54:41 +09:00
Bill Currie
b7b8df0801 [ruamoko] Add str_lower builtin
This returns a string with all chars lower-cased.
2020-04-08 21:53:53 +09:00
Bill Currie
d88c1e2f40 [libr] Fix missing alias meta name 2020-04-04 15:46:37 +09:00
Bill Currie
e80344c58e [qwaq] Use full file path for loading source files 2020-04-04 14:34:18 +09:00
Bill Currie
6291a3c503 [qwaq] Hold the editor filename
It may be an ephemeral string.
2020-04-04 14:33:56 +09:00
Bill Currie
63714c7c55 [qwaq] Add builtin to get a file's full path
If the file's base directory cannot be found, the file name is returned
as-is.
2020-04-04 12:51:42 +09:00
Bill Currie
686fc4c43e [qwaq] Guard qwaq_debug_data with a pthread cond
I should have realized this would be prone to races.
2020-04-04 12:23:28 +09:00
Bill Currie
d69db50cf9 [qfcc] Remove path stripping
It never really helped sort out the path issues when using build
directories. It worked well enough for single directory projects, but
things got messy very quickly, especially when mixing ruamoko libs with
external progs. A better method based on dwarf is coming.
2020-04-03 00:50:06 +09:00
Bill Currie
9b1ce44fda [qwaq] Fix some issues with fetching type encodings
Now struct defs show FIXME instead of void data.
2020-04-02 19:31:11 +09:00
Bill Currie
63caa5794d [qwaq] Implement step-over tracing
I decided that stopping in between function calls that are on the same
line is a good thing as it gives a chance to skip over the first but
step into the second.
2020-04-02 17:44:53 +09:00
Bill Currie
c09f57c39e [gamecode] Delay .ctor calls if debugging
This allows a debugger to do any symbol lookups and other preparations
between loading progs and the first code execution. .ctors are called as
per normal if debug_handler is not set.
2020-04-02 17:39:11 +09:00
Bill Currie
ea1e85905c [qwaq] Implement source-level stepping
Now the debugger stops only when the source line has changed or the
statement address is stuck.
2020-04-02 13:07:50 +09:00
Bill Currie
7e51f26b10 [qwaq] Move all the def views into a subdirectory
More declutter.
2020-04-02 13:06:31 +09:00
Bill Currie
6d8bc395f4 [qwaq] Make debug event data available 2020-04-02 12:30:59 +09:00
Bill Currie
118fba8df5 [qwaq] Cope with functions that don't have locals
In this case, .ctor functions.
2020-04-02 00:51:22 +09:00
Bill Currie
1d5058d267 [qwaq] Move progs create and load into the threads
While this does answer the question of how I'll go about restarting the
target progs (when I get to that point), it was required just to start
full-on ruamoko progs because .ctor was getting run in the main thread
and blocking due to trace.
2020-04-02 00:11:47 +09:00
Bill Currie
d9668a1185 [qwaq] Silence some more debug
I was wondering where those sprintfs were going
2020-04-02 00:11:34 +09:00
Bill Currie
154da7653d [qwaq] Quote the string value before display 2020-04-01 21:29:42 +09:00
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
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
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
7ca3dc9db1 [qwaq] Fix some missed retain/release messages 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
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
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
1eef2a8b5e [qfcc] Implement type aliasing again
When a type is aliased, the alias has two type chains: the simple type
chain with all other aliases stripped, and the full type chain. There
are still plenty of bugs in it, but having the clean type chain takes
care of the major issue that was in the previous attempt as only the
head of the type-chain needs to be skipped for type comparison.

Most of the bugs are in finding the locations where the head needs to be
skipped.
2020-03-28 12:10:23 +09:00
Bill Currie
8997c81bd1 [qwaq] Implement rectangular region clearing
You'd think ncurses would have this, but I guess it's too
window-oriented.
2020-03-28 09:41:54 +09:00
Bill Currie
1efbb2ab49 [cl_menu] Remove a stale FIXME 2020-03-27 22:12:45 +09:00
Bill Currie
09d3e1b59f [qwaq] Remove extern from function prototypes
Yay.
2020-03-27 18:17:24 +09:00
Bill Currie
b2de2a9f3b [qwaq] Display values for simple defs
Mostly works, but need to sort out clearing the view without clearing
the window (silly curses and its full-line clears)
2020-03-26 21:01:39 +09:00
Bill Currie
8dcb3fefb3 [qwaq] Offset position when forwardning mvaddstr 2020-03-26 20:31:14 +09:00
Bill Currie
adb7b018d9 [qwaq] Improve focus setting
The view is recorded as having focus but is not given focus until the
parent view is actually in focus. This fixes the locals view not having
focus at startup and thus blocking F7.
2020-03-26 18:27:02 +09:00
Bill Currie
b2814700b9 [qwaq] Hook up locals view for events
The same debugger method is used because the idea is that all the
window in a group respond to the same commands in general.
2020-03-26 18:25:26 +09:00
Bill Currie
bd8d09479f [qwaq] Start work on displaying local defs
The names show for the first function, but there are problems after
that.
2020-03-26 18:25:26 +09:00
Bill Currie
6ec7b96693 [qwaq] Initialize onEvent
sigh
2020-03-26 18:25:26 +09:00
Bill Currie
48f41142f5 [qwaq] Add function to get a string from the target 2020-03-26 18:14:20 +09:00
Bill Currie
90d89e8874 [qwaq] Move onEvent into View
In the end, it did make sense since it seems to facilitate MVC nicely.
2020-03-26 17:28:38 +09:00
Bill Currie
91c5283af5 [build] Fix ruamoko/gui's auto dependencies
Changing str_free's return type highlighted that I'd missed an edit when
I did the big ruamoko build cleanup.

Also silence the sed/mv noise now that things are working nicely.
2020-03-26 16:53:53 +09:00
Bill Currie
45d23ce521 [libr] Add bindings for new string functions
And correct str_free's return type.
2020-03-26 16:49:09 +09:00
Bill Currie
e893421dba [qwaq] Get context from owner instead of prev view
The previous view might be nil, which would result in the new view not
getting a context.
2020-03-26 14:46:48 +09:00
Bill Currie
e018f5cf71 [qwaq] Clean up Editor's event forwarding
Much less clunky with that container object. With this, I think it will
be useful moving the forwarding into View. Still unsure on that, though.
2020-03-26 14:16:58 +09:00
Bill Currie
aac732fc63 [qwaq] Support an actual parameter for listeners 2020-03-26 14:16:07 +09:00
Bill Currie
983a7422db [libr] Add a two-object Array perform method
I decided it was worth doing after all. This cleans up event forwarding
in qwaq.
2020-03-26 14:14:04 +09:00
Bill Currie
6e74f2a03f [qwaq] remove @ from externs
I had forgotten that extern worked and that @extern was for headers that
might be compiled in traditional or extended modes.
2020-03-26 13:30:33 +09:00
Bill Currie
a28e7417e6 [qwaq] Make traceon and traceoff always available
Tired of adding and removing them all the time.
2020-03-26 13:27:53 +09:00
Bill Currie
30b97af65a [qwaq] Actually send on receive/release focus messages
Noticed while tracking down the proxy view switch issue.
2020-03-26 13:21:05 +09:00
Bill Currie
dbb3802740 [qwaq] Transfer context to new view in proxy
This fixes the broken source window on file change.
2020-03-26 13:20:10 +09:00
Bill Currie
2d5df34234 [gamecode] Add VM enter/exit events
And rename prd_exit to prd_terminate (the idea is the host will
terminate the VM). This makes it possible for the debugger to pause the
VM before any code, even a builtin function, is executed. Breaks the
debugger source window, but only because it's not updating on file
change (I think).
2020-03-26 12:30:32 +09:00
Bill Currie
1bd8e2ee85 [gamecode] Add a param pointer to debug_handler
I decided I want events for VM enter/exit but enter needs to somehow
pass the function which will be executed (even if a builtin). A generic
void * param seemed the best idea, which meant the error string could be
passed via the param instead of a "global" string in the progs struct.
2020-03-26 11:44:02 +09:00
Bill Currie
35bb3a3854 [qwaq] Raise windows when clicked 2020-03-26 11:18:00 +09:00
Bill Currie
af0333a172 [qwaq] Ensure super's handleEvent is called
This fixes the inability to single-step (debug window couldn't regain
focus).
2020-03-26 11:04:57 +09:00
Bill Currie
1f8301774c [qwaq] Fix over-consumption of editor events
This lets the window scroll again.
2020-03-26 09:19:22 +09:00
Bill Currie
fd73daea4b [qwaq] Correct mangled params to qwaq_mvwvprintf 2020-03-26 09:11:56 +09:00
Bill Currie
22d173068b [qwaq] Make a start on a locals viewer
It's just a data dump for now. Also, found a bug...
2020-03-26 09:11:39 +09:00
Bill Currie
e579ffcb00 [qwaq] Add functions to get functions by number 2020-03-26 09:03:44 +09:00
Bill Currie
115541877a [qwaq] Set up an application color palette
Nothing special, just all the combinations of the 8 colors
2020-03-26 09:01:39 +09:00
Bill Currie
3ea16c2764 [qwaq] Add support for getting data, defs and functions
This will allow for really probing the target progs.
2020-03-25 22:39:17 +09:00
Bill Currie
513bb868fc [qfcc] Remove unsigned define
I had forgotten that qfcc supports the keyword, just not the type yet.
2020-03-25 22:37:38 +09:00
Bill Currie
1f8cc7186c [qfcc] Hide "function" type behind an @
I'm not sure it's all that useful and thus it clutters the namespace.
2020-03-25 21:04:22 +09:00
Bill Currie
6f7ddf52ac [gamecode] Add an exit debug event type
The VM never sends it because it cannot know if its exit is program exit
or just sub-program exit, but it's available for host systems to send.
2020-03-25 18:28:28 +09:00