Commit Graph

358 Commits

Author SHA1 Message Date
SHIRAKATA Kentaro
83bb81c624 fix Makefile.nmake when USE_DLB=N 2025-03-01 00:12:03 +09:00
nhmall
d56b0a3b7a follow-up bit for Windows console 2025-02-26 23:14:52 -05:00
nhmall
1eaafddca3 fix dolook() on Windows console
usemap boolean wasn't being set to TRUE when it should have been
2025-02-26 23:10:30 -05:00
nhmall
f1be2eaffa add --dumpmongen to view mongen_order[] array 2025-02-14 09:38:29 -05:00
nhmall
f8773f65db update tested versions of Visual Studio 2025-02-11 2025-02-11 19:50:08 -05:00
nhmall
8de3aa564f update tested versions of Visual Studio 2025-01-19 2025-01-19 22:02:43 -05:00
nhmall
85965b1b32 Visual Studio project files:directory name cleanup 2025-01-07 10:00:28 -05:00
nhmall
be5143bb74 window-port updates
Remove start_screen() and end_screen() from the
Window-port interface.

They were only ever used by tty, and there was a comment
carried to several window-ports about how they "really
should go away. They are tty-specific"

term_start_screen() and term_end_screen() are part of
terminal/NO_TERMS supporting routines now.
2025-01-04 23:38:34 -05:00
nhmall
37758c7e48 some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
2025-01-04 19:01:34 -05:00
nhmall
556f1c9839 Windows: remove troublesome template lines
Closes #1345
2024-12-26 17:38:03 -05:00
nhmall
57f86662fd try harder to have --showpaths succeed
This helps avoid a potential chicken-and-egg scenario
with the system configuration file (sysconf).

If sysconf wasn't accessible at the expected location, it
caused an immediate exit, without relaying any helpful
information. That happened even when using:
    'nethack --showpaths'

That's particularly unhelpful, because the --showpaths
output might have been useful towards understanding where
NetHack was looking for such things.

That left you without an easy recourse to identify where
the game is looking for the sysconf file. That might be
especially troublesome if you didn't build the game
yourself.
2024-12-22 19:58:52 -05:00
nhmall
f12d755ba2 Makefile.nmake updates
Be more consistent in the use of path separators.

Add a second version of Makefile variables that contain paths,
one with a trailing separator, and one without (prefixed with R_
for use in Makefile rules).

Also, in dat/luahelper,

Updates due to correspond to the Makefile.nmake changes.

Add Makefile variable AWK to use $(AWK) instead of hardcoded awk.
2024-12-22 09:43:00 -05:00
Pasi Kallinen
f7e86aa150 Add a new bigroom variant "two hexagons" 2024-12-21 12:19:26 +02:00
nhmall
45b2a6c49a more C standard progress
There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
2024-12-20 10:32:38 -05:00
nhmall
c7739171a2 follow-up: consoletty.c 2024-12-12 22:46:44 -05:00
nhmall
c7276bcf67 more MSYS2 warning clean-up 2024-12-12 22:35:38 -05:00
nhmall
1b607d1757 deal with some MSYS2 warnings 2024-12-12 17:02:37 -05:00
nhmall
fec6320e68 rename sys/windows/Makefile.mingw32 to GNUmakefile
GNU make looks first for a file called GNUmakefile, ahead of
looking for Makefile and then makefile.

Renaming sys/windows/Makefile.mingw32 to sys/windows/GNUmakefile
allows:

o src/GNUmakefile (for use by GNU make) and src/Makefile (for use
  Microsoft nmake) to both reside in the src folder during build.

o src/GNUmakefile will be used by GNU make, without having to
  explicitly specify "-f GNUmakefile" on the GNU make command line.

o src/Makefile will be used by Microsoft nmake, without having to
  explicitly specify "-f Makefile" on the Microsoft nmake command line.

For the gcc build, the movemement of sys/windows/GNUmakefile needs
to be copied to src/GNUmakefile as part of the build process (see
sys/windows/build-msys2.txt).

For the Microsoft Visual Studio command line build with nmake,
sys/windows/Makefile.nmake needs to be copied to src/Makefile as
part of the build process (see sys/windows/build-nmake.txt).

They are both copied to the src folder from their respective
repository source file names when the nhsetup.bat file is used.
2024-12-02 19:04:08 -05:00
Keni
9777e7785a rename local ctxp -> contextp to avoid global ctxp 2024-12-01 11:25:16 -08:00
nhmall
763ed61af7 a pair of analyzer bits 2024-11-30 22:07:18 -05:00
nhmall
cd032881ad Windows pdcurses: suppress fallthrough warnings
Avoid warning about issues in 3rd party code
2024-11-30 19:19:54 -05:00
nhmall
b89e792873 Some Windows gcc fixes 2024-11-30 19:06:05 -05:00
nhmall
8f2b979f32 Windows: nmake lualib build bit 2024-11-30 17:05:23 -05:00
nhmall
df86614318 Windows Visual Studio: another follow-up
Missed a couple of configuration options in previous fix
2024-11-30 15:51:30 -05:00
nhmall
36227fcb6d follow-up: build fix when using VS 2019 2024-11-30 15:47:40 -05:00
nhmall
d94f728a9f Windows visual studio: lualib as separate entity 2024-11-30 15:42:06 -05:00
nhmall
0792e5fe9e expand implicit fallthrough detection to non-gcc compilers
gcc has recognized various "magic comments" for white-listing
occurrences of implicit fallthrough in switch statements for
a long time:

    The range and shape of "falls through" comments accepted are
    contingent upon the level of the warning. (The default level is =3.)

    -Wimplicit-fallthrough=0 disables the warning altogether.
    -Wimplicit-fallthrough=1 treats any kind of comment as a "falls through" comment.
    -Wimplicit-fallthrough=2 essentially accepts any comment that contains something
     that matches (case insensitively) "falls?[ \t-]*thr(ough|u)" regular expression.
    -Wimplicit-fallthrough=3 case sensitively matches a wide range of regular
     expressions, listed in the GCC manual. E.g., all of these are accepted:
        /* Falls through. */
        /* fall-thru */
        /* Else falls through. */
        /* FALLTHRU */
        /* ... falls through ... */
       etc.
    -Wimplicit-fallthrough=4 also, case sensitively matches a range of regular
     expressions but is much more strict than level =3.
    -Wimplicit-fallthrough=5 doesn't recognize any comments.

Plenty of other compilers did not recognize the gcc comment convention,
and up until now the compiler warning for detecting unintended
fallthrough had to be suppressed on other compilers. That's because the code
in NetHack has been relying on the gcc approach, and only the gcc approach.

The C23 standard introduces an attribute [[fallthrough]] for the
functionality, when implicit fallthrough warnings have been enabled.

Several popular compilers already support that, or a very similar attribute
style approach, today, even ahead of their C23 support:

       C compiler                       whitelist approach
       ---------------------------   -------------------------------------
       C23 conforming compilers         [[fallthrough]]

       clang versions supporting
       standards prior to
       C23                              __attribute__((__fallthrough__))

       Microsoft Visual Studio
       since VS 2022 17.4.
       The warning C5262 controls
       whether the implict
       fallthrough is detected and
       warned about with
       /std:clatest.                    [[fallthrough]]

This adds support to NetHack for the attribute approach by inserting a
macro FALLTHROUGH to the existing cases that require white-listing, so
other compilers can analyze things too.

The definition of the FALLTHROUGH macro is controlled in include/tradstdc.h.

The gcc comment approach has also been left in place at this time.
2024-11-30 14:16:27 -05:00
nhmall
d6beba7b6a Windows: fix hacklib subproject settings in VS 2024-11-30 11:57:20 -05:00
nhmall
c1c74db90c update tested versions of Visual Studio 2024-11-27 2024-11-27 09:48:35 -05:00
nhmall
7932497450 follow-up for Makefile.nmake 2024-11-16 10:45:22 -05:00
nhmall
21b495f835 Makefile.nmake build fix when no curses options
Resolves #1325
2024-11-16 10:10:10 -05:00
nhmall
13db1aed0d replace stray tabs that have crept in 2024-11-14 11:54:39 -05:00
nhmall
52a9af7278 early_init() was being called twice on Windows GUI 2024-11-13 13:57:18 -05:00
nhmall
c85b5d3e56 rearrange function layout in Windows windmain.c 2024-11-13 13:48:03 -05:00
nhmall
724f8f865c more memory freeing before exit on Windows 2024-11-12 18:51:04 -05:00
nhmall
0e52eac184 update tested versions of Visual Studio 2024-11-12 2024-11-12 18:00:37 -05:00
nhmall
7414b906b2 release some memory before exit under Windows 2024-11-11 16:50:57 -05:00
nhkeni
91c38355e7 Merge branch 'keni-gitset2' into NetHack-3.7 2024-11-11 11:27:27 -05:00
nhkeni
36e8d9e6fc nhgitset version 4
To update, run "perl DEVEL/nhgitset.pl"

Fixes:
- "nhcommit -a" has been fixed
- NHDT was hardwired in places
- no longer complain about a missing dat directory outside of the
    NetHack source tree
- make update of gitinfo atomic
- Replace some hardwired directory separators with OS-dependent constructs

Backwards Incompatibilities:
- NH_DATESUB's DATE() is now Date() to match the other variables
- MSYS2 requires an additional Perl package - the MSYS2 docs have
    been updated

New Help System:
- git nhhelp
   This command mirrors "git help" for nh* commands.
- See git nhhelp nhsub for general help on substitution variables

New Substitution Variables:
-Brev()
    An aBREViation of $PREFIX-Branch$:$PREFIX-Revision$ - this
    may help get line length under control in file headers.
-Assert(TYPE=VALUE)
    If TYPE does not match VALUE, do not substitute on this line.
    TYPE P checks VALUE against nethack.substprefix
-Project(arg)
    Returns nethack.projectname if there is no arg and an uppercase
    version if arg is uc.

Other New Features:
- Add nethack.projectname
- Documentation updates - see "git nhhelp nhsub"
- On checkout or merge of a branch, check for nhgitset version updates
  and provide an optional message to the user.
- Move NH_DATESUB substitutions here from cron job to keep dates in sync
- PREFIX-* keywords now available in NH_DATESUB templates
- Support use of nhgitset.pl from a different repo; note that update
  checks will be dependent on keeping the original source repo up-to-date
  and in the same location.
2024-11-11 09:15:49 -05:00
nhmall
e83e04dbb3 fix some memory leaks 2024-11-10 22:24:45 -05:00
nhmall
70a5b06c45 Makefile.nmake fix for target spotless under x64 2024-11-02 09:15:20 -04:00
Pasi Kallinen
696af89299 Change MSGHANDLER from compile-time to sysconf 2024-10-19 10:47:53 +03:00
nhmall
ac3031932f update tested versions of Visual Studio 2024-10-10 2024-10-10 18:14:57 -04:00
nhmall
a70ad42d22 address Windows windsys.c analyzer complaints
sys/windows/windsys.c(419): warning C6387: 'hMod' could be '0':
  this does not adhere to the specification for the function 'GetProcAddress'.

sys/windows/windsys.c(437): warning C28159:
  Consider using 'GetTickCount64' instead of 'GetTickCount'.
  Reason: GetTickCount overflows roughly every 49 days.  Code that does not
          take that into account can loop indefinitely.
          GetTickCount64 operates on 64 bit values and does not have that
          problem
2024-10-08 11:57:46 -04:00
nhmall
19d8ec6d12 address Windows consoletty.c analyzer complaints
sys/windows/consoletty.c: warning C6388: '&reserved' might not be '0':
  this does not adhere to the specification for the function 'WriteConsoleA'.
sys/windows/consoletty.c(2514): warning C28159:
  Consider using 'IsWindows*' instead of 'GetVersion'. Reason: Deprecated.
Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers.
2024-10-08 11:32:58 -04:00
nhmall
fb70aadbb5 improve copy_bytes() maintenance
Remove the copy_bytes() function from files.c and util/recover.c
and place a single copy into hacklib.
2024-10-05 15:55:20 -04:00
nhmall
33652b8288 remove extraneous script file (Windows) 2024-09-07 10:13:04 -04:00
nhkeni
aa542afe53 Merge branch 'NetHack-3.7' into keni-prefix 2024-09-06 15:07:19 -04:00
nhkeni
6b4173688f Documentation cleanup and streamlining. 2024-09-06 12:44:19 -04:00
nhmall
78042680b8 update tested versions of Visual Studio 2024-09-01 2024-09-01 09:39:56 -04:00