Sign in Join

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

Mailing lists / fpc-devel / 2006-03

Sending a patch

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Alexsander Rosa

What's the procedure for sending a patch? There are a few Delphi functions I would like to add to FPC, like "StrToDateDef" and "RoundTo". It seems the first must be added to
objpas/sysutils/dati.inc (probable close to StrToDate, at line 306); I'm not sure about the second one.

I saw also that BoolToStr is different. In Delphi it is:

//--- Delphi's BoolToStr
function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string;

If UseBoolStrs is false (the default), it returns '-1' for true and '0' for false. If UseBoolStrs is true, it returns the strings 'TRUE' and 'FALSE'. In Free Pascal there are 2 functions:

//--- in objpas/sysutils/sysstr.inc
function BoolToStr(B: Boolean): string;
begin
  If B then
    Result:='TRUE'
  else
    Result:='FALSE';
end;
//--- in ide/wutils
function BoolToStr(B: boolean; const TrueS, FalseS: string): string;
begin
  if B then BoolToStr:=TrueS else BoolToStr:=FalseS;
end;

So a call to BoolStr(true) would return '-1' in Delphi and 'TRUE' in FPC. I don't know if it was pointed before, and I agree that returning 'TRUE' makes a lot of sense, but when porting an application this may lead to trouble.

About me: I code since 1989 (C/C++) and have been using Delphi since 1997 (I started in version 3.0). At the moment I'm porting a 150+ kloc Delphi project to Lazarus.

Atenciosamente, Alexsander da Rosa

Reply by email

Daniël Mantione
to Alexsander Rosa

Op Fri, 17 Mar 2006, schreef Alexsander Rosa:

What's the procedure for sending a patch?

Whatever is convenient, i.e. you can post the patch on the mailinglist, or post the modified code. We're flexible.

There are a few Delphi

Show quoted text 6 lines
functions I would like to add to FPC, like "StrToDateDef" and "RoundTo". It seems the first must be added to objpas/sysutils/dati.inc (probable close to StrToDate, at line 306); I'm not sure about the second one. I saw also that BoolToStr is different. In Delphi it is:

Looks like a patch is okay here :)

Daniël

Reply by email