From: Harald H. <h.h...@tu...> - 2004-07-16 16:49:45
|
On Fri, 16 Jul 2004, Ethan Merritt wrote: > > internal.c internal.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > 1) Define a new internal function f_sprintf(). [...] > > I think this patch looks like a good thing, but I really > > don't like the name `sprintf'. It really sounds like a c > > programmer had no good idea how to call it. > > I was not clear enough. This *is* the C language > sprintf routine [*]. The gnuplot code just collects the > variables and the format and passes them along to > the C library. The documentation will refer users to > "man sprintf" or to any C language manual. > > > set xlabel string(" %d %d %d", 1,2,3) > > > > The sprintf (or string) command should really understand all > > gnuplot formats (%t, %T, %l, %L, etc.). > > For me, part of the rationale for this work is that the gnuplot > formats are limiting. If there is some particular format that > you cannot produce using a C language printf() variant, then > we can provide a separate routine for that. Or there could > be a second formatting function that specifically uses only > the non-C gnuplot format conversion specifiers. > > mystring =3D string("Format using %T %L etc", var1, var2) > set title sprint("C Format with embedded %s", mystring) I would prefer one function that does everything. Maybe, it could parse the string for gnuplot format specifiers (%t, %T, ...), first. All formats that are not known by gnuplot can then be parsed to the C function snprintf(). When deviding it into two function you really have to know too much about internel things of the implementation. When using one function the documentation may say something like The `string` function understands all gnuplot format specifiers (see format specifiers) and all C specifiers (see Kerninham/Ritchie). Of course programming of a string command is much more work than passing the arguments to snprintf(). But I think it is worth it. Yours Harald --=20 Harald Harders Langer Kamp 8 Technische Universit=E4t Braunschweig D-38106 Braunschweig Institut f=FCr Werkstoffe Germany E-Mail: h.h...@tu... Tel: +49 (5 31) 3 91-3062 WWW : http://www.ifw.tu-bs.de Fax: +49 (5 31) 3 91-3058 |