Re: [fpc-pascal] Primitive Record Wrappers
On Fri, Feb 26, 2016 at 10:38 PM, Mazola Winstrol wrote: > In the code bellow, the generic type TNullableTyple is implemented (and > incomplete for now). > How to reset TNullableType to Null value? HasValue seems to be read-only. > Is there any possibility of "nullable types" be added to RTL or anyother > fpc provided package? > You could start your own package separate from RTL. It's not about where the package is hosted, it's about letting others know that the package exists. thanks, Dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Primitive Record Wrappers
Hello, In the code bellow, the generic type TNullableTyple is implemented (and incomplete for now). Is there any possibility of "nullable types" be added to RTL or anyother fpc provided package? unit NullableTypes; {$mode delphi}{$H+} interface type { TNullable } TNullable = record strict private FValue: T; FHasValue: IInterface; function GetValue: T; function GetHasValue: Boolean; procedure SetValue(const AValue: T); procedure SetFlatInterface(var Intf: IInterface); public constructor Create(const AValue: T); function GetValueOrDefault: T; overload; function GetValueOrDefault(Default: T): T; overload; property HasValue: Boolean read GetHasValue; property Value: T read GetValue; class operator Implicit(AValue: TNullable): T; class operator Implicit(const AValue: T): TNullable; class operator Explicit(AValue: TNullable): T; end; TInteger = TNullable; function NopAddref(inst: Pointer): Integer; stdcall; function NopRelease(inst: Pointer): Integer; stdcall; function NopQueryInterface(inst: Pointer; const IID: TGUID; out Obj): HResult; const FlagInterfaceVTable: array[0..2] of Pointer = ( @NopQueryInterface, @NopAddref, @NopRelease ); FlagInterfaceInstance: Pointer = @FlagInterfaceVTable; implementation uses SysUtils; function NopAddref(inst: Pointer): Integer; stdcall; begin Result := -1; end; function NopRelease(inst: Pointer): Integer; stdcall; begin Result := -1; end; function NopQueryInterface(inst: Pointer; const IID: TGUID; out Obj): HResult; stdcall; begin Result := E_NOINTERFACE; end; { TNullable } procedure TNullable.SetFlatInterface(var Intf: IInterface); begin Intf := IInterface(@FlagInterfaceInstance); end; class operator TNullable.Explicit(AValue: TNullable): T; begin Result := AValue.Value; end; function TNullable.GetHasValue: Boolean; begin Result := FHasValue <> nil; end; function TNullable.GetValue: T; begin if not HasValue then raise Exception.Create('Invalid operation, Nullable type has no value'); Result := FValue; end; function TNullable.GetValueOrDefault: T; begin if HasValue then Result := FValue else Result := Default(T); end; function TNullable.GetValueOrDefault(Default: T): T; begin if not HasValue then Result := Default else Result := FValue; end; class operator TNullable.Implicit(AValue: TNullable): T; begin Result := AValue.Value; end; class operator TNullable.Implicit(const AValue: T): TNullable; begin Result := TNullable.Create(AValue); end; procedure TNullable.SetValue(const AValue: T); begin FValue := AValue; SetFlatInterface(FHasValue); end; constructor TNullable.Create(const AValue: T); begin FValue := AValue; SetFlatInterface(FHasValue); end; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Codepage + class helper raises "Error identifier idents no member ..."
On Fri, Feb 26, 2016 at 8:29 PM, Bart wrote: > On 2/26/16, silvioprog wrote: > > > It compiles fine, but when you uncomment the line "//{$codepage utf8}", > it > > raises: > > > > 'Error: identifier idents no member "Bar"' > > Same here. > fpc 3.0.0 win32. Oops, I forgot to show my env. ^^' Lazarus 1.7 rUnknown FPC 3.1.1 i386-win32-win32/win64 -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Codepage + class helper raises "Error identifier idents no member ..."
On 2/26/16, silvioprog wrote: > It compiles fine, but when you uncomment the line "//{$codepage utf8}", it > raises: > > 'Error: identifier idents no member "Bar"' Same here. fpc 3.0.0 win32. Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Codepage + class helper raises "Error identifier idents no member ..."
Hello, Consider the following code: === code === program project1; {$mode objfpc}{$H+} *//{$codepage utf8}* uses Classes; type TFoo = class helper for TStream public procedure Bar; end; procedure TFoo.Bar; begin end; var s: string = ''; m: TStream; begin m := TMemoryStream.Create; try m.Bar; finally m.Free; end; end. === /code === It compiles fine, but when you uncomment the line "//{$codepage utf8}", it raises: 'Error: identifier idents no member "Bar"' If you confirm it as bug I can open a issue on bugtracker. -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
On 2/26/16, Bart wrote: > The original message is: "A lone zero block at %s" See: https://pear.php.net/bugs/bug.php?id=5452 "When extracting tar files created with PEAR::Archive_Tar, tar shows a warning like 'tar: A lone zero block at *'. The reason for the message is that newer GNU Tar implementations expects TWO empty records marking the end of the archive but Archive_Tar is writing only ONE. That is confusing for many users." Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
On 2/26/16, Bart wrote: > See: https://pear.php.net/bugs/bug.php?id=5452 and http://osdir.com/ml/gnu.tar.bugs/2007-04/msg00047.html "Use --ignore-zeros command line option" Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
On 2/26/16, Bart wrote: > Should I be concerned about the "tar: Een los blok met nullen op 1527" > messages? > (It roughly translates to: "tar: A separate/isolated/loose(?) block > with zeros at 1527" The original message is: "A lone zero block at %s" Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
On 2/26/16, Mark Morgan Lloyd wrote: > Are you sure you are using the standard tar? What does tar --version > report? bart@simenon:~$ tar --version tar (GNU tar) 1.27.1 bart@simenon:~$ tar --help ... *Deze* tar gebruikt de volgende standaardwaarden: (This tar uses the following defaults) --format=gnu -f- -b20 --quoting-style=escape --rmt-command=/usr/lib/tar/rmt --rsh-command=/usr/bin/rsh Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
Bart wrote: Hi, I installed fpc 3.0 on my "new" Debian system, running the script form fpc-3.0.0.i386-linux.tar. This shell script will attempt to install the Free Pascal Compiler version 3.0.0 with the items you select Install prefix (/usr or /usr/local) [/usr] : /usr/local Installing compiler and RTL for i386-linux... Installing rtl packages... Installing rtl-console tar: Een los blok met nullen op 613 Installing rtl-extra tar: Een los blok met nullen op 1527 Installing rtl-objpas tar: Een los blok met nullen op 2442 Installing rtl-unicode tar: Een los blok met nullen op 5916 Installing fcl... Installing fcl-async .. Should I be concerned about the "tar: Een los blok met nullen op 1527" messages? (It roughly translates to: "tar: A separate/isolated/loose(?) block with zeros at 1527" I was able to build Lazarus with it, so I guess it's OK? Are you sure you are using the standard tar? What does tar --version report? I don't know whether there's a master chacksum os has list anywhere. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Official/recommended citations for scientific papers
Hello all, this is a cross-post to FPC-Pascal and Lazarus mailing lists. I'm finishing my PhD thesis and because I was implementing some partial differential equation solvers and visualization/image processing tools using FPC and Lazarus, I need to add some references. I was wandering are there any published official/recommended/written-by-core-developers articles or books about Free Pascal and/or Lazarus I could use as references in my thesis (English preferably)? Currently I'm referencing these: @Book{Leestma93, Title= {Pascal Programming and Problem Solving}, Author = {S. Leestma and L. Nyhoff}, Publisher= {Prentice Hall}, Year = {1993}, Address = {New York}, Edition = {Fourth} } @book{Person13, Title= {Getting Started with the Lazarus IDE}, Author = {R. Person}, Publisher= {Packt Publishing Ltd}, Year = {2013}, Address = {United Kingdom} } @book{Ellison15, Author = {M. Abiola-Ellison}, Title= {Getting Started with Lazarus and Free Pascal: Learning by Doing}, Publisher= {Mka Publishing Ltd}, Year = {2015}, Address = {United Kingdom} } Any other suggestions? Best regards, Žilvinas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Tar messages when running the installscript from fpc-3.0.0.i386-linux.tar.
Hi, I installed fpc 3.0 on my "new" Debian system, running the script form fpc-3.0.0.i386-linux.tar. This shell script will attempt to install the Free Pascal Compiler version 3.0.0 with the items you select Install prefix (/usr or /usr/local) [/usr] : /usr/local Installing compiler and RTL for i386-linux... Installing rtl packages... Installing rtl-console tar: Een los blok met nullen op 613 Installing rtl-extra tar: Een los blok met nullen op 1527 Installing rtl-objpas tar: Een los blok met nullen op 2442 Installing rtl-unicode tar: Een los blok met nullen op 5916 Installing fcl... Installing fcl-async ... Should I be concerned about the "tar: Een los blok met nullen op 1527" messages? (It roughly translates to: "tar: A separate/isolated/loose(?) block with zeros at 1527" I was able to build Lazarus with it, so I guess it's OK? Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Include directive for current procedure/method/function name?
On 2016-02-26 07:00, Sven Barth wrote: > Yes, it was a relatively recent addition. In the mean time (as I only use FPC 2.6.4 and FPC 3.0) I tried to use GetLineInfo internally instead, that gives the the same result (though I guess with more overhead). Unfortunately GetLineInfo() [for DWARF] is incomplete, where method names are not implemented, but unit name and line number is. :-/ There is a bug report about this already: http://mantis.freepascal.org/view.php?id=17547 So I'm back at square one with what I wanted to achieve. :-( Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Building FPC for Windows X64
Justin Smyth wrote: iget these errors.. This now seems to be solved: http://forum.lazarus.freepascal.org/index.php?topic=31589.new;topicseen#new Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal