Re: prepare vasnprintf for Unicode strings

2007-06-17 Thread Gary V. Vaughan
On 11 Jun 2007, at 13:24, Daniel Jacobowitz wrote: On Mon, Jun 11, 2007 at 03:08:53AM +0200, Bruno Haible wrote: The snprintfv code has not been migrating to gnulib (yet? dormant project?), so I have no other choice than using gnulib's vasnprintf.c as code base. I ran out of time to work on

Re: prepare vasnprintf for Unicode strings

2007-06-12 Thread Bruno Haible
Paul Eggert wrote: > So, instead of this: > > if (flags >= 16) > type = TYPE_U32_STRING; > else if (flags >= 8) > type = TYPE_U16_STRING; > else > type = TYPE_U8_STRING; > > I might use something

Re: prepare vasnprintf for Unicode strings

2007-06-12 Thread Paul Eggert
Jim Meyering <[EMAIL PROTECTED]> writes: >>type = TYPE_U8_STRING + (8 <= flags) + (16 <= flags); > For that one-liner, you must be playing devil's advocate or something, I suppose I was :-). Still, if performance is important and if we like computing with 'int' the idea could be

Re: prepare vasnprintf for Unicode strings

2007-06-12 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote: > Bruno Haible <[EMAIL PROTECTED]> writes: > >> Hey, 'int' is a flexible data type! > > I agree, though for this particular example I find the code > easier to read if the test is ordered numerically, and if an > if-then-else expression is used. So, instead

Re: prepare vasnprintf for Unicode strings

2007-06-12 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes: > Hey, 'int' is a flexible data type! I agree, though for this particular example I find the code easier to read if the test is ordered numerically, and if an if-then-else expression is used. So, instead of this: if (flags >= 16)

Re: prepare vasnprintf for Unicode strings

2007-06-11 Thread Bruno Haible
Eric Blake wrote: > > + static const uint8_t u8_null_string[] = > > + { '(', 'N', 'U', 'L', 'L', 0 }; > > Typo. Missing ')'. copy-n-pasted twice more. Oops, fixed. Thanks. > > + uint16_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */ > > what about a A F? Add

Re: prepare vasnprintf for Unicode strings

2007-06-11 Thread Daniel Jacobowitz
On Mon, Jun 11, 2007 at 03:08:53AM +0200, Bruno Haible wrote: > The snprintfv code has not been migrating to gnulib (yet? dormant project?), > so I have no other choice than using gnulib's vasnprintf.c as code base. I ran out of time to work on it - I can't promise I'll get back to it. I do want t

Re: prepare vasnprintf for Unicode strings

2007-06-11 Thread Eric Blake
Bruno Haible clisp.org> writes: > > The Unicode string I/O - essentially a *printf directive 'U' that accepts > Unicode strings as arguments, but also the ability to produce Unicode strings > rather than char* strings - requires some modifications to the vasnprintf > code. Hmm - cygwin (and I a