Use extern.h for regexes.

I was planning to do this anyway, but it created an include loop that
was breaking it on Windows.
This commit is contained in:
Sean Hunt
2015-04-03 15:08:29 -04:00
parent b86ad06d6b
commit 80aa109855
5 changed files with 10 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
/* 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 $NHDT-Date: 1428088106 2015/04/03 19:08:26 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.8 $ */
/* 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,8 +7,6 @@
#ifndef COLOR_H
#define COLOR_H
#include <nhregex.h>
/*
* The color scheme used is tailored for an IBM PC. It consists of the
* standard 8 colors, folowed by their bright counterparts. There are

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 extern.h $NHDT-Date: 1428806395 2015/04/12 02:39:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.455 $ */
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1488,6 +1487,13 @@ E void NDECL(init_lan_features);
E char *NDECL(lan_username);
#endif
/* ### nhregex.c ### */
E struct nhregex * NDECL(regex_init);
E boolean FDECL(regex_compile, (const char *, struct nhregex *));
E const char *FDECL(regex_error_desc, (struct nhregex *));
E boolean FDECL(regex_match, (const char *, struct nhregex*));
E void FDECL(regex_free, (struct nhregex *));
/* ### nttty.c ### */
#ifdef WIN32CON

View File

@@ -1,19 +0,0 @@
/* 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

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 options.c $NHDT-Date: 1428084467 2015/04/03 18:07:47 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.181 $ */
/* NetHack 3.5 options.c $NHDT-Date: 1428088105 2015/04/03 19:08:25 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.182 $ */
/* NetHack 3.5 options.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.153 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -15,7 +15,6 @@ NEARDATA struct instance_flags iflags; /* provide linkage */
#define static
#else
#include "hack.h"
#include "nhregex.h"
#include "tcap.h"
#include <ctype.h>
#endif

View File

@@ -7,7 +7,7 @@
#include <memory>
extern "C" {
#include <nhregex.h>
#include <hack.h>
struct nhregex {
std::unique_ptr<std::regex> re;