From bc88266081e15036261dc9ad2a96d603d76e65a1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 Nov 2024 17:08:54 -0500 Subject: [PATCH] NetHack's regex function prototypes into nhregex.h There was an issue with Windows mingw build because the function prototypes were not available. Place them into a distinct header file nhregex.h and include it from extern.h, and available for cppregex.cpp to include without the rest of extern.h (which can give some problems with c++). --- include/extern.h | 7 +------ include/nhregex.h | 17 +++++++++++++++++ sys/share/cppregex.cpp | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 include/nhregex.h diff --git a/include/extern.h b/include/extern.h index 81c52e11d..8fa5aa9b3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2074,12 +2074,7 @@ extern void tutorial(boolean); #endif /* MAKEDEFS_C MDLIB_C CPPREGEX_C */ /* ### {cpp,pmatch,posix}regex.c ### */ - -extern struct nhregex *regex_init(void); -extern boolean regex_compile(const char *, struct nhregex *) NONNULLARG1; -extern char *regex_error_desc(struct nhregex *, char *) NONNULLARG2; -extern boolean regex_match(const char *, struct nhregex *) NO_NNARGS; -extern void regex_free(struct nhregex *) NONNULLARG1; +#include "nhregex.h" #if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(CPPREGEX_C) diff --git a/include/nhregex.h b/include/nhregex.h new file mode 100644 index 000000000..6dc989213 --- /dev/null +++ b/include/nhregex.h @@ -0,0 +1,17 @@ +/* NetHack 3.7 nhregex.h $NHDT-Date: $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: $ */ +/* NetHack may be freely redistributed. See license for details. */ + +#ifndef NHREGEX_H +#define NHREGEX_H + +/* ### {cpp,pmatch,posix}regex.c ### */ + +extern struct nhregex *regex_init(void); +extern boolean regex_compile(const char *, struct nhregex *) NONNULLARG1; +extern char *regex_error_desc(struct nhregex *, char *) NONNULLARG2; +extern boolean regex_match(const char *, struct nhregex *) NO_NNARGS; +extern void regex_free(struct nhregex *) NONNULLARG1; + +#endif /* NHREGEX_H */ + +/*extern.h*/ diff --git a/sys/share/cppregex.cpp b/sys/share/cppregex.cpp index 4d45928c7..9835a1f5c 100644 --- a/sys/share/cppregex.cpp +++ b/sys/share/cppregex.cpp @@ -10,7 +10,7 @@ extern "C" { #include "config.h" #define CPPREGEX_C -//#include "extern.h" +#include "nhregex.h" } // extern "C"