[qwaq] Hook up the debugger modules

Now to write all the high level stuff. Wheeeee
This commit is contained in:
Bill Currie 2020-03-24 20:15:35 +09:00
parent 12f7b52fff
commit 32d77eabac
2 changed files with 28 additions and 9 deletions

View file

@ -53,6 +53,7 @@
#include "QF/zone.h"
#include "qwaq.h"
#include "qwaq-debug.h"
#define MAX_EDICTS 1024
@ -141,8 +142,10 @@ init_qf (void)
}
typedef void (*progsinit_f) (progs_t *pr);
static progs_t *
create_progs (void)
create_progs (progsinit_f *funcs)
{
progs_t *pr = calloc (1, sizeof (*pr));
@ -154,10 +157,9 @@ create_progs (void)
PR_Init_Cvars ();
PR_Init (pr);
RUA_Init (pr, 0);
Key_Progs_Init (pr); // FIXME not all threads
PR_Cmds_Init (pr); // FIXME not all threads
BI_Init (pr); // FIXME not all threads
QWAQ_EditBuffer_Init (pr); // FIXME not all threads
while (*funcs) {
(*funcs++) (pr);
}
return pr;
}
@ -183,7 +185,7 @@ load_progs (progs_t *pr, const char *name)
}
static void
spawn_progs (qwaq_thread_t *thread)
spawn_progs (qwaq_thread_t *thread, progsinit_f *funcs)
{
dfunction_t *dfunc;
const char *name = 0;
@ -192,7 +194,7 @@ spawn_progs (qwaq_thread_t *thread)
progs_t *pr;
thread->main_func = 0;
pr = thread->pr = create_progs ();
pr = thread->pr = create_progs (funcs);
if (thread->args.size) {
name = thread->args.a[0];
}
@ -321,6 +323,20 @@ done:
return qargs_ind;
}
static progsinit_f main_app[] = {
Key_Progs_Init,
PR_Cmds_Init,
BI_Init,
QWAQ_EditBuffer_Init,
QWAQ_Debug_Init,
0
};
static progsinit_f target_app[] = {
QWAQ_DebugTarget_Init,
0
};
int
main (int argc, char **argv)
{
@ -378,6 +394,8 @@ main (int argc, char **argv)
for (size_t i = 1, thread_ind = 0; i < thread_data.size; i++) {
qwaq_thread_t *thread = thread_data.a[i];
progsinit_f *app_funcs = target_app;
if (thread->args.size && thread->args.a[0]
&& strcmp (thread->args.a[0], "--qargs")) {
// skip the args set that's passed to qargs
@ -391,8 +409,9 @@ main (int argc, char **argv)
}
if (main_ind < 0) {
main_ind = i;
app_funcs = main_app;
}
spawn_progs (thread);
spawn_progs (thread, app_funcs);
}
if (main_ind >= 0) {
// threads might start new threads before the end is reached

View file

@ -3,7 +3,7 @@
#include "event.h"
enum {
typedef enum {
qe_debug_event = 0x0100,
} qwaq_debug_messages;