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

19
include/nhregex.h Normal file
View File

@@ -0,0 +1,19 @@
/* NetHack 3.5 nhregex.h $NHDT-Date: 1428084467 2015/04/03 18:07:47 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.0 $ */
/* NetHack 3.5 nhregex.h $Date: 2009/05/06 10:44:33 $ $Revision: 1.4 $ */
/* Copyright (c) Sean Hunt 2015. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef NHREGEX_H
#define NHREGEX_H
#include <hack.h>
struct nhregex;
struct nhregex *regex_init(void);
boolean regex_compile(const char *s, struct nhregex *re);
const char *regex_error_desc(struct nhregex *re);
boolean regex_match(const char *s, struct nhregex *re);
void regex_free(struct nhregex *re);
#endif