VA_DECL/VA_END usage
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.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1428655166 2015/04/10 08:39:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */
|
||||
/* NetHack 3.6 tradstdc.h $NHDT-Date: 1431737043 2015/05/16 00:44:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */
|
||||
/* NetHack 3.6 tradstdc.h $Date: 2012/01/11 18:23:26 $ $Revision: 1.15 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -65,6 +65,25 @@
|
||||
#endif
|
||||
|
||||
#ifdef NEED_VARARGS /* only define these if necessary */
|
||||
/*
|
||||
* These have changed since 3.4.3. VA_END() now provides an explicit
|
||||
* closing brace to complement VA_DECL()'s hidden opening brace, so code
|
||||
* started with VA_DECL() needs an extra opening brace to complement
|
||||
* the explicit final closing brace. This was done so that the source
|
||||
* would look less strange, where VA_DECL() appeared to introduce a
|
||||
* function whose opening brace was missing; there are now visible and
|
||||
* invisible braces at beginning and end. 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()
|
||||
* Reading the code--or using source browsing tools which match braces--
|
||||
* results in seeing a matched set of braces. Usage of VA_END() is
|
||||
* potentially trickier, but nethack uses it in a straightforward manner.
|
||||
*/
|
||||
|
||||
#ifdef USE_STDARG
|
||||
#include <stdarg.h>
|
||||
# define VA_DECL(typ1,var1) (typ1 var1, ...) { va_list the_args;
|
||||
@@ -74,7 +93,7 @@
|
||||
# define VA_NEXT(var1,typ1) var1 = va_arg(the_args, typ1)
|
||||
# define VA_ARGS the_args
|
||||
# define VA_START(x) va_start(the_args, x)
|
||||
# define VA_END() va_end(the_args)
|
||||
# define VA_END() va_end(the_args); }
|
||||
# if defined(ULTRIX_PROTO) && !defined(_VA_LIST_)
|
||||
# define _VA_LIST_ /* prevents multiple def in stdio.h */
|
||||
# endif
|
||||
@@ -89,7 +108,7 @@
|
||||
# define VA_START(x) va_start(the_args)
|
||||
# define VA_INIT(var1,typ1) var1 = va_arg(the_args, typ1)
|
||||
# define VA_NEXT(var1,typ1) var1 = va_arg(the_args,typ1)
|
||||
# define VA_END() va_end(the_args)
|
||||
# define VA_END() va_end(the_args); }
|
||||
# else
|
||||
# define VA_ARGS arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9
|
||||
# define VA_DECL(typ1,var1) (var1,VA_ARGS) typ1 var1; \
|
||||
@@ -106,9 +125,10 @@
|
||||
# define VA_SHIFT() (arg1=arg2, arg2=arg3, arg3=arg4, arg4=arg5,\
|
||||
arg5=arg6, arg6=arg7, arg7=arg8, arg8=arg9)
|
||||
# define VA_NEXT(var1,typ1) ((var1 = (typ1)arg1), VA_SHIFT(), var1)
|
||||
# define VA_END()
|
||||
# define VA_END() }
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* NEED_VARARGS */
|
||||
|
||||
#if defined(NHSTDC) || defined(MSDOS) || defined(MAC) || defined(ULTRIX_PROTO) || defined(__BEOS__)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 end.c $NHDT-Date: 1431192755 2015/05/09 17:32:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.96 $ */
|
||||
/* NetHack 3.6 end.c $NHDT-Date: 1431737052 2015/05/16 00:44:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.97 $ */
|
||||
/* NetHack 3.6 end.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.79 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -511,6 +511,7 @@ int how;
|
||||
/*VARARGS1*/
|
||||
void panic
|
||||
VA_DECL(const char *, str)
|
||||
{
|
||||
VA_START(str);
|
||||
VA_INIT(str, char *);
|
||||
|
||||
|
||||
45
src/pline.c
45
src/pline.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pline.c $NHDT-Date: 1431192765 2015/05/09 17:32:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
|
||||
/* NetHack 3.6 pline.c $NHDT-Date: 1431737055 2015/05/16 00:44:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
|
||||
/* NetHack 3.6 pline.c $Date: 2013/02/09 01:33:37 $ $Revision: 1.30 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -21,32 +21,31 @@ static void FDECL(vpline, (const char *, va_list));
|
||||
|
||||
void pline
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, char *);
|
||||
vpline(line, VA_ARGS);
|
||||
VA_END();
|
||||
}
|
||||
|
||||
#ifdef USE_STDARG
|
||||
# ifdef USE_STDARG
|
||||
static void
|
||||
vpline(const char *line, va_list the_args)
|
||||
{
|
||||
#else
|
||||
# else
|
||||
static void
|
||||
vpline(line, the_args)
|
||||
const char *line;
|
||||
va_list the_args;
|
||||
{
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#else /* USE_STDARG | USE_VARARG */
|
||||
|
||||
#define vpline pline
|
||||
# define vpline pline
|
||||
|
||||
void pline
|
||||
VA_DECL(const char *, line)
|
||||
#endif /* USE_STDARG | USE_VARARG */
|
||||
|
||||
{ /* start of vpline() or of nested block in USE_OLDARG's pline() */
|
||||
char pbuf[3 * BUFSZ];
|
||||
int ln;
|
||||
/* Do NOT use VA_START and VA_END in here... see above */
|
||||
@@ -94,11 +93,17 @@ VA_DECL(const char *, line)
|
||||
putstr(WIN_MESSAGE, 0, line);
|
||||
/* this gets cleared after every pline message */
|
||||
iflags.last_msg = PLNMSG_UNKNOWN;
|
||||
#if !(defined(USE_STDARG) || defined(USE_VARARGS))
|
||||
/* provide closing brace for the nested block
|
||||
which immediately follows USE_OLDARGS's VA_DECL() */
|
||||
VA_END();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
void Norep
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
no_repeat = TRUE;
|
||||
@@ -143,6 +148,7 @@ free_youbuf()
|
||||
/*VARARGS1*/
|
||||
void You
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -153,6 +159,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void Your
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -163,6 +170,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void You_feel
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -177,6 +185,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void You_cant
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -187,6 +196,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void pline_The
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -197,6 +207,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void There
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
@@ -207,6 +218,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void You_hear
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
if (Deaf || !flags.acoustics)
|
||||
@@ -226,6 +238,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void You_see
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
VA_START(line);
|
||||
@@ -247,6 +260,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void verbalize
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
VA_START(line);
|
||||
@@ -269,30 +283,29 @@ static void FDECL(vraw_printf, (const char *, va_list));
|
||||
|
||||
void raw_printf
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, char *);
|
||||
vraw_printf(line, VA_ARGS);
|
||||
VA_END();
|
||||
}
|
||||
|
||||
#ifdef USE_STDARG
|
||||
# ifdef USE_STDARG
|
||||
static void
|
||||
vraw_printf(const char *line, va_list the_args)
|
||||
{
|
||||
#else
|
||||
# else
|
||||
static void
|
||||
vraw_printf(line, the_args)
|
||||
const char *line;
|
||||
va_list the_args;
|
||||
{
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#else /* USE_STDARG | USE_VARARG */
|
||||
|
||||
void raw_printf
|
||||
VA_DECL(const char *, line)
|
||||
#endif
|
||||
|
||||
{
|
||||
char pbuf[3 * BUFSZ];
|
||||
int ln;
|
||||
/* Do NOT use VA_START and VA_END in here... see above */
|
||||
@@ -308,11 +321,15 @@ VA_DECL(const char *, line)
|
||||
pbuf[BUFSZ - 1] = '\0'; /* terminate strncpy or truncate vsprintf */
|
||||
}
|
||||
raw_print(line);
|
||||
#if !(defined(USE_STDARG) || defined(USE_VARARGS))
|
||||
VA_END(); /* (see vpline) */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
void impossible
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
char pbuf[2 * BUFSZ];
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 amiwind.c $NHDT-Date: 1431192783 2015/05/09 17:33:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 amiwind.c $NHDT-Date: 1431737059 2015/05/16 00:44:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 amiwind.c $Date: 2009/05/06 10:48:30 $ $Revision: 1.5 $ */
|
||||
/* SCCS Id: @(#)amiwind.c 3.5 2000/01/12
|
||||
/* Copyright (c) Olaf Seibert (KosmoSoft), 1989, 1992 */
|
||||
@@ -889,6 +889,7 @@ amii_loadlib(void)
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, char *);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 macerrs.c $NHDT-Date: 1431192785 2015/05/09 17:33:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 macerrs.c $NHDT-Date: 1431737061 2015/05/16 00:44:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 macerrs.c $Date: 2009/05/06 10:49:10 $ $Revision: 1.5 $ */
|
||||
/* SCCS Id: @(#)macerrs.c 3.5 1993/01/24 */
|
||||
/* Copyright (c) Michael Hamel, 1991 */
|
||||
@@ -102,7 +102,8 @@ static void vprogerror();
|
||||
#endif
|
||||
|
||||
/* Macro substitute for error() */
|
||||
void error VA_DECL(const char *, line){
|
||||
void error VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, char *);
|
||||
vprogerror(line, VA_ARGS);
|
||||
@@ -111,18 +112,18 @@ void error VA_DECL(const char *, line){
|
||||
|
||||
#ifdef USE_STDARG
|
||||
static void
|
||||
vprogerror(const char *line, va_list the_args) {
|
||||
vprogerror(const char *line, va_list the_args)
|
||||
#else
|
||||
static void
|
||||
vprogerror(line, the_args) const char *line; va_list the_args; {
|
||||
vprogerror(line, the_args) const char *line; va_list the_args;
|
||||
#endif
|
||||
|
||||
#else /* USE_STDARG | USE_VARARG */
|
||||
|
||||
void
|
||||
error VA_DECL(const char *, line){
|
||||
error VA_DECL(const char *, line)
|
||||
#endif
|
||||
/* Do NOT use VA_START and VA_END in here... see above */
|
||||
{ /* opening brace for vprogerror(), nested block for USE_OLDARG error() */
|
||||
char pbuf[BUFSZ];
|
||||
|
||||
if(index(line, '%')) {
|
||||
@@ -130,6 +131,10 @@ error VA_DECL(const char *, line){
|
||||
line = pbuf;
|
||||
}
|
||||
showerror("of an internal error",line);
|
||||
|
||||
#if !(defined(USE_STDARG) || defined(USE_VARARGS))
|
||||
VA_END(); /* provides closing brace for USE_OLDARGS's nested block */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pcsys.c $NHDT-Date: 1431192778 2015/05/09 17:32:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
|
||||
/* NetHack 3.6 pcsys.c $NHDT-Date: 1431737062 2015/05/16 00:44:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
|
||||
/* NetHack 3.6 pcsys.c $Date: 2012/01/22 06:33:47 $ $Revision: 1.18 $ */
|
||||
/* SCCS Id: @(#)pcsys.c 3.5 2002/01/22 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -418,6 +418,7 @@ const char *str;
|
||||
#ifndef WIN32
|
||||
void msmsg
|
||||
VA_DECL(const char *, fmt)
|
||||
{
|
||||
VA_START(fmt);
|
||||
VA_INIT(fmt, const char *);
|
||||
#if defined(MSDOS) && defined(NO_TERMS)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pctty.c $NHDT-Date: 1431192779 2015/05/09 17:32:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 pctty.c $NHDT-Date: 1431737063 2015/05/16 00:44:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
|
||||
/* NetHack 3.6 pctty.c $Date: 2009/05/06 10:50:30 $ $Revision: 1.6 $ */
|
||||
/* SCCS Id: @(#)pctty.c 3.5 1990/22/02
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
@@ -75,6 +75,7 @@ unsigned mseconds;
|
||||
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
/* error() may get called before tty is initialized */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 unixtty.c $NHDT-Date: 1431192779 2015/05/09 17:32:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
|
||||
/* NetHack 3.6 unixtty.c $NHDT-Date: 1431737063 2015/05/16 00:44:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
|
||||
/* NetHack 3.6 unixtty.c $Date: 2012/01/23 07:11:09 $ $Revision: 1.10 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -456,6 +456,7 @@ init_linux_cons()
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
if (settty_needed)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 vmstty.c $NHDT-Date: 1431192780 2015/05/09 17:33:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
|
||||
/* NetHack 3.6 vmstty.c $NHDT-Date: 1431737064 2015/05/16 00:44:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */
|
||||
/* NetHack 3.6 vmstty.c $Date: 2011/04/13 01:48:13 $ $Revision: 1.10 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -547,6 +547,7 @@ unsigned mseconds; /* milliseconds */
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 winhack.c $NHDT-Date: 1431192786 2015/05/09 17:33:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
|
||||
/* NetHack 3.6 winhack.c $NHDT-Date: 1431737065 2015/05/16 00:44:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
|
||||
/* NetHack 3.6 winhack.c $Date: 2009/10/22 02:59:35 $ $Revision: 1.11 $ */
|
||||
/* Copyright (C) 2001 by Alex Kompel */
|
||||
// winhack.cpp : Defines the entry point for the application.
|
||||
@@ -240,6 +240,7 @@ gotlock:
|
||||
/* misc functions */
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
TCHAR wbuf[1024];
|
||||
char buf[1024];
|
||||
DWORD last_error = GetLastError();
|
||||
@@ -269,10 +270,8 @@ VA_DECL(const char *, s)
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
}
|
||||
VA_END();
|
||||
|
||||
MessageBox(NULL, wbuf, TEXT("Error"), MB_OK | MB_ICONERROR);
|
||||
|
||||
VA_END();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 nttty.c $NHDT-Date: 1431192782 2015/05/09 17:33:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
|
||||
/* NetHack 3.6 nttty.c $NHDT-Date: 1431737067 2015/05/16 00:44:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
|
||||
/* Copyright (c) NetHack PC Development Team 1993 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1014,11 +1014,11 @@ load_keyboard_handler()
|
||||
*/
|
||||
void msmsg
|
||||
VA_DECL(const char *, fmt)
|
||||
{
|
||||
char buf[ROWNO * COLNO]; /* worst case scenario */
|
||||
VA_START(fmt);
|
||||
VA_INIT(fmt, const char *);
|
||||
Vsprintf(buf, fmt, VA_ARGS);
|
||||
VA_END();
|
||||
if (redirect_stdout)
|
||||
fprintf(stdout, "%s", buf);
|
||||
else {
|
||||
@@ -1026,6 +1026,7 @@ VA_DECL(const char *, fmt)
|
||||
if (ttyDisplay)
|
||||
curs(BASE_WINDOW, cursor.X + 1, cursor.Y);
|
||||
}
|
||||
VA_END();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1033,6 +1034,7 @@ VA_DECL(const char *, fmt)
|
||||
/*VARARGS1*/
|
||||
void nttty_error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
char buf[BUFSZ];
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
@@ -1041,9 +1043,9 @@ VA_DECL(const char *, s)
|
||||
end_screen();
|
||||
buf[0] = '\n';
|
||||
(void) vsprintf(&buf[1], s, VA_ARGS);
|
||||
VA_END();
|
||||
msmsg(buf);
|
||||
really_move_cursor();
|
||||
VA_END();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ load_keyboard_handler()
|
||||
*/
|
||||
void msmsg
|
||||
VA_DECL(const char *, fmt)
|
||||
{
|
||||
VA_START(fmt);
|
||||
VA_INIT(fmt, const char *);
|
||||
VA_END();
|
||||
@@ -147,6 +148,7 @@ VA_DECL(const char *, fmt)
|
||||
/*VARARGS1*/
|
||||
void nttty_error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
VA_END();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 winnt.c $NHDT-Date: 1431192782 2015/05/09 17:33:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */
|
||||
/* NetHack 3.6 winnt.c $NHDT-Date: 1431737068 2015/05/16 00:44:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
|
||||
/* Copyright (c) NetHack PC Development Team 1993, 1994 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -197,6 +197,7 @@ return &szFullPath[0];
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
{
|
||||
char buf[BUFSZ];
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 lev_main.c $NHDT-Date: 1431192770 2015/05/09 17:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
|
||||
/* NetHack 3.6 lev_main.c $NHDT-Date: 1431737057 2015/05/16 00:44:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
|
||||
/* NetHack 3.6 lev_main.c $Date: 2012/01/12 04:48:12 $ $Revision: 1.20 $ */
|
||||
/* SCCS Id: @(#)lev_main.c 3.5 2007/01/17 */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
@@ -365,6 +365,7 @@ static void FDECL(lc_vpline, (const char *, va_list));
|
||||
|
||||
void lc_pline
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, char *);
|
||||
lc_vpline(line, VA_ARGS);
|
||||
@@ -374,13 +375,11 @@ VA_DECL(const char *, line)
|
||||
#ifdef USE_STDARG
|
||||
static void
|
||||
lc_vpline(const char *line, va_list the_args)
|
||||
{
|
||||
#else
|
||||
static void
|
||||
lc_vpline(line, the_args)
|
||||
const char *line;
|
||||
va_list the_args;
|
||||
{
|
||||
#endif
|
||||
|
||||
#else /* USE_STDARG | USE_VARARG */
|
||||
@@ -390,6 +389,7 @@ va_list the_args;
|
||||
void lc_pline
|
||||
VA_DECL(const char *, line)
|
||||
#endif /* USE_STDARG | USE_VARARG */
|
||||
{ /* opening brace for lc_vpline, nested block for USE_OLDARGS lc_pline */
|
||||
|
||||
char pbuf[3 * BUFSZ];
|
||||
static char nomsg[] = "(no message)";
|
||||
@@ -415,11 +415,15 @@ VA_DECL(const char *, line)
|
||||
}
|
||||
lc_pline_mode = LC_PLINE_MESSAGE; /* reset to default */
|
||||
return;
|
||||
#if !(defined(USE_STDARG) || defined(USE_VARARGS))
|
||||
VA_END(); /* closing brace ofr USE_OLDARGS's nested block */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
void lc_error
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
lc_pline_mode = LC_PLINE_ERROR;
|
||||
@@ -431,6 +435,7 @@ VA_DECL(const char *, line)
|
||||
/*VARARGS1*/
|
||||
void lc_warning
|
||||
VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
lc_pline_mode = LC_PLINE_WARNING;
|
||||
@@ -598,6 +603,7 @@ static void FDECL(vadd_opvars, (sp_lev *, const char *, va_list));
|
||||
|
||||
void add_opvars
|
||||
VA_DECL2(sp_lev *, sp, const char *, fmt)
|
||||
{
|
||||
VA_START(fmt);
|
||||
VA_INIT(fmt, char *);
|
||||
vadd_opvars(sp, fmt, VA_ARGS);
|
||||
|
||||
8238
util/lev_main.i
Normal file
8238
util/lev_main.i
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 panic.c $NHDT-Date: 1431192770 2015/05/09 17:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
|
||||
/* NetHack 3.6 panic.c $NHDT-Date: 1431737058 2015/05/16 00:44:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 panic.c $Date: 2009/05/06 10:54:39 $ $Revision: 1.4 $ */
|
||||
/* SCCS Id: @(#)panic.c 3.5 1994/03/02 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
@@ -25,6 +25,7 @@ void VDECL(panic, (char *, ...));
|
||||
|
||||
void panic
|
||||
VA_DECL(char *, str)
|
||||
{
|
||||
VA_START(str);
|
||||
VA_INIT(str, char *);
|
||||
if (panicking++)
|
||||
|
||||
Reference in New Issue
Block a user