Update dlb_main to use the revised vms_basename() for #if VMS in
case it issues a usage message.
Change recover to use similar setup, but the vms-specific bit is
commented out because I'm not sure whether the necessary routine
is being linked with it.
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.
If you want to try building on a platform that doesn't offer those
two functions, these are available:
define NOT_C99 /* to make some non-C99 code available */
define NEED_INDEX /* to define a macro for index() */
define NEED_RINDX /* to define a macro for rindex() */
I tried to reproduce #812 so that I could check whether the suggested
fix worked but I discovered that external 'recover' was broken by the
coordxy changes.
The fix is trivial but I haven't gone back to #812.
One of the drivers of this change was that screen coordinates require a
type that can hold values greater than 127. Parameters to the window
port routines require a large type in order to be able to have values
a fair bit larger than COLNO and ROWNO passed to them, particularly for
their use to the right of the map window.
This splits the uses of xchar into 3 different situations, and adjusts
their type and size:
xchar
|
-----------------------
| | |
coordxy xint16 xint8
coordxy: Actual x or y coordinates for various things (moved to 16-bits).
xint16: Same data size as coordxy, but for non-coordinate use (16-bits).
xint8: There are only a few use cases initially, where it was very
plain to see that the variable could remain as 8-bits, rather
than be bumped to 16-bits. There are probably more such cases
that could be changed after additional review.
Note: This first changed all xchar variables to coordxy. Some were
reviewed and got changed to xint16 or xint8 when it became apparent that
their usage was not for coordinates.
This increments EDITLEVEL in patchlevel.h
This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:
date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.
pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.
onames.h dependency and its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.
artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.
makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.
The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
makedefs -d (database)
makedefs -r (rumors)
makedefs -h (oracles)
makedefs -s (epitaphs, engravings, bogusmons)
date.c
Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)
nethack --dumpenums (optional, but on by default)
Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.
Uncomment #define NODUMPENUMS in config.h to disable this.
The updates to sys/windows/Makefile.gcc have not been tested yet.
recover had deviated somewhat from NetHack in its
file expectations:
1) A couple of 3.7 fields needed to be accommodated.
2) hard-coded file size values had deviated.
The file sizes are now in an added header file named "filesize.h",
which is included at the bottom of config.h.
There will likely be another commit to write the filename size ahead
of the file name so that the precise number of characters can be read,
but since that will break existing saves, it can go in along with another
save-breaking commit.
This commit doesn't not alter savefiles written by nethack so does not
require an editlevel bump. It does alter the read-in expectation in
recover to match the game and this get recover working again.
Moved the code page 437 mapping table to winnt.c so that it could be
used in window and console clients.
Added check that fonts support unicode values we use from code page 437.
Use unicode to draw text if font supports it otherwise use ASCII.
Change lev_comp's add_opvars() to be like pline(), where there's a
single visible opening brace and a second one hidden in VA_DECL2
that introduces a nested block, plus a single visible closing brace
with a hidden one in VA_END() to close the nested block. This
addresses the erroneous report (sent directly to devteam, so no #H
number, subject "missing '{' in util/lev_main.c:634") that the code
for !USE_STDARG/!USE_VARARGS in add_opvars() wouldn't compile.
Also, fix the part of "#H5778: file descriptor leaks" dealing with
util/recover.c -- an open file not being closed after various errors.
I didn't take responsibility for this entry in the bugzilla list
since the report includes similar problems in other code that's not
addressed here.
And a blast from the past: some reformatting fixups in recover.c.
The most interesting bit is for a block of dead code....
I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.
To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
> Oops:
>
> "NetHack.exe - Entry Point Not Found
>
> The procedure entry point Process32Next could not be located in the dynamic link
> library KERNEL32.dll."
>
> And the program refuses to run. Same goes for NetHackW.exe.
>
> Windows NT 4 (to be precise: 4.00.1381, SP6)
> IE 5.0 (to be precise: 5.00.2919.6307)
>
> The Help for Process32Next shows the following compatibility list:
> QuickInfo
> Windows NT: Requires version 5.0 or later.
> Windows: Requires Windows 95 or later.
> Windows CE: Unsupported.
> Header: Declared in tlhelp32.h.
> Import Library: Use kernel32.lib.
It turns out that the processentry32 structure contents
are slightly different on 2000/XP than they are on
95/98/Me according to the docs.
szExeFile
Pointer to a null-terminated string that specifies the name
of the executable file for the process.
Windows 2000/XP: The file name does not include the path.
Windows 95/98/Me: The file name includes the path.
Ensure that we check for the target values at the end of
the string.