[gamecode] Expose value_string as PR_Debug_ValueString

PR_Debug_ValueString prints the value at the given offset using the
provided type to format the string. The formatted string is appended to
the provided dstring.
This commit is contained in:
Bill Currie 2022-09-14 19:23:59 +09:00
parent 942ea22266
commit 98f773b0ed
2 changed files with 12 additions and 0 deletions

View file

@ -1984,6 +1984,9 @@ int PR_LoadDebug (progs_t *pr);
const char *PR_Debug_GetBaseDirectory (progs_t *pr, const char *file); const char *PR_Debug_GetBaseDirectory (progs_t *pr, const char *file);
void PR_Debug_Watch (progs_t *pr, const char *expr); void PR_Debug_Watch (progs_t *pr, const char *expr);
void PR_Debug_Print (progs_t *pr, const char *expr); void PR_Debug_Print (progs_t *pr, const char *expr);
const char *PR_Debug_ValueString (progs_t *pr, pr_ptr_t offset,
struct qfot_type_s *type,
struct dstring_s *dstr);
pr_auxfunction_t *PR_Debug_AuxFunction (progs_t *pr, pr_uint_t func) __attribute__((pure)); pr_auxfunction_t *PR_Debug_AuxFunction (progs_t *pr, pr_uint_t func) __attribute__((pure));
pr_auxfunction_t *PR_Debug_MappedAuxFunction (progs_t *pr, pr_uint_t func) __attribute__((pure)); pr_auxfunction_t *PR_Debug_MappedAuxFunction (progs_t *pr, pr_uint_t func) __attribute__((pure));
pr_def_t *PR_Debug_LocalDefs (progs_t *pr, pr_auxfunction_t *aux_function) __attribute__((pure)); pr_def_t *PR_Debug_LocalDefs (progs_t *pr, pr_auxfunction_t *aux_function) __attribute__((pure));

View file

@ -1168,6 +1168,15 @@ global_string (pr_debug_data_t *data, pr_ptr_t offset, qfot_type_t *type,
return dstr->str; return dstr->str;
} }
const char *
PR_Debug_ValueString (progs_t *pr, pr_ptr_t offset, qfot_type_t *type,
dstring_t *dstr)
{
pr_debug_data_t data = {pr, dstr};
value_string (&data, type, pr->pr_globals + offset);
return dstr->str;
}
static void static void
pr_debug_void_view (qfot_type_t *type, pr_type_t *value, void *_data) pr_debug_void_view (qfot_type_t *type, pr_type_t *value, void *_data)
{ {