Lines Matching defs:fp
219 struct Frame *fp = NULL; /* frame pointer. bottom level unused */
236 fp = frame = (struct Frame *) calloc(nframe += 100, sizeof(struct Frame));
243 dprintf( ("calling %s, %d args (%d in defn), fp=%d\n", s, ncall, ndef, (int) (fp-frame)) );
250 dprintf( ("evaluate args[%d], fp=%d:\n", i, (int) (fp-frame)) );
267 fp++; /* now ok to up frame */
268 if (fp >= frame + nframe) {
269 int dfp = fp - frame; /* old index */
274 fp = frame + dfp;
276 fp->fcncell = fcn;
277 fp->args = args;
278 fp->nargs = ndef; /* number defined with (excess are locals) */
279 fp->retval = gettemp();
281 dprintf( ("start exec of %s, fp=%d\n", s, (int) (fp-frame)) );
283 dprintf( ("finished exec of %s, fp=%d\n", s, (int) (fp-frame)) );
286 Cell *t = fp->args[i];
315 z = fp->retval; /* return value */
317 fp--;
340 dprintf( ("arg(%d), fp->nargs=%d\n", n, fp->nargs) );
341 if (n+1 > fp->nargs)
343 n+1, fp->fcncell->nval);
344 return fp->args[n];
363 setsval(fp->retval, getsval(y));
364 fp->retval->fval = getfval(y);
365 fp->retval->tval |= NUM;
368 setsval(fp->retval, getsval(y));
370 setfval(fp->retval, getfval(y));
395 FILE *fp;
410 fp = openfile(mode, getsval(x));
412 if (fp == NULL)
415 n = readrec(&buf, &bufsize, fp);
965 FILE *fp;
985 fp = redirect(ptoi(a[1]), a[2]);
986 /* fputs(buf, fp); */
987 fwrite(buf, len, 1, fp);
988 fflush(fp);
989 if (ferror(fp))
990 FATAL("write error on %s", filename(fp));
1471 FILE *fp;
1543 } else if ((fp = openfile(FFLUSH, getsval(x))) == NULL)
1546 u = fflush(fp);
1567 FILE *fp;
1570 fp = stdout;
1572 fp = redirect(ptoi(a[1]), a[2]);
1575 fputs(getpssval(y), fp);
1578 fputs(*ORS, fp);
1580 fputs(*OFS, fp);
1583 fflush(fp);
1584 if (ferror(fp))
1585 FATAL("write error on %s", filename(fp));
1599 FILE *fp;
1605 fp = openfile(a, fname);
1606 if (fp == NULL)
1609 return fp;
1613 FILE *fp;
1624 files[0].fp = stdin;
1625 files[1].fp = stdout;
1626 files[2].fp = stderr;
1633 FILE *fp = 0;
1640 return files[i].fp;
1642 return files[i].fp;
1648 if (files[i].fp == 0)
1655 fp = fopen(s, "w");
1657 fp = fopen(s, "a");
1660 fp = popen(s, "w");
1662 fp = popen(s, "r");
1664 fp = strcmp(s, "-") == 0 ? stdin : fopen(s, "r"); /* "-" is stdin */
1667 if (fp != NULL) {
1669 files[i].fp = fp;
1672 return fp;
1675 const char *filename(FILE *fp)
1680 if (fp == files[i].fp)
1696 if (ferror(files[i].fp))
1699 stat = pclose(files[i].fp);
1701 stat = fclose(files[i].fp);
1707 files[i].fp = NULL;
1721 if (files[i].fp) {
1722 if (ferror(files[i].fp))
1725 stat = pclose(files[i].fp);
1727 stat = fclose(files[i].fp);
1739 if (files[i].fp)
1740 fflush(files[i].fp);