Make the variadic functions look more like ordinary code rather than
have the function opening brace be hidden inside the VA_DECL() macro.
That brace is still there, but VA_DECL() now needs to be followed by
a visible brace (which introduces a nested block rather than the
start of the funciton). VA_END() now provides a hidden closing brace
to end the nested block, and the existing closing brace still matches
the one in VA_DECL().
Sample usage:
void foo VA_DECL(int, arg) --macro expansion has a hidden opening brace
{ --new, explicit opening brace (actually introduces a nested block)
VA_START(bar);
...code for foo...
VA_END(); --expansion now provides a closing brace for the nested block
} --existing closing brace, still pairs with the hidden one in VA_DECL()
This should help if/when another round of reformatting ever takes place,
and also with editors or other tools that do brace/bracket/parenthesis
matching.
I had forgotten that there were variadic functions in sys/* and ended
up modifying a lot more files than intended. The majority of changes
to those just inserted a new '{' line so that revised VA_END()'s '}'
won't introduce a syntax error. A couple of them needed VA_END() moved
so that local variables wouldn't go out of scope too soon. Only the
Unix ones have been tested.
171 lines
1.9 KiB
C
171 lines
1.9 KiB
C
#include "hack.h"
|
|
|
|
#ifdef GUISTUB
|
|
#ifdef TTYSTUB
|
|
#error You can't compile this with both GUISTUB and TTYSTUB defined.
|
|
#endif
|
|
|
|
int GUILaunched;
|
|
struct window_procs mswin_procs = { "guistubs" };
|
|
void
|
|
mswin_destroy_reg()
|
|
{
|
|
return;
|
|
}
|
|
|
|
/* MINGW32 has trouble with both a main() and WinMain()
|
|
* so we move main for the MINGW tty version into this stub
|
|
* so that it is out of sight for the gui linkage.
|
|
*/
|
|
#ifdef __MINGW32__
|
|
extern char default_window_sys[];
|
|
|
|
int
|
|
main(argc, argv)
|
|
int argc;
|
|
char *argv[];
|
|
{
|
|
boolean resuming;
|
|
|
|
sys_early_init();
|
|
Strcpy(default_window_sys, "tty");
|
|
resuming = pcmain(argc, argv);
|
|
moveloop(resuming);
|
|
nethack_exit(EXIT_SUCCESS);
|
|
/*NOTREACHED*/
|
|
return 0;
|
|
}
|
|
#endif
|
|
#endif /* GUISTUB */
|
|
|
|
/* =============================================== */
|
|
|
|
#ifdef TTYSTUB
|
|
|
|
#include "hack.h"
|
|
|
|
int GUILaunched;
|
|
struct window_procs tty_procs = { "ttystubs" };
|
|
|
|
void
|
|
win_tty_init(dir)
|
|
int dir;
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
nttty_open(mode)
|
|
int mode;
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
xputc(ch)
|
|
char ch;
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
xputs(s)
|
|
const char *s;
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
raw_clear_screen()
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
clear_screen()
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
backsp()
|
|
{
|
|
return;
|
|
}
|
|
|
|
int
|
|
has_color(int color)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
#ifndef NO_MOUSE_ALLOWED
|
|
void
|
|
toggle_mouse_support()
|
|
{
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
#ifdef PORT_DEBUG
|
|
void
|
|
win32con_debug_keystrokes()
|
|
{
|
|
return;
|
|
}
|
|
void
|
|
win32con_handler_info()
|
|
{
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
void
|
|
map_subkeyvalue(op)
|
|
register char *op;
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
load_keyboard_handler()
|
|
{
|
|
return;
|
|
}
|
|
|
|
/* this is used as a printf() replacement when the window
|
|
* system isn't initialized yet
|
|
*/
|
|
void msmsg
|
|
VA_DECL(const char *, fmt)
|
|
{
|
|
VA_START(fmt);
|
|
VA_INIT(fmt, const char *);
|
|
VA_END();
|
|
return;
|
|
}
|
|
|
|
/*VARARGS1*/
|
|
void nttty_error
|
|
VA_DECL(const char *, s)
|
|
{
|
|
VA_START(s);
|
|
VA_INIT(s, const char *);
|
|
VA_END();
|
|
return;
|
|
}
|
|
|
|
void
|
|
synch_cursor()
|
|
{
|
|
return;
|
|
}
|
|
|
|
void
|
|
more()
|
|
{
|
|
return;
|
|
}
|
|
|
|
#endif /* TTYSTUBS */
|