switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions
+3 -3
View File
@@ -53,7 +53,7 @@ Version _WIN_32IE Platform/IE
/*#define COMCTL_URL
* "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/
extern void FDECL(nethack_exit, (int)) NORETURN;
extern void nethack_exit(int) NORETURN;
static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor);
BOOL WINAPI
@@ -72,7 +72,7 @@ extern int GUILaunched; /* We tell shared startup code in windmain.c
#endif
// Foward declarations of functions included in this code module:
extern boolean FDECL(main, (int, char **));
extern boolean main(int, char **);
static void __cdecl mswin_moveloop(void *);
#define MAX_CMDLINE_PARAM 255
@@ -242,7 +242,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
}
PNHWinApp
GetNHApp()
GetNHApp(void)
{
return &_nethack_app;
}
+1 -1
View File
@@ -345,7 +345,7 @@ static boolean plselRandomize(plsel_data_t * data);
static BOOL plselDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam);
boolean
mswin_player_selection_window()
mswin_player_selection_window(void)
{
INT_PTR ret;
plsel_data_t data;
+1 -1
View File
@@ -217,7 +217,7 @@ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace)
}
UINT
mswin_charset()
mswin_charset(void)
{
CHARSETINFO cis;
if (SYMHANDLING(H_IBM))
+3 -3
View File
@@ -34,7 +34,7 @@ mswin_nh_input_init(void)
/* check for input */
int
mswin_have_input()
mswin_have_input(void)
{
return
#ifdef SAFERHANGUP
@@ -63,7 +63,7 @@ mswin_input_push(PMSNHEvent event)
/* get event from the queue and delete it */
PMSNHEvent
mswin_input_pop()
mswin_input_pop(void)
{
PMSNHEvent retval;
@@ -92,7 +92,7 @@ mswin_input_pop()
/* get event from the queue but leave it there */
PMSNHEvent
mswin_input_peek()
mswin_input_peek(void)
{
PMSNHEvent retval;
+6 -5
View File
@@ -44,7 +44,7 @@ static void mswin_apply_window_style_all();
// returns strdup() created pointer - callee assumes the ownership
HWND
mswin_init_main_window()
mswin_init_main_window(void)
{
static int run_once = 0;
HWND ret;
@@ -98,7 +98,7 @@ mswin_init_main_window()
}
void
register_main_window_class()
register_main_window_class(void)
{
WNDCLASS wcex;
@@ -1102,7 +1102,7 @@ About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
}
void
mswin_menu_check_intf_mode()
mswin_menu_check_intf_mode(void)
{
HMENU hMenu = GetMenu(GetNHApp()->hMainWnd);
@@ -1235,7 +1235,8 @@ mswin_apply_window_style(HWND hwnd) {
}
void
mswin_apply_window_style_all() {
mswin_apply_window_style_all(void)
{
int i;
for (i = 0; i < MAXWINDOWS; i++) {
if (IsWindow(GetNHApp()->windowlist[i].win)
@@ -1249,7 +1250,7 @@ mswin_apply_window_style_all() {
// returns strdup() created pointer - callee assumes the ownership
#define TEXT_BUFFER_SIZE 4096
char *
nh_compose_ascii_screenshot()
nh_compose_ascii_screenshot(void)
{
char *retval;
PMSNHMsgGetText text;
+2 -2
View File
@@ -96,7 +96,7 @@ static void nhglyph2charcolor(short glyph, uchar *ch, int *color);
extern boolean win32_cursorblink; /* from sys\winnt\winnt.c */
HWND
mswin_init_map_window()
mswin_init_map_window(void)
{
static int run_once = 0;
HWND hWnd;
@@ -517,7 +517,7 @@ void mswin_map_update(HWND hWnd)
/* register window class for map window */
void
register_map_window_class()
register_map_window_class(void)
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
+3 -3
View File
@@ -29,11 +29,11 @@
typedef struct mswin_menu_item {
glyph_info glyphinfo;
ANY_P identifier;
CHAR_P accelerator;
CHAR_P group_accel;
char accelerator;
char group_accel;
int attr;
char str[NHMENU_STR_SIZE];
BOOLEAN_P presel;
boolean presel;
unsigned int itemflags;
int count;
BOOL has_focus;
+5 -5
View File
@@ -34,8 +34,8 @@ typedef struct mswin_nhmsg_putstr {
} MSNHMsgPutstr, *PMSNHMsgPutstr;
typedef struct mswin_nhmsg_print_glyph {
XCHAR_P x;
XCHAR_P y;
xchar x;
xchar y;
glyph_info glyphinfo;
glyph_info bkglyphinfo;
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
@@ -48,11 +48,11 @@ typedef struct mswin_nhmsg_cliparound {
typedef struct mswin_nhmsg_add_menu {
glyph_info glyphinfo;
const ANY_P *identifier;
CHAR_P accelerator;
CHAR_P group_accel;
char accelerator;
char group_accel;
int attr;
const char *str;
BOOLEAN_P presel;
boolean presel;
unsigned int itemflags;
} MSNHMsgAddMenu, *PMSNHMsgAddMenu;
+2 -2
View File
@@ -66,7 +66,7 @@ extern void play_sound_for_message(const char *str);
#endif
HWND
mswin_init_message_window()
mswin_init_message_window(void)
{
static int run_once = 0;
HWND ret;
@@ -116,7 +116,7 @@ mswin_init_message_window()
}
void
register_message_window_class()
register_message_window_class(void)
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
+1 -1
View File
@@ -40,7 +40,7 @@ INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
HWND
mswin_init_RIP_window()
mswin_init_RIP_window(void)
{
HWND ret;
PNHRIPWindow data;
+2 -2
View File
@@ -86,7 +86,7 @@ static LRESULT onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam);
#define DEFAULT_COLOR_FG_STATUS COLOR_WINDOWTEXT
HWND
mswin_init_status_window()
mswin_init_status_window(void)
{
static int run_once = 0;
HWND ret;
@@ -151,7 +151,7 @@ mswin_init_status_window()
}
void
register_status_window_class()
register_status_window_class(void)
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
+1 -1
View File
@@ -24,7 +24,7 @@ static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutText(HWND hwnd);
HWND
mswin_init_text_window()
mswin_init_text_window(void)
{
HWND ret;
RECT rt;
+26 -26
View File
@@ -744,7 +744,7 @@ mswin_suspend_nhwindows(const char *str)
/* Restore the windows after being suspended. */
void
mswin_resume_nhwindows()
mswin_resume_nhwindows(void)
{
logDebug("mswin_resume_nhwindows()\n");
@@ -854,7 +854,7 @@ mswin_clear_nhwindow(winid wid)
--more--, if necessary, in the tty window-port.
*/
void
mswin_display_nhwindow(winid wid, BOOLEAN_P block)
mswin_display_nhwindow(winid wid, boolean block)
{
logDebug("mswin_display_nhwindow(%d, %d)\n", wid, block);
if (GetNHApp()->windowlist[wid].win != NULL) {
@@ -1035,7 +1035,7 @@ mswin_putstr_ex(winid wid, int attr, const char *text, int app)
iff complain is TRUE.
*/
void
mswin_display_file(const char *filename, BOOLEAN_P must_exist)
mswin_display_file(const char *filename, boolean must_exist)
{
dlb *f;
TCHAR wbuf[BUFSZ];
@@ -1130,7 +1130,7 @@ add_menu(windid window, const glyph_info *glyphinfo,
void
mswin_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
char accelerator, char group_accel, int attr,
const char *str, unsigned int itemflags)
{
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
@@ -1232,7 +1232,7 @@ mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected)
window up, otherwise empty.
*/
void
mswin_update_inventory()
mswin_update_inventory(void)
{
logDebug("mswin_update_inventory()\n");
if (iflags.perm_invent && g.program_state.something_worth_saving
@@ -1246,7 +1246,7 @@ mark_synch() -- Don't go beyond this point in I/O on any channel until
for the moment
*/
void
mswin_mark_synch()
mswin_mark_synch(void)
{
logDebug("mswin_mark_synch()\n");
}
@@ -1258,7 +1258,7 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for
display is OK when return from wait_synch().
*/
void
mswin_wait_synch()
mswin_wait_synch(void)
{
logDebug("mswin_wait_synch()\n");
mswin_raw_print_flush();
@@ -1299,7 +1299,7 @@ print_glyph(window, x, y, glyphinfo, bkglyphinfo)
*/
void
mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
mswin_print_glyph(winid wid, xchar x, xchar y,
const glyph_info *glyphinfo, const glyph_info *bkglyphinfo)
{
logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyphinfo->glyph, bkglyphinfo->glyph);
@@ -1338,7 +1338,7 @@ mswin_raw_print_accumulate(const char * str, boolean bold)
* dialog box and clear raw_print_strbuf.
*/
void
mswin_raw_print_flush()
mswin_raw_print_flush(void)
{
if (raw_print_strbuf.str != NULL) {
int wlen = strlen(raw_print_strbuf.str) + 1;
@@ -1408,7 +1408,7 @@ int nhgetch() -- Returns a single character input from the user.
Returned character _must_ be non-zero.
*/
int
mswin_nhgetch()
mswin_nhgetch(void)
{
PMSNHEvent event;
int key = 0;
@@ -1467,7 +1467,7 @@ nhbell() -- Beep at user. [This will exist at least until sounds are
anyway.]
*/
void
mswin_nhbell()
mswin_nhbell(void)
{
logDebug("mswin_nhbell()\n");
}
@@ -1478,7 +1478,7 @@ doprev_message()
-- On the tty-port this scrolls WIN_MESSAGE back one line.
*/
int
mswin_doprev_message()
mswin_doprev_message(void)
{
logDebug("mswin_doprev_message()\n");
SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_VSCROLL,
@@ -1506,14 +1506,14 @@ char yn_function(const char *ques, const char *choices, char default)
ports might use a popup.
*/
char
mswin_yn_function(const char *question, const char *choices, CHAR_P def)
mswin_yn_function(const char *question, const char *choices, char def)
{
char ch;
char yn_esc_map = '\033';
char message[BUFSZ];
char res_ch[2];
int createcaret;
boolean digit_ok, allow_num;
boolean digit_ok, allow_num = FALSE;
logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def);
@@ -1746,7 +1746,7 @@ int get_ext_cmd(void)
selection, -1 otherwise.
*/
int
mswin_get_ext_cmd()
mswin_get_ext_cmd(void)
{
int ret;
logDebug("mswin_get_ext_cmd()\n");
@@ -1849,7 +1849,7 @@ delay_output() -- Causes a visible delay of 50ms in the output.
by a nap(50ms), but allows asynchronous operation.
*/
void
mswin_delay_output()
mswin_delay_output(void)
{
logDebug("mswin_delay_output()\n");
mswin_map_update(mswin_hwnd_from_winid(WIN_MAP));
@@ -1857,13 +1857,13 @@ mswin_delay_output()
}
void
mswin_change_color()
mswin_change_color(void)
{
logDebug("mswin_change_color()\n");
}
char *
mswin_get_color_string()
mswin_get_color_string(void)
{
logDebug("mswin_get_color_string()\n");
return ("");
@@ -1877,7 +1877,7 @@ start_screen() -- Only used on Unix tty ports, but must be declared for
just declare an empty function.
*/
void
mswin_start_screen()
mswin_start_screen(void)
{
/* Do Nothing */
logDebug("mswin_start_screen()\n");
@@ -1888,7 +1888,7 @@ end_screen() -- Only used on Unix tty ports, but must be declared for
completeness. The complement of start_screen().
*/
void
mswin_end_screen()
mswin_end_screen(void)
{
/* Do Nothing */
logDebug("mswin_end_screen()\n");
@@ -2064,7 +2064,7 @@ mswin_preference_update(const char *pref)
#define TEXT_BUFFER_SIZE 4096
char *
mswin_getmsghistory(BOOLEAN_P init)
mswin_getmsghistory(boolean init)
{
static PMSNHMsgGetText text = 0;
static char *next_message = 0;
@@ -2101,7 +2101,7 @@ mswin_getmsghistory(BOOLEAN_P init)
}
void
mswin_putmsghistory(const char *msg, BOOLEAN_P restoring)
mswin_putmsghistory(const char *msg, boolean restoring)
{
BOOL save_sound_opt;
@@ -2119,7 +2119,7 @@ mswin_putmsghistory(const char *msg, BOOLEAN_P restoring)
}
void
mswin_main_loop()
mswin_main_loop(void)
{
while (!mswin_have_input()) {
MSG msg;
@@ -2377,7 +2377,7 @@ logDebug(const char *fmt, ...)
#define INTFKEY "Interface"
void
mswin_read_reg()
mswin_read_reg(void)
{
HKEY key;
DWORD size;
@@ -2489,7 +2489,7 @@ mswin_read_reg()
}
void
mswin_write_reg()
mswin_write_reg(void)
{
HKEY key;
DWORD disposition;
@@ -2567,7 +2567,7 @@ mswin_write_reg()
}
void
mswin_destroy_reg()
mswin_destroy_reg(void)
{
char keystring[MAX_PATH];
HKEY key;
+2 -1
View File
@@ -8,7 +8,8 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4820;4706;4244;4245;4100;4310</DisableSpecificWarnings>
<PreprocessorDefinitions>WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;WINVER=0x0601;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
+7 -7
View File
@@ -146,16 +146,16 @@ void mswin_suspend_nhwindows(const char *);
void mswin_resume_nhwindows(void);
winid mswin_create_nhwindow(int type);
void mswin_clear_nhwindow(winid wid);
void mswin_display_nhwindow(winid wid, BOOLEAN_P block);
void mswin_display_nhwindow(winid wid, boolean block);
void mswin_destroy_nhwindow(winid wid);
void mswin_curs(winid wid, int x, int y);
void mswin_putstr(winid wid, int attr, const char *text);
void mswin_putstr_ex(winid wid, int attr, const char *text, int);
void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
void mswin_display_file(const char *filename, boolean must_exist);
void mswin_start_menu(winid wid, unsigned long mbehavior);
void mswin_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
char accelerator, char group_accel, int attr,
const char *str, unsigned int itemflags);
void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
@@ -163,7 +163,7 @@ void mswin_update_inventory(void);
void mswin_mark_synch(void);
void mswin_wait_synch(void);
void mswin_cliparound(int x, int y);
void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
void mswin_print_glyph(winid wid, xchar x, xchar y,
const glyph_info *glyph, const glyph_info *bkglyph);
void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str);
@@ -172,7 +172,7 @@ int mswin_nhgetch(void);
int mswin_nh_poskey(int *x, int *y, int *mod);
void mswin_nhbell(void);
int mswin_doprev_message(void);
char mswin_yn_function(const char *question, const char *choices, CHAR_P def);
char mswin_yn_function(const char *question, const char *choices, char def);
void mswin_getlin(const char *question, char *input);
int mswin_get_ext_cmd(void);
void mswin_number_pad(int state);
@@ -183,8 +183,8 @@ void mswin_start_screen(void);
void mswin_end_screen(void);
void mswin_outrip(winid wid, int how, time_t when);
void mswin_preference_update(const char *pref);
char *mswin_getmsghistory(BOOLEAN_P init);
void mswin_putmsghistory(const char *msg, BOOLEAN_P);
char *mswin_getmsghistory(boolean init);
void mswin_putmsghistory(const char *msg, boolean);
void mswin_status_init(void);
void mswin_status_finish(void);