Bill Currie
7bcfd2f2be
[gamecode] Move file_hash into debug resources
...
I don't remember why I didn't do this earlier when I thread-safed progs.
2020-04-03 22:39:27 +09:00
Bill Currie
fbbe144399
[gamecode] Clean up some stray "struct"
...
Left over from moving debug data from progs.h to pr_debug.c
2020-04-03 22:35:55 +09:00
Bill Currie
17871b979d
[ruamoko] Implement obj_calloc correctly
...
Forgetting to multiply by the second term leads to not good things.
2020-04-02 19:29:54 +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
f90613bc3a
[gamecode] Rename fields in pr_stack_t
...
s and f are a little too succinct.
2020-04-02 15:00:01 +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
41184bd97d
[gamecode] Document the format state machine
2020-04-01 20:50:42 +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
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
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
59481bdf61
[ruamoko] Report class name in obj_verror
2020-03-31 14:40:22 +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
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
8b1e4eea58
[qfcc] Bring back the core of type aliasing
...
No aliasing is done yet, but most of the infrastructure is there again.
2020-03-27 12:27:46 +09:00
Bill Currie
58ebbb147d
[ruamoko] Add some new string builtins
...
Wrappers for hold, valid and mutable. I have no idea why I didn't think
of wrapping string validation years ago.
2020-03-26 16:39:21 +09:00
Bill Currie
1586df4dfc
[gamecode] Make it possible to check string mutability
2020-03-26 16:38:09 +09:00
Bill Currie
ec82d6b027
[gamecode] Add support for holding ephemeral strings
...
PR_HoldString converts ephemeral (temp and return) strings to dynamic
strings. This makes dealing with strings in progs a little easier.
2020-03-26 16:36:29 +09:00
Bill Currie
b4874f7d9b
[gamecode] Make PR_FreeString a little more forgiving
...
It treats only strings that are actually invalid as invalid. That is,
now it is safe to "free" a static string: it's just a no-op.
2020-03-26 15:48:04 +09:00
Bill Currie
22e2695f80
[gamecode] Add VISIBLE to some missed functions
2020-03-26 15:36:46 +09:00
Bill Currie
6e473dc8f2
[ruamoko] Return nil IMP for nil method
...
Fixes a segfault.
2020-03-26 14:13:05 +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
4cef9792f4
[util] Make hash-tables semi-thread-safe
...
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie
0ad9f559ea
[ruamoko] Move some string functions
...
sprintf, vsprintf and strlen now in rua_strings, and strlen now returns
int like it should.
2020-03-25 00:04:20 +09:00
Bill Currie
c945c42989
[gamecode] Fix some silly errors
...
I forgot to compile-test :(
2020-03-24 23:16:25 +09:00
Bill Currie
d867a1a9f1
[gamecode] Allow watch-point to be updated
...
With the watch-point address cached in a local var, it was not possible
to update the watch-point while the progs were executing.
2020-03-24 19:45:39 +09:00
Bill Currie
713150b41a
[gamecode] Add debug hooks to the VM engine
...
While there was a breakpoint hook, it was for only breakpoints and more
was needed. Now there's a generic hook that is called for tracing,
breakpoints, watch points, runtime errors and VM errors, with the
"event" type passed as the first parameter and a data pointer in the
second.
2020-03-24 19:45:10 +09:00
Bill Currie
1d6843d7f0
[gamecode] Improve watchpoint handling a little
...
Mostly just update the old value if the condition didn't trigger.
2020-03-24 13:26:35 +09:00
Bill Currie
753d183d82
[gamecode] Be more informative with function calls
...
PR_EnterFunction and PR_LeaveFunction now print the
entered/left/returned function when tracing. Makes debugging obj code
much easier.
2020-03-24 13:24:55 +09:00
Bill Currie
d0c8d75e92
Clean up unnecessary includes of signal.h
2020-03-23 16:18:08 +09:00
Bill Currie
9986b57a77
[console] Use sig_atomic_t for SIGWINCH
...
If it's not defined on other platforms, something can be done in
config.h
2020-03-23 16:16:50 +09:00
Bill Currie
178c8dec85
[console] Fix server console resize
...
I goofed when doing the win32 fixes
2020-03-23 16:01:07 +09:00
Bill Currie
eb386826d3
[util] Fix some missed signal calls
...
*sigh*
2020-03-23 15:28:12 +09:00
Bill Currie
a9c6974fc7
[audio] Quieten jack about xruns
...
They messages are annoying at the moment, but I will want them when I
get around to chasing down the root cause, so hidden behind a developer
mask.
2020-03-23 15:19:05 +09:00
Bill Currie
4a61ff0d35
[util] Switch to using sigaction for signal handling
...
This allows for much more consistent semantics when dealing with
signals.
2020-03-23 15:15:39 +09:00
Bill Currie
4dbf280012
[util] Add a means to open a gap in a text buffer
...
for loading files into the buffer.
2020-03-22 20:19:25 +09:00
Bill Currie
28f50d2719
Add function key defs up to F48
...
This allows for the four combinations of shift and control. Not
bothering with alt because alt-f4 closes my xterm (bbkeys from the looks
of it: it grabs a bunch of Mod1-* keys).
2020-03-22 13:46:27 +09:00
Bill Currie
88b4046632
[util] Pass a data pointer to shutdown functions
...
And clean up the mess.
2020-03-22 00:57:54 +09:00
Bill Currie
d2f03e8a64
[util] Fix darray test for gcc purity
2020-03-20 12:59:25 +09:00
Bill Currie
966bd267c5
Add a set of macros for dynamic arrays
...
Includes docs and test cases.
2020-03-20 12:59:25 +09:00
Bill Currie
0cbe438ac1
[util] Make va slight robust against chained use
...
va now cycles through a set of four dstrings rather than using just the
one. This allows for some simple chaining of va usage.
2020-03-17 15:05:58 +09:00
Bill Currie
b544a052bf
[gamecode] Bail if PR_SearchDefs is given 0 defs
...
Fixes the hang when searching for a field in progs that don't have any.
2020-03-16 14:24:48 +09:00
Bill Currie
e3a1413ad3
[gamecode] Tweak output for lea
2020-03-15 10:06:37 +09:00
Bill Currie
99f89840f9
[gamecode] Show containing def and relative offset
...
No more guessing when accessing structure field members. Next is ivars,
I guess.
2020-03-15 02:51:29 +09:00
Bill Currie
3d62a7f253
[gamecode] Use fuzzy bsearch to find defs by address
...
The idea is to find th def that contains the address. Had to write my
own bsearch (well... lifted from wikipedia) because libc's is exact. The
defs are assumed to be sorted (which qfcc now ensures when it writes
progs and sym files).
2020-03-15 02:48:13 +09:00