22 register struct re_guts *g = r->re_g;
29 fprintf(d,
"%ld states, %d categories", (
long)g->nstates,
31 fprintf(d,
", first %ld last %ld", (
long)g->firststate,
34 fprintf(d,
", USEBOL");
36 fprintf(d,
", USEEOL");
40 fprintf(d,
", nsub=%ld", (
long)g->nsub);
42 fprintf(d,
", must(%ld) `%*s'", (
long)g->mlen, (
int)g->mlen,
45 fprintf(d,
", backrefs");
47 fprintf(d,
", nplus %ld", (
long)g->nplus);
49 s_print(r->charset, g, d);
50 for (i = 0; i < g->ncategories; i++) {
52 for (c = CHAR_MIN; c <= CHAR_MAX; c++)
53 if (g->categories[c] == i)
56 fprintf(d,
"cc0#%d", nincat[0]);
57 for (i = 1; i < g->ncategories; i++)
59 for (c = CHAR_MIN; c <= CHAR_MAX; c++)
60 if (g->categories[c] == i)
62 fprintf(d,
", %d=%s", i, regchar(r->charset,c,buf));
65 for (i = 1; i < g->ncategories; i++)
67 fprintf(d,
"cc%d\t", i);
69 for (c = CHAR_MIN; c <= CHAR_MAX+1; c++)
70 if (c <= CHAR_MAX && g->categories[c] == i) {
72 fprintf(d,
"%s", regchar(r->charset,c,buf));
79 regchar(r->charset,c-1,buf));
92 s_print(charset, g, d)
100 register int done = 0;
102 register int col = 0;
104 register sopno
offset = 2;
106 # define GAP() { if (offset % 5 == 0) { \
108 fprintf(d, "\n\t"); \
119 if (OP(g->strip[0]) != OEND)
120 fprintf(d,
"missing initial OEND!\n");
121 for (s = &g->strip[1]; !done; s++) {
129 if (strchr(
"\\|()^$.[+*?{}!<> ", (
char)opnd) != NULL)
130 fprintf(d,
"\\%c", (
char)opnd);
132 fprintf(d,
"%s", regchar(charset,(
char)opnd,buf));
150 fprintf(d,
"[(%ld)", (
long)opnd);
153 for (i = 0; i < g->csetsize+1; i++)
154 if (CHIN(cs, i) && i < g->csetsize) {
156 fprintf(d,
"%s", regchar(charset,i,buf));
163 regchar(charset,i-1,buf));
170 fprintf(d,
"(\\<%ld>", (
long)opnd);
173 fprintf(d,
"<%ld>\\)", (
long)opnd);
177 if (OP(*(s+opnd)) != O_PLUS)
178 fprintf(d,
"<%ld>", (
long)opnd);
181 if (OP(*(s-opnd)) != OPLUS_)
182 fprintf(d,
"<%ld>", (
long)opnd);
187 if (OP(*(s+opnd)) != O_QUEST)
188 fprintf(d,
"<%ld>", (
long)opnd);
191 if (OP(*(s-opnd)) != OQUEST_)
192 fprintf(d,
"<%ld>", (
long)opnd);
196 fprintf(d,
"((<%ld>", (
long)opnd);
199 fprintf(d,
"<%ld>))", (
long)opnd);
203 if (OP(*(s+opnd)) != OOR2)
204 fprintf(d,
"<%ld>", (
long)opnd);
207 if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
208 fprintf(d,
"<%ld>", (
long)opnd);
213 if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
214 fprintf(d,
"<%ld>", (
long)opnd);
217 if (OP(*(s-opnd)) != OOR1)
218 fprintf(d,
"<%ld>", (
long)opnd);
222 fprintf(d,
"!%ld(%ld)!", OP(*s), opnd);
235 regchar(charset,ch,buf)
241 if (my_isprint(charset,ch) || ch ==
' ')
242 sprintf(buf,
"%c", ch);
244 sprintf(buf,
"\\%o", ch);