summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/regc_color.c32
-rw-r--r--generic/regc_cvec.c6
-rw-r--r--generic/regc_lex.c30
-rw-r--r--generic/regc_nfa.c62
-rw-r--r--generic/regcomp.c3
-rw-r--r--generic/regcustom.h10
-rw-r--r--generic/regex.h68
-rw-r--r--generic/regexec.c2
-rw-r--r--generic/regfronts.c6
-rw-r--r--generic/regguts.h9
10 files changed, 141 insertions, 87 deletions
diff --git a/generic/regc_color.c b/generic/regc_color.c
index 92e0aad..53fc20d 100644
--- a/generic/regc_color.c
+++ b/generic/regc_color.c
@@ -37,7 +37,7 @@
/*
- initcm - set up new colormap
- ^ static void initcm(struct vars *, struct colormap *);
+ ^ static VOID initcm(struct vars *, struct colormap *);
*/
static void
initcm(
@@ -88,7 +88,7 @@ initcm(
/*
- freecm - free dynamically-allocated things in a colormap
- ^ static void freecm(struct colormap *);
+ ^ static VOID freecm(struct colormap *);
*/
static void
freecm(
@@ -116,7 +116,7 @@ freecm(
/*
- cmtreefree - free a non-terminal part of a colormap tree
- ^ static void cmtreefree(struct colormap *, union tree *, int);
+ ^ static VOID cmtreefree(struct colormap *, union tree *, int);
*/
static void
cmtreefree(
@@ -294,7 +294,7 @@ newcolor(
/*
- freecolor - free a color (must have no arcs or subcolor)
- ^ static void freecolor(struct colormap *, pcolor);
+ ^ static VOID freecolor(struct colormap *, pcolor);
*/
static void
freecolor(
@@ -327,7 +327,7 @@ freecolor(
cm->free = cm->cd[cm->free].sub;
}
if (cm->free > 0) {
- assert((size_t)cm->free < cm->max);
+ assert(cm->free < cm->max);
pco = cm->free;
nco = cm->cd[pco].sub;
while (nco > 0) {
@@ -339,7 +339,7 @@ freecolor(
nco = cm->cd[nco].sub;
cm->cd[pco].sub = nco;
} else {
- assert((size_t)nco < cm->max);
+ assert(nco < cm->max);
pco = nco;
nco = cm->cd[pco].sub;
}
@@ -429,7 +429,7 @@ newsub(
/*
- subrange - allocate new subcolors to this range of chrs, fill in arcs
- ^ static void subrange(struct vars *, pchr, pchr, struct state *,
+ ^ static VOID subrange(struct vars *, pchr, pchr, struct state *,
^ struct state *);
*/
static void
@@ -477,7 +477,7 @@ subrange(
/*
- subblock - allocate new subcolors for one tree block of chrs, fill in arcs
- ^ static void subblock(struct vars *, pchr, struct state *, struct state *);
+ ^ static VOID subblock(struct vars *, pchr, struct state *, struct state *);
*/
static void
subblock(
@@ -582,7 +582,7 @@ subblock(
/*
- okcolors - promote subcolors to full colors
- ^ static void okcolors(struct nfa *, struct colormap *);
+ ^ static VOID okcolors(struct nfa *, struct colormap *);
*/
static void
okcolors(
@@ -643,7 +643,7 @@ okcolors(
/*
- colorchain - add this arc to the color chain of its color
- ^ static void colorchain(struct colormap *, struct arc *);
+ ^ static VOID colorchain(struct colormap *, struct arc *);
*/
static void
colorchain(
@@ -662,7 +662,7 @@ colorchain(
/*
- uncolorchain - delete this arc from the color chain of its color
- ^ static void uncolorchain(struct colormap *, struct arc *);
+ ^ static VOID uncolorchain(struct colormap *, struct arc *);
*/
static void
uncolorchain(
@@ -688,7 +688,7 @@ uncolorchain(
/*
- rainbow - add arcs of all full colors (but one) between specified states
- ^ static void rainbow(struct nfa *, struct colormap *, int, pcolor,
+ ^ static VOID rainbow(struct nfa *, struct colormap *, int, pcolor,
^ struct state *, struct state *);
*/
static void
@@ -715,7 +715,7 @@ rainbow(
/*
- colorcomplement - add arcs of complementary colors
* The calling sequence ought to be reconciled with cloneouts().
- ^ static void colorcomplement(struct nfa *, struct colormap *, int,
+ ^ static VOID colorcomplement(struct nfa *, struct colormap *, int,
^ struct state *, struct state *, struct state *);
*/
static void
@@ -748,7 +748,7 @@ colorcomplement(
/*
- dumpcolors - debugging output
- ^ static void dumpcolors(struct colormap *, FILE *);
+ ^ static VOID dumpcolors(struct colormap *, FILE *);
*/
static void
dumpcolors(
@@ -797,7 +797,7 @@ dumpcolors(
/*
- fillcheck - check proper filling of a tree
- ^ static void fillcheck(struct colormap *, union tree *, int, FILE *);
+ ^ static VOID fillcheck(struct colormap *, union tree *, int, FILE *);
*/
static void
fillcheck(
@@ -826,7 +826,7 @@ fillcheck(
/*
- dumpchr - print a chr
* Kind of char-centric but works well enough for debug use.
- ^ static void dumpchr(pchr, FILE *);
+ ^ static VOID dumpchr(pchr, FILE *);
*/
static void
dumpchr(
diff --git a/generic/regc_cvec.c b/generic/regc_cvec.c
index d450d3e..25a44b9 100644
--- a/generic/regc_cvec.c
+++ b/generic/regc_cvec.c
@@ -74,7 +74,7 @@ clearcvec(
/*
- addchr - add a chr to a cvec
- ^ static void addchr(struct cvec *, pchr);
+ ^ static VOID addchr(struct cvec *, pchr);
*/
static void
addchr(
@@ -87,7 +87,7 @@ addchr(
/*
- addrange - add a range to a cvec
- ^ static void addrange(struct cvec *, pchr, pchr);
+ ^ static VOID addrange(struct cvec *, pchr, pchr);
*/
static void
addrange(
@@ -129,7 +129,7 @@ getcvec(
/*
- freecvec - free a cvec
- ^ static void freecvec(struct cvec *);
+ ^ static VOID freecvec(struct cvec *);
*/
static void
freecvec(
diff --git a/generic/regc_lex.c b/generic/regc_lex.c
index 588932b..8d07c59 100644
--- a/generic/regc_lex.c
+++ b/generic/regc_lex.c
@@ -63,7 +63,7 @@
/*
- lexstart - set up lexical stuff, scan leading options
- ^ static void lexstart(struct vars *);
+ ^ static VOID lexstart(struct vars *);
*/
static void
lexstart(
@@ -89,7 +89,7 @@ lexstart(
/*
- prefixes - implement various special prefixes
- ^ static void prefixes(struct vars *);
+ ^ static VOID prefixes(struct vars *);
*/
static void
prefixes(
@@ -207,7 +207,7 @@ prefixes(
- lexnest - "call a subroutine", interpolating string at the lexical level
* Note, this is not a very general facility. There are a number of
* implicit assumptions about what sorts of strings can be subroutines.
- ^ static void lexnest(struct vars *, const chr *, const chr *);
+ ^ static VOID lexnest(struct vars *, const chr *, const chr *);
*/
static void
lexnest(
@@ -275,7 +275,7 @@ static const chr brbackw[] = { /* \w within brackets */
/*
- lexword - interpolate a bracket expression for word characters
* Possibly ought to inquire whether there is a "word" character class.
- ^ static void lexword(struct vars *);
+ ^ static VOID lexword(struct vars *);
*/
static void
lexword(
@@ -922,7 +922,7 @@ lexdigits(
int len;
chr c;
int d;
- const uchr ub = (uchr) base;
+ CONST uchr ub = (uchr) base;
n = 0;
for (len = 0; len < maxlen && !ATEOS(); len++) {
@@ -1080,7 +1080,7 @@ brenext(
/*
- skip - skip white space and comments in expanded form
- ^ static void skip(struct vars *);
+ ^ static VOID skip(struct vars *);
*/
static void
skip(
@@ -1124,6 +1124,24 @@ newline(void)
}
/*
+ - ch - return the chr sequence for regc_locale.c's fake collating element ch
+ * This helps confine use of CHR to this source file. Beware that the caller
+ * knows how long the sequence is.
+ ^ #ifdef REG_DEBUG
+ ^ static const chr *ch(NOPARMS);
+ ^ #endif
+ */
+#ifdef REG_DEBUG
+static const chr *
+ch(void)
+{
+ static const chr chstr[] = { CHR('c'), CHR('h'), CHR('\0') };
+
+ return chstr;
+}
+#endif
+
+/*
- chrnamed - return the chr known by a given (chr string) name
* The code is a bit clumsy, but this routine gets only such specialized
* use that it hardly matters.
diff --git a/generic/regc_nfa.c b/generic/regc_nfa.c
index 088c6c0..87648ba 100644
--- a/generic/regc_nfa.c
+++ b/generic/regc_nfa.c
@@ -90,7 +90,7 @@ newnfa(
/*
- freenfa - free an entire NFA
- ^ static void freenfa(struct nfa *);
+ ^ static VOID freenfa(struct nfa *);
*/
static void
freenfa(
@@ -184,7 +184,7 @@ newfstate(
/*
- dropstate - delete a state's inarcs and outarcs and free it
- ^ static void dropstate(struct nfa *, struct state *);
+ ^ static VOID dropstate(struct nfa *, struct state *);
*/
static void
dropstate(
@@ -204,7 +204,7 @@ dropstate(
/*
- freestate - free a state, which has no in-arcs or out-arcs
- ^ static void freestate(struct nfa *, struct state *);
+ ^ static VOID freestate(struct nfa *, struct state *);
*/
static void
freestate(
@@ -235,7 +235,7 @@ freestate(
/*
- destroystate - really get rid of an already-freed state
- ^ static void destroystate(struct nfa *, struct state *);
+ ^ static VOID destroystate(struct nfa *, struct state *);
*/
static void
destroystate(
@@ -260,7 +260,7 @@ destroystate(
/*
- newarc - set up a new arc within an NFA
- ^ static void newarc(struct nfa *, int, pcolor, struct state *,
+ ^ static VOID newarc(struct nfa *, int, pcolor, struct state *,
^ struct state *);
*/
/*
@@ -410,7 +410,7 @@ allocarc(
/*
- freearc - free an arc
- ^ static void freearc(struct nfa *, struct arc *);
+ ^ static VOID freearc(struct nfa *, struct arc *);
*/
static void
freearc(
@@ -569,7 +569,7 @@ findarc(
/*
- cparc - allocate a new arc within an NFA, copying details from old one
- ^ static void cparc(struct nfa *, struct arc *, struct state *,
+ ^ static VOID cparc(struct nfa *, struct arc *, struct state *,
^ struct state *);
*/
static void
@@ -756,7 +756,7 @@ sortouts_cmp(
* checks become too slow. In that case we proceed by sorting and merging
* the arc lists, and then we can indeed just update the arcs in-place.
*
- ^ static void moveins(struct nfa *, struct state *, struct state *);
+ ^ static VOID moveins(struct nfa *, struct state *, struct state *);
*/
static void
moveins(
@@ -1016,7 +1016,7 @@ mergeins(
/*
- moveouts - move all out arcs of a state to another state
- ^ static void moveouts(struct nfa *, struct state *, struct state *);
+ ^ static VOID moveouts(struct nfa *, struct state *, struct state *);
*/
static void
moveouts(
@@ -1176,7 +1176,7 @@ copyouts(
/*
- cloneouts - copy out arcs of a state to another state pair, modifying type
- ^ static void cloneouts(struct nfa *, struct state *, struct state *,
+ ^ static VOID cloneouts(struct nfa *, struct state *, struct state *,
^ struct state *, int);
*/
static void
@@ -1200,7 +1200,7 @@ cloneouts(
- delsub - delete a sub-NFA, updating subre pointers if necessary
* This uses a recursive traversal of the sub-NFA, marking already-seen
* states using their tmp pointer.
- ^ static void delsub(struct nfa *, struct state *, struct state *);
+ ^ static VOID delsub(struct nfa *, struct state *, struct state *);
*/
static void
delsub(
@@ -1223,7 +1223,7 @@ delsub(
/*
- deltraverse - the recursive heart of delsub
* This routine's basic job is to destroy all out-arcs of the state.
- ^ static void deltraverse(struct nfa *, struct state *, struct state *);
+ ^ static VOID deltraverse(struct nfa *, struct state *, struct state *);
*/
static void
deltraverse(
@@ -1266,7 +1266,7 @@ deltraverse(
* Another recursive traversal, this time using tmp to point to duplicates as
* well as mark already-seen states. (You knew there was a reason why it's a
* state pointer, didn't you? :-))
- ^ static void dupnfa(struct nfa *, struct state *, struct state *,
+ ^ static VOID dupnfa(struct nfa *, struct state *, struct state *,
^ struct state *, struct state *);
*/
static void
@@ -1292,7 +1292,7 @@ dupnfa(
/*
- duptraverse - recursive heart of dupnfa
- ^ static void duptraverse(struct nfa *, struct state *, struct state *);
+ ^ static VOID duptraverse(struct nfa *, struct state *, struct state *);
*/
static void
duptraverse(
@@ -1337,7 +1337,7 @@ duptraverse(
/*
- cleartraverse - recursive cleanup for algorithms that leave tmp ptrs set
- ^ static void cleartraverse(struct nfa *, struct state *);
+ ^ static VOID cleartraverse(struct nfa *, struct state *);
*/
static void
cleartraverse(
@@ -1358,7 +1358,7 @@ cleartraverse(
/*
- specialcolors - fill in special colors for an NFA
- ^ static void specialcolors(struct nfa *);
+ ^ static VOID specialcolors(struct nfa *);
*/
static void
specialcolors(
@@ -1441,7 +1441,7 @@ optimize(
/*
- pullback - pull back constraints backward to eliminate them
- ^ static void pullback(struct nfa *, FILE *);
+ ^ static VOID pullback(struct nfa *, FILE *);
*/
static void
pullback(
@@ -1621,7 +1621,7 @@ pull(
/*
- pushfwd - push forward constraints forward to eliminate them
- ^ static void pushfwd(struct nfa *, FILE *);
+ ^ static VOID pushfwd(struct nfa *, FILE *);
*/
static void
pushfwd(
@@ -1860,7 +1860,7 @@ combine(
/*
- fixempties - get rid of EMPTY arcs
- ^ static void fixempties(struct nfa *, FILE *);
+ ^ static VOID fixempties(struct nfa *, FILE *);
*/
static void
fixempties(
@@ -2683,7 +2683,7 @@ clonesuccessorstates(
/*
- cleanup - clean up NFA after optimizations
- ^ static void cleanup(struct nfa *);
+ ^ static VOID cleanup(struct nfa *);
*/
static void
cleanup(
@@ -2724,7 +2724,7 @@ cleanup(
/*
- markreachable - recursive marking of reachable states
- ^ static void markreachable(struct nfa *, struct state *, struct state *,
+ ^ static VOID markreachable(struct nfa *, struct state *, struct state *,
^ struct state *);
*/
static void
@@ -2748,7 +2748,7 @@ markreachable(
/*
- markcanreach - recursive marking of states which can reach here
- ^ static void markcanreach(struct nfa *, struct state *, struct state *,
+ ^ static VOID markcanreach(struct nfa *, struct state *, struct state *,
^ struct state *);
*/
static void
@@ -2796,7 +2796,7 @@ analyze(
/*
- compact - construct the compact representation of an NFA
- ^ static void compact(struct nfa *, struct cnfa *);
+ ^ static VOID compact(struct nfa *, struct cnfa *);
*/
static void
compact(
@@ -2890,7 +2890,7 @@ compact(
/*
- carcsort - sort compacted-NFA arcs by color
- ^ static void carcsort(struct carc *, struct carc *);
+ ^ static VOID carcsort(struct carc *, struct carc *);
*/
static void
carcsort(
@@ -2927,7 +2927,7 @@ carc_cmp(
/*
- freecnfa - free a compacted NFA
- ^ static void freecnfa(struct cnfa *);
+ ^ static VOID freecnfa(struct cnfa *);
*/
static void
freecnfa(
@@ -2942,7 +2942,7 @@ freecnfa(
/*
- dumpnfa - dump an NFA in human-readable form
- ^ static void dumpnfa(struct nfa *, FILE *);
+ ^ static VOID dumpnfa(struct nfa *, FILE *);
*/
static void
dumpnfa(
@@ -2988,7 +2988,7 @@ dumpnfa(
/*
- dumpstate - dump an NFA state in human-readable form
- ^ static void dumpstate(struct state *, FILE *);
+ ^ static VOID dumpstate(struct state *, FILE *);
*/
static void
dumpstate(
@@ -3018,7 +3018,7 @@ dumpstate(
/*
- dumparcs - dump out-arcs in human-readable form
- ^ static void dumparcs(struct state *, FILE *);
+ ^ static VOID dumparcs(struct state *, FILE *);
*/
static void
dumparcs(
@@ -3052,7 +3052,7 @@ dumparcs(
/*
- dumparc - dump one outarc in readable form, including prefixing tab
- ^ static void dumparc(struct arc *, struct state *, FILE *);
+ ^ static VOID dumparc(struct arc *, struct state *, FILE *);
*/
static void
dumparc(
@@ -3126,7 +3126,7 @@ dumparc(
/*
- dumpcnfa - dump a compacted NFA in human-readable form
- ^ static void dumpcnfa(struct cnfa *, FILE *);
+ ^ static VOID dumpcnfa(struct cnfa *, FILE *);
*/
static void
dumpcnfa(
@@ -3167,7 +3167,7 @@ dumpcnfa(
/*
- dumpcstate - dump a compacted-NFA state in human-readable form
- ^ static void dumpcstate(int, struct cnfa *, FILE *);
+ ^ static VOID dumpcstate(int, struct cnfa *, FILE *);
*/
static void
dumpcstate(
diff --git a/generic/regcomp.c b/generic/regcomp.c
index bee35d0..2bc0744 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -83,6 +83,9 @@ static chr lexdigits(struct vars *, int, int, int);
static int brenext(struct vars *, pchr);
static void skip(struct vars *);
static chr newline(NOPARMS);
+#ifdef REG_DEBUG
+static const chr *ch(NOPARMS);
+#endif
static chr chrnamed(struct vars *, const chr *, const chr *, pchr);
/* === regc_color.c === */
static void initcm(struct vars *, struct colormap *);
diff --git a/generic/regcustom.h b/generic/regcustom.h
index c2583fa..1c970ea 100644
--- a/generic/regcustom.h
+++ b/generic/regcustom.h
@@ -60,6 +60,12 @@
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
+#ifdef __REG_VOID_T
+#undef __REG_VOID_T
+#endif
+#ifdef __REG_CONST
+#undef __REG_CONST
+#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -69,6 +75,8 @@
/* Interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* Not really right, but good enough... */
+#define __REG_VOID_T void
+#define __REG_CONST const
/* Names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
@@ -89,7 +97,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */
#define NOCELT (-1) /* Celt value which is not valid chr */
#define CHR(c) (UCHAR(c)) /* Turn char literal into chr literal */
#define DIGITVAL(c) ((c)-'0') /* Turn chr digit into its value */
-#if TCL_UTF_MAX > 3
+#if TCL_UTF_MAX > 4
#define CHRBITS 32 /* Bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* Smallest and largest chr; the value */
#define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */
diff --git a/generic/regex.h b/generic/regex.h
index 8845f72..04a0d76 100644
--- a/generic/regex.h
+++ b/generic/regex.h
@@ -92,6 +92,12 @@ extern "C" {
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
+#ifdef __REG_VOID_T
+#undef __REG_VOID_T
+#endif
+#ifdef __REG_CONST
+#undef __REG_CONST
+#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -101,6 +107,8 @@ extern "C" {
/* interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* not really right, but good enough... */
+#define __REG_VOID_T VOID
+#define __REG_CONST CONST
/* names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
@@ -126,6 +134,26 @@ typedef long regoff_t;
#endif
/*
+ * For benefit of old compilers, we offer <sys/types.h> the option of
+ * overriding the `void' type used to declare nonexistent return types.
+ */
+#ifdef __REG_VOID_T
+typedef __REG_VOID_T re_void;
+#else
+typedef void re_void;
+#endif
+
+/*
+ * Also for benefit of old compilers, <sys/types.h> can supply a macro which
+ * expands to a substitute for `const'.
+ */
+#ifndef __REG_CONST
+#define __REG_CONST const
+#endif
+
+
+
+/*
* other interface types
*/
@@ -169,13 +197,13 @@ typedef struct {
/*
* compilation
^ #ifndef __REG_NOCHAR
- ^ int re_comp(regex_t *, const char *, size_t, int);
+ ^ int re_comp(regex_t *, __REG_CONST char *, size_t, int);
^ #endif
^ #ifndef __REG_NOFRONT
- ^ int regcomp(regex_t *, const char *, int);
+ ^ int regcomp(regex_t *, __REG_CONST char *, int);
^ #endif
^ #ifdef __REG_WIDE_T
- ^ int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
+ ^ int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
^ #endif
*/
#define REG_BASIC 000000 /* BREs (convenience) */
@@ -200,14 +228,14 @@ typedef struct {
/*
* execution
^ #ifndef __REG_NOCHAR
- ^ int re_exec(regex_t *, const char *, size_t,
+ ^ int re_exec(regex_t *, __REG_CONST char *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
^ #ifndef __REG_NOFRONT
- ^ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
+ ^ int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
^ #endif
^ #ifdef __REG_WIDE_T
- ^ int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t,
+ ^ int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
*/
@@ -220,7 +248,7 @@ typedef struct {
/*
* misc generics (may be more functions here eventually)
- ^ void regfree(regex_t *);
+ ^ re_void regfree(regex_t *);
*/
/*
@@ -232,7 +260,7 @@ typedef struct {
* of character is used for error reports is independent of what kind is used
* in matching.
*
- ^ extern size_t regerror(int, const regex_t *, char *, size_t);
+ ^ extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
*/
#define REG_OKAY 0 /* no errors detected */
#define REG_NOMATCH 1 /* failed to match */
@@ -265,25 +293,25 @@ typedef struct {
/* automatically gathered by fwd; do not hand-edit */
/* === regproto.h === */
#ifndef __REG_NOCHAR
-int re_comp(regex_t *, const char *, size_t, int);
+int re_comp(regex_t *, __REG_CONST char *, size_t, int);
#endif
#ifndef __REG_NOFRONT
-int regcomp(regex_t *, const char *, int);
+int regcomp(regex_t *, __REG_CONST char *, int);
#endif
#ifdef __REG_WIDE_T
-MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
+MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
#endif
#ifndef __REG_NOCHAR
-int re_exec(regex_t *, const char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
+int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
#ifndef __REG_NOFRONT
-int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
+int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
#endif
#ifdef __REG_WIDE_T
-MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
+MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
-MODULE_SCOPE void regfree(regex_t *);
-MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
+MODULE_SCOPE re_void regfree(regex_t *);
+MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
@@ -295,11 +323,3 @@ MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
#endif
#endif
-
-/*
- * Local Variables:
- * mode: c
- * c-basic-offset: 4
- * fill-column: 78
- * End:
- */
diff --git a/generic/regexec.c b/generic/regexec.c
index 6d12827..a7053c3 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -163,7 +163,7 @@ static struct sset *pickNextSS(struct vars *const, struct dfa *const, chr *const
int
exec(
regex_t *re,
- const chr *string,
+ CONST chr *string,
size_t len,
rm_detail_t *details,
size_t nmatch,
diff --git a/generic/regfronts.c b/generic/regfronts.c
index 088a640..5003297 100644
--- a/generic/regfronts.c
+++ b/generic/regfronts.c
@@ -39,7 +39,7 @@
int
regcomp(
regex_t *re,
- const char *str,
+ CONST char *str,
int flags)
{
size_t len;
@@ -61,12 +61,12 @@ regcomp(
int
regexec(
regex_t *re,
- const char *str,
+ CONST char *str,
size_t nmatch,
regmatch_t pmatch[],
int flags)
{
- const char *start;
+ CONST char *start;
size_t len;
int f = flags;
diff --git a/generic/regguts.h b/generic/regguts.h
index 1ac2465..cd14df5 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -66,6 +66,11 @@
#define NOPARMS void /* for empty parm lists */
#endif
+/* const */
+#ifndef CONST
+#define CONST const /* for old compilers, might be empty */
+#endif
+
/* function-pointer declarator */
#ifndef FUNCPTR
#if __STDC__ >= 1
@@ -408,7 +413,7 @@ struct subre {
*/
struct fns {
- void FUNCPTR(free, (regex_t *));
+ VOID FUNCPTR(free, (regex_t *));
};
/*
@@ -425,7 +430,7 @@ struct guts {
struct cnfa search; /* for fast preliminary search */
int ntree; /* number of subre's, plus one */
struct colormap cmap;
- int FUNCPTR(compare, (const chr *, const chr *, size_t));
+ int FUNCPTR(compare, (CONST chr *, CONST chr *, size_t));
struct subre *lacons; /* lookahead-constraint vector */
int nlacons; /* size of lacons */
};