Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-09

clocale glibc extension patch

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi.

I'am author of initial implementation clocale. On Ubuntu I found some incompatibilities. And here is little patch, which reflects some glibc extensions to strftime. We need to omit some more modifiers than 'E' and 'O'.

I send this patch 28.04.2008 but was probably forgotten.

Index: rtl/unix/clocale.pp
=================================================================== --- rtl/unix/clocale.pp (revision 11355)
+++ rtl/unix/clocale.pp (working copy)
@@ -104,20 +104,31 @@

     GetLocaleChar := nl_langinfo(item)^;
   end;
+  procedure OmitModifiers(const s: string; var i: integer);
+  var
+    l: Integer;
+  begin
+    l := Length(s);
+    if (i<=l) and (s[i] in ['E', 'O']) then //possible modifier
+      inc(i);
+    if (i<=l) and (s[i] in ['_', '-', '0', '^', '#']) then //possible flag - glibc extension
+      inc(i);
+    while (i<=l) and (s[i] in ['0'..'9']) do //possible with specifier - glibc exension
+      inc(i);
+  end;
+
   function FindSeparator(const s: string; Def: char): char;
   var
-    i, l: integer;
+    i: 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
+    OmitModifiers(s, i);
+    inc(i);
+    if i<=Length(s) then
       FindSeparator := s[i];
   end;
@@ -133,8 +144,7 @@
     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);
+        OmitModifiers(s, i);
         if i>l then
           Exit;
         case s[i] of

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 7 lines
I'am author of initial implementation clocale. On Ubuntu I found some incompatibilities. And here is little patch, which reflects some glibc extensions to strftime. We need to omit some more modifiers than 'E' and 'O'. I send this patch 28.04.2008 but was probably forgotten.

It's best to use the bug reporting system, then things can't be forgotten: http://bugs.freepascal.org

Jonas

Reply by email

Unknown author
to Jonas Maebe
Jonas Maebe wrote 13 lines
On 11 Sep 2008, at 16:10, wrote: >I'am author of initial implementation clocale. On Ubuntu I found >some incompatibilities. >And here is little patch, which reflects some glibc extensions to >strftime. >We need to omit some more modifiers than 'E' and 'O'. > >I send this patch 28.04.2008 but was probably forgotten. It's best to use the bug reporting system, then things can't be forgotten: http://bugs.freepascal.org

Is something wrong with my patch, that cannot be applied?

Or I have to place it into http://bugs.freepascal.org?

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 15 lines
On Thu, Sep 11, 2008 at 06:47:42PM +0100, Jonas Maebe wrote: > > On 11 Sep 2008, at 16:10, wrote: > > >I'am author of initial implementation clocale. On Ubuntu I found > >some incompatibilities. > >And here is little patch, which reflects some glibc extensions to > >strftime. > >We need to omit some more modifiers than 'E' and 'O'. > > > >I send this patch 28.04.2008 but was probably forgotten. > > It's best to use the bug reporting system, then things can't be > forgotten: http://bugs.freepascal.org Is something wrong with my patch, that cannot be applied?

Nono, I just didn't have time.

Or I have to place it into http://bugs.freepascal.org?

Please do, and assign it to me. I'll try to do it later today, but if I don't find the time, at least it won't be forgotten.

Michael.

Reply by email

Unknown author
to Michael Van Canneyt
Michael Van Canneyt wrote 27 lines
On Mon, 15 Sep 2008, wrote: > On Thu, Sep 11, 2008 at 06:47:42PM +0100, Jonas Maebe wrote: > > > > On 11 Sep 2008, at 16:10, wrote: > > > > >I'am author of initial implementation clocale. On Ubuntu I found > > >some incompatibilities. > > >And here is little patch, which reflects some glibc extensions to > > >strftime. > > >We need to omit some more modifiers than 'E' and 'O'. > > > > > >I send this patch 28.04.2008 but was probably forgotten. > > > > It's best to use the bug reporting system, then things can't be > > forgotten: http://bugs.freepascal.org > Is something wrong with my patch, that cannot be applied? Nono, I just didn't have time. > > Or I have to place it into http://bugs.freepascal.org? Please do, and assign it to me. I'll try to do it later today, but if I don't find the time, at least it won't be forgotten.

I made record in bug tracker no. 0012148, but I cannot assign it (probably rights).

Patch is included.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email