Merge branch 'keni-crdumplog' into NetHack-3.7

This commit is contained in:
nhkeni
2024-02-21 16:27:52 -05:00
14 changed files with 30 additions and 26 deletions

View File

@@ -199,6 +199,7 @@ steps:
sed -i '/^#[ ]*define CRASHREPORT/d' include/config.h
#sed -i '/^#[ ]*define DOAGAIN/d' include/config.h
sed -i '/^#[ ]*define DUMPLOG/d' include/config.h
sed -i '/^#[ ]*define DUMPLOG_CORE/d' include/config.h
#sed -i '/^#[ ]*define GDBPATH/d' include/config.h
#sed -i '/^#[ ]*define GREPPATH/d' include/config.h
sed -i '/^#[ ]*define INSURANCE/d' include/config.h

View File

@@ -262,8 +262,8 @@
#endif
#ifdef CRASHREPORT
# ifndef DUMPLOG
# define DUMPLOG // required to get ^P info
# ifndef DUMPLOG_CORE
# define DUMPLOG_CORE // required to get ^P info
# endif
# ifdef MACOS
# define PANICTRACE
@@ -726,9 +726,7 @@ typedef unsigned char uchar;
#endif /* LIVELOG */
#ifdef DUMPLOG
#ifndef DUMPLOG_MSG_COUNT
#define DUMPLOG_MSG_COUNT 50
#endif /* DUMPLOG_MSG_COUNT */
#define DUMPLOG_CORE
#ifndef DUMPLOG_FILE
#define DUMPLOG_FILE "/tmp/nethack.%n.%d.log"
/* DUMPLOG_FILE allows following placeholders:
@@ -745,5 +743,10 @@ typedef unsigned char uchar;
*/
#endif /* DUMPLOG_FILE */
#endif /* DUMPLOG */
#ifdef DUMPLOG_CORE
#ifndef DUMPLOG_MSG_COUNT
#define DUMPLOG_MSG_COUNT 50
#endif /* DUMPLOG_MSG_COUNT */
#endif
#endif /* CONFIG_H */

View File

@@ -917,7 +917,7 @@ struct instance_globals_s {
boolean shop_filter;
/* pline.c */
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
unsigned saved_pline_index; /* slot in saved_plines[] to use next */
char *saved_plines[DUMPLOG_MSG_COUNT];
#endif

View File

@@ -2356,7 +2356,7 @@ extern boolean autopick_testobj(struct obj *, boolean) NONNULLARG1;
/* ### pline.c ### */
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
extern void dumplogmsg(const char *);
extern void dumplogfreemessages(void);
#endif

View File

@@ -6611,7 +6611,7 @@ yn_function(
{
char res = '\033', qbuf[QBUFSZ];
struct _cmd_queue cq, *cmdq;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
unsigned idx = gs.saved_pline_index;
/* buffer to hold query+space+formatted_single_char_response */
char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
@@ -6653,7 +6653,7 @@ yn_function(
cmdq_add_key(CQ_REPEAT, res);
}
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
if (idx == gs.saved_pline_index) {
/* when idx is still the same as gs.saved_pline_index, the interface
didn't put the prompt into gs.saved_plines[]; we put a simplified

View File

@@ -775,7 +775,7 @@ const struct instance_globals_s g_init_s = {
/* pickup.c */
FALSE, /* shop_filter */
/* pline.c */
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
0U, /* saved_pline_index */
{ NULL }, /* saved_plines */
#endif

View File

@@ -537,7 +537,7 @@ submit_web_report(int cos, const char *msg, const char *why){
#endif // !WIN32
}
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
// config.h turns this on, but make it easy to turn off if needed
if(cos==1) {
int k;
@@ -1191,6 +1191,7 @@ dump_plines(void)
}
}
}
#endif /* DUMPLOG */
#ifdef CRASHREPORT
// lineno==0 gives the most recent message (e.g. "Do you want to call panic..."
@@ -1214,7 +1215,6 @@ get_saved_pline(int lineno){
return NULL;
}
#endif /* CRASHREPORT */
#endif /* DUMPLOG */
/*ARGSUSED*/
static void

View File

@@ -1787,7 +1787,7 @@ do_look(int mode, coord *click_cc)
if (found) {
/* use putmixed() because there may be an encoded glyph present */
putmixed(WIN_MESSAGE, 0, out_str);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
{
char dmpbuf[BUFSZ];

View File

@@ -17,7 +17,7 @@ static void execplinehandler(const char *);
#ifdef USER_SOUNDS
extern void maybe_play_sound(const char *);
#endif
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* keep the most recent DUMPLOG_MSG_COUNT messages */
void
@@ -205,7 +205,7 @@ vpline(const char *line, va_list the_args)
}
msgtyp = MSGTYP_NORMAL;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* We hook here early to have options-agnostic output.
* Unfortunately, that means Norep() isn't honored (general issue) and
* that short lines aren't combined into one longer one (tty behavior).

View File

@@ -1233,7 +1233,7 @@ freedynamicdata(void)
#ifdef USER_SOUNDS
release_sound_mappings();
#endif
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogfreemessages();
#endif
discard_gamelog();

View File

@@ -962,7 +962,7 @@ void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring)
if (msg) {
//raw_printf("msg='%s'", msg);
window->PutStr(ATR_NONE, QString::fromLatin1(msg));
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(msg);
#endif
} else if (msgs_saved) {
@@ -970,7 +970,7 @@ void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring)
for (int i = 0; i < msgs_strings->size(); ++i) {
const QString &nxtmsg = msgs_strings->at(i);
window->PutStr(ATR_NONE, nxtmsg);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(nxtmsg.toLatin1().constData());
#endif
}

View File

@@ -1044,7 +1044,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
stash_head = first_mesg, first_mesg = (nhprev_mesg *) 0;
last_mesg = (nhprev_mesg *) 0; /* no need to remember the tail */
initd = TRUE;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* this suffices; there's no need to scrub g.saved_pline[] pointers */
gs.saved_pline_index = 0;
#endif
@@ -1058,7 +1058,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
and those messages should have a normal turn value */
if (last_mesg) /* appease static analyzer */
last_mesg->turn = restoring_msghist ? (1L << 3) : gh.hero_seq;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(last_mesg->str);
#endif
} else if (stash_count) {
@@ -1081,7 +1081,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
/* added line became new tail */
if (last_mesg) /* appease static analyzer */
last_mesg->turn = mesg_turn;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(mesg->str);
#endif
free((genericptr_t) mesg->str);

View File

@@ -214,7 +214,7 @@ hooked_tty_getlin(
/* prevent next message from pushing current query+answer into
tty message history */
*gt.toplines = '\0';
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
} else {
/* needed because we've bypassed pline() */
dumplogmsg(gt.toplines);

View File

@@ -534,7 +534,7 @@ tty_yn_function(
(void) key2txt(q, rtmp);
/* addtopl(rtmp); -- rewrite gt.toplines instead */
Sprintf(gt.toplines, "%s%s", prompt, rtmp);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
ttyDisplay->inread--;
@@ -684,7 +684,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
restored ones are being put into place */
msghistory_snapshot(TRUE);
initd = TRUE;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* this suffices; there's no need to scrub saved_pline[] pointers */
gs.saved_pline_index = 0;
#endif
@@ -701,7 +701,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
/* move most recent message to history, make this become most recent */
remember_topl();
Strcpy(gt.toplines, msg);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
} else if (snapshot_mesgs) {
@@ -712,7 +712,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
for (idx = 0; snapshot_mesgs[idx]; ++idx) {
remember_topl();
Strcpy(gt.toplines, snapshot_mesgs[idx]);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
}