Lines Matching refs:shf
30 static void ptree(struct op *, int, struct shf *);
31 static void pioact(struct shf *, int, struct ioword *);
32 static const char *wdvarput(struct shf *, const char *, int, int);
33 static void vfptreef(struct shf *, int, const char *, va_list);
46 ptree(struct op *t, int indent, struct shf *shf) in ptree() argument
73 fptreef(shf, indent, "%S", t->vars[0]); in ptree()
80 fptreef(shf, indent, "%S ", *w++); in ptree()
82 shf_puts("#no-vars# ", shf); in ptree()
86 fptreef(shf, indent, "%S ", *w++); in ptree()
88 shf_puts("#no-args# ", shf); in ptree()
94 fptreef(shf, indent + 2, "( %T) ", t->left); in ptree()
97 fptreef(shf, indent, "%T| ", t->left); in ptree()
101 fptreef(shf, indent, "%T%;", t->left); in ptree()
106 fptreef(shf, indent, "%T%s %T", in ptree()
110 shf_puts("! ", shf); in ptree()
116 shf_puts("[[", shf); in ptree()
118 fptreef(shf, indent, " %S", *w++); in ptree()
119 shf_puts(" ]] ", shf); in ptree()
123 fptreef(shf, indent, "%s %s ", in ptree()
126 shf_puts("in ", shf); in ptree()
129 fptreef(shf, indent, "%S ", *w++); in ptree()
130 fptreef(shf, indent, "%;"); in ptree()
132 fptreef(shf, indent + INDENT, "do%N%T", t->left); in ptree()
133 fptreef(shf, indent, "%;done "); in ptree()
136 fptreef(shf, indent, "case %S in", t->str); in ptree()
138 fptreef(shf, indent, "%N("); in ptree()
141 fptreef(shf, indent, "%S%c", *w, in ptree()
145 fptreef(shf, indent + INDENT, "%N%T%N;%c", t1->left, in ptree()
148 fptreef(shf, indent, "%Nesac "); in ptree()
162 fptreef(shf, indent, "%;"); in ptree()
165 fptreef(shf, indent + 5 - i, Telif_pT + i, t1->left); in ptree()
168 fptreef(shf, indent, "%;"); in ptree()
169 fptreef(shf, indent + INDENT, "%s%N%T", in ptree()
174 fptreef(shf, indent, "%;"); in ptree()
175 fptreef(shf, indent + INDENT, "%s%N%T", in ptree()
178 fptreef(shf, indent, "%;fi "); in ptree()
183 fptreef(shf, indent + 6, "%s %T", in ptree()
186 fptreef(shf, indent, "%;"); in ptree()
187 fptreef(shf, indent + INDENT, "do%N%T", t->right); in ptree()
188 fptreef(shf, indent, "%;done "); in ptree()
191 fptreef(shf, indent + INDENT, "{%N%T", t->left); in ptree()
192 fptreef(shf, indent, "%;} "); in ptree()
195 fptreef(shf, indent, "%T|& ", t->left); in ptree()
199 fptreef(shf, indent, "%T& ", t->left); in ptree()
203 fpFUNCTf(shf, indent, tobool(t->u.ksh_func), t->str, t->left); in ptree()
206 fptreef(shf, indent, "%s %T", "time", t->left); in ptree()
209 shf_puts("<botch>", shf); in ptree()
217 pioact(shf, indent, *ioact++); in ptree()
226 shf_putc('\n', shf); in ptree()
227 shf_puts(iop->heredoc, shf); in ptree()
228 fptreef(shf, indent, "%s", in ptree()
240 shf_putc('\n', shf); in ptree()
247 pioact(struct shf *shf, int indent, struct ioword *iop) in pioact() argument
258 shf_fprintf(shf, "%d", iop->unit); in pioact()
262 shf_puts("<", shf); in pioact()
265 shf_puts(flag & IOSKIP ? "<<-" : "<<", shf); in pioact()
268 shf_puts(">>", shf); in pioact()
271 shf_puts(flag & IOCLOB ? ">|" : ">", shf); in pioact()
274 shf_puts("<>", shf); in pioact()
277 shf_puts(flag & IORDUP ? "<&" : ">&", shf); in pioact()
283 wdvarput(shf, iop->delim, 0, WDS_TPUTS); in pioact()
285 shf_putc(' ', shf); in pioact()
287 fptreef(shf, indent, (iop->flag & IONAMEXP) ? "%s " : "%S ", in pioact()
294 wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode) in wdvarput() argument
319 shf_putc(MAGIC, shf); in wdvarput()
320 shf_putc(c, shf); in wdvarput()
335 shf_putc('\\', shf); in wdvarput()
336 shf_putc(c, shf); in wdvarput()
340 shf_puts("$(", shf); in wdvarput()
344 shf_putc(c, shf); in wdvarput()
345 shf_puts(cs, shf); in wdvarput()
348 shf_puts("${ ", shf); in wdvarput()
352 shf_puts("$((", shf); in wdvarput()
358 shf_putc('"', shf); in wdvarput()
365 shf_putc('"', shf); in wdvarput()
369 shf_putc('$', shf); in wdvarput()
371 shf_putc('{', shf); in wdvarput()
373 shf_putc(c, shf); in wdvarput()
374 wp = wdvarput(shf, wp, 0, opmode); in wdvarput()
378 shf_putc('}', shf); in wdvarput()
382 shf_putc(MAGIC, shf); in wdvarput()
383 shf_putchar(*wp++ | 0x80, shf); in wdvarput()
385 shf_putchar(*wp++, shf); in wdvarput()
386 shf_putc('(', shf); in wdvarput()
395 shf_putc(MAGIC, shf); in wdvarput()
396 shf_putc(c, shf); in wdvarput()
407 fptreef(struct shf *shf, int indent, const char *fmt, ...) in fptreef() argument
412 vfptreef(shf, indent, fmt, va); in fptreef()
421 struct shf shf; in snptreef() local
423 shf_sopen(s, n, SHF_WR | (s ? 0 : SHF_DYNAMIC), &shf); in snptreef()
426 vfptreef(&shf, 0, fmt, va); in snptreef()
430 return (shf_sclose(&shf)); in snptreef()
434 vfptreef(struct shf *shf, int indent, const char *fmt, va_list va) in vfptreef() argument
443 shf_putchar(va_arg(va, int), shf); in vfptreef()
447 shf_puts(va_arg(va, char *), shf); in vfptreef()
451 wdvarput(shf, va_arg(va, char *), 0, WDS_TPUTS); in vfptreef()
455 shf_fprintf(shf, "%d", va_arg(va, int)); in vfptreef()
459 shf_fprintf(shf, "%u", va_arg(va, unsigned int)); in vfptreef()
463 ptree(va_arg(va, struct op *), indent, shf); in vfptreef()
469 if (shf->flags & SHF_STRING) { in vfptreef()
471 shf_putc(';', shf); in vfptreef()
472 shf_putc(' ', shf); in vfptreef()
476 shf_putc('\n', shf); in vfptreef()
479 shf_putc('\t', shf); in vfptreef()
483 shf_putc(' ', shf); in vfptreef()
488 pioact(shf, indent, va_arg(va, struct ioword *)); in vfptreef()
491 shf_putc(c, shf); in vfptreef()
495 shf_putc(c, shf); in vfptreef()
634 struct shf shf; in wdstrip() local
636 shf_sopen(NULL, 32, SHF_WR | SHF_DYNAMIC, &shf); in wdstrip()
637 wdvarput(&shf, wp, 0, opmode); in wdstrip()
639 return (shf_sclose(&shf)); in wdstrip()
731 fpFUNCTf(struct shf *shf, int i, bool isksh, const char *k, struct op *v) in fpFUNCTf() argument
734 fptreef(shf, i, "%s %s %T", Tfunction, k, v); in fpFUNCTf()
736 fptreef(shf, i, "%s() %T", k, v); in fpFUNCTf()
786 dumpchar(struct shf *shf, int c) in dumpchar() argument
790 shf_putc((c & 0x80) ? '$' : '^', shf); in dumpchar()
793 shf_putc(c, shf); in dumpchar()
798 dumpwdvar_i(struct shf *shf, const char *wp, int quotelevel) in dumpwdvar_i() argument
805 shf_puts("EOS", shf); in dumpwdvar_i()
808 shf_puts("ADELIM=", shf); in dumpwdvar_i()
811 shf_puts("CHAR=", shf); in dumpwdvar_i()
812 dumpchar(shf, *wp++); in dumpwdvar_i()
815 shf_puts("QCHAR<", shf); in dumpwdvar_i()
819 shf_putc('\\', shf); in dumpwdvar_i()
820 dumpchar(shf, c); in dumpwdvar_i()
823 shf_puts("COMSUB<", shf); in dumpwdvar_i()
826 dumpchar(shf, c); in dumpwdvar_i()
828 shf_putc('>', shf); in dumpwdvar_i()
831 shf_puts("FUNSUB<", shf); in dumpwdvar_i()
834 shf_puts("EXPRSUB<", shf); in dumpwdvar_i()
837 shf_fprintf(shf, "OQUOTE{%d", ++quotelevel); in dumpwdvar_i()
840 shf_fprintf(shf, "%d}CQUOTE", quotelevel); in dumpwdvar_i()
844 shf_puts("(err)", shf); in dumpwdvar_i()
847 shf_puts("OSUBST(", shf); in dumpwdvar_i()
848 dumpchar(shf, *wp++); in dumpwdvar_i()
849 shf_puts(")[", shf); in dumpwdvar_i()
851 dumpchar(shf, c); in dumpwdvar_i()
852 shf_putc('|', shf); in dumpwdvar_i()
853 wp = dumpwdvar_i(shf, wp, 0); in dumpwdvar_i()
856 shf_puts("]CSUBST(", shf); in dumpwdvar_i()
857 dumpchar(shf, *wp++); in dumpwdvar_i()
858 shf_putc(')', shf); in dumpwdvar_i()
861 shf_puts("OPAT=", shf); in dumpwdvar_i()
862 dumpchar(shf, *wp++); in dumpwdvar_i()
865 shf_puts("SPAT", shf); in dumpwdvar_i()
868 shf_puts("CPAT", shf); in dumpwdvar_i()
871 shf_fprintf(shf, "INVAL<%u>", (uint8_t)wp[-1]); in dumpwdvar_i()
874 shf_putc(' ', shf); in dumpwdvar_i()
878 dumpwdvar(struct shf *shf, const char *wp) in dumpwdvar() argument
880 dumpwdvar_i(shf, wp, 0); in dumpwdvar()
884 dumpioact(struct shf *shf, struct op *t) in dumpioact() argument
891 shf_puts("{IOACT", shf); in dumpioact()
894 #define DT(x) case x: shf_puts(#x, shf); break; in dumpioact()
895 #define DB(x) if (iop->flag & x) shf_puts("|" #x, shf); in dumpioact()
897 shf_putc(';', shf); in dumpioact()
906 shf_fprintf(shf, "unk%d", type); in dumpioact()
916 shf_fprintf(shf, ",unit=%d", iop->unit); in dumpioact()
918 shf_puts(",delim<", shf); in dumpioact()
919 dumpwdvar(shf, iop->delim); in dumpioact()
920 shf_putc('>', shf); in dumpioact()
924 shf_puts(",name=", shf); in dumpioact()
925 print_value_quoted(shf, iop->name); in dumpioact()
927 shf_puts(",name<", shf); in dumpioact()
928 dumpwdvar(shf, iop->name); in dumpioact()
929 shf_putc('>', shf); in dumpioact()
933 shf_puts(",heredoc=", shf); in dumpioact()
934 print_value_quoted(shf, iop->heredoc); in dumpioact()
939 shf_putc('}', shf); in dumpioact()
943 dumptree(struct shf *shf, struct op *t) in dumptree() argument
951 shf_putc('\t', shf); in dumptree()
953 shf_puts("{tree:" /*}*/, shf); in dumptree()
958 dumpioact(shf, t); in dumptree()
960 #define OPEN(x) case x: name = #x; shf_puts(" {" #x ":", shf); /*}*/ in dumptree()
967 shf_putc('\n', shf); in dumptree()
969 shf_putc('\t', shf); in dumptree()
970 shf_fprintf(shf, " var%d<", i++); in dumptree()
971 dumpwdvar(shf, *w++); in dumptree()
972 shf_putc('>', shf); in dumptree()
975 shf_puts(" #no-vars#", shf); in dumptree()
980 shf_putc('\n', shf); in dumptree()
982 shf_putc('\t', shf); in dumptree()
983 shf_fprintf(shf, " arg%d<", i++); in dumptree()
984 dumpwdvar(shf, *w++); in dumptree()
985 shf_putc('>', shf); in dumptree()
988 shf_puts(" #no-args#", shf); in dumptree()
994 shf_putc('\n', shf); in dumptree()
995 dumptree(shf, t); in dumptree()
1001 shf_putc('\n', shf); in dumptree()
1002 dumptree(shf, t->left); in dumptree()
1004 shf_fprintf(shf, "/%s:", name); in dumptree()
1020 shf_putc('\n', shf); in dumptree()
1022 shf_putc('\t', shf); in dumptree()
1023 shf_fprintf(shf, " arg%d<", i++); in dumptree()
1024 dumpwdvar(shf, *w++); in dumptree()
1025 shf_putc('>', shf); in dumptree()
1030 shf_fprintf(shf, " str<%s>", t->str); in dumptree()
1035 shf_putc('\n', shf); in dumptree()
1037 shf_putc('\t', shf); in dumptree()
1038 shf_fprintf(shf, " var%d<", i++); in dumptree()
1039 dumpwdvar(shf, *w++); in dumptree()
1040 shf_putc('>', shf); in dumptree()
1047 shf_fprintf(shf, " str<%s>", t->str); in dumptree()
1050 shf_putc('\n', shf); in dumptree()
1052 shf_putc('\t', shf); in dumptree()
1053 shf_fprintf(shf, " sub%d[(", i); in dumptree()
1056 dumpwdvar(shf, *w); in dumptree()
1058 shf_putc('|', shf); in dumptree()
1061 shf_putc(')', shf); in dumptree()
1062 dumpioact(shf, t); in dumptree()
1063 shf_putc('\n', shf); in dumptree()
1064 dumptree(shf, t1->left); in dumptree()
1065 shf_fprintf(shf, " ;%c/%d]", t1->u.charflag, i++); in dumptree()
1079 shf_fprintf(shf, " str<%s> ksh<%s>", t->str, in dumptree()
1086 shf_putc('\n', shf); in dumptree()
1087 dumptree(shf, t->left); in dumptree()
1089 dumpioact(shf, t); in dumptree()
1091 shf_puts(" /TTHEN:\n", shf); in dumptree()
1092 dumptree(shf, t->left); in dumptree()
1095 shf_puts(" /TELIF:", shf); in dumptree()
1097 dumpioact(shf, t); in dumptree()
1101 shf_puts(" /TELSE:\n", shf); in dumptree()
1102 dumptree(shf, t->right); in dumptree()
1107 shf_puts("unexpected", shf); in dumptree()
1115 shf_fprintf(shf, "{T<%d>:" /*}*/, t->type); in dumptree()
1121 shf_fprintf(shf, /*{*/ " /%s}\n", name); in dumptree()