Implement a new system-based matching harness.

The intent is to look for platform-specific facilities for regex
matching, to provide portable MENUCOLORS configuration files.

This is a prototype implementation being committed to see if Windows can
use the POSIX regex implementation provided with the C++11 standard
library. If this works, I will write a harness for POSIX regexes and for
pmatch(), and those can be linked in by platforms as appropriate.

pmatch() should be used only as a very last resort, because it breaks
compatibility between platforms.
This commit is contained in:
Sean Hunt
2015-04-03 14:07:53 -04:00
parent a3387432ac
commit b86ad06d6b
5 changed files with 81 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 color.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 color.h $NHDT-Date: 1428084467 2015/04/03 18:07:47 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.7 $ */
/* NetHack 3.5 color.h $Date: 2009/05/06 10:44:34 $ $Revision: 1.5 $ */
/* SCCS Id: @(#)color.h 3.5 1992/02/02 */
/* Copyright (c) Steve Linhart, Eric Raymond, 1989. */
@@ -7,9 +7,7 @@
#ifndef COLOR_H
#define COLOR_H
#ifdef MENU_COLOR_REGEX
#include <regex.h>
#endif
#include <nhregex.h>
/*
* The color scheme used is tailored for an IBM PC. It consists of the
@@ -56,15 +54,7 @@
#define HI_ZAP CLR_BRIGHT_BLUE
struct menucoloring {
# ifdef MENU_COLOR_REGEX
# ifdef MENU_COLOR_REGEX_POSIX
regex_t match;
# else
struct re_pattern_buffer match;
# endif
# else
char *match;
# endif
struct nhregex *match;
int color, attr;
struct menucoloring *next;
};