frontend/define.c, cleanup `prtree()'
This commit is contained in:
parent
15f0f5f22f
commit
e7c7e7052b
|
|
@ -26,7 +26,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||||
|
|
||||||
static void savetree(struct pnode *pn);
|
static void savetree(struct pnode *pn);
|
||||||
static void prdefs(char *name);
|
static void prdefs(char *name);
|
||||||
static void prtree(struct udfunc *ud);
|
static void prtree(struct udfunc *ud, FILE *fp);
|
||||||
static void prtree1(struct pnode *pn, FILE *fp);
|
static void prtree1(struct pnode *pn, FILE *fp);
|
||||||
static struct pnode *trcopy(struct pnode *tree, char *args, struct pnode *nn);
|
static struct pnode *trcopy(struct pnode *tree, char *args, struct pnode *nn);
|
||||||
static struct pnode *ntharg(int num, struct pnode *args);
|
static struct pnode *ntharg(int num, struct pnode *args);
|
||||||
|
|
@ -203,10 +203,10 @@ prdefs(char *name)
|
||||||
if (name && *name) { /* You never know what people will do */
|
if (name && *name) { /* You never know what people will do */
|
||||||
for (udf = udfuncs; udf; udf = udf->ud_next)
|
for (udf = udfuncs; udf; udf = udf->ud_next)
|
||||||
if (eq(name, udf->ud_name))
|
if (eq(name, udf->ud_name))
|
||||||
prtree(udf);
|
prtree(udf, cp_out);
|
||||||
} else {
|
} else {
|
||||||
for (udf = udfuncs; udf; udf = udf->ud_next)
|
for (udf = udfuncs; udf; udf = udf->ud_next)
|
||||||
prtree(udf);
|
prtree(udf, cp_out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,26 +214,26 @@ prdefs(char *name)
|
||||||
/* Print out one definition. */
|
/* Print out one definition. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prtree(struct udfunc *ud)
|
prtree(struct udfunc *ud, FILE *fp)
|
||||||
{
|
{
|
||||||
char *s, buf[BSIZE_SP];
|
const char *s = ud->ud_name;
|
||||||
|
|
||||||
/* Print the head. */
|
/* print the function name */
|
||||||
buf[0] = '\0';
|
fprintf(fp, "%s (", s);
|
||||||
(void) strcat(buf, ud->ud_name);
|
s = strchr(s, '\0') + 1;
|
||||||
s = strchr(ud->ud_name, '\0') + 1;
|
|
||||||
(void) strcat(buf, " (");
|
/* print the formal args */
|
||||||
while (*s) {
|
while (*s) {
|
||||||
(void) strcat(buf, s);
|
fputs(s, fp);
|
||||||
s = strchr(s, '\0');
|
s = strchr(s, '\0') + 1;
|
||||||
if (s[1])
|
if (*s)
|
||||||
(void) strcat(buf, ", ");
|
fputs(", ", fp);
|
||||||
s++;
|
|
||||||
}
|
}
|
||||||
(void) strcat(buf, ") = ");
|
fputs(") = ", fp);
|
||||||
fputs(buf, cp_out);
|
|
||||||
prtree1(ud->ud_text, cp_out);
|
/* print the function body */
|
||||||
(void) putc('\n', cp_out);
|
prtree1(ud->ud_text, fp);
|
||||||
|
putc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue