Lines Matching +full:fsin +full:- +full:output

52 	if (p->ctype == OCELL && (p->csub < CUNK || p->csub > CFREE)) {  in tempfree()
54 p->csub, p->ctype, p->sval); in tempfree()
119 int boff = pbptr ? *pbptr - *pbuf : 0; in adjbuf()
122 minlen += quantum - rminlen; in adjbuf()
154 for (a = u; ; a = a->nnext) { in execute()
157 x = (Cell *) (a->narg[0]); in execute()
164 if (notlegal(a->nobj)) /* probably a Cell* but too risky to print */ in execute()
166 proc = proctab[a->nobj-FIRSTTOKEN]; in execute()
167 x = (*proc)(a->narg, a->nobj); in execute()
176 if (a->nnext == NULL) in execute()
241 s = fcn->nval; in call()
249 for (ncall = 0, x = a[1]; x != NULL; x = x->nnext) /* args in call */ in call()
251 ndef = (int) fcn->fval; /* args in defn */ in call()
252 DPRINTF("calling %s, %d args (%d in defn), frp=%d\n", s, ncall, ndef, (int) (frp-frame)); in call()
258 for (i = 0, x = a[1]; x != NULL; i++, x = x->nnext) { /* get call args */ in call()
259 DPRINTF("evaluate args[%d], frp=%d:\n", i, (int) (frp-frame)); in call()
263 i, NN(y->nval), y->fval, isarr(y) ? "(array)" : NN(y->sval), y->tval); in call()
265 FATAL("can't use function %s as argument in %s", y->nval, s); in call()
278 int dfp = frp - frame; /* old index */ in call()
284 frp->fcncell = fcn; in call()
285 frp->args = args; in call()
286 frp->nargs = ndef; /* number defined with (excess are locals) */ in call()
287 frp->retval = gettemp(); in call()
289 DPRINTF("start exec of %s, frp=%d\n", s, (int) (frp-frame)); in call()
290 y = execute((Node *)(fcn->sval)); /* execute body */ in call()
291 DPRINTF("finished exec of %s, frp=%d\n", s, (int) (frp-frame)); in call()
294 Cell *t = frp->args[i]; in call()
296 if (t->csub == CCOPY) { in call()
299 t->csub = CTEMP; in call()
302 oargs[i]->tval = t->tval; in call()
303 oargs[i]->tval &= ~(STR|NUM|DONTFREE); in call()
304 oargs[i]->sval = t->sval; in call()
309 t->csub = CTEMP; in call()
311 } else if (t == y && t->csub == CCOPY) { in call()
312 t->csub = CTEMP; in call()
323 z = frp->retval; /* return value */ in call()
324 DPRINTF("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval); in call()
325 frp--; in call()
336 y->tval = x->tval & ~(CON|FLD|REC); in copycell()
337 y->csub = CCOPY; /* prevents freeing until call is over */ in copycell()
338 y->nval = x->nval; /* BUG? */ in copycell()
339 if (isstr(x) /* || x->ctype == OCELL */) { in copycell()
340 y->sval = tostring(x->sval); in copycell()
341 y->tval &= ~DONTFREE; in copycell()
343 y->tval |= DONTFREE; in copycell()
344 y->fval = x->fval; in copycell()
352 DPRINTF("arg(%d), frp->nargs=%d\n", n, frp->nargs); in arg()
353 if (n+1 > frp->nargs) in arg()
355 n+1, frp->fcncell->nval); in arg()
356 return frp->args[n]; in arg()
374 if ((y->tval & (STR|NUM)) == (STR|NUM)) { in jump()
375 setsval(frp->retval, getsval(y)); in jump()
376 frp->retval->fval = getfval(y); in jump()
377 frp->retval->tval |= NUM; in jump()
379 else if (y->tval & STR) in jump()
380 setsval(frp->retval, getsval(y)); in jump()
381 else if (y->tval & NUM) in jump()
382 setfval(frp->retval, getfval(y)); in jump()
384 FATAL("bad type variable %d", y->tval); in jump()
427 n = -1; in awkgetline()
435 if (is_number(x->sval, & result)) { in awkgetline()
436 x->fval = result; in awkgetline()
437 x->tval |= NUM; in awkgetline()
442 if (is_number(fldtab[0]->sval, & result)) { in awkgetline()
443 fldtab[0]->fval = result; in awkgetline()
444 fldtab[0]->tval |= NUM; in awkgetline()
455 if (is_number(x->sval, & result)) { in awkgetline()
456 x->fval = result; in awkgetline()
457 x->tval |= NUM; in awkgetline()
489 for (; p; p = p->nnext) { in makearraystring()
493 size_t nsub = p->nnext ? seplen : 0; in makearraystring()
499 func, x->nval, buf); in makearraystring()
520 DPRINTF("making %s into an array\n", NN(x->nval)); in array()
522 xfree(x->sval); in array()
523 x->tval &= ~(STR|NUM|DONTFREE); in array()
524 x->tval |= ARR; in array()
525 x->sval = (char *) makesymtab(NSYMTAB); in array()
527 z = setsymtab(buf, "", 0.0, STR|NUM, (Array *) x->sval); in array()
528 z->ctype = OCELL; in array()
529 z->csub = CVAR; in array()
547 x->tval &= ~STR; in awkdelete()
548 x->tval |= ARR; in awkdelete()
549 x->sval = (char *) makesymtab(NSYMTAB); in awkdelete()
566 DPRINTF("making %s into an array\n", ap->nval); in intest()
568 xfree(ap->sval); in intest()
569 ap->tval &= ~(STR|NUM|DONTFREE); in intest()
570 ap->tval |= ARR; in intest()
571 ap->sval = (char *) makesymtab(NSYMTAB); in intest()
574 k = lookup(buf, (Array *) ap->sval); in intest()
584 /* ======== utf-8 code ========== */
587 * Awk strings can contain ascii, random 8-bit items (eg Latin-1),
588 * or utf-8. u8_isutf tests whether a string starts with a valid
589 * utf-8 sequence, and returns 0 if not (e.g., high bit set).
591 * 1 for ascii, 2..4 for utf-8, or 1 for high bit non-utf.
592 * u8_strlen returns length of string in valid utf-8 sequences
593 * and/or high-bit bytes. Conversion functions go between byte
596 * In theory, this behaves the same as before for non-utf8 bytes.
601 /* is s the beginning of a valid utf-8 string? */
627 /* Convert (prefix of) utf8 string to utf-32 rune. */
673 /* return number of utf characters or single non-utf bytes */
695 /* convert utf-8 char number in a string to its byte offset */
705 charnum--; in u8_char2byte()
710 /* convert byte offset in s to utf-8 char number that starts there */
719 return -1; /* ??? */ in u8_byte2char()
742 T1 = ((1<<(Bit1+1))-1) ^ 0xFF, /* 0000 0000 */
743 Tx = ((1<<(Bitx+1))-1) ^ 0xFF, /* 1000 0000 */
744 T2 = ((1<<(Bit2+1))-1) ^ 0xFF, /* 1100 0000 */
745 T3 = ((1<<(Bit3+1))-1) ^ 0xFF, /* 1110 0000 */
746 T4 = ((1<<(Bit4+1))-1) ^ 0xFF, /* 1111 0000 */
747 T5 = ((1<<(Bit5+1))-1) ^ 0xFF, /* 1111 1000 */
749 Rune1 = (1<<(Bit1+0*Bitx))-1, /* 0000 0000 0000 0000 0111 1111 */
750 Rune2 = (1<<(Bit2+1*Bitx))-1, /* 0000 0000 0000 0111 1111 1111 */
751 Rune3 = (1<<(Bit3+2*Bitx))-1, /* 0000 0000 1111 1111 1111 1111 */
752 Rune4 = (1<<(Bit4+3*Bitx))-1, /* 0011 1111 1111 1111 1111 1111 */
754 Maskx = (1<<Bitx)-1, /* 0011 1111 */
761 /* one character sequence 00000-0007F => 00-7F */ in runetochar()
767 /* two character sequence 00080-007FF => T2 Tx */ in runetochar()
774 /* three character sequence 00800-0FFFF => T3 Tx Tx */ in runetochar()
784 /* four character sequence 010000-1FFFFF => T4 Tx Tx Tx */ in runetochar()
812 if (a[0] == NULL) /* a[1] == 0: already-compiled reg expr */ in matchop()
823 int start = patbeg - s + 1; /* origin 1 */ in matchop()
827 cstart = u8_byte2char(s, start-1); in matchop()
841 x->tval = NUM; in matchop()
842 x->fval = start; in matchop()
894 x_is_nan = isnan(x->fval); in relop()
895 y_is_nan = isnan(y->fval); in relop()
896 if (x->tval&NUM && y->tval&NUM) { in relop()
899 j = x->fval - y->fval; in relop()
900 i = j<0? -1: (j>0? 1: 0); in relop()
929 DPRINTF("freeing %s %s %o\n", NN(a->nval), NN(a->sval), a->tval); in tfree()
930 xfree(a->sval); in tfree()
934 a->cnext = tmps; in tfree()
947 tmps[i-1].cnext = &tmps[i]; in gettemp()
948 tmps[i-1].cnext = NULL; in gettemp()
951 tmps = x->cnext; in gettemp()
965 FATAL("trying to access out of range field %s", x->nval); in indirect()
969 x->ctype = OCELL; /* BUG? why are these needed? */ in indirect()
970 x->csub = CFLD; in indirect()
1008 n = k - 1; in substr()
1011 else if (n > k - m) in substr()
1012 n = k - m; in substr()
1016 mb = u8_char2byte(s, m-1); /* byte offset of start char in s */ in substr()
1017 nb = u8_char2byte(s, m-1+n); /* byte offset of end+1 char in s */ in substr()
1043 /* v = (Awkfloat) (p1 - s1 + 1); origin 1 */ in sindex()
1048 for (i = 0; i < p1-s1+1; i += len) { in sindex()
1061 int has_utf8(char *s) /* return 1 if s contains any utf-8 (2 bytes or more) character */ in has_utf8()
1075 int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like conversions */ in format()
1086 #define FMTSZ(a) (fmtsz - ((a) - fmt)) in format()
1087 #define BUFSZ(a) (bufsize - ((a) - buf)) in format()
1105 adjbuf(&buf, &bufsize, MAXNUMSIZE+1+p-buf, recsize, &p, "format1"); in format()
1117 fmtwd = -fmtwd; in format()
1118 adjbuf(&buf, &bufsize, fmtwd+1+p-buf, recsize, &p, "format2"); in format()
1120 if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3")) in format()
1124 t--; in format()
1137 a = a->nnext; in format()
1138 snprintf(t - 1, FMTSZ(t - 1), in format()
1141 fmtwd = -fmtwd; in format()
1142 adjbuf(&buf, &bufsize, fmtwd+1+p-buf, recsize, &p, "format"); in format()
1149 fmtwd = -fmtwd; in format()
1150 adjbuf(&buf, &bufsize, fmtwd+1+p-buf, recsize, &p, "format4"); in format()
1163 *(t-1) = 'j'; in format()
1181 a = a->nnext; in format()
1185 adjbuf(&buf, &bufsize, 1+n+p-buf, recsize, &p, "format5"); in format()
1193 adjbuf(&buf, &bufsize, 1+strlen(p)+n+p-buf, recsize, &p, "format6"); in format()
1206 /* if simple format or no utf-8 in the string, sprintf works */ in format()
1210 if (!adjbuf(&buf, &bufsize, 1+n+p-buf, recsize, &p, "format7")) in format()
1217 /* get here if string has utf-8 chars and fmt is not plain %s */ in format()
1218 /* "%-w.ps", where -, w and .p are all optional */ in format()
1223 if (f[0] == '-') { in format()
1246 pad = wid>prec ? wid - prec : 0; // has to be >= 0 in format()
1283 * our best to convert it back into UTF-8. If we in format()
1284 * can't, we output the encoding of the Unicode in format()
1310 *p = '\0'; /* next output will start here */ in format()
1325 if (f[0] == '-') { in format()
1346 if (prec > 1) // %c --> only one character in format()
1348 pad = wid>prec ? wid - prec : 0; // has to be >= 0 in format()
1379 for ( ; a; a = a->nnext) { /* evaluate any remaining args */ in format()
1385 return p - buf; in format()
1397 y = a[0]->nnext; in awksprintf()
1399 if (format(&buf, &bufsz, getsval(x), y) == -1) in awksprintf()
1403 x->sval = buf; in awksprintf()
1404 x->tval = STR; in awksprintf()
1420 y = a[0]->nnext; in awkprintf()
1422 if ((len = format(&buf, &bufsz, getsval(x), y)) == -1) in awkprintf()
1442 Cell *arith(Node **a, int n) /* a[0] + a[1], etc. also -a[0] */ in arith()
1462 i -= j; in arith()
1476 i = i - j * v; in arith()
1479 i = -i; in arith()
1519 k = (n == PREINCR || n == POSTINCR) ? 1 : -1; in incrdecr()
1540 if (x == y && !(x->tval & (FLD|REC)) && x != nfloc) in assign()
1541 ; /* self-assignment: leave alone unless it's a field or NF */ in assign()
1542 else if ((y->tval & (STR|NUM)) == (STR|NUM)) { in assign()
1545 x->fval = yf; in assign()
1546 x->tval |= NUM; in assign()
1564 xf -= yf; in assign()
1578 xf = xf - yf * v; in assign()
1607 memcpy(s, x->sval, n1); in cat()
1614 memcpy(s + n1, y->sval, n2); in cat()
1620 z->sval = s; in cat()
1621 z->tval = STR; in cat()
1696 DPRINTF("split: s=|%s|, a=%s, sep=|%s|\n", s, NN(ap->nval), fs); in split()
1697 ap->tval &= ~STR; in split()
1698 ap->tval |= ARR; in split()
1699 ap->sval = (char *) makesymtab(NSYMTAB); in split()
1702 if (arg3type == REGEXPR && strlen((char*)((fa*)a[2])->restr) == 0) { in split()
1716 tempstat = pfa->initstat; in split()
1717 pfa->initstat = 2; in split()
1724 setsymtab(num, s, result, STR|NUM, (Array *) ap->sval); in split()
1726 setsymtab(num, s, 0.0, STR, (Array *) ap->sval); in split()
1729 if (*(patbeg+patlen-1) == '\0' || *s == '\0') { in split()
1732 setsymtab(num, "", 0.0, STR, (Array *) ap->sval); in split()
1733 pfa->initstat = tempstat; in split()
1737 pfa->initstat = tempstat; /* bwk: has to be here to reset */ in split()
1743 setsymtab(num, s, result, STR|NUM, (Array *) ap->sval); in split()
1745 setsymtab(num, s, 0.0, STR, (Array *) ap->sval); in split()
1774 setsymtab(num, newt, result, STR|NUM, (Array *) ap->sval); in split()
1776 setsymtab(num, newt, 0.0, STR, (Array *) ap->sval); in split()
1798 setsymtab(num, t, result, STR|NUM, (Array *) ap->sval); in split()
1800 setsymtab(num, t, 0.0, STR, (Array *) ap->sval); in split()
1818 setsymtab(num, buf, atof(buf), STR|NUM, (Array *) ap->sval); in split()
1820 setsymtab(num, buf, 0.0, STR, (Array *) ap->sval); in split()
1833 setsymtab(num, t, result, STR|NUM, (Array *) ap->sval); in split()
1835 setsymtab(num, t, 0.0, STR, (Array *) ap->sval); in split()
1845 x->tval = NUM; in split()
1846 x->fval = n; in split()
1952 tp = (Array *) arrayp->sval; in instat()
1954 for (i = 0; i < tp->size; i++) { /* this routine knows too much */ in instat()
1955 for (cp = tp->tab[i]; cp != NULL; cp = ncp) { in instat()
1956 setsval(vp, cp->nval); in instat()
1957 ncp = cp->cnext; in instat()
2008 n > 0 && n != (size_t)-1 && n != (size_t)-2) in nawk_convert()
2013 if (n == (size_t)-1) in nawk_convert()
2074 nextarg = a[1]->nnext; in bltin()
2078 u = ((Array *) x->sval)->nelem; /* GROT. should be function*/ in bltin()
2096 case FSIN: in bltin()
2105 y = execute(a[1]->nnext); in bltin()
2108 nextarg = nextarg->nnext; in bltin()
2120 y = execute(a[1]->nnext); in bltin()
2123 nextarg = nextarg->nnext; in bltin()
2131 y = execute(a[1]->nnext); in bltin()
2134 nextarg = nextarg->nnext; in bltin()
2142 y = execute(a[1]->nnext); in bltin()
2145 nextarg = nextarg->nnext; in bltin()
2153 y = execute(a[1]->nnext); in bltin()
2156 nextarg = nextarg->nnext; in bltin()
2164 y = execute(a[1]->nnext); in bltin()
2167 nextarg = nextarg->nnext; in bltin()
2172 if (status != -1) { in bltin()
2184 /* else estatus was set to -1 */ in bltin()
2188 /* random() returns numbers in [0..2^31-1] in bltin()
2216 flush_all(); /* fflush() or fflush("") -> all */ in bltin()
2227 &tm->tm_year, &tm->tm_mon, &tm->tm_mday, &tm->tm_hour, in bltin()
2228 &tm->tm_min, &tm->tm_sec, &tm->tm_isdst); in bltin()
2231 tm->tm_isdst = -1; /* let mktime figure it out */ in bltin()
2234 tm->tm_year -= 1900; in bltin()
2235 tm->tm_mon--; in bltin()
2239 u = -1; in bltin()
2250 nextarg = nextarg->nnext; in bltin()
2287 for ( ; nextarg; nextarg = nextarg->nnext) { in bltin()
2305 for (x = a[0]; x != NULL; x = x->nnext) { in printstat()
2309 if (x->nnext == NULL) in printstat()
2415 } else if (a == '|') { /* output pipe */ in openfile()
2420 fp = strcmp(s, "-") == 0 ? stdin : fopen(s, "r"); /* "-" is stdin */ in openfile()
2455 if (!files[i].fname || strcmp(x->sval, files[i].fname) != 0) in closefile()
2470 stat = pclose(files[i].fp) == -1; in closefile()
2482 setfval(x, (Awkfloat) (stat ? -1 : 0)); in closefile()
2507 stat = pclose(files[i].fp) == -1; in closeall()
2544 if (a[0] == NULL) { /* 0 => a[1] is already-compiled regexpr */ in dosub()
2574 tempstat = pfa->initstat; in dosub()
2575 pfa->initstat = 2; in dosub()
2595 adjbuf(&buf, &bufsz, (pb - buf) + (patbeg - start), in dosub()
2607 adjbuf(&buf, &bufsz, 5+pb-buf, recsize, &pb, "dosub"); in dosub()
2612 adjbuf(&buf, &bufsz, 1+patlen+pb-buf, recsize, in dosub()
2627 adjbuf(&buf, &bufsz, (pb-buf) + patlen, recsize, &pb, "dosub"); in dosub()
2647 pfa->initstat = tempstat; in dosub()
2650 adjbuf(&buf, &bufsz, 1+strlen(start)+pb-buf, 0, &pb, "dosub"); in dosub()
2660 x->tval = NUM; in dosub()
2661 x->fval = m; in dosub()
2666 /* XXX incomplete - doesn't support backreferences \0 ... \9 */ in gensub()
2683 res = copycell(x); /* target string - initially copy of source */ in gensub()
2684 res->csub = CTEMP; /* result values are temporary */ in gensub()
2685 if (a[0] == 0) /* 0 => a[1] is already-compiled regexpr */ in gensub()
2696 whichm = -1; in gensub()
2703 whichm = (int) getfval(h) - 1; in gensub()
2712 tempstat = pfa->initstat; in gensub()
2713 pfa->initstat = 2; in gensub()
2729 adjbuf(&buf, &bufsz, (pb - buf) + (patbeg - t) + patlen, recsize, &pb, "gensub"); in gensub()
2732 * match to output buffer */ in gensub()
2743 adjbuf(&buf, &bufsz, 5+pb-buf, recsize, &pb, "gensub"); in gensub()
2748 adjbuf(&buf, &bufsz, 1+patlen+pb-buf, recsize, &pb, "gensub"); in gensub()
2757 adjbuf(&buf, &bufsz, 2+pb-buf, recsize, &pb, "gensub"); in gensub()
2766 adjbuf(&buf, &bufsz, 1+(patbeg-sptr)+pb-buf, recsize, &pb, "gensub"); in gensub()
2771 adjbuf(&buf, &bufsz, 5+pb-buf, recsize, &pb, "gensub"); in gensub()
2776 adjbuf(&buf, &bufsz, 1+patlen+pb-buf, recsize, &pb, "gensub"); in gensub()
2783 if (patlen == 0 || *t == 0 || *(t-1) == 0) in gensub()
2791 adjbuf(&buf, &bufsz, 1+strlen(sptr)+pb-buf, 0, &pb, "gensub"); in gensub()
2798 pfa->initstat = tempstat; in gensub()
2819 if (sptr[2] == '\\' && sptr[3] == '&') { /* \\\& -> \& */ in backsub()
2823 } else if (sptr[2] == '&') { /* \\& -> \ + matched */ in backsub()
2826 } else if (do_posix) { /* \\x -> \x */ in backsub()
2829 } else { /* \\x -> \\x */ in backsub()
2867 // 0x00010000 - 0x10FFFF in wide_char_to_byte_str()