support for link-time option in #version
Changes to be committed: modified: src/version.c modified: sys/share/cppregex.cpp modified: sys/share/pmatchregex.c modified: sys/share/posixregex.c modified: util/makedefs.c Some options in 3.6.0 are determined by what you link with. The choice of regex support is one. Let #version show that linked option along with the compile-time options.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 version.c $NHDT-Date: 1434025553 2015/06/11 12:25:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.31 $ */
|
||||
/* NetHack 3.6 version.c $NHDT-Date: 1434151385 2015/06/12 23:23:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#define BETA_INFO "Beta2"
|
||||
|
||||
STATIC_DCL void FDECL(insert_rtoptions, (winid,char *));
|
||||
|
||||
/* fill buffer with short version (so caller can avoid including date.h) */
|
||||
char *
|
||||
version_string(buf)
|
||||
@@ -55,8 +57,9 @@ int
|
||||
doextversion()
|
||||
{
|
||||
dlb *f;
|
||||
char *cr, buf[BUFSZ];
|
||||
char *cr, *pd, buf[BUFSZ];
|
||||
winid win = create_nhwindow(NHW_TEXT);
|
||||
boolean rtadded = FALSE;
|
||||
|
||||
/* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
|
||||
the file manually so we can include dynamic version info */
|
||||
@@ -108,7 +111,17 @@ doextversion()
|
||||
if (prolog || !*buf)
|
||||
continue;
|
||||
|
||||
putstr(win, 0, buf);
|
||||
if (!rtadded) {
|
||||
pd = eos(buf);
|
||||
pd--;
|
||||
if (*pd == '.' && strlen(buf) > 1) {
|
||||
insert_rtoptions(win, buf);
|
||||
rtadded = TRUE; /* only do it once */
|
||||
*buf = 0;
|
||||
}
|
||||
}
|
||||
if (*buf)
|
||||
putstr(win, 0, buf);
|
||||
}
|
||||
(void) dlb_fclose(f);
|
||||
display_nhwindow(win, FALSE);
|
||||
@@ -117,6 +130,58 @@ doextversion()
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern char regex_id[];
|
||||
|
||||
static char *rt_opts[] = {
|
||||
"pattern matching via", regex_id,
|
||||
};
|
||||
static const char indent[] = " ";
|
||||
|
||||
/*
|
||||
* 3.6.0
|
||||
* Some optional stuff is no longer available to makedefs because
|
||||
* it depends which of several object files got linked into the
|
||||
* game image, so we insert those options here.
|
||||
*/
|
||||
STATIC_OVL void
|
||||
insert_rtoptions(win, buf)
|
||||
winid win;
|
||||
char *buf;
|
||||
{
|
||||
char rtbuf[BUFSZ];
|
||||
char *pd;
|
||||
int l, i = 0, j = 0;
|
||||
|
||||
if (strlen(buf) >= BUFSZ - 3)
|
||||
return;
|
||||
|
||||
strcpy(rtbuf, buf);
|
||||
pd = eos(rtbuf);
|
||||
pd--;
|
||||
if (*pd == '.')
|
||||
*pd = 0;
|
||||
Strcat(rtbuf, ", ");
|
||||
l = strlen(rtbuf);
|
||||
|
||||
for (i = 0; i < SIZE(rt_opts); i++) {
|
||||
if (l + strlen(rt_opts[i]) > COLNO - 5) {
|
||||
putstr(win, 0, rtbuf);
|
||||
if (strlen(rt_opts[i]) < BUFSZ - (1 + strlen(indent))) {
|
||||
Strcpy(rtbuf, indent);
|
||||
}
|
||||
}
|
||||
Strcat(rtbuf, rt_opts[i]);
|
||||
l = strlen(rtbuf);
|
||||
if (i % 2)
|
||||
Strcat(rtbuf, (i < SIZE(rt_opts)- 1) ? "," : "."), l++;
|
||||
else
|
||||
Strcat(rtbuf, " "), l++;
|
||||
}
|
||||
|
||||
if (l)
|
||||
putstr(win, 0, rtbuf);
|
||||
}
|
||||
|
||||
#ifdef MICRO
|
||||
boolean
|
||||
comp_times(filetime)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
extern "C" {
|
||||
#include <hack.h>
|
||||
|
||||
char regex_id[] = "cppregex";
|
||||
|
||||
struct nhregex {
|
||||
std::unique_ptr<std::regex> re;
|
||||
std::unique_ptr<std::regex_error> err;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 posixregex.c $NHDT-Date: 1432472490 2015/05/24 13:01:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
|
||||
/* NetHack 3.6 posixregex.c $NHDT-Date: 1434151360 2015/06/12 23:22:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
|
||||
/* Copyright (c) Sean Hunt 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
* NOTE: This file is untested.
|
||||
*/
|
||||
|
||||
char regex_id[] = "pmatchregex";
|
||||
|
||||
struct nhregex {
|
||||
const char *pat;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 posixregex.c $NHDT-Date: 1431192778 2015/05/09 17:32:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.2 $ */
|
||||
/* NetHack 3.6 posixregex.c $NHDT-Date: 1434151361 2015/06/12 23:22:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.4 $ */
|
||||
/* Copyright (c) Sean Hunt 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
* Deallocate a regex object.
|
||||
*/
|
||||
|
||||
char regex_id[] = "posixregex";
|
||||
|
||||
struct nhregex {
|
||||
regex_t re;
|
||||
int err;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 makedefs.c $NHDT-Date: 1432535188 2015/05/25 06:26:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.102 $ */
|
||||
/* NetHack 3.6 makedefs.c $NHDT-Date: 1434151372 2015/06/12 23:22:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
||||
/* Copyright (c) Dean Luick, 1990. */
|
||||
@@ -1352,11 +1352,6 @@ static const char *build_opts[] = {
|
||||
#ifdef NEWS
|
||||
"news file",
|
||||
#endif
|
||||
#ifdef MENU_COLOR_REGEX
|
||||
"menu colors via regular expressions",
|
||||
#else
|
||||
"menu colors via pmatch",
|
||||
#endif
|
||||
#ifdef OVERLAY
|
||||
#ifdef MOVERLAY
|
||||
"MOVE overlays",
|
||||
|
||||
Reference in New Issue
Block a user