MCPcopy Create free account
hub / github.com/NetHack/NetHack / trace_add_menu

Function trace_add_menu

win/chain/wc_trace.c:450–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void
451trace_add_menu(
452 void *vp,
453 winid window, /* window to use, must be of type NHW_MENU */
454 const glyph_info *glyphinfo, /* glyph plus glyph info to display with item */
455 const anything *identifier, /* what to return if selected */
456 char ch, /* keyboard accelerator (0 = pick our own) */
457 char gch, /* group accelerator (0 = no group) */
458 int attr, /* attribute for string (like tty_putstr()) */
459 int clr, /* color for string */
460 const char *str, /* menu string */
461 unsigned int itemflags) /* itemflags such as marked as selected */
462{
463 struct trace_data *tdp = vp;
464
465 char buf_ch[10];
466 char buf_gch[10];
467
468 if (isprint(ch)) {
469 sprintf(buf_ch, "'%c'(%d)", ch, ch);
470 } else {
471 sprintf(buf_ch, "(%d)", ch);
472 }
473
474 if (isprint(gch)) {
475 sprintf(buf_gch, "'%c'(%d)", gch, gch);
476 } else {
477 sprintf(buf_gch, "(%d)", gch);
478 }
479
480 if (str) {
481 fprintf(wc_tracelogf,
482 "%sadd_menu(%d, %d, %u, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
483 window, glyphinfo->glyph, glyphinfo->gm.glyphflags, (void *) identifier,
484 buf_ch, buf_gch, attr, str, (int) strlen(str), itemflags);
485 } else {
486 fprintf(wc_tracelogf,
487 "%sadd_menu(%d, %d, %u, %p, %s, %s, %d, NULL, %u)\n", INDENT,
488 window, glyphinfo->glyph, glyphinfo->gm.glyphflags, (void *) identifier,
489 buf_ch, buf_gch, attr, itemflags);
490 }
491
492 PRE;
493 (*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyphinfo,
494 identifier,ch, gch, attr, clr, str, itemflags);
495 POST;
496}
497
498void
499trace_end_menu(

Callers

nothing calls this directly

Calls 2

isprintFunction · 0.85
fprintfFunction · 0.85

Tested by

no test coverage detected