Email List: Xaustin-group-futures-lX
[All Lists]

Re: test + formatting functions

To: Bruce Korb <yyyyy@xxxxxxxxxxx>
Subject: Re: test + formatting functions
From: Harti Brandt <yyyyyy@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 1 Aug 2003 17:59:29 +0200 (CEST)
Cc: yyyyyyyyyyyyyyyyyyyyyy@xxxxxxxxxxxxx
References: <3F2A8BA8.23C3F7CE@veritas.com>
On Fri, 1 Aug 2003, Bruce Korb wrote:

BK>In "the other list" ``asprintf'' was suggested as a function worthy
BK>of consideration for standardization.  I've seen more suggestions
BK>beyond that, and the full cross product of possibilities seems like
BK>a reasonable set to me:
BK>
BK>A) result placement types:
BK>   1. stdout        -- printf
BK>   2. FILE*         -- fprintf
BK>   3. string        -- sprintf
BK>   4. sized string  -- snprintf
BK>   5. alloc string  -- asprintf
BK>   6. file desc.    -- dprintf
BK>
BK>B) argument passing types:
BK>   1. vari-len list -- printf
BK>   2. var args      -- vprintf
BK>   3. arg vector    -- printfv
BK>      This makes it possible to dynamically compute the argument list.
BK>      the profile is:  int printfv( const char *fmt, const void **argv )
BK>
BK>yielding 18 functions
BK>
BK>   printf    vprintf    printfv
BK>   fprintf   vfprintf   fprintfv
BK>   sprintf   vsprintf   sprintfv
BK>   snprintf  vsnprintf  snprintfv
BK>   asprintf  vasprintf  asprintfv
BK>   dprintf   vdprintf   dprintfv

Yes, please.

BK>And, yes, there is an implementation:
BK>
BK>   http://savannah.nongnu.org/projects/libsnprintfv/
BK>
BK>It has a few other features:
BK>
BK>* output to a dynamically sized string ("filaments")
BK>* user callbacks for formatting extensions.  My favorite:
BK>     %{struct whatever}
BK>  to take an address as a pointer to a ``struct whatever''
BK>  and replace the above with the data formatted in some
BK>  reasonable way, likely by elf-opening the program file
BK>  and searching the symbol table.
BK>
BK>Very Useful, and I've seen similar stuff in some other libraries,
BK>but it might be a bit difficult to get agreement on a common approach.

I always wanted the plan9 feature to install your own conversion
characters with a callback function. I don't have the man page for that
one at hand (look for fmtinstall).

harti
-- 
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
yyyyyy@xxxxxxxxxxxxxxxxxxx, yyyyy@xxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>