mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 02:41:30 +00:00
[qwaq] Add printf builtin to ease debugging
This commit is contained in:
parent
7f9a415cbc
commit
3defe50be6
3 changed files with 20 additions and 0 deletions
|
@ -1468,6 +1468,20 @@ bi_initialize (progs_t *pr)
|
|||
res->stdscr.win = stdscr;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_printf (progs_t *pr)
|
||||
{
|
||||
const char *fmt = P_GSTRING (pr, 0);
|
||||
int count = pr->pr_argc - 1;
|
||||
pr_type_t **args = pr->pr_params + 1;
|
||||
dstring_t *dstr = dstring_new ();
|
||||
|
||||
PR_Sprintf (pr, dstr, "bi_printf", fmt, count, args);
|
||||
if (dstr->str)
|
||||
Sys_Printf (dstr->str, stdout);
|
||||
dstring_delete (dstr);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_c_TextContext__is_initialized (progs_t *pr)
|
||||
{
|
||||
|
@ -1674,6 +1688,8 @@ static builtin_t builtins[] = {
|
|||
{"wborder", bi_wborder, -1},
|
||||
{"mvwblit_line", bi_mvwblit_line, -1},
|
||||
|
||||
{"printf", bi_printf, -1},
|
||||
|
||||
{"_c_TextContext__is_initialized", bi_c_TextContext__is_initialized, -1},
|
||||
{"_c_TextContext__max_colors", bi_c_TextContext__max_colors, -1},
|
||||
{"_c_TextContext__max_color_pairs", bi_c_TextContext__max_color_pairs, -1},
|
||||
|
|
|
@ -121,6 +121,8 @@ typedef struct panel_s *panel_t;
|
|||
@extern void wborder (window_t window,
|
||||
box_sides_t sides, box_corners_t corners);
|
||||
@extern void mvwblit_line (window_t window, int x, int y, int *wch, int len);
|
||||
|
||||
@extern void printf(string fmt, ...);
|
||||
#endif
|
||||
|
||||
#endif//__qwaq_curses_h
|
||||
|
|
|
@ -166,3 +166,5 @@ int curs_set (int visibility) = #0;
|
|||
int move (int x, int y) = #0;
|
||||
void wborder (window_t window, box_sides_t sides, box_corners_t corners) = #0;
|
||||
void mvwblit_line (window_t window, int x, int y, int *wch, int len) = #0;
|
||||
|
||||
void printf(string fmt, ...) = #0;
|
||||
|
|
Loading…
Reference in a new issue