Lines Matching refs:shf
30 static void ptree(struct op *, int, struct shf *);
31 static void pioact(struct shf *, struct ioword *);
32 static const char *wdvarput(struct shf *, const char *, int, int);
33 static void vfptreef(struct shf *, int, const char *, va_list);
43 static struct shf ptree_heredoc;
44 #define ptree_outhere(shf) do { \ argument
46 shf_puts(shf_sclose(&ptree_heredoc), (shf)); \
47 shf_putc('\n', (shf)); \
59 ptree(struct op *t, int indent, struct shf *shf) in ptree() argument
90 fptreef(shf, indent, Tf_S, t->vars[0]); in ptree()
97 fptreef(shf, indent, Tf_S_, *w++); in ptree()
101 shf_puts("#no-vars# ", shf); in ptree()
109 shf_putc('\\', shf); in ptree()
110 shf_puts(cp, shf); in ptree()
111 shf_putc(' ', shf); in ptree()
115 fptreef(shf, indent, Tf_S_, *w++); in ptree()
119 shf_puts("#no-args# ", shf); in ptree()
126 fptreef(shf, indent + 2, "( %T) ", t->left); in ptree()
129 fptreef(shf, indent, "%T| ", t->left); in ptree()
133 fptreef(shf, indent, "%T%;", t->left); in ptree()
138 fptreef(shf, indent, "%T%s %T", in ptree()
142 shf_puts("! ", shf); in ptree()
148 shf_puts("[[", shf); in ptree()
150 fptreef(shf, indent, Tf__S, *w++); in ptree()
151 shf_puts(" ]] ", shf); in ptree()
155 fptreef(shf, indent, "%s %s ", in ptree()
158 shf_puts("in ", shf); in ptree()
161 fptreef(shf, indent, Tf_S_, *w++); in ptree()
162 fptreef(shf, indent, Tft_end); in ptree()
164 fptreef(shf, indent + INDENT, "do%N%T", t->left); in ptree()
165 fptreef(shf, indent, "%;done "); in ptree()
168 fptreef(shf, indent, "case %S in", t->str); in ptree()
170 fptreef(shf, indent, "%N("); in ptree()
173 fptreef(shf, indent, "%S%c", *w, in ptree()
177 fptreef(shf, indent + INDENT, "%N%T%N;%c", t1->left, in ptree()
180 fptreef(shf, indent, "%Nesac "); in ptree()
192 fptreef(shf, indent, Tft_end); in ptree()
195 fptreef(shf, indent + 5 - i, Telif_pT + i, t1->left); in ptree()
198 fptreef(shf, indent, Tft_end); in ptree()
199 fptreef(shf, indent + INDENT, "%s%N%T", in ptree()
204 fptreef(shf, indent, Tft_end); in ptree()
205 fptreef(shf, indent + INDENT, "%s%N%T", in ptree()
208 fptreef(shf, indent, "%;fi "); in ptree()
213 fptreef(shf, indent + 6, Tf_s_T, in ptree()
216 fptreef(shf, indent, Tft_end); in ptree()
217 fptreef(shf, indent + INDENT, "do%N%T", t->right); in ptree()
218 fptreef(shf, indent, "%;done "); in ptree()
221 fptreef(shf, indent + INDENT, "{%N%T", t->left); in ptree()
222 fptreef(shf, indent, "%;} "); in ptree()
225 fptreef(shf, indent, "%T|& ", t->left); in ptree()
229 fptreef(shf, indent, "%T& ", t->left); in ptree()
233 fpFUNCTf(shf, indent, tobool(t->u.ksh_func), t->str, t->left); in ptree()
236 fptreef(shf, indent, Tf_s_T, Ttime, t->left); in ptree()
239 shf_puts("<botch>", shf); in ptree()
245 pioact(shf, *ioact++); in ptree()
249 pioact(struct shf *shf, struct ioword *iop) in pioact() argument
260 shf_fprintf(shf, Tf_d, (int)iop->unit); in pioact()
264 shf_putc('<', shf); in pioact()
268 shf_puts("<<<", shf); in pioact()
271 shf_puts("<<", shf); in pioact()
273 shf_putc('-', shf); in pioact()
289 wdvarput(shf, iop->delim, 0, WDS_TPUTS); in pioact()
292 shf_puts(">>", shf); in pioact()
295 shf_putc('>', shf); in pioact()
297 shf_putc('|', shf); in pioact()
300 shf_puts("<>", shf); in pioact()
303 shf_puts(flag & IORDUP ? "<&" : ">&", shf); in pioact()
309 print_value_quoted(shf, iop->ioname); in pioact()
311 wdvarput(shf, iop->ioname, 0, WDS_TPUTS); in pioact()
313 shf_putc(' ', shf); in pioact()
319 wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode) in wdvarput() argument
346 shf_putc(c, shf); in wdvarput()
359 shf_putc(ORD('\\'), shf); in wdvarput()
362 shf_putc(c, shf); in wdvarput()
366 shf_puts("$(", shf); in wdvarput()
369 shf_putc(' ', shf); in wdvarput()
372 shf_putc(c, shf); in wdvarput()
373 shf_puts(cs, shf); in wdvarput()
382 shf_putc('$', shf); in wdvarput()
383 shf_putc('{', shf); in wdvarput()
384 shf_putc(c, shf); in wdvarput()
388 shf_puts("$((", shf); in wdvarput()
394 shf_putc('"', shf); in wdvarput()
401 shf_putc('"', shf); in wdvarput()
405 shf_putc('$', shf); in wdvarput()
407 shf_putc('{', shf); in wdvarput()
409 shf_putc(c, shf); in wdvarput()
410 wp = wdvarput(shf, wp, 0, opmode); in wdvarput()
415 shf_putc('}', shf); in wdvarput()
419 shf_putchar(*wp++, shf); in wdvarput()
420 shf_putc('(', shf); in wdvarput()
428 shf_putc(c, shf); in wdvarput()
439 fptreef(struct shf *shf, int indent, const char *fmt, ...) in fptreef() argument
444 vfptreef(shf, indent, fmt, va); in fptreef()
453 struct shf shf; in snptreef() local
455 shf_sopen(s, n, SHF_WR | (s ? 0 : SHF_DYNAMIC), &shf); in snptreef()
458 vfptreef(&shf, 0, fmt, va); in snptreef()
462 return (shf_sclose(&shf)); in snptreef()
466 vfptreef(struct shf *shf, int indent, const char *fmt, va_list va) in vfptreef() argument
478 shf_putchar(va_arg(va, int), shf); in vfptreef()
482 shf_puts(va_arg(va, char *), shf); in vfptreef()
486 wdvarput(shf, va_arg(va, char *), 0, WDS_TPUTS); in vfptreef()
490 shf_fprintf(shf, Tf_d, va_arg(va, int)); in vfptreef()
494 shf_fprintf(shf, "%u", va_arg(va, unsigned int)); in vfptreef()
498 ptree(va_arg(va, struct op *), indent, shf); in vfptreef()
504 if (shf->flags & SHF_STRING) { in vfptreef()
507 shf_putc(';', shf); in vfptreef()
508 shf_putc(' ', shf); in vfptreef()
512 ptree_outhere(shf); in vfptreef()
513 shf_putc('\n', shf); in vfptreef()
515 shf_putc('\t', shf); in vfptreef()
519 shf_putc(' ', shf); in vfptreef()
524 pioact(shf, va_arg(va, struct ioword *)); in vfptreef()
527 shf_putc(c, shf); in vfptreef()
531 shf_putc(c, shf); in vfptreef()
538 ptree_outhere(shf); in vfptreef()
679 struct shf shf; in wdstrip() local
681 shf_sopen(NULL, 32, SHF_WR | SHF_DYNAMIC, &shf); in wdstrip()
682 wdvarput(&shf, wp, 0, opmode); in wdstrip()
684 return (shf_sclose(&shf)); in wdstrip()
772 fpFUNCTf(struct shf *shf, int i, bool isksh, const char *k, struct op *v) in fpFUNCTf() argument
775 fptreef(shf, i, "%s %s %T", Tfunction, k, v); in fpFUNCTf()
777 fptreef(shf, i, "%s %s() %T", Tfunction, k, v); in fpFUNCTf()
779 fptreef(shf, i, "%s() %T", k, v); in fpFUNCTf()
830 dumpchar(struct shf *shf, unsigned char c) in dumpchar() argument
834 shf_putc('^', shf); in dumpchar()
837 shf_putc(c, shf); in dumpchar()
842 dumpwdvar_i(struct shf *shf, const char *wp, int quotelevel) in dumpwdvar_i() argument
849 shf_puts("EOS", shf); in dumpwdvar_i()
853 shf_puts(/*{*/ "]ADELIM(})", shf); in dumpwdvar_i()
856 shf_puts("ADELIM=", shf); in dumpwdvar_i()
860 shf_puts("CHAR=", shf); in dumpwdvar_i()
861 dumpchar(shf, *wp++); in dumpwdvar_i()
864 shf_puts("QCHAR<", shf); in dumpwdvar_i()
868 shf_putc('\\', shf); in dumpwdvar_i()
869 dumpchar(shf, c); in dumpwdvar_i()
872 shf_puts("COMASUB<", shf); in dumpwdvar_i()
875 shf_puts("COMSUB<", shf); in dumpwdvar_i()
878 dumpchar(shf, c); in dumpwdvar_i()
880 shf_putc('>', shf); in dumpwdvar_i()
883 shf_puts("FUNASUB<", shf); in dumpwdvar_i()
886 shf_puts("FUNSUB<", shf); in dumpwdvar_i()
889 shf_puts("VALSUB<", shf); in dumpwdvar_i()
892 shf_puts("EXPRSUB<", shf); in dumpwdvar_i()
895 shf_fprintf(shf, "OQUOTE{%d" /*}*/, ++quotelevel); in dumpwdvar_i()
898 shf_fprintf(shf, /*{*/ "%d}CQUOTE", quotelevel); in dumpwdvar_i()
902 shf_puts("(err)", shf); in dumpwdvar_i()
905 shf_puts("OSUBST(", shf); in dumpwdvar_i()
906 dumpchar(shf, *wp++); in dumpwdvar_i()
907 shf_puts(")[", shf); in dumpwdvar_i()
909 dumpchar(shf, c); in dumpwdvar_i()
910 shf_putc('|', shf); in dumpwdvar_i()
911 wp = dumpwdvar_i(shf, wp, 0); in dumpwdvar_i()
914 shf_puts("]CSUBST(", shf); in dumpwdvar_i()
915 dumpchar(shf, *wp++); in dumpwdvar_i()
916 shf_putc(')', shf); in dumpwdvar_i()
919 shf_puts("OPAT=", shf); in dumpwdvar_i()
920 dumpchar(shf, *wp++); in dumpwdvar_i()
923 shf_puts("SPAT", shf); in dumpwdvar_i()
926 shf_puts("CPAT", shf); in dumpwdvar_i()
929 shf_fprintf(shf, "INVAL<%u>", (uint8_t)wp[-1]); in dumpwdvar_i()
932 shf_putc(' ', shf); in dumpwdvar_i()
936 dumpwdvar(struct shf *shf, const char *wp) in dumpwdvar() argument
938 dumpwdvar_i(shf, wp, 0); in dumpwdvar()
942 dumpioact(struct shf *shf, struct op *t) in dumpioact() argument
949 shf_puts("{IOACT", shf); in dumpioact()
952 #define DT(x) case x: shf_puts(#x, shf); break; in dumpioact()
953 #define DB(x) if (iop->ioflag & x) shf_puts("|" #x, shf); in dumpioact()
955 shf_putc(';', shf); in dumpioact()
964 shf_fprintf(shf, "unk%d", type); in dumpioact()
974 shf_fprintf(shf, ",unit=%d", (int)iop->unit); in dumpioact()
976 shf_puts(",delim<", shf); in dumpioact()
977 dumpwdvar(shf, iop->delim); in dumpioact()
978 shf_putc('>', shf); in dumpioact()
982 shf_puts(",name=", shf); in dumpioact()
983 print_value_quoted(shf, iop->ioname); in dumpioact()
985 shf_puts(",name<", shf); in dumpioact()
986 dumpwdvar(shf, iop->ioname); in dumpioact()
987 shf_putc('>', shf); in dumpioact()
991 shf_puts(",heredoc=", shf); in dumpioact()
992 print_value_quoted(shf, iop->heredoc); in dumpioact()
997 shf_putc('}', shf); in dumpioact()
1001 dumptree(struct shf *shf, struct op *t) in dumptree() argument
1009 shf_putc('\t', shf); in dumptree()
1011 shf_puts("{tree:" /*}*/, shf); in dumptree()
1016 dumpioact(shf, t); in dumptree()
1018 #define OPEN(x) case x: name = #x; shf_puts(" {" #x ":", shf); /*}*/ in dumptree()
1025 shf_putc('\n', shf); in dumptree()
1027 shf_putc('\t', shf); in dumptree()
1028 shf_fprintf(shf, " var%d<", i++); in dumptree()
1029 dumpwdvar(shf, *w++); in dumptree()
1030 shf_putc('>', shf); in dumptree()
1033 shf_puts(" #no-vars#", shf); in dumptree()
1038 shf_putc('\n', shf); in dumptree()
1040 shf_putc('\t', shf); in dumptree()
1041 shf_fprintf(shf, " arg%d<", i++); in dumptree()
1042 dumpwdvar(shf, *w++); in dumptree()
1043 shf_putc('>', shf); in dumptree()
1046 shf_puts(" #no-args#", shf); in dumptree()
1052 shf_putc('\n', shf); in dumptree()
1053 dumptree(shf, t); in dumptree()
1059 shf_putc('\n', shf); in dumptree()
1060 dumptree(shf, t->left); in dumptree()
1062 shf_fprintf(shf, "/%s:", name); in dumptree()
1078 shf_putc('\n', shf); in dumptree()
1080 shf_putc('\t', shf); in dumptree()
1081 shf_fprintf(shf, " arg%d<", i++); in dumptree()
1082 dumpwdvar(shf, *w++); in dumptree()
1083 shf_putc('>', shf); in dumptree()
1088 shf_fprintf(shf, " str<%s>", t->str); in dumptree()
1093 shf_putc('\n', shf); in dumptree()
1095 shf_putc('\t', shf); in dumptree()
1096 shf_fprintf(shf, " var%d<", i++); in dumptree()
1097 dumpwdvar(shf, *w++); in dumptree()
1098 shf_putc('>', shf); in dumptree()
1105 shf_fprintf(shf, " str<%s>", t->str); in dumptree()
1108 shf_putc('\n', shf); in dumptree()
1110 shf_putc('\t', shf); in dumptree()
1111 shf_fprintf(shf, " sub%d[(", i); in dumptree()
1114 dumpwdvar(shf, *w); in dumptree()
1116 shf_putc('|', shf); in dumptree()
1119 shf_putc(')', shf); in dumptree()
1120 dumpioact(shf, t); in dumptree()
1121 shf_putc('\n', shf); in dumptree()
1122 dumptree(shf, t1->left); in dumptree()
1123 shf_fprintf(shf, " ;%c/%d]", t1->u.charflag, i++); in dumptree()
1137 shf_fprintf(shf, " str<%s> ksh<%s>", t->str, in dumptree()
1144 shf_putc('\n', shf); in dumptree()
1145 dumptree(shf, t->left); in dumptree()
1147 dumpioact(shf, t); in dumptree()
1149 shf_puts(" /TTHEN:\n", shf); in dumptree()
1150 dumptree(shf, t->left); in dumptree()
1153 shf_puts(" /TELIF:", shf); in dumptree()
1155 dumpioact(shf, t); in dumptree()
1159 shf_puts(" /TELSE:\n", shf); in dumptree()
1160 dumptree(shf, t->right); in dumptree()
1165 shf_puts(Tunexpected, shf); in dumptree()
1173 shf_fprintf(shf, "{T<%d>:" /*}*/, t->type); in dumptree()
1179 shf_fprintf(shf, /*{*/ " /%s}\n", name); in dumptree()