Sign in Join

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

Mailing lists / fpc-devel / 2003-11

demo programs for bugreports

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Vincent Snijders

Hi,

When I submit a bugreport and add a demo program to it I want it to be as useful to you, fpc-developers, as possible.

On the website you mention "Generating high quality feedback (bugreports with 100 lines max demo programs)".

One requirement for demo programs is clear:
- less than 100 lines.

Do you have other requirements? i.e on the output it should generate, when run?

Regards,
Vincent Snijders.

Reply by email

Marco van de Voort
to Vincent Snijders
Show quoted text 11 lines
When I submit a bugreport and add a demo program to it I want it to be as useful to you, fpc-developers, as possible. On the website you mention "Generating high quality feedback (bugreports with 100 lines max demo programs)". One requirement for demo programs is clear: - less than 100 lines. Do you have other requirements? i.e on the output it should generate, when run?

- Shorter is better,
- using less units is better.
- Strip to the minimum as much as you can. So try e.g. if killing the parent class matters if you can, a program instead of a unit (if it is not unit related) etc.
- Play with it, see if the problems changes if you change some types related to the problem.
- if you have multiple compiler (version)s, test both. If it is typical object pascal, a short comment on what delphi did is useful.

Output is hardly important. A breakpoint on the problem spot is the standard way to proceed.

Reply by email

David Butler
to Marco van de Voort

Thanks for the great 1.90 release!

I'm busy converting the open source "Fundamentals" units (http://fundementals.sourceforge.net/) to compile under FreePascal.

So far I have found the following minor issues:

*
const
  MinCurrency : Currency = -922337203685477.5807;
  MaxCurrency : Currency = 922337203685477.5807;

causes

"Fatal: Internal error 18"

* Minor difference with Delphi units:
* RaiseLastOSError is not defined in SysUtils.
* variables Win32Platform, Win32MajorVersion, etc. not defined in SysUtils.
* type TFNFiberStartRoutine = TFarProc not defined in Windows.

Regards
David

Reply by email

Marco van de Voort
to David Butler
Show quoted text 15 lines
Thanks for the great 1.90 release! I'm busy converting the open source "Fundamentals" units (http://fundementals.sourceforge.net/) to compile under FreePascal. So far I have found the following minor issues: * const MinCurrency : Currency = -922337203685477.5807; MaxCurrency : Currency = 922337203685477.5807; causes "Fatal: Internal error 18"

Over my head atm to do this quickly, I'll open a bugtracker item for it tho, so that it doesn't get lost.

* Minor difference with Delphi units: * RaiseLastOSError is not defined in SysUtils.

What is it supposed to do, specifically on non windows, or should it be windows only?

* variables Win32Platform, Win32MajorVersion, etc. not defined in SysUtils.

Win32platform is already defined.

I assume the "etc" are Win32MajorVersion, Win32MinorVersion, Win32BuildNumber and Win32CSDVersion? Added to windows version of SysUtils only (I assumed their contents also originate from getversionex)

I'll add them as soon as I find an implementation. Will look into that early next week.

* type TFNFiberStartRoutine = TFarProc not defined in Windows.

Added. (all additions to CVS)

Reply by email

David Butler
to Marco van de Voort
you wrote 5 lines
> * Minor difference with Delphi units: > * RaiseLastOSError is not defined in SysUtils. What is it supposed to do, specifically on non windows, or should it be windows only?

I had a look at Kylix's RaiseLastOSError function. It uses GetLastError which calls '__errno_location' from 'libc.so.6'. On Windows this uses the GetLastError WinAPI call.

This is Delphi's implementation for RaiseLastOSError:

procedure RaiseLastOSError;
var
  LastError: Integer;
  Error: EOSError;
begin
  LastError := GetLastError;
  if LastError  0 then
    Error := EOSError.CreateResFmt(@SOSError, [LastError,
      SysErrorMessage(LastError)])
  else
    Error := EOSError.CreateRes(@SUnkOSError);
  Error.ErrorCode := LastError;
  raise Error;
end;
Show quoted text 8 lines
> * variables Win32Platform, Win32MajorVersion, etc. not defined in > SysUtils. Win32platform is already defined. I assume the "etc" are Win32MajorVersion, Win32MinorVersion, Win32BuildNumber and Win32CSDVersion? Added to windows version of SysUtils only (I assumed their contents also originate from getversionex)

Yes, the variables from GetVersionEx.

Added. (all additions to CVS)

:-)

Reply by email

Marco van de Voort
to David Butler
Show quoted text 13 lines
On Thu, 6 Nov 2003 23:31:27 +0100 (CET), you wrote: >> * Minor difference with Delphi units: >> * RaiseLastOSError is not defined in SysUtils. > >What is it supposed to do, specifically on non windows, or should it >be windows only? I had a look at Kylix's RaiseLastOSError function. It uses GetLastError which calls '__errno_location' from 'libc.so.6'. On Windows this uses the GetLastError WinAPI call. This is Delphi's implementation for RaiseLastOSError:

[/me pinches his eyes. Doesn't want to see Delphi code out of cleanroom reasons]

The __errno_location (threadsafe errno) is a bit of a problem for various reasons.

But anyway, essentially it takes the OS error, and raises some exception.

Reply by email

David Butler
to Marco van de Voort
you wrote 9 lines
> I had a look at Kylix's RaiseLastOSError function. It uses > GetLastError which calls '__errno_location' from 'libc.so.6'. On > Windows this uses the GetLastError WinAPI call. > > This is Delphi's implementation for RaiseLastOSError: [/me pinches his eyes. Doesn't want to see Delphi code out of cleanroom reasons] The __errno_location (threadsafe errno) is a bit of a problem for various reasons. But anyway, essentially it takes the OS error, and raises some exception.

Sorry, I should have guessed. Yes, it basically takes the OS error and raises some exception. The exception message is the OS error message as returned by an OS function call.

Reply by email

Johannes Berg
to David Butler
David Butler wrote
Sorry, I should have guessed. Yes, it basically takes the OS error and raises some exception. The exception message is the OS error message as returned by an OS function call.

Here's a basic implementation that works for me (*):

const
  StrOSError : string = 'System error (number %d).'+LineEnding+'%s';
type
  EOSError = class(Exception)
  end;
procedure RaiseLastOSError;
var
  LError: integer;
begin
  LError := GetLastError;
  raise EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]);
end;
(*) for linux, GetLastError is not defined in system.pp. It should be
(to be Delphi compatible), and this works:
function GetLastError: Integer;
begin
  Result := fpGetErrno;
end;

johannes

http://www.sipsolutions.de/ GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc Key-ID: 9AB78CA5 Johannes Berg Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5

Reply by email

Johannes Berg
to Johannes Berg
Johannes Berg wrote
Here's a basic implementation that works for me (*):

And before someone complains about Delphi compatibility:

type
  EOSError = class(Exception)
  protected
    FErrorCode: Integer;
  public
    property ErrorCode: Integer read FErrorCode;
  end;
procedure RaiseLastOSError;
var
  LError: integer;
  LErrExc: EOSError;
begin
  LError := GetLastError;
  LErrExc := EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]);
  LErrExc.FErrorCode := LError;
  raise LErrExc;
end;

johannes

http://www.sipsolutions.de/ GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc Key-ID: 9AB78CA5 Johannes Berg Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5

Reply by email

Marco van de Voort
to Johannes Berg: Here's a basic implementation that works for me (*): const StrOSError : string = 'System…
Show quoted text 29 lines
On Fri, 2003-11-07 at 12:55, David Butler wrote: > Sorry, I should have guessed. Yes, it basically takes the OS error and > raises some exception. The exception message is the OS error message > as returned by an OS function call. Here's a basic implementation that works for me (*): const StrOSError : string = 'System error (number %d).'+LineEnding+'%s'; type EOSError = class(Exception) end; procedure RaiseLastOSError; var LError: integer; begin LError := GetLastError; raise EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]); end; (*) for linux, GetLastError is not defined in system.pp. It should be (to be Delphi compatible), and this works: function GetLastError: Integer; begin Result := fpGetErrno; end;

I will look into this tomorrow.

Reply by email