Forráskód Böngészése

Merged revisions 10620,10626,10693,10697,10780,10801-10804 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r10620 | michael | 2008-04-09 10:32:26 +0200 (Wed, 09 Apr 2008) | 1 line

* Added clocale.pp from Petr Kristan
........
r10626 | marco | 2008-04-11 17:00:26 +0200 (Fri, 11 Apr 2008) | 2 lines

* quick test successful -> commit
........
r10693 | yury | 2008-04-18 15:31:43 +0200 (Fri, 18 Apr 2008) | 1 line

* Fixed tests to be locale independent.
........
r10697 | yury | 2008-04-18 16:18:14 +0200 (Fri, 18 Apr 2008) | 1 line

* Fixed test to be locale independent.
........
r10780 | jonas | 2008-04-24 15:08:43 +0200 (Thu, 24 Apr 2008) | 2 lines

+ (interactive) test for locale settings by Petr Kristan
........
r10801 | marco | 2008-04-26 13:30:11 +0200 (Sat, 26 Apr 2008) | 2 lines

* some debug stuff under ifdef + one fix for *BSD currency
........
r10802 | marco | 2008-04-26 15:49:41 +0200 (Sat, 26 Apr 2008) | 2 lines

* support for debuglocale and print the names of the fields.
........
r10803 | marco | 2008-04-26 16:28:19 +0200 (Sat, 26 Apr 2008) | 2 lines

* some fields not qualified with org*.
........
r10804 | marco | 2008-04-26 17:15:16 +0200 (Sat, 26 Apr 2008) | 2 lines

* fix currency copy with extra safety on *BSD, fixed ampm
........

git-svn-id: branches/fixes_2_2@10863 -

marco 17 éve
szülő
commit
a75cc28bc4

+ 3 - 0
.gitattributes

@@ -4756,6 +4756,7 @@ rtl/beos/unxsockh.inc svneol=native#text/plain
 rtl/bsd/bsd.pas -text
 rtl/bsd/bunxfunch.inc svneol=native#text/plain
 rtl/bsd/bunxsysc.inc svneol=native#text/plain
+rtl/bsd/clocale.inc svneol=native#text/plain
 rtl/bsd/i386/syscall.inc svneol=native#text/plain
 rtl/bsd/i386/syscallh.inc svneol=native#text/plain
 rtl/bsd/ipcbsd.inc svneol=native#text/plain
@@ -5702,6 +5703,7 @@ rtl/unix/bunxh.inc svneol=native#text/plain
 rtl/unix/bunxovl.inc svneol=native#text/plain
 rtl/unix/bunxovlh.inc svneol=native#text/plain
 rtl/unix/classes.pp svneol=native#text/plain
+rtl/unix/clocale.pp svneol=native#text/plain
 rtl/unix/convert.inc -text
 rtl/unix/crt.pp svneol=native#text/plain
 rtl/unix/cthreads.pp svneol=native#text/plain
@@ -7518,6 +7520,7 @@ tests/test/units/sysutils/tastrcmp.pp svneol=native#text/plain
 tests/test/units/sysutils/tfile1.pp svneol=native#text/plain
 tests/test/units/sysutils/tfilename.pp svneol=native#text/plain
 tests/test/units/sysutils/tfloattostr.pp -text
+tests/test/units/sysutils/tlocale.pp svneol=native#text/plain
 tests/test/units/sysutils/tsscanf.pp svneol=native#text/plain
 tests/test/units/sysutils/tstrtobool.pp svneol=native#text/plain
 tests/test/uprec6.pp svneol=native#text/plain

+ 135 - 0
rtl/bsd/clocale.inc

@@ -0,0 +1,135 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 by the Free Pascal development team.
+
+    Init rtl formating variables based on BSD like libc locales
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ **********************************************************************}
+
+{ Initial FreeBSD Implementation by Marco van de Voort.
+  Crosschecked with OS X 10.4/ppc headers.
+  To some symbols leading underscores were added. If these values are
+   ever exposed in an interface this has to be reevaluated.
+}
+
+{$IFDEF FPC}
+{$PACKRECORDS C}
+{$ENDIF}
+
+  __LC_ALL          = 0;
+  __LC_COLLATE      = 1;
+  __LC_CTYPE        = 2;
+  __LC_MONETARY     = 3;
+  __LC_NUMERIC      = 4;
+  __LC_TIME         = 5;
+  __LC_MESSAGES     = 6;
+  _LC_LAST         = 7;              { marks end }
+
+
+Type
+     lconv = record
+          decimal_point     : pchar;
+          thousands_sep     : pchar;
+          grouping          : pchar;
+          int_curr_symbol   : pchar;
+          currency_symbol   : pchar;
+          mon_decimal_point : pchar;
+          mon_thousands_sep : pchar;
+          mon_grouping      : pchar;
+          positive_sign     : pchar;
+          negative_sign     : pchar;
+          int_frac_digits   : char;
+          frac_digits       : char;
+          p_cs_precedes     : char;
+          p_sep_by_space    : char;
+          n_cs_precedes     : char;
+          n_sep_by_space    : char;
+          p_sign_posn       : char;
+          n_sign_posn       : char;
+          int_p_cs_precedes : char;
+          int_n_cs_precedes : char;
+          int_p_sep_by_space: char;
+          int_n_sep_by_space: char;
+          int_p_sign_posn   : char;
+          int_n_sign_posn   : char;
+       end;
+     Tlconv = lconv;
+     plconv = ^lconv;
+
+Const
+        CODESET         = 0;     { codeset name }
+        D_T_FMT         = 1;     { string for formatting date and time }
+        D_FMT           = 2;     { date format string }
+        T_FMT           = 3;     { time format string }
+        T_FMT_AMPM      = 4;     { a.m. or p.m. time formatting string }
+        AM_STR          = 5;     { Ante Meridian affix }
+        PM_STR          = 6;     { Post Meridian affix }
+
+{ week day names }
+        DAY_1           = 7;
+        DAY_2           = 8;
+        DAY_3           = 9;
+        DAY_4           = 10;
+        DAY_5           = 11;
+        DAY_6           = 12;
+        DAY_7           = 13;
+
+{ abbreviated week day names }
+        ABDAY_1         = 14;
+        ABDAY_2         = 15;
+        ABDAY_3         = 16;
+        ABDAY_4         = 17;
+        ABDAY_5         = 18;
+        ABDAY_6         = 19;
+        ABDAY_7         = 20;
+
+{ month names }
+        MON_1           = 21;
+        MON_2           = 22;
+        MON_3           = 23;
+        MON_4           = 24;
+        MON_5           = 25;
+        MON_6           = 26;
+        MON_7           = 27;
+        MON_8           = 28;
+        MON_9           = 29;
+        MON_10          = 30;
+        MON_11          = 31;
+        MON_12          = 32;
+
+{ abbreviated month names }
+        ABMON_1         = 33;
+        ABMON_2         = 34;
+        ABMON_3         = 35;
+        ABMON_4         = 36;
+        ABMON_5         = 37;
+        ABMON_6         = 38;
+        ABMON_7         = 39;
+        ABMON_8         = 40;
+        ABMON_9         = 41;
+        ABMON_10        = 42;
+        ABMON_11        = 43;
+        ABMON_12        = 44;
+                        
+        ERA             = 45;      { era description segments }
+        ERA_D_FMT       = 46;      { era date format string }
+        ERA_D_T_FMT     = 47;      { era date and time format string }
+        ERA_T_FMT       = 48;      { era time format string }
+        ALT_DIGITS      = 49;      { alternative symbols for digits }
+        RADIXCHAR       = 50;      { radix char }
+        THOUSEP         = 51;      { separator for thousands }
+
+        YESEXPR         = 52;      { affirmative response expression }
+        NOEXPR          = 53;      { negative response expression }
+        YESSTR          = 54;      { affirmative response for yes/no queries }
+        NOSTR           = 55;      { negative response for yes/no queries }
+        CRNCYSTR        = 56;      { currency symbol }
+        D_MD_ORDER      = 57;      { month/day order (local extension) }
+
+function localeconv:plconv; cdecl; external clib name 'localeconv';

+ 2 - 1
rtl/freebsd/Makefile.fpc

@@ -17,7 +17,8 @@ units=$(SYSTEMUNIT) unixtype ctypes objpas macpas strings syscall sysctl  baseun
       $(CPU_UNITS) charset ucomplex crt getopts heaptrc lnfodwrf lineinfo \
       errors sockets ipc terminfo bsd freebsd \
       video mouse keyboard console serial dateutils \
-      sysconst cthreads strutils convutils stdconvs dos objects cwstring
+      sysconst cthreads strutils convutils stdconvs dos objects cwstring \
+      clocale
 implicitunits=exeinfo
 
 rsts=math varutils typinfo classes variants dateutils sysconst

+ 2 - 1
rtl/linux/Makefile.fpc

@@ -16,7 +16,8 @@ units=$(SYSTEMUNIT) $(SYSINIT_UNITS) \
       charset ucomplex getopts \
       errors sockets gpm ipc serial terminfo dl dynlibs \
       video mouse keyboard variants types dateutils sysconst fmtbcd \
-      cthreads classes fgl convutils stdconvs strutils rtlconsts dos objects cwstring fpcylix
+      cthreads classes fgl convutils stdconvs strutils rtlconsts dos objects cwstring fpcylix \
+      clocale
 implicitunits=exeinfo
 
 rsts=math varutils typinfo variants sysconst rtlconsts stdconvs

+ 316 - 0
rtl/unix/clocale.pp

@@ -0,0 +1,316 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2008 by the Free Pascal development team.
+
+    Init rtl formating variables based on libc locales
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ **********************************************************************}
+
+{ Initial implementation by petr kristan }
+
+unit clocale;
+
+{$mode objfpc}
+
+interface
+
+{$ifdef localedebug}
+// for easier debugging, allows to print untransformed values in test
+Type TOrgFormatSettings = record
+                            ShortDateFormat,
+                            LongDateFormat ,
+                            ShortTimeFormat, 
+                            LongTimeFormat ,
+                            CurrencyString1, 
+                            CurrencyString2: string;
+                           end;
+
+var OrgFormatSettings : TOrgFormatSettings;
+
+{$endif}
+
+implementation
+
+{$linklib c}
+
+Uses
+  SysUtils, unixtype, initc;
+
+Const
+{$ifdef BSD}
+  // Darwin and FreeBSD. Note the lead underscores are added.
+ {$i clocale.inc}
+{$else}
+// checked for Linux only, but might be general glibc.
+  __LC_CTYPE    = 0;
+  __LC_NUMERIC  = 1;
+  __LC_TIME     = 2;
+  __LC_COLLATE  = 3;
+  __LC_MONETARY = 4;
+  __LC_MESSAGES = 5;
+  __LC_ALL      = 6;
+ ABDAY_1 = (__LC_TIME shl 16);
+ DAY_1 = (ABDAY_1)+7;
+ ABMON_1 = (ABDAY_1)+14;
+ MON_1 = (ABDAY_1)+26;
+ AM_STR = (ABDAY_1)+38;
+ PM_STR = (ABDAY_1)+39;
+ D_T_FMT = (ABDAY_1)+40;
+ D_FMT = (ABDAY_1)+41;
+ T_FMT = (ABDAY_1)+42;
+ T_FMT_AMPM = (ABDAY_1)+43;
+
+ __DECIMAL_POINT = (__LC_NUMERIC shl 16);
+ RADIXCHAR = __DECIMAL_POINT;
+ __THOUSANDS_SEP = (__DECIMAL_POINT)+1;
+
+ __INT_CURR_SYMBOL = (__LC_MONETARY shl 16);
+ __CURRENCY_SYMBOL = (__INT_CURR_SYMBOL)+1;
+ __MON_DECIMAL_POINT = (__INT_CURR_SYMBOL)+2;
+ __MON_THOUSANDS_SEP = (__INT_CURR_SYMBOL)+3;
+ __MON_GROUPING = (__INT_CURR_SYMBOL)+4;
+ __POSITIVE_SIGN = (__INT_CURR_SYMBOL)+5;
+ __NEGATIVE_SIGN = (__INT_CURR_SYMBOL)+6;
+ __INT_FRAC_DIGITS = (__INT_CURR_SYMBOL)+7;
+ __FRAC_DIGITS = (__INT_CURR_SYMBOL)+8;
+ __P_CS_PRECEDES = (__INT_CURR_SYMBOL)+9;
+ __P_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+10;
+ __N_CS_PRECEDES = (__INT_CURR_SYMBOL)+11;
+ __N_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+12;
+ __P_SIGN_POSN = (__INT_CURR_SYMBOL)+13;
+ __N_SIGN_POSN = (__INT_CURR_SYMBOL)+14;
+ _NL_MONETARY_CRNCYSTR = (__INT_CURR_SYMBOL)+15;
+ {$endif}
+
+
+function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name 'setlocale';
+function nl_langinfo(__item: cint):Pchar;cdecl;external clib name 'nl_langinfo';
+
+procedure GetFormatSettings;
+
+  function GetLocaleStr(item: cint): string;
+  begin
+    GetLocaleStr := AnsiString(nl_langinfo(item));
+  end;
+
+  function GetLocaleChar(item: cint): char;
+  begin
+    GetLocaleChar := nl_langinfo(item)^;
+  end;
+
+  function FindSeparator(const s: string; Def: char): char;
+  var
+    i, l: integer;
+  begin
+    FindSeparator := Def;
+    i := Pos('%', s);
+    if i=0 then
+      Exit;
+    l := Length(s);
+    inc(i);
+    if (i<=l) and (s[i] in ['E', 'O']) then //possible modifier
+      inc(i);
+    inc(i); 
+    if i<=l then
+      FindSeparator := s[i];
+  end;
+
+  function TransformFormatStr(const s: string): string;
+  var
+    i, l: integer;
+    clock12:boolean;
+  begin
+    clock12:=false; // should ampm get appended?
+    TransformFormatStr := '';
+    i := 1;
+    l := Length(s);
+    while i<=l do begin
+      if s[i]='%' then begin
+        inc(i);
+        if (i<=l) and (s[i] in ['E', 'O']) then //ignore modifier
+          inc(i);
+        if i>l then
+          Exit;
+        case s[i] of
+          'a': TransformFormatStr := TransformFormatStr + 'ddd';
+          'A': TransformFormatStr := TransformFormatStr + 'dddd';
+          'b': TransformFormatStr := TransformFormatStr + 'mmm';
+          'B': TransformFormatStr := TransformFormatStr + 'mmmm';
+          'c': TransformFormatStr := TransformFormatStr + 'c';
+          //'C':
+          'd': TransformFormatStr := TransformFormatStr + 'dd';
+          'D': TransformFormatStr := TransformFormatStr + 'mm"/"dd"/"yy';
+          'e': TransformFormatStr := TransformFormatStr + 'd';
+          'F': TransformFormatStr := TransformFormatStr + 'yyyy-mm-dd';
+          'g': TransformFormatStr := TransformFormatStr + 'yy';
+          'G': TransformFormatStr := TransformFormatStr + 'yyyy';
+          'h': TransformFormatStr := TransformFormatStr + 'mmm';
+          'H': TransformFormatStr := TransformFormatStr + 'hh';
+          'I': begin 
+                 TransformFormatStr := TransformFormatStr + 'hh';
+                 clock12:=true;
+               end;
+          //'j':
+          'k': TransformFormatStr := TransformFormatStr + 'h';
+          'l': begin
+		  TransformFormatStr := TransformFormatStr + 'h';
+                  clock12:=true;
+               end;
+          'm': TransformFormatStr := TransformFormatStr + 'mm';
+          'M': TransformFormatStr := TransformFormatStr + 'nn';
+          'n': TransformFormatStr := TransformFormatStr + sLineBreak;
+          'p','P': 
+               begin
+                 TransformFormatStr := TransformFormatStr + 'ampm';
+                 clock12:=false;
+               end;
+          'r': begin
+                 TransformFormatStr := TransformFormatStr + 'hh:nn:ss';
+                 clock12:=true;  
+               end;
+          'R': TransformFormatStr := TransformFormatStr + 'hh:nn';
+          //'s':
+          'S': TransformFormatStr := TransformFormatStr + 'ss';
+          't': TransformFormatStr := TransformFormatStr + #9;
+          'T': TransformFormatStr := TransformFormatStr + 'hh:nn:ss';
+          //'u':
+          //'U':
+          //'V':
+          //'w':
+          //'W':
+          'x': TransformFormatStr := TransformFormatStr + 'ddddd';
+          'X': TransformFormatStr := TransformFormatStr + 't';
+          'y': TransformFormatStr := TransformFormatStr + 'yy';
+          'Y': TransformFormatStr := TransformFormatStr + 'yyyy';
+          //'z':
+          //'Z':
+          '%': TransformFormatStr := TransformFormatStr + '%';
+        end;
+      end else
+        TransformFormatStr := TransformFormatStr + s[i];
+      inc(i);
+    end;
+    i:=length(TransformFormatStr);
+    if clock12 and (i>0) then
+      begin
+        if transformformatstr[i]<>' ' then
+          TransformFormatStr := TransformFormatStr + ' ';
+        TransformFormatStr := TransformFormatStr + 'ampm';
+      end;
+  end;
+
+const
+  //                      sign  prec  sep
+  NegFormatsTable: array [0..4, 0..1, 0..1] of byte = (
+    ( (4, 15), (0, 14) ), //Parentheses surround the quantity and currency_symbol
+    ( (5, 8), (1, 9) ), //The sign string precedes the quantity and currency_symbol
+    ( (7, 10), (3, 11) ), //The sign string follows the quantity and currency_symbol
+    ( (6, 13), (1, 9) ), //The sign string immediately precedes the currency_symbol
+    ( (7, 10), (2, 12) )  //The sign string immediately follows the currency_symbol
+  ); 
+var
+  i: integer;
+  prec, sep, signp: byte;
+  {$ifdef BSD}
+   plocale : plconv;
+  {$ENDIF}
+begin
+  setlocale(__LC_ALL,'');
+  for i := 1 to 12 do
+    begin
+    ShortMonthNames[i]:=GetLocaleStr(ABMON_1+i-1);
+    LongMonthNames[i]:=GetLocaleStr(MON_1+i-1);
+    end;
+  for i := 1 to 7 do
+    begin
+    ShortDayNames[i]:=GetLocaleStr(ABDAY_1+i-1);
+    LongDayNames[i]:=GetLocaleStr(DAY_1+i-1);
+    end;
+  //Date stuff
+  ShortDateFormat := GetLocaleStr(D_FMT);
+ 
+{$ifdef localedebug}
+  OrgFormatSettings.ShortDateFormat:=shortdateformat;
+{$endif}
+ 
+  DateSeparator := FindSeparator(ShortDateFormat, DateSeparator);
+  ShortDateFormat := TransformFormatStr(ShortDateFormat);
+  LongDateFormat := GetLocaleStr(D_T_FMT);
+{$ifdef localedebug}
+  OrgFormatSettings.LongDateFormat:=longdateformat;
+{$endif}
+  LongDateFormat := TransformFormatStr(LongDateFormat);
+  //Time stuff
+  TimeAMString := GetLocaleStr(AM_STR);
+  TimePMString := GetLocaleStr(PM_STR);
+  ShortTimeFormat := GetLocaleStr(T_FMT);
+{$ifdef localedebug}
+  OrgFormatSettings.ShortTimeFormat:=shorttimeformat;
+{$endif}
+  TimeSeparator := FindSeparator(ShortTimeFormat, TimeSeparator);
+  ShortTimeFormat := TransformFormatStr(ShortTimeFormat);
+  LongTimeFormat := GetLocaleStr(T_FMT_AMPM);
+{$ifdef localedebug}
+  OrgFormatSettings.LongTimeFormat:=longtimeformat;
+{$endif}
+
+  LongTimeFormat := TransformFormatStr(LongTimeFormat);
+
+  {$Ifdef BSD}
+     plocale:=localeconv;
+     // for these fields there is a separate BSD derived POSIX function.
+     if not assigned(plocale) then exit; // for now.
+
+     CurrencyString:=plocale^.currency_symbol; // int_CURR_SYMBOL (in latin chars)
+     if CurrencyString='' then
+        CurrencyString:=plocale^.int_curr_symbol;
+     CurrencyDecimals:=ord(plocale^.FRAC_DIGITS);
+{$ifdef localedebug}
+  OrgFormatSettings.CurrencyString1:=plocale^.currency_symbol;
+  OrgFormatSettings.CurrencyString2:=plocale^.int_curr_symbol;
+{$endif}
+     prec:=ord(plocale^.P_CS_PRECEDES);
+     sep:=ord(plocale^.P_SEP_BY_SPACE);
+     if (prec<=1) and (sep<=1) then
+       CurrencyFormat := byte(not boolean(prec)) + sep shl 1;
+     prec := ord(plocale^.N_CS_PRECEDES);
+     sep := ord(plocale^.N_SEP_BY_SPACE);
+     signp := ord(plocale^.N_SIGN_POSN);
+     if (signp in [0..4]) and (prec in [0, 1]) and (sep in [0, 1]) then
+       NegCurrFormat := NegFormatsTable[signp, prec, sep];
+  //Number stuff
+     ThousandSeparator:=plocale^.THOUSANDS_SEP[0];
+  {$else}
+   //Currency stuff
+  CurrencyString := GetLocaleStr(_NL_MONETARY_CRNCYSTR);
+{$ifdef localedebug}
+  OrgFormatSettings.CurrencyString1:=currencystring;
+  OrgFormatSettings.CurrencyString2:='';
+{$endif}
+  CurrencyString := Copy(CurrencyString, 2, Length(CurrencyString));
+  CurrencyDecimals := StrToIntDef(GetLocaleStr(__FRAC_DIGITS), CurrencyDecimals);
+  prec := byte(GetLocaleChar(__P_CS_PRECEDES));
+  sep := byte(GetLocaleChar(__P_SEP_BY_SPACE));
+  if (prec<=1) and (sep<=1) then
+    CurrencyFormat := byte(not boolean(prec)) + sep shl 1;
+  prec := byte(GetLocaleChar(__N_CS_PRECEDES));
+  sep := byte(GetLocaleChar(__N_SEP_BY_SPACE));
+  signp := byte(GetLocaleChar(__N_SIGN_POSN));
+  if (signp in [0..4]) and (prec in [0, 1]) and (sep in [0, 1]) then
+    NegCurrFormat := NegFormatsTable[signp, prec, sep];
+  //Number stuff
+  ThousandSeparator:=GetLocaleChar(__THOUSANDS_SEP);
+  {$endif}
+  DecimalSeparator:=GetLocaleChar(RADIXCHAR);
+end;
+
+initialization
+  GetFormatSettings;
+
+end.

+ 65 - 0
tests/test/units/sysutils/tlocale.pp

@@ -0,0 +1,65 @@
+{ %interactive }
+
+uses
+{$ifdef unix}
+  cwstring,
+  clocale,
+{$endif}
+  SysUtils;
+
+procedure PrintSettings;
+var
+ i: integer;
+begin
+  Writeln('Month names:');
+  for i := 1 to 12 do
+    Writeln('month ',i:5,' ',shortmonthnames[i]:25,' - ',longmonthnames[i]);
+  Writeln;
+  Writeln('Day names  :');
+  for i := 1 to 7 do
+     writeln('short day ',i:5,' ',shortdaynames[i]:25,' - ',longdaynames[i]);
+
+  writeln('Dateseparator :', dateseparator);
+  {$ifdef localedebug}
+  writeln('orgshortdate  :', orgformatsettings.shortdateformat);
+  {$endif}
+  writeln('short date    :', shortdateformat);
+  {$ifdef localedebug}
+  writeln('orglongdate   :', orgformatsettings.longdateformat);
+  {$endif}
+  writeln('long  date    :', longdateformat);
+ { Time stuff }
+  writeln('TimeSeparator :', timeseparator);
+  writeln('TimeAMstring  :', timeamstring);
+  writeln('TimePMstring  :', timepmstring);  
+  {$ifdef localedebug}
+  writeln('orgshorttime  :', orgformatsettings.shorttimeformat);
+  {$endif}
+
+ // No support for 12 hour stuff at the moment...
+  writeln('short time    :', shorttimeformat);
+  {$ifdef localedebug}
+  writeln('orglongtime   :', orgformatsettings.longtimeformat);
+  {$endif}
+  writeln('long  time    :', longtimeformat);
+
+ { Currency stuff }
+
+  {$ifdef localedebug}
+  writeln('currency1     :', orgformatsettings.currencystring1);
+  writeln('currency2     :', orgformatsettings.currencystring2);
+  {$endif}
+
+  writeln('currencystring  :', currencystring);
+
+  writeln('currencyformat  :', currencyformat);
+  writeln('negcurrformat   :', negcurrformat);
+
+  writeln('decimalseparator :', decimalseparator);
+  writeln('thousandseparator:', thousandseparator);
+  writeln('currencydecimals :', currencydecimals);
+end;
+
+begin
+  printsettings;
+end.