> o.k. i've had a look at the libc source (locale dir).  i understand
> the general gist of things, but it'd take ages to implement in pascal
> if i try and transliterate that.  it's also not very easy to read (due
> to a generous use of defines).  what work has been done on this for
> fpc?  is there any (more readable) documentation on the locale binary
> files?  posix docs?
> 
> to get the time and date format info i'd have to do this:
> 
> (1) get the locale that's being used (LANG environment variable).
> mine gives en_GB.utf8
> (2) open the LC_TIME file that can be found under
> /usr/lib/locale/{locale from (1)}/

Not portable. E.g. on BSD it is /usr/share/locale
So between 1 and 2 there should be a step "find locale dir".

This because a solution is required to be Solaris, BSD and Mac OS X
compatible.

> (3) extract the date and time format from this file
> 
> sorry it's not more specific, but that's the main idea.  it would
> obviously make sense to implement the whole lot of locale functions.
> i think it's quite fundamental.  will fpc choose to mimic what libc
> does?  it'd quite nice to have a single function that queries certain
> variables from certain categories (e.g. LC_MONETARY, LC_TIME,
> LC_NUMERIC).
> 
> i'll see if i can do some more work on this.

Another solution would be to have an additional unit that links to libc and
gets the data. This way the limiting libc linking would only happen at the
writers request, and not hamper all sysutils using programs.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to