Re: [fpc-pascal] red( clGrayText)

2014-12-01 Thread Mattias Gaertner
On Mon, 01 Dec 2014 22:01:15 -0200
Philippe  wrote:

>[...]
> http://wiki.lazarus.freepascal.org/Colors#System_colors [1]
> > 
> > I have seen it ... but did not catch that it may not work
> with red( x) ... making it more simple, it means that the range of
> values used for those constants as clGrayText is not TColor compatible.
> Is that correct? 

clGrayText is a TColor, but TColor is not always a simple RGB value.
System colors are context sensitive.
You might try

Red(ColorToRGB(clGrayText));


Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] red( clGrayText)

2014-12-01 Thread Philippe
 

Em 01.12.2014 20:04, Mattias Gaertner escreveu: 

> On Mon, 01 Dec
2014 15:17:04 -0200
> Philippe  wrote:
> 
>>
using -Cr (Range Check) option, red( clGrayText) as example, throw an
exception! how should I program "red" (or green, blue and may be some
others) functions to avoid that? should I write red( clGrayText and
$ff) ? ... another better way?
> 
> Have you read this?
>
http://wiki.lazarus.freepascal.org/Colors#System_colors [1]
> 
>
Mattias
> 
> I have seen it ... but did not catch that it may not work
with red( x) ... making it more simple, it means that the range of
values used for those constants as clGrayText is not TColor compatible.
Is that correct? 
> 
> ___
>
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
>
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [2]




Links:
--
[1]
http://wiki.lazarus.freepascal.org/Colors#System_colors
[2]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] red( clGrayText)

2014-12-01 Thread Mattias Gaertner
On Mon, 01 Dec 2014 15:17:04 -0200
Philippe  wrote:

>  
> 
> using -Cr (Range Check) option, red( clGrayText) as example, throw
> an exception! 
> 
> how should I program "red" (or green, blue and may be
> some others) functions to avoid that? 
> 
> should I write red( clGrayText
> and $ff) ? ... another better way? 

Have you read this?
http://wiki.lazarus.freepascal.org/Colors#System_colors


Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Helper type and class fields

2014-12-01 Thread silvioprog
On Mon, Dec 1, 2014 at 4:49 PM, Sven Barth 
wrote:

> Am 01.12.2014 18:59 schrieb "silvioprog" :
> >
> > Hello,
> >
> > From the Embarcadero wiki:
> >
> > "A helper type may not declare instance data, but class fields are
> allowed." (
> http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi)
>  ).
> >
> > In Delphi it compiles fine:
> >
> >   TFoo = class
> >   end;
> >
> >   TBar = class helper for TFoo
> >   private class var
> > FFoo: TFoo;
> >   end;
> >
> > In FPC:
> >
> > project1.lpr(11,5) Error: An interface, helper or Objective-C protocol
> or category cannot contain fields
> >
> > Bug?
>
> Yes, bug. Please report.
>
> Regards,
> Sven
>
Done: http://bugs.freepascal.org/view.php?id=27120.

Thx!

--
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Helper type and class fields

2014-12-01 Thread Sven Barth
Am 01.12.2014 18:59 schrieb "silvioprog" :
>
> Hello,
>
> From the Embarcadero wiki:
>
> "A helper type may not declare instance data, but class fields are
allowed." (
http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi)
 ).
>
> In Delphi it compiles fine:
>
>   TFoo = class
>   end;
>
>   TBar = class helper for TFoo
>   private class var
> FFoo: TFoo;
>   end;
>
> In FPC:
>
> project1.lpr(11,5) Error: An interface, helper or Objective-C protocol or
category cannot contain fields
>
> Bug?

Yes, bug. Please report.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Helper type and class fields

2014-12-01 Thread silvioprog
Hello,

>From the Embarcadero wiki:

"A helper type may not declare instance data, but class fields are
allowed." (
http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi)
 ).

In Delphi it compiles fine:

  TFoo = class
  end;

  TBar = class helper for TFoo
  private class var
FFoo: TFoo;
  end;

In FPC:

project1.lpr(11,5) Error: An interface, helper or Objective-C protocol or
category cannot contain fields

Bug?

Thank you!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] -CR option and simplehtmltreeparser

2014-12-01 Thread Philippe
 

compiling simplehtmltreeparser with -CR option I get:


F:lazaruscomponentsinternettoolsdatasimplehtmltreeparser.pas(591,13)
Error: Incompatible type for arg no. 2: Got "Class Of INamespace",
expected "TClass" 

here is the line .. 

function
TNamespaceList.getNamespace(i: integer): INamespace;
begin
 result :=
INamespace(inherited get(i)) ;
end; 

 it is difficulting to use the -CR
option  ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] red( clGrayText)

2014-12-01 Thread Philippe
 

using -Cr (Range Check) option, red( clGrayText) as example, throw
an exception! 

how should I program "red" (or green, blue and may be
some others) functions to avoid that? 

should I write red( clGrayText
and $ff) ? ... another better way? 

Philippe ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] SameValue and +-Infinity

2014-12-01 Thread Valdas Jankūnas

Hello,

today I discovered that SameValue(infinity, neginfinity) returns TRUE. 
Why? It should be FALSE. Or not?


 Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64

--
  Valdas Jankūnas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] mORMot

2014-12-01 Thread Alan Krause
I have used one specific part of it for PDF generation, and have no
complaints.

Alan


--
Alan L. Krause jr.al...@shermanloan.com*Manager of Software Development*Voice:
(760) 634-1700Sherman and Associates, Inc. Fax:
(760) 634-1992

On Mon, Dec 1, 2014 at 3:09 AM, Mark Morgan Lloyd <
markmll.fpc-pas...@telemetry.co.uk> wrote:

> Discussion elsewhere has mentioned mORMot as a development framework. It
> claims to work with both Delphi and FPC: is anybody actively using it "in
> anger", so that I can pass the confirmation back to where I saw this
> mentioned?
>
> --
> 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 maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Question about functions returning a string

2014-12-01 Thread Ewald
On 12/01/2014 04:34 AM, leledumbo wrote:
>> So in general, one should not use managed types in the prototype of an 
>> exported (public) function?
>
> Bingo. At least not until we have properly sharable RTL.

The problem lies not with a sharable RTL. As mentioned, I do not want to
/use/ these managed types in another language. I just want to pass them
along :-)



>> my thought was that it would be 
>> possible to pass along these managed types (especially string, as it is 
>> a pointer internally) to another pascal function (a callback in my case).
>
> You can still pass pointer to its first element as a PChar, treating it
> read-only in the caller for safety reason (though it's possible to make it
> writable as well, but the safety burden is propagated to the caller).

Actually I was trying to avoid PChar's ;-)

In the meanwhile, I've fixed my issue by not returning a string as a
result, but as an out parameter:

Function Bla: String;

... becomes ...

Procedure Bla(out Result: String);

This seems to work. How portable it is, I do not know, I guess time will
be the judge and jury on that.

Anyway, thanks to you all!

-- 
Ewald


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] mORMot

2014-12-01 Thread Mark Morgan Lloyd
Discussion elsewhere has mentioned mORMot as a development framework. It 
claims to work with both Delphi and FPC: is anybody actively using it 
"in anger", so that I can pass the confirmation back to where I saw this 
mentioned?


--
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