hmm. referring to the comments in fmt_compile.h, i see that rather than
implementing a "modifies str" function, as above, i've done an "outputs
text" function, like so:
{ "metric", TF_EXPR, FT_METRIC, 0, 0 },
i guess i'm not sure why i'd choose one over the other.
Other than the put* functions, there are no "pure output" functions.
Every function that generates output stores the output in "str", and
has TFL_PUTS (or TFL_PUTN) flag so the appropriate PUTSTR instruction
is generated when appropriate.
Why? Well, think about the case when you want to use the output of
that function in another function. There probably aren't many uses
for that, but what about something you might want to do in a scan
format:
%-6(putstr(metric(size)))
You are probably thinking you could do:
%-6(metric(size))
.... except that only works if there's an implicit PUTSTR (which is
generated when the function is flagged with TFL_PUTS).
Clear as mud? :-/ Trust me, if you want to have your instruction generate
output, the "right" way to do it is to use either TFL_PUTS or TFL_PUTN.
I wish this was all documented somewhere ... sigh. Learning this was
rather painful.
--Ken
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers