header file changes hack.h, decl.h/.c, system.h, wintty.h
- Move secondary preprocessor defines down further in config.h
so that they can be overridden via [platform]conf.h which is
included from global.h, specifically:
LIVELOGFILE when LIVELOG is defined
DUMPLOG_FILE when DUMPLOG is defined
- Minimize platform-specific, or compiler-specific code in hack.h and decl.h.
- reorganize src/decl.c to align with include/decl.h.
- a new header file cstd.h added, containing calls to C99
standard header files.
- hack.h, decl.h, and decl.c have been cleaned up and had code
moved so that things line up as follows:
hack.h defines values that are available to all
NetHack source files, contains enums for use in all
NetHack source files, and contains a number of
struct definitions for use in all NetHack source files.
It does not contain variable declarations or variable
definitions.
decl.h contains the extern declarations for variables that
are defined in decl.c. These variables are global and
available to all NetHack source files. The location of
the variables within decl.h was random, so give it some
order for now.
decl.c contains the definition of the variables declared in
decl.h, and initializes them where appropriate. The
variable definitions are laid out in much the
same order as their declarations in decl.h.
- wintty.h: There were some varying terminal-related prototypes in
system.h, and that was the only thing left that demanded that
system.h be included. Those have been replaced by an #include
<term.h> in include/wintty.h to get the more current (and hopefully
more correct) prototypes, rather than hardcoding them in NetHack
sources.
For edge-case platform compatiblity, there is no #include <term.h>
if the build defines NO_TERMCAP_HEADERS. In that case one set of
hardcoded prototypes is still used in include/wintty.h.
The added #include "term.h" is also bypassed for NO_TERMS builds (builds
that don't link to terminfo/termcap at all, but still present a tty
interface using platform or window-port specific functions to fulfill
the same role as that of terminfo/termcap).
- some scattered, unnecessary #include "integer.h" were removed from
various files, since that's always included in current NetHack-3.7
sources, either directly from config.h or indirectly from #include
"hack.h".
- system.h references removed.
- new cstd.h added; the #include "system.h" references in Makefiles
and project files (Xcode, visual studio), were replaced
with #include "cstd.h" references. A "make depends" is probably
warranted.
Also:
- Use of <term.h>, which defines clear_screen() as a macro, conflicts
with an actual function with that name in win/tty/termcap.c. The most
straight-forward course of action was to rename the NetHack function,
and change the references to it, from clear_screen() to
term_clear_screen(), so that was done.
This commit is contained in:
@@ -400,7 +400,7 @@ YOUPROP_H = $(PERMONST_H) $(MONDATA_H) $(INCL)/prop.h \
|
||||
YOU_H = $(MONST_H) $(YOUPROP_H) $(INCL)/align.h \
|
||||
$(INCL)/attrib.h $(INCL)/you.h
|
||||
DISPLAY_H = $(MONDATA_H) $(INCL)/vision.h $(INCL)/display.h
|
||||
PCCONF_H = $(INCL)/micro.h $(INCL)/system.h $(INCL)/pcconf.h \
|
||||
PCCONF_H = $(INCL)/micro.h $(INCL)/cstd.h $(INCL)/pcconf.h \
|
||||
$(MSYS)/pcvideo.h
|
||||
CONFIG_H = $(GLOBAL_H) $(INCL)/fnamesiz.h $(INCL)/tradstdc.h \
|
||||
$(INCL)/config1.h $(INCL)/config.h
|
||||
@@ -1081,7 +1081,7 @@ TARGET_CFLAGS=$(cflags)
|
||||
#$(CONFIG_H): ../include/config.h ../include/config1.h ../include/patchlevel.h \
|
||||
# ../include/tradstdc.h ../include/integer.h \
|
||||
# ../include/global.h ../include/coord.h ../include/vmsconf.h \
|
||||
# ../include/system.h ../include/nhlua.h ../include/unixconf.h \
|
||||
# ../include/cstd.h ../include/nhlua.h ../include/unixconf.h \
|
||||
# ../include/pcconf.h ../include/micro.h ../include/windconf.h \
|
||||
# ../include/warnings.h ../include/fnamesiz.h
|
||||
# touch $(CONFIG_H)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* Maintain a data structure describing a monospaced bitmap font */
|
||||
|
||||
#include "hack.h"
|
||||
#include "integer.h"
|
||||
#include "font.h"
|
||||
|
||||
static uint32 read_u32(const unsigned char *);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
#include "integer.h"
|
||||
|
||||
/*
|
||||
* The file format is Linux PSF, version 2. Version 1 is not supported.
|
||||
* Actual Linux fonts are restricted to 256 or 512 glyphs; for NetHack, the
|
||||
|
||||
@@ -156,7 +156,7 @@ backsp(void)
|
||||
}
|
||||
|
||||
void
|
||||
clear_screen(void)
|
||||
term_clear_screen(void)
|
||||
{
|
||||
if (!iflags.grmode) {
|
||||
txt_clear_screen();
|
||||
|
||||
@@ -1062,7 +1062,7 @@ vesa_Init(void)
|
||||
iflags.over_view = FALSE;
|
||||
CO = 80;
|
||||
LI = 25;
|
||||
/* clear_screen() */ /* not vesa_clear_screen() */
|
||||
/* term_clear_screen() */ /* not vesa_clear_screen() */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1078,7 +1078,7 @@ vesa_Init(void)
|
||||
iflags.over_view = FALSE;
|
||||
CO = 80;
|
||||
LI = 25;
|
||||
/* clear_screen() */ /* not vesa_clear_screen() */
|
||||
/* term_clear_screen() */ /* not vesa_clear_screen() */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ vesa_Init(void)
|
||||
vesa_SetPalette(paletteptr);
|
||||
g_attribute = attrib_gr_normal;
|
||||
font = vesa_FontPtrs();
|
||||
clear_screen();
|
||||
term_clear_screen();
|
||||
clipx = 0;
|
||||
clipxmax = clipx + (viewport_cols - 1);
|
||||
clipy = 0;
|
||||
|
||||
@@ -268,7 +268,7 @@ void vga_cl_end(int col, int row)
|
||||
/*
|
||||
* This is being done via character writes.
|
||||
* This should perhaps be optimized for speed by using VGA write
|
||||
* mode 2 methods as did clear_screen()
|
||||
* mode 2 methods as did term_clear_screen()
|
||||
*/
|
||||
for (count = col; count < (CO - 1); ++count) {
|
||||
vga_WriteChar(' ', count, row, BACKGROUND_VGA_COLOR);
|
||||
@@ -769,7 +769,7 @@ vga_Init(void)
|
||||
iflags.over_view = FALSE;
|
||||
CO = 80;
|
||||
LI = 25;
|
||||
/* clear_screen() */ /* not vga_clear_screen() */
|
||||
/* term_clear_screen() */ /* not vga_clear_screen() */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -807,7 +807,7 @@ vga_Init(void)
|
||||
psf_font = NULL;
|
||||
}
|
||||
|
||||
clear_screen();
|
||||
term_clear_screen();
|
||||
clipx = 0;
|
||||
clipxmax = clipx + (viewport_size - 1);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ extern char orgdir[];
|
||||
|
||||
#if defined(TTY_GRAPHICS)
|
||||
extern void backsp(void);
|
||||
extern void clear_screen(void);
|
||||
extern void term_clear_screen(void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@@ -189,7 +189,7 @@ getlock(void)
|
||||
if (recover_savefile()) {
|
||||
#if defined(TTY_GRAPHICS)
|
||||
if (WINDOWPORT(tty))
|
||||
clear_screen(); /* display gets fouled up otherwise */
|
||||
term_clear_screen(); /* display gets fouled up otherwise */
|
||||
#endif
|
||||
goto gotlock;
|
||||
} else {
|
||||
|
||||
@@ -432,7 +432,7 @@ QUIETCC=0
|
||||
# Nothing below this line should have to be changed.
|
||||
#
|
||||
# Other things that have to be reconfigured are in config.h,
|
||||
# {unixconf.h, pcconf.h}, and possibly system.h
|
||||
# {unixconf.h, pcconf.h}, and possibly cstd.h
|
||||
|
||||
# Add rule for possible cross-compiler
|
||||
$(TARGETPFX)%.o : %.c
|
||||
@@ -549,7 +549,7 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
|
||||
permonst.h prop.h rect.h region.h sym.h defsym.h rm.h sp_lev.h \
|
||||
spell.h sndprocs.h seffects.h sys.h system.h tcap.h timeout.h \
|
||||
tradstdc.h trap.h unixconf.h vision.h vmsconf.h wintty.h wincurs.h \
|
||||
winX.h winprocs.h wintype.h you.h youprop.h
|
||||
winX.h winprocs.h wintype.h you.h youprop.h cstd.h
|
||||
|
||||
HSOURCES = $(HACKINCL) dgn_file.h
|
||||
|
||||
@@ -800,7 +800,7 @@ depend: ../sys/unix/depend.awk \
|
||||
$(CONFIG_H): ../include/config.h ../include/config1.h ../include/patchlevel.h \
|
||||
../include/tradstdc.h ../include/integer.h \
|
||||
../include/global.h ../include/coord.h ../include/vmsconf.h \
|
||||
../include/system.h ../include/nhlua.h ../include/unixconf.h \
|
||||
../include/cstd.h ../include/nhlua.h ../include/unixconf.h \
|
||||
../include/pcconf.h ../include/micro.h ../include/windconf.h \
|
||||
../include/warnings.h ../include/fnamesiz.h
|
||||
touch $(CONFIG_H)
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
3186A38521A4B0FB0052BF02 /* mextra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mextra.h; path = ../../include/mextra.h; sourceTree = "<group>"; };
|
||||
3186A38721A4B0FB0052BF02 /* color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = color.h; path = ../../include/color.h; sourceTree = "<group>"; };
|
||||
3186A38821A4B0FB0052BF02 /* artifact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = artifact.h; path = ../../include/artifact.h; sourceTree = "<group>"; };
|
||||
3186A38A21A4B0FB0052BF02 /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = ../../include/system.h; sourceTree = "<group>"; };
|
||||
3186A38A21A4B0FB0052BF02 /* cstd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cstd.h; path = ../../include/cstd.h; sourceTree = "<group>"; };
|
||||
3186A38E21A4B0FC0052BF02 /* dlb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dlb.h; path = ../../include/dlb.h; sourceTree = "<group>"; };
|
||||
3186A38F21A4B0FC0052BF02 /* monflag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = monflag.h; path = ../../include/monflag.h; sourceTree = "<group>"; };
|
||||
3186A39121A4B0FC0052BF02 /* micro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = micro.h; path = ../../include/micro.h; sourceTree = "<group>"; };
|
||||
@@ -823,7 +823,7 @@
|
||||
3186A3B621A4B0FD0052BF02 /* sp_lev.h */,
|
||||
3186A3A321A4B0FD0052BF02 /* spell.h */,
|
||||
3186A3CB21A4B0FE0052BF02 /* sys.h */,
|
||||
3186A38A21A4B0FB0052BF02 /* system.h */,
|
||||
3186A38A21A4B0FB0052BF02 /* cstd.h */,
|
||||
3186A3C321A4B0FE0052BF02 /* tcap.h */,
|
||||
3186A3A121A4B0FD0052BF02 /* tile2x11.h */,
|
||||
3186A39421A4B0FC0052BF02 /* tileset.h */,
|
||||
|
||||
@@ -453,7 +453,7 @@ HACKINCL = $(INCL)\align.h $(INCL)\artifact.h $(INCL)\artilist.h \
|
||||
$(INCL)\optlist.h $(INCL)\patchlevel.h $(INCL)\pcconf.h \
|
||||
$(INCL)\permonst.h $(INCL)\prop.h $(INCL)\rect.h $(INCL)\region.h \
|
||||
$(INCL)\sym.h $(INCL)\defsym.h $(INCL)\rm.h $(INCL)\sp_lev.h \
|
||||
$(INCL)\spell.h $(INCL)\sys.h $(INCL)\system.h $(INCL)\tcap.h \
|
||||
$(INCL)\spell.h $(INCL)\sys.h $(INCL)\cstd.h $(INCL)\tcap.h \
|
||||
$(INCL)\timeout.h $(INCL)\tradstdc.h $(INCL)\trap.h \
|
||||
$(INCL)\unixconf.h $(INCL)\vision.h $(INCL)\vmsconf.h \
|
||||
$(INCL)\wintty.h $(INCL)\wincurs.h $(INCL)\winX.h \
|
||||
@@ -851,7 +851,7 @@ RCFLAGS = $(RCFLAGS) -dRCWAV
|
||||
|
||||
CONFIG_H = $(INCL)\config.h $(INCL)\config1.h $(INCL)\patchlevel.h \
|
||||
$(INCL)\tradstdc.h $(INCL)\global.h $(INCL)\coord.h \
|
||||
$(INCL)\vmsconf.h $(INCL)\system.h $(INCL)\nhlua.h \
|
||||
$(INCL)\vmsconf.h $(INCL)\cstd.h $(INCL)\nhlua.h \
|
||||
$(INCL)\unixconf.h $(INCL)\pcconf.h $(INCL)\micro.h \
|
||||
$(INCL)\windconf.h $(INCL)\warnings.h \
|
||||
$(INCL)\fnamesiz.h
|
||||
@@ -2339,7 +2339,7 @@ MOCPATH = moc.exe
|
||||
#$(CONFIG_H): $(INCL)\config.h $(INCL)\config1.h $(INCL)\patchlevel.h \
|
||||
# $(INCL)\tradstdc.h $(INCL)\integer.h \
|
||||
# $(INCL)\global.h $(INCL)\coord.h $(INCL)\vmsconf.h \
|
||||
# $(INCL)\system.h $(INCL)\nhlua.h $(INCL)\unixconf.h \
|
||||
# $(INCL)\cstd.h $(INCL)\nhlua.h $(INCL)\unixconf.h \
|
||||
# $(INCL)\pcconf.h $(INCL)\micro.h $(INCL)\windconf.h \
|
||||
# $(INCL)\warnings.h $(INCL)\fnamesiz.h
|
||||
# touch $(CONFIG_H)
|
||||
@@ -2759,7 +2759,7 @@ MOCPATH = moc.exe
|
||||
#$(CONFIG_H): $(INCL)\config.h $(INCL)\config1.h $(INCL)\patchlevel.h \
|
||||
# $(INCL)\tradstdc.h $(INCL)\integer.h \
|
||||
# $(INCL)\global.h $(INCL)\coord.h $(INCL)\vmsconf.h \
|
||||
# $(INCL)\system.h $(INCL)\nhlua.h $(INCL)\unixconf.h \
|
||||
# $(INCL)\cstd.h $(INCL)\nhlua.h $(INCL)\unixconf.h \
|
||||
# $(INCL)\pcconf.h $(INCL)\micro.h $(INCL)\windconf.h \
|
||||
# $(INCL)\warnings.h $(INCL)\fnamesiz.h
|
||||
# touch $(CONFIG_H)
|
||||
|
||||
@@ -1054,7 +1054,7 @@ tty_start_screen(void)
|
||||
void
|
||||
tty_end_screen(void)
|
||||
{
|
||||
clear_screen();
|
||||
term_clear_screen();
|
||||
really_move_cursor();
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
|
||||
back_buffer_flip();
|
||||
@@ -1067,7 +1067,7 @@ CtrlHandler(DWORD ctrltype)
|
||||
switch (ctrltype) {
|
||||
/* case CTRL_C_EVENT: */
|
||||
case CTRL_BREAK_EVENT:
|
||||
clear_screen();
|
||||
term_clear_screen();
|
||||
case CTRL_CLOSE_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
@@ -1557,7 +1557,7 @@ raw_clear_screen(void)
|
||||
}
|
||||
|
||||
void
|
||||
clear_screen(void)
|
||||
term_clear_screen(void)
|
||||
{
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
|
||||
home();
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
<ClInclude Include="$(IncDir)config1.h" />
|
||||
<ClInclude Include="$(IncDir)context.h" />
|
||||
<ClInclude Include="$(IncDir)coord.h" />
|
||||
<ClInclude Include="$(IncDir)cstd.h" />
|
||||
<ClInclude Include="$(IncDir)decl.h" />
|
||||
<ClInclude Include="$(IncDir)defsym.h" />
|
||||
<ClInclude Include="$(IncDir)display.h" />
|
||||
@@ -285,4 +286,4 @@
|
||||
<Target Name="AfterRebuild">
|
||||
<MSBuild Projects="afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -225,6 +225,7 @@
|
||||
<ClInclude Include="$(IncDir)config1.h" />
|
||||
<ClInclude Include="$(IncDir)context.h" />
|
||||
<ClInclude Include="$(IncDir)coord.h" />
|
||||
<ClInclude Include="$(IncDir)cstd.h" />
|
||||
<ClInclude Include="$(IncDir)decl.h" />
|
||||
<ClInclude Include="$(IncDir)defsym.h" />
|
||||
<ClInclude Include="$(IncDir)dgn_file.h" />
|
||||
@@ -273,7 +274,6 @@
|
||||
<ClInclude Include="$(IncDir)sp_lev.h" />
|
||||
<ClInclude Include="$(IncDir)sym.h" />
|
||||
<ClInclude Include="$(IncDir)sys.h" />
|
||||
<ClInclude Include="$(IncDir)system.h" />
|
||||
<ClInclude Include="$(IncDir)tcap.h" />
|
||||
<ClInclude Include="$(IncDir)tile2x11.h" />
|
||||
<ClInclude Include="$(IncDir)tileset.h" />
|
||||
@@ -316,4 +316,4 @@
|
||||
<Target Name="AfterRebuild">
|
||||
<MSBuild Projects="$(vsDir)NetHack\afternethack.proj" Targets="Build" Properties="Configuration=$(Configuration)" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -36,7 +36,7 @@ extern void mswin_destroy_reg(void);
|
||||
extern void backsp(void);
|
||||
#endif
|
||||
#endif
|
||||
extern void clear_screen(void);
|
||||
extern void term_clear_screen(void);
|
||||
|
||||
#ifdef update_file
|
||||
#undef update_file
|
||||
@@ -1288,14 +1288,14 @@ getlock(void)
|
||||
: "not start a new game");
|
||||
#ifdef WIN32CON
|
||||
if (istty)
|
||||
clear_screen();
|
||||
term_clear_screen();
|
||||
#endif
|
||||
raw_printf("%s", oops);
|
||||
if (prompt_result == 1) { /* recover */
|
||||
if (recover_savefile()) {
|
||||
#if 0
|
||||
if (istty)
|
||||
clear_screen(); /* display gets fouled up otherwise */
|
||||
term_clear_screen(); /* display gets fouled up otherwise */
|
||||
#endif
|
||||
goto gotlock;
|
||||
} else {
|
||||
@@ -1309,7 +1309,7 @@ getlock(void)
|
||||
if (eraseoldlocks()) {
|
||||
#ifdef WIN32CON
|
||||
if (istty)
|
||||
clear_screen(); /* display gets fouled up otherwise */
|
||||
term_clear_screen(); /* display gets fouled up otherwise */
|
||||
#endif
|
||||
goto gotlock;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user