Rename dprintf to DPRINTF and use C99 cpp variadic arguments. (#82)

POSIX specifies a dprintf function that operates on an fd instead of
a stdio stream.  Using upper case for macros is more idiomatic too.
We no longer need to use an extra set of parentheses for debugging
printf statements.
This commit is contained in:
Todd C. Miller 2020-06-25 12:32:34 -06:00 committed by GitHub
parent cef5180110
commit 292d39f7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 55 deletions

7
awk.h
View File

@ -44,14 +44,13 @@ typedef unsigned char uschar;
*/ */
#define setptr(ptr, a) (*(char *)(intptr_t)(ptr)) = (a) #define setptr(ptr, a) (*(char *)(intptr_t)(ptr)) = (a)
#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf #define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for DPRINTF
*/ */
#define DEBUG #define DEBUG
#ifdef DEBUG #ifdef DEBUG
/* uses have to be doubly parenthesized */ # define DPRINTF(...) if (dbg) printf(__VA_ARGS__)
# define dprintf(x) if (dbg) printf x
#else #else
# define dprintf(x) # define DPRINTF(...)
#endif #endif
extern enum compile_states { extern enum compile_states {

4
b.c
View File

@ -397,7 +397,7 @@ char *cclenter(const char *argp) /* add a character class */
i++; i++;
} }
*bp = 0; *bp = 0;
dprintf( ("cclenter: in = |%s|, out = |%s|\n", op, buf) ); DPRINTF("cclenter: in = |%s|, out = |%s|\n", op, buf);
xfree(op); xfree(op);
return (char *) tostring((char *) buf); return (char *) tostring((char *) buf);
} }
@ -733,7 +733,7 @@ Node *reparse(const char *p) /* parses regular expression pointed to by p */
{ /* uses relex() to scan regular expression */ { /* uses relex() to scan regular expression */
Node *np; Node *np;
dprintf( ("reparse <%s>\n", p) ); DPRINTF("reparse <%s>\n", p);
lastre = prestr = (const uschar *) p; /* prestr points to string to be parsed */ lastre = prestr = (const uschar *) p; /* prestr points to string to be parsed */
rtok = relex(); rtok = relex();
/* GNU compatibility: an empty regexp matches anything */ /* GNU compatibility: an empty regexp matches anything */

28
lib.c
View File

@ -147,8 +147,8 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record *
firsttime = false; firsttime = false;
initgetrec(); initgetrec();
} }
dprintf( ("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n", DPRINTF("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n",
*RS, *FS, *ARGC, *FILENAME) ); *RS, *FS, *ARGC, *FILENAME);
if (isrecord) { if (isrecord) {
donefld = false; donefld = false;
donerec = true; donerec = true;
@ -157,7 +157,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record *
saveb0 = buf[0]; saveb0 = buf[0];
buf[0] = 0; buf[0] = 0;
while (argno < *ARGC || infile == stdin) { while (argno < *ARGC || infile == stdin) {
dprintf( ("argno=%d, file=|%s|\n", argno, file) ); DPRINTF("argno=%d, file=|%s|\n", argno, file);
if (infile == NULL) { /* have to open a new file */ if (infile == NULL) { /* have to open a new file */
file = getargv(argno); file = getargv(argno);
if (file == NULL || *file == '\0') { /* deleted or zapped */ if (file == NULL || *file == '\0') { /* deleted or zapped */
@ -170,7 +170,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record *
continue; continue;
} }
*FILENAME = file; *FILENAME = file;
dprintf( ("opening file %s\n", file) ); DPRINTF("opening file %s\n", file);
if (*file == '-' && *(file+1) == '\0') if (*file == '-' && *(file+1) == '\0')
infile = stdin; infile = stdin;
else if ((infile = fopen(file, "r")) == NULL) else if ((infile = fopen(file, "r")) == NULL)
@ -271,7 +271,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec
*pbuf = buf; *pbuf = buf;
*pbufsize = bufsize; *pbufsize = bufsize;
isrec = *buf || !feof(inf); isrec = *buf || !feof(inf);
dprintf( ("readrec saw <%s>, returns %d\n", buf, isrec) ); DPRINTF("readrec saw <%s>, returns %d\n", buf, isrec);
return isrec; return isrec;
} }
@ -286,7 +286,7 @@ char *getargv(int n) /* get ARGV[n] */
return NULL; return NULL;
x = setsymtab(temp, "", 0.0, STR, ARGVtab); x = setsymtab(temp, "", 0.0, STR, ARGVtab);
s = getsval(x); s = getsval(x);
dprintf( ("getargv(%d) returns |%s|\n", n, s) ); DPRINTF("getargv(%d) returns |%s|\n", n, s);
return s; return s;
} }
@ -305,7 +305,7 @@ void setclvar(char *s) /* set var=value from s */
q->fval = atof(q->sval); q->fval = atof(q->sval);
q->tval |= NUM; q->tval |= NUM;
} }
dprintf( ("command line set %s to |%s|\n", s, p) ); DPRINTF("command line set %s to |%s|\n", s, p);
} }
@ -504,7 +504,7 @@ int refldbld(const char *rec, const char *fs) /* build fields from reg expr in F
if (*rec == '\0') if (*rec == '\0')
return 0; return 0;
pfa = makedfa(fs, 1); pfa = makedfa(fs, 1);
dprintf( ("into refldbld, rec = <%s>, pat = <%s>\n", rec, fs) ); DPRINTF("into refldbld, rec = <%s>, pat = <%s>\n", rec, fs);
tempstat = pfa->initstat; tempstat = pfa->initstat;
for (i = 1; ; i++) { for (i = 1; ; i++) {
if (i > nfields) if (i > nfields)
@ -513,16 +513,16 @@ int refldbld(const char *rec, const char *fs) /* build fields from reg expr in F
xfree(fldtab[i]->sval); xfree(fldtab[i]->sval);
fldtab[i]->tval = FLD | STR | DONTFREE; fldtab[i]->tval = FLD | STR | DONTFREE;
fldtab[i]->sval = fr; fldtab[i]->sval = fr;
dprintf( ("refldbld: i=%d\n", i) ); DPRINTF("refldbld: i=%d\n", i);
if (nematch(pfa, rec)) { if (nematch(pfa, rec)) {
pfa->initstat = 2; /* horrible coupling to b.c */ pfa->initstat = 2; /* horrible coupling to b.c */
dprintf( ("match %s (%d chars)\n", patbeg, patlen) ); DPRINTF("match %s (%d chars)\n", patbeg, patlen);
strncpy(fr, rec, patbeg-rec); strncpy(fr, rec, patbeg-rec);
fr += patbeg - rec + 1; fr += patbeg - rec + 1;
*(fr-1) = '\0'; *(fr-1) = '\0';
rec = patbeg + patlen; rec = patbeg + patlen;
} else { } else {
dprintf( ("no match %s\n", rec) ); DPRINTF("no match %s\n", rec);
strcpy(fr, rec); strcpy(fr, rec);
pfa->initstat = tempstat; pfa->initstat = tempstat;
break; break;
@ -556,15 +556,15 @@ void recbld(void) /* create $0 from $1..$NF if necessary */
if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3")) if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3"))
FATAL("built giant record `%.30s...'", record); FATAL("built giant record `%.30s...'", record);
*r = '\0'; *r = '\0';
dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); DPRINTF("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]);
if (freeable(fldtab[0])) if (freeable(fldtab[0]))
xfree(fldtab[0]->sval); xfree(fldtab[0]->sval);
fldtab[0]->tval = REC | STR | DONTFREE; fldtab[0]->tval = REC | STR | DONTFREE;
fldtab[0]->sval = record; fldtab[0]->sval = record;
dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); DPRINTF("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]);
dprintf( ("recbld = |%s|\n", record) ); DPRINTF("recbld = |%s|\n", record);
donerec = true; donerec = true;
} }

6
main.c
View File

@ -200,7 +200,7 @@ int main(int argc, char *argv[])
exit(0); exit(0);
FATAL("no program given"); FATAL("no program given");
} }
dprintf( ("program = |%s|\n", argv[1]) ); DPRINTF("program = |%s|\n", argv[1]);
lexprog = argv[1]; lexprog = argv[1];
argc--; argc--;
argv++; argv++;
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
syminit(); syminit();
compile_time = COMPILING; compile_time = COMPILING;
argv[0] = cmdname; /* put prog name at front of arglist */ argv[0] = cmdname; /* put prog name at front of arglist */
dprintf( ("argc=%d, argv[0]=%s\n", argc, argv[0]) ); DPRINTF("argc=%d, argv[0]=%s\n", argc, argv[0]);
arginit(argc, argv); arginit(argc, argv);
if (!safe) if (!safe)
envinit(environ); envinit(environ);
@ -221,7 +221,7 @@ int main(int argc, char *argv[])
#endif #endif
if (fs) if (fs)
*FS = qstring(fs, '\0'); *FS = qstring(fs, '\0');
dprintf( ("errorflag=%d\n", errorflag) ); DPRINTF("errorflag=%d\n", errorflag);
if (errorflag == 0) { if (errorflag == 0) {
compile_time = RUNNING; compile_time = RUNNING;
run(winner); run(winner);

View File

@ -250,7 +250,7 @@ void defn(Cell *v, Node *vl, Node *st) /* turn on FCN bit in definition, */
for (p = vl; p; p = p->nnext) for (p = vl; p; p = p->nnext)
n++; n++;
v->fval = n; v->fval = n;
dprintf( ("defining func %s (%d args)\n", v->nval, n) ); DPRINTF("defining func %s (%d args)\n", v->nval, n);
} }
int isarg(const char *s) /* is s in argument list for current function? */ int isarg(const char *s) /* is s in argument list for current function? */

28
run.c
View File

@ -119,7 +119,7 @@ int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr,
if (rminlen) if (rminlen)
minlen += quantum - rminlen; minlen += quantum - rminlen;
tbuf = realloc(*pbuf, minlen); tbuf = realloc(*pbuf, minlen);
dprintf( ("adjbuf %s: %d %d (pbuf=%p, tbuf=%p)\n", whatrtn, *psiz, minlen, *pbuf, tbuf) ); DPRINTF("adjbuf %s: %d %d (pbuf=%p, tbuf=%p)\n", whatrtn, *psiz, minlen, *pbuf, tbuf);
if (tbuf == NULL) { if (tbuf == NULL) {
if (whatrtn) if (whatrtn)
FATAL("out of memory in %s", whatrtn); FATAL("out of memory in %s", whatrtn);
@ -247,18 +247,18 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
for (ncall = 0, x = a[1]; x != NULL; x = x->nnext) /* args in call */ for (ncall = 0, x = a[1]; x != NULL; x = x->nnext) /* args in call */
ncall++; ncall++;
ndef = (int) fcn->fval; /* args in defn */ ndef = (int) fcn->fval; /* args in defn */
dprintf( ("calling %s, %d args (%d in defn), frp=%d\n", s, ncall, ndef, (int) (frp-frame)) ); DPRINTF("calling %s, %d args (%d in defn), frp=%d\n", s, ncall, ndef, (int) (frp-frame));
if (ncall > ndef) if (ncall > ndef)
WARNING("function %s called with %d args, uses only %d", WARNING("function %s called with %d args, uses only %d",
s, ncall, ndef); s, ncall, ndef);
if (ncall + ndef > NARGS) if (ncall + ndef > NARGS)
FATAL("function %s has %d arguments, limit %d", s, ncall+ndef, NARGS); FATAL("function %s has %d arguments, limit %d", s, ncall+ndef, NARGS);
for (i = 0, x = a[1]; x != NULL; i++, x = x->nnext) { /* get call args */ for (i = 0, x = a[1]; x != NULL; i++, x = x->nnext) { /* get call args */
dprintf( ("evaluate args[%d], frp=%d:\n", i, (int) (frp-frame)) ); DPRINTF("evaluate args[%d], frp=%d:\n", i, (int) (frp-frame));
y = execute(x); y = execute(x);
oargs[i] = y; oargs[i] = y;
dprintf( ("args[%d]: %s %f <%s>, t=%o\n", DPRINTF("args[%d]: %s %f <%s>, t=%o\n",
i, NN(y->nval), y->fval, isarr(y) ? "(array)" : NN(y->sval), y->tval) ); i, NN(y->nval), y->fval, isarr(y) ? "(array)" : NN(y->sval), y->tval);
if (isfcn(y)) if (isfcn(y))
FATAL("can't use function %s as argument in %s", y->nval, s); FATAL("can't use function %s as argument in %s", y->nval, s);
if (isarr(y)) if (isarr(y))
@ -284,9 +284,9 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
frp->nargs = ndef; /* number defined with (excess are locals) */ frp->nargs = ndef; /* number defined with (excess are locals) */
frp->retval = gettemp(); frp->retval = gettemp();
dprintf( ("start exec of %s, frp=%d\n", s, (int) (frp-frame)) ); DPRINTF("start exec of %s, frp=%d\n", s, (int) (frp-frame));
y = execute((Node *)(fcn->sval)); /* execute body */ y = execute((Node *)(fcn->sval)); /* execute body */
dprintf( ("finished exec of %s, frp=%d\n", s, (int) (frp-frame)) ); DPRINTF("finished exec of %s, frp=%d\n", s, (int) (frp-frame));
for (i = 0; i < ndef; i++) { for (i = 0; i < ndef; i++) {
Cell *t = frp->args[i]; Cell *t = frp->args[i];
@ -319,7 +319,7 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
tempfree(y); /* don't free twice! */ tempfree(y); /* don't free twice! */
} }
z = frp->retval; /* return value */ z = frp->retval; /* return value */
dprintf( ("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval) ); DPRINTF("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval);
frp--; frp--;
return(z); return(z);
} }
@ -347,7 +347,7 @@ Cell *arg(Node **a, int n) /* nth argument of a function */
{ {
n = ptoi(a[0]); /* argument number, counting from 0 */ n = ptoi(a[0]); /* argument number, counting from 0 */
dprintf( ("arg(%d), frp->nargs=%d\n", n, frp->nargs) ); DPRINTF("arg(%d), frp->nargs=%d\n", n, frp->nargs);
if (n+1 > frp->nargs) if (n+1 > frp->nargs)
FATAL("argument #%d of function %s was not supplied", FATAL("argument #%d of function %s was not supplied",
n+1, frp->fcncell->nval); n+1, frp->fcncell->nval);
@ -512,7 +512,7 @@ Cell *array(Node **a, int n) /* a[0] is symtab, a[1] is list of subscripts */
x = execute(a[0]); /* Cell* for symbol table */ x = execute(a[0]); /* Cell* for symbol table */
buf = makearraystring(a[1], __func__); buf = makearraystring(a[1], __func__);
if (!isarr(x)) { if (!isarr(x)) {
dprintf( ("making %s into an array\n", NN(x->nval)) ); DPRINTF("making %s into an array\n", NN(x->nval));
if (freeable(x)) if (freeable(x))
xfree(x->sval); xfree(x->sval);
x->tval &= ~(STR|NUM|DONTFREE); x->tval &= ~(STR|NUM|DONTFREE);
@ -558,7 +558,7 @@ Cell *intest(Node **a, int n) /* a[0] is index (list), a[1] is symtab */
ap = execute(a[1]); /* array name */ ap = execute(a[1]); /* array name */
if (!isarr(ap)) { if (!isarr(ap)) {
dprintf( ("making %s into an array\n", ap->nval) ); DPRINTF("making %s into an array\n", ap->nval);
if (freeable(ap)) if (freeable(ap))
xfree(ap->sval); xfree(ap->sval);
ap->tval &= ~(STR|NUM|DONTFREE); ap->tval &= ~(STR|NUM|DONTFREE);
@ -687,7 +687,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */
void tfree(Cell *a) /* free a tempcell */ void tfree(Cell *a) /* free a tempcell */
{ {
if (freeable(a)) { if (freeable(a)) {
dprintf( ("freeing %s %s %o\n", NN(a->nval), NN(a->sval), a->tval) ); DPRINTF("freeing %s %s %o\n", NN(a->nval), NN(a->sval), a->tval);
xfree(a->sval); xfree(a->sval);
} }
if (a == tmps) if (a == tmps)
@ -774,7 +774,7 @@ Cell *substr(Node **a, int nnn) /* substr(a[0], a[1], a[2]) */
n = 0; n = 0;
else if (n > k - m) else if (n > k - m)
n = k - m; n = k - m;
dprintf( ("substr: m=%d, n=%d, s=%s\n", m, n, s) ); DPRINTF("substr: m=%d, n=%d, s=%s\n", m, n, s);
y = gettemp(); y = gettemp();
temp = s[n+m-1]; /* with thanks to John Linderman */ temp = s[n+m-1]; /* with thanks to John Linderman */
s[n+m-1] = '\0'; s[n+m-1] = '\0';
@ -1276,7 +1276,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
sep = *fs; sep = *fs;
ap = execute(a[1]); /* array name */ ap = execute(a[1]); /* array name */
freesymtab(ap); freesymtab(ap);
dprintf( ("split: s=|%s|, a=%s, sep=|%s|\n", s, NN(ap->nval), fs) ); DPRINTF("split: s=|%s|, a=%s, sep=|%s|\n", s, NN(ap->nval), fs);
ap->tval &= ~STR; ap->tval &= ~STR;
ap->tval |= ARR; ap->tval |= ARR;
ap->sval = (char *) makesymtab(NSYMTAB); ap->sval = (char *) makesymtab(NSYMTAB);

34
tran.c
View File

@ -234,8 +234,8 @@ Cell *setsymtab(const char *n, const char *s, Awkfloat f, unsigned t, Array *tp)
Cell *p; Cell *p;
if (n != NULL && (p = lookup(n, tp)) != NULL) { if (n != NULL && (p = lookup(n, tp)) != NULL) {
dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", DPRINTF("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n",
(void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval);
return(p); return(p);
} }
p = malloc(sizeof(*p)); p = malloc(sizeof(*p));
@ -253,8 +253,8 @@ Cell *setsymtab(const char *n, const char *s, Awkfloat f, unsigned t, Array *tp)
h = hash(n, tp->size); h = hash(n, tp->size);
p->cnext = tp->tab[h]; p->cnext = tp->tab[h];
tp->tab[h] = p; tp->tab[h] = p;
dprintf( ("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", DPRINTF("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n",
(void*)p, p->nval, p->sval, p->fval, p->tval) ); (void*)p, p->nval, p->sval, p->fval, p->tval);
return(p); return(p);
} }
@ -313,11 +313,11 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */
fldno = atoi(vp->nval); fldno = atoi(vp->nval);
if (fldno > *NF) if (fldno > *NF)
newfld(fldno); newfld(fldno);
dprintf( ("setting field %d to %g\n", fldno, f) ); DPRINTF("setting field %d to %g\n", fldno, f);
} else if (&vp->fval == NF) { } else if (&vp->fval == NF) {
donerec = false; /* mark $0 invalid */ donerec = false; /* mark $0 invalid */
setlastfld(f); setlastfld(f);
dprintf( ("setting NF to %g\n", f) ); DPRINTF("setting NF to %g\n", f);
} else if (isrec(vp)) { } else if (isrec(vp)) {
donefld = false; /* mark $1... invalid */ donefld = false; /* mark $1... invalid */
donerec = true; donerec = true;
@ -333,7 +333,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */
vp->tval |= NUM; /* mark number ok */ vp->tval |= NUM; /* mark number ok */
if (f == -0) /* who would have thought this possible? */ if (f == -0) /* who would have thought this possible? */
f = 0; f = 0;
dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); DPRINTF("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval);
return vp->fval = f; return vp->fval = f;
} }
@ -353,8 +353,8 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */
int fldno; int fldno;
Awkfloat f; Awkfloat f;
dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", DPRINTF("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n",
(void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld);
if ((vp->tval & (NUM | STR)) == 0) if ((vp->tval & (NUM | STR)) == 0)
funnyvar(vp, "assign to"); funnyvar(vp, "assign to");
if (isfld(vp)) { if (isfld(vp)) {
@ -362,7 +362,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */
fldno = atoi(vp->nval); fldno = atoi(vp->nval);
if (fldno > *NF) if (fldno > *NF)
newfld(fldno); newfld(fldno);
dprintf( ("setting field %d to %s (%p)\n", fldno, s, s) ); DPRINTF("setting field %d to %s (%p)\n", fldno, s, s);
} else if (isrec(vp)) { } else if (isrec(vp)) {
donefld = false; /* mark $1... invalid */ donefld = false; /* mark $1... invalid */
donerec = true; donerec = true;
@ -378,14 +378,14 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */
vp->tval |= STR; vp->tval |= STR;
vp->fmt = NULL; vp->fmt = NULL;
setfree(vp); setfree(vp);
dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", DPRINTF("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n",
(void*)vp, NN(vp->nval), t, t, vp->tval, donerec, donefld) ); (void*)vp, NN(vp->nval), t, t, vp->tval, donerec, donefld);
vp->sval = t; vp->sval = t;
if (&vp->fval == NF) { if (&vp->fval == NF) {
donerec = false; /* mark $0 invalid */ donerec = false; /* mark $0 invalid */
f = getfval(vp); f = getfval(vp);
setlastfld(f); setlastfld(f);
dprintf( ("setting NF to %g\n", f) ); DPRINTF("setting NF to %g\n", f);
} }
return(vp->sval); return(vp->sval);
@ -404,8 +404,8 @@ Awkfloat getfval(Cell *vp) /* get float val of a Cell */
if (is_number(vp->sval) && !(vp->tval&CON)) if (is_number(vp->sval) && !(vp->tval&CON))
vp->tval |= NUM; /* make NUM only sparingly */ vp->tval |= NUM; /* make NUM only sparingly */
} }
dprintf( ("getfval %p: %s = %g, t=%o\n", DPRINTF("getfval %p: %s = %g, t=%o\n",
(void*)vp, NN(vp->nval), vp->fval, vp->tval) ); (void*)vp, NN(vp->nval), vp->fval, vp->tval);
return(vp->fval); return(vp->fval);
} }
@ -492,8 +492,8 @@ static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cel
} }
} }
done: done:
dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", DPRINTF("getsval %p: %s = \"%s (%p)\", t=%o\n",
(void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); (void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval);
return(vp->sval); return(vp->sval);
} }