add debugger window support via _RPT*; add regex
currently it's locked behind _MSC_VER, but anything that runs on Win32 should be able to use those functions as long as it has something that can pass as a debug window. also, add a non-wildcard-accepting version of showdebug for the dumpit() functions in dungeon.c and questpgr.c; this makes DEBUGFILES=* workable without being excruciatingly painful
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 extern.h $NHDT-Date: 1428806395 2015/04/12 02:39:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.455 $ */
|
||||
/* NetHack 3.5 extern.h $NHDT-Date: 1429135323 2015/04/15 22:02:03 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.464 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -749,7 +749,7 @@ E int FDECL(nhclose, (int));
|
||||
E void NDECL(really_close);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
E boolean FDECL(showdebug, (const char *));
|
||||
E boolean FDECL(debugcore, (const char *, boolean));
|
||||
#endif
|
||||
E void FDECL(read_tribute, (const char *,const char *,int));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 hack.h $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.52 $ */
|
||||
/* NetHack 3.5 hack.h $NHDT-Date: 1429136301 2015/04/15 22:18:21 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.59 $ */
|
||||
/* SCCS Id: @(#)hack.h 3.5 2008/03/19 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -12,20 +12,34 @@
|
||||
|
||||
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
|
||||
#ifdef DEBUG
|
||||
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
|
||||
# define showdebug(file) debugcore(file, TRUE)
|
||||
# define explicitdebug(file) debugcore(file, FALSE)
|
||||
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
|
||||
# ifdef _MSC_VER
|
||||
/* if we have microsoft's C runtime we can use these instead */
|
||||
# include <crtdbg.h>
|
||||
# define crtdebug(stmt) do { if (showdebug(__FILE__)) stmt; \
|
||||
_RPT0(_CRT_WARN,"\n"); } while (0)
|
||||
# define debugpline0(str) crtdebug(_RPT0(_CRT_WARN,str))
|
||||
# define debugpline1(fmt,arg) crtdebug(_RPT1(_CRT_WARN,fmt,arg))
|
||||
# define debugpline2(fmt,a1,a2) crtdebug(_RPT2(_CRT_WARN,fmt,a1,a2))
|
||||
# define debugpline3(fmt,a1,a2,a3) crtdebug(_RPT3(_CRT_WARN,fmt,a1,a2,a3))
|
||||
# define debugpline4(fmt,a1,a2,a3,a4) crtdebug(_RPT4(_CRT_WARN,fmt,a1,a2,a3,a4))
|
||||
# else
|
||||
/* these don't require compiler support for C99 variadic macros */
|
||||
# define debugpline0(str) ifdebug(pline(str))
|
||||
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
|
||||
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
|
||||
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
|
||||
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
|
||||
# define debugpline0(str) ifdebug(pline(str))
|
||||
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
|
||||
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
|
||||
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
|
||||
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
|
||||
# endif
|
||||
#else
|
||||
# define debugpline0(str) /*empty*/
|
||||
# define debugpline1(fmt,arg) /*empty*/
|
||||
# define debugpline2(fmt,a1,a2) /*empty*/
|
||||
# define debugpline3(fmt,a1,a2,a3) /*empty*/
|
||||
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
|
||||
#endif /*DEBUG*/
|
||||
# define debugpline0(str) /*empty*/
|
||||
# define debugpline1(fmt,arg) /*empty*/
|
||||
# define debugpline2(fmt,a1,a2) /*empty*/
|
||||
# define debugpline3(fmt,a1,a2,a3) /*empty*/
|
||||
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
|
||||
#endif /*DEBUG*/
|
||||
|
||||
#define TELL 1
|
||||
#define NOTELL 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 dungeon.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.39 $ */
|
||||
/* NetHack 3.5 dungeon.c $NHDT-Date: 1429135381 2015/04/15 22:03:01 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.49 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -80,7 +80,7 @@ dumpit()
|
||||
s_level *x;
|
||||
branch *br;
|
||||
|
||||
if (!showdebug(__FILE__)) return;
|
||||
if (!explicitdebug(__FILE__)) return;
|
||||
|
||||
for(i = 0; i < n_dgns; i++) {
|
||||
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i,
|
||||
|
||||
16
src/files.c
16
src/files.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1427337311 2015/03/26 02:35:11 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.141 $ */
|
||||
/* NetHack 3.5 files.c $NHDT-Date: 1429136302 2015/04/15 22:18:22 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.166 $ */
|
||||
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -3267,11 +3267,16 @@ assure_syscf_file() {
|
||||
|
||||
#ifdef DEBUG
|
||||
/* used by debugpline() to decide whether to issue a message
|
||||
from a partiular source file; caller passes __FILE__ and we check
|
||||
whether it is in the source file list supplied by SYSCF's DEBUGFILES */
|
||||
* from a partiular source file; caller passes __FILE__ and we check
|
||||
* whether it is in the source file list supplied by SYSCF's DEBUGFILES
|
||||
*
|
||||
* pass FALSE to override wildcard matching; useful for files
|
||||
* like dungeon.c and questpgr.c, which generate a ridiculous amount of
|
||||
* output if DEBUG is defined and effectively block the use of a wildcard */
|
||||
boolean
|
||||
showdebug(filename)
|
||||
debugcore(filename, wildcards)
|
||||
const char *filename;
|
||||
boolean wildcards;
|
||||
{
|
||||
const char *debugfiles, *p;
|
||||
|
||||
@@ -3314,7 +3319,7 @@ const char *filename;
|
||||
* attempt a wildcard match against each element, but that would be
|
||||
* overkill for the intended usage.]
|
||||
*/
|
||||
if (pmatch(debugfiles, filename))
|
||||
if (wildcards && pmatch(debugfiles, filename))
|
||||
return TRUE;
|
||||
|
||||
/* check whether filename is an element of the list */
|
||||
@@ -3327,6 +3332,7 @@ const char *filename;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /*DEBUG*/
|
||||
|
||||
/* ---------- BEGIN TRIBUTE ----------- */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 questpgr.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.18 $ */
|
||||
/* NetHack 3.5 questpgr.c $NHDT-Date: 1429135390 2015/04/15 22:03:10 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.26 $ */
|
||||
/* Copyright 1991, M. Stephenson */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -46,7 +46,7 @@ dump_qtlist() /* dump the character msg list to check appearance */
|
||||
{
|
||||
struct qtmsg *msg;
|
||||
|
||||
if (!showdebug(__FILE__)) return;
|
||||
if (!explicitdebug(__FILE__)) return;
|
||||
|
||||
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
|
||||
pline("msgnum %d: delivery %c",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 pcmain.c $NHDT-Date: 1427337317 2015/03/26 02:35:17 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.52 $ */
|
||||
/* NetHack 3.5 pcmain.c $NHDT-Date: 1429135416 2015/04/15 22:03:36 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.60 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -118,6 +118,17 @@ char *argv[];
|
||||
#endif
|
||||
boolean resuming = FALSE; /* assume new game */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* set these appropriately for VS debugging */
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); /* | _CRTDBG_MODE_FILE);*/
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
/*| _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW);*/
|
||||
/* use STDERR by default
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(_WIN32)
|
||||
startup();
|
||||
#endif
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;WIN32CON;DLB;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/NetHack.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\$(ConfigurationName)\$(ProjectName)\</AssemblerListingLocation>
|
||||
@@ -261,7 +261,7 @@
|
||||
<PreprocessorDefinitions>WIN32;WIN32CON;DLB;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/NetHack.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\$(ConfigurationName)\$(ProjectName)\</AssemblerListingLocation>
|
||||
@@ -410,6 +410,7 @@
|
||||
<ClCompile Include="..\src\worn.c" />
|
||||
<ClCompile Include="..\src\write.c" />
|
||||
<ClCompile Include="..\src\zap.c" />
|
||||
<ClCompile Include="..\sys\share\cppregex.cpp" />
|
||||
<ClCompile Include="..\sys\share\nhlan.c" />
|
||||
<ClCompile Include="..\sys\share\pcmain.c" />
|
||||
<ClCompile Include="..\sys\share\pcsys.c" />
|
||||
@@ -418,7 +419,6 @@
|
||||
<ClCompile Include="..\sys\winnt\ntsound.c" />
|
||||
<ClCompile Include="..\sys\winnt\nttty.c" />
|
||||
<ClCompile Include="..\sys\winnt\winnt.c" />
|
||||
<ClCompile Include="..\sys\share\cppregex.cpp" />
|
||||
<ClCompile Include="..\win\tty\getline.c" />
|
||||
<ClCompile Include="..\win\tty\topl.c" />
|
||||
<ClCompile Include="..\win\tty\wintty.c" />
|
||||
|
||||
@@ -650,6 +650,7 @@ copy ..\sys\winnt\defaults.nh ..\binary\defaults.nh
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sys\share\cppregex.cpp" />
|
||||
<ClCompile Include="..\win\tty\getline.c">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
||||
Reference in New Issue
Block a user