- Use PROGS instead of PROG so that we can co-exist with TESTS_C
- Make the helper program compile again.
This commit is contained in:
parent
cb5943b9ae
commit
5b9dde0010
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile,v 1.2 2011/10/09 18:21:08 christos Exp $
|
# $NetBSD: Makefile,v 1.3 2011/10/10 04:32:41 christos Exp $
|
||||||
|
|
||||||
MKMAN= no
|
MKMAN= no
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ MKMAN= no
|
||||||
TESTSDIR= ${TESTSBASE}/lib/libc/regex
|
TESTSDIR= ${TESTSBASE}/lib/libc/regex
|
||||||
|
|
||||||
BINDIR= ${TESTSDIR}
|
BINDIR= ${TESTSDIR}
|
||||||
PROG= h_regex
|
PROGS+= h_regex
|
||||||
SRCS= main.c split.c debug.c
|
SRCS.h_regex= main.c split.c debug.c
|
||||||
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/regex
|
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/regex
|
||||||
|
|
||||||
TESTS_SH= t_regex
|
TESTS_SH= t_regex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: debug.c,v 1.1 2011/01/08 18:10:31 pgoyette Exp $ */
|
/* $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1993 The NetBSD Foundation, Inc.
|
* Copyright (c) 1993 The NetBSD Foundation, Inc.
|
||||||
|
@ -51,12 +51,11 @@ void
|
||||||
regprint(regex_t *r, FILE *d)
|
regprint(regex_t *r, FILE *d)
|
||||||
{
|
{
|
||||||
struct re_guts *g = r->re_g;
|
struct re_guts *g = r->re_g;
|
||||||
int i;
|
|
||||||
int c;
|
int c;
|
||||||
int last;
|
int last;
|
||||||
int nincat[NC];
|
int nincat[NC];
|
||||||
|
|
||||||
fprintf(d, "%ld states, %d categories", (long)g->nstates,
|
fprintf(d, "%ld states, %zu categories", (long)g->nstates,
|
||||||
g->ncategories);
|
g->ncategories);
|
||||||
fprintf(d, ", first %ld last %ld", (long)g->firststate,
|
fprintf(d, ", first %ld last %ld", (long)g->firststate,
|
||||||
(long)g->laststate);
|
(long)g->laststate);
|
||||||
|
@ -77,24 +76,24 @@ regprint(regex_t *r, FILE *d)
|
||||||
fprintf(d, ", nplus %ld", (long)g->nplus);
|
fprintf(d, ", nplus %ld", (long)g->nplus);
|
||||||
fprintf(d, "\n");
|
fprintf(d, "\n");
|
||||||
s_print(g, d);
|
s_print(g, d);
|
||||||
for (i = 0; i < g->ncategories; i++) {
|
for (size_t i = 0; i < g->ncategories; i++) {
|
||||||
nincat[i] = 0;
|
nincat[i] = 0;
|
||||||
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
||||||
if (g->categories[c] == i)
|
if (g->categories[c] == i)
|
||||||
nincat[i]++;
|
nincat[i]++;
|
||||||
}
|
}
|
||||||
fprintf(d, "cc0#%d", nincat[0]);
|
fprintf(d, "cc0#%d", nincat[0]);
|
||||||
for (i = 1; i < g->ncategories; i++)
|
for (size_t i = 1; i < g->ncategories; i++)
|
||||||
if (nincat[i] == 1) {
|
if (nincat[i] == 1) {
|
||||||
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
|
||||||
if (g->categories[c] == i)
|
if (g->categories[c] == i)
|
||||||
break;
|
break;
|
||||||
fprintf(d, ", %d=%s", i, regchar(c));
|
fprintf(d, ", %zu=%s", i, regchar(c));
|
||||||
}
|
}
|
||||||
fprintf(d, "\n");
|
fprintf(d, "\n");
|
||||||
for (i = 1; i < g->ncategories; i++)
|
for (size_t i = 1; i < g->ncategories; i++)
|
||||||
if (nincat[i] != 1) {
|
if (nincat[i] != 1) {
|
||||||
fprintf(d, "cc%d\t", i);
|
fprintf(d, "cc%zu\t", i);
|
||||||
last = -1;
|
last = -1;
|
||||||
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
|
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
|
||||||
if (c <= CHAR_MAX && g->categories[c] == i) {
|
if (c <= CHAR_MAX && g->categories[c] == i) {
|
||||||
|
@ -122,11 +121,10 @@ s_print(struct re_guts *g, FILE *d)
|
||||||
{
|
{
|
||||||
sop *s;
|
sop *s;
|
||||||
cset *cs;
|
cset *cs;
|
||||||
int i;
|
|
||||||
int done = 0;
|
int done = 0;
|
||||||
sop opnd;
|
sop opnd;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
int last;
|
ssize_t last;
|
||||||
sopno offset = 2;
|
sopno offset = 2;
|
||||||
# define GAP() { if (offset % 5 == 0) { \
|
# define GAP() { if (offset % 5 == 0) { \
|
||||||
if (col > 40) { \
|
if (col > 40) { \
|
||||||
|
@ -175,7 +173,7 @@ s_print(struct re_guts *g, FILE *d)
|
||||||
fprintf(d, "[(%ld)", (long)opnd);
|
fprintf(d, "[(%ld)", (long)opnd);
|
||||||
cs = &g->sets[opnd];
|
cs = &g->sets[opnd];
|
||||||
last = -1;
|
last = -1;
|
||||||
for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
|
for (size_t i = 0; i < g->csetsize+1; i++) /* +1 flushes */
|
||||||
if (CHIN(cs, i) && i < g->csetsize) {
|
if (CHIN(cs, i) && i < g->csetsize) {
|
||||||
if (last < 0) {
|
if (last < 0) {
|
||||||
fprintf(d, "%s", regchar(i));
|
fprintf(d, "%s", regchar(i));
|
||||||
|
@ -183,9 +181,9 @@ s_print(struct re_guts *g, FILE *d)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (last >= 0) {
|
if (last >= 0) {
|
||||||
if (last != i-1)
|
if (last != (ssize_t)i - 1)
|
||||||
fprintf(d, "-%s",
|
fprintf(d, "-%s",
|
||||||
regchar(i-1));
|
regchar(i - 1));
|
||||||
last = -1;
|
last = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue