nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] new marker format broke test suite


From: Ken Hornstein
Subject: Re: [Nmh-workers] new marker format broke test suite
Date: Tue, 06 May 2014 14:20:29 -0400

>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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]