Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32

From: Nicolai Tufar <ntufar(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>,Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers(at)postgresql(dot)org,pgsql-hackers-win32(at)postgresql(dot)org,Ismail Teppeev <iteppeev(at)gmail(dot)com>
Subject: Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32
Date: 2005-01-23 00:08:47
Message-ID: d8092939050122160826ce2962@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-hackers-win32
On Sat, 22 Jan 2005 17:05:22 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 
> > src/port/snprintf.c is not not a particularly pretty. And
> > after my rework it got even uglier. I have looked at
> > FreeBDS's one and it is not *that* complicated.
> 
> If you can get it to work then it'd be a better bet than writing (and
> having to maintain) our own.

Very well, I am starting to work on it.
I will put everything necessary in on file.
So far it is 1500-odd lines and will probably
grow a little bit. Plus we would probably need to
include Double-to-ASCII package too:
http://cvsup.pt.freebsd.org/cgi-bin/cvsweb/cvsweb.cgi/src/contrib/gdtoa/
A daunting task indeed. I will do it but I am afraid
it would not be too portable. 

I was wandering if reimplementing print formatting
is the right thing to do.  The problem I have is 
in fmtnum() and probably in  fmtfloat() functions
which are very platform-dependent.

The code to shuffle xxprinf() arguments based on 
%n$ formatting stirngs is ready why don't shuffle
formatting placeholders too and call OS's vsnprintf()
with modified formatting formatting strings and
va_list?

Or, a similar solution, for every parameter
extract formatting placeholder and value,
call snprintf() and the combine the resulting string?

The first solution requires doing nasty manipulations 
with va_list, the second will be slower because of 
multiple calls to snprintf().

Which one is better?

Best regards,
Nicolai Tufar


> 
>                         regards, tom lane
>

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-01-23 00:42:12
Subject: Re: Extending System Views: proposal for 8.1/8.2
Previous:From: Alvaro HerreraDate: 2005-01-22 23:42:58
Subject: Re: Extending System Views: proposal for 8.1/8.2

pgsql-hackers-win32 by date

Next:From: Tom LaneDate: 2005-01-23 01:00:23
Subject: Re: pg_restore
Previous:From: Edin KadribasicDate: 2005-01-22 23:46:10
Subject: Re: Include files for static VC libpq.lib

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group