Re: [fpc-pascal] Free Pascal Language Diagram

2018-09-11 Thread Michael Van Canneyt



On Tue, 11 Sep 2018, Anthony Walter wrote:


I posted this link once before, but I thought I'd remind you guys it exists
and ask if anyone would like to take the work from the page, and integrate
it into either the official documentation or maintain it somewhere on the
free  pascal website.

https://www.getlazarus.org/learn/language/lexical/


Where did you get the rendering library from ?

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

Re: [fpc-pascal] Free Pascal Language Diagram

2018-09-11 Thread R0b0t1
Noice.

I'd been wanting to collect all of the ones from the docs into a more
coherent representation of the syntax.

On Tue, Sep 11, 2018 at 1:49 PM, Anthony Walter  wrote:

> I posted this link once before, but I thought I'd remind you guys it
> exists and ask if anyone would like to take the work from the page, and
> integrate it into either the official documentation or maintain it
> somewhere on the free  pascal website.
>
> https://www.getlazarus.org/learn/language/lexical/
>
> The diagrams are pretty easy to create and edit. For example proecudre
> header is defined through a script tag on the page as follows:
>
>   
> Schematic(
>   Link('Identifier', '#identifier'),
>   Optional(Link('Generic Block', '#generic_block')),
>   Optional(Link('Parameters', '#parameters')),
>   Keyword(':'),
>   Link('Identifier Dot', '#identifier_dot'),
>   Keyword(';'),
>   Optional(Link('Function Directives', '#function_directives'))
> ).render();
>   
>
>
> And renders like so:
>
> https://www.getlazarus.org/learn/language/lexical/#function_header
>
> To use just copy this css and script file on the any page you want to
> display diagrams:
>
> 
> 
>
> You can look at the source of the page to see exactly what Schematic()
> commands are given to generate each diagram.
>
>
>
> ___
> 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

[fpc-pascal] Free Pascal Language Diagram

2018-09-11 Thread Anthony Walter
I posted this link once before, but I thought I'd remind you guys it exists
and ask if anyone would like to take the work from the page, and integrate
it into either the official documentation or maintain it somewhere on the
free  pascal website.

https://www.getlazarus.org/learn/language/lexical/

The diagrams are pretty easy to create and edit. For example proecudre
header is defined through a script tag on the page as follows:

  
Schematic(
  Link('Identifier', '#identifier'),
  Optional(Link('Generic Block', '#generic_block')),
  Optional(Link('Parameters', '#parameters')),
  Keyword(':'),
  Link('Identifier Dot', '#identifier_dot'),
  Keyword(';'),
  Optional(Link('Function Directives', '#function_directives'))
).render();
  


And renders like so:

https://www.getlazarus.org/learn/language/lexical/#function_header

To use just copy this css and script file on the any page you want to
display diagrams:




You can look at the source of the page to see exactly what Schematic()
commands are given to generate each diagram.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Hint converting to int64

2018-09-11 Thread Mark Morgan Lloyd

On 11/09/18 16:15, Santiago A. wrote:
El 11/09/18 a las 12:30, Mark Morgan Lloyd escribió:> On 11/09/18 10:15, 
Santiago A. wrote:>> Hello:FPC: 3.0.4 (Realease from Lazarus 1.8.4 SVN: 
57972)OS: Windows7 >> 32bits / Linux 64Bits>> I have this code and I get 
a hint>> -- var  Entity:Longword;FullParagraph:string; 
pIni:Integer; >> begin  
Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== >> Hint  end; 
--->> Hint: Converting the operands to "Int64" before doing the 
add could >> prevent overflow errors.I can't see why it mentions int64, 
there are >> integer and longword variables, but no Int64 one.>> There 
is you know.>> 
https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1 
 >


--var   Entity:Longword;   FullParagraph:string;   
pIni:Integer;begin      
Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== Hint   end; 
  ---Do you mean that Entity is promoted to int64 in a 32bits 
system?


The operands Entity*10 and 10+ord(FullParagraph[pIni])-48 are both 32 
bits, but the addition could overflow. The compiler writer's trying to 
be nice to you, quit kvetching :-)


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

Re: [fpc-pascal] Hint converting to int64

2018-09-11 Thread Santiago A.

El 11/09/18 a las 12:30, Mark Morgan Lloyd escribió:

On 11/09/18 10:15, Santiago A. wrote:
Hello:FPC: 3.0.4 (Realease from Lazarus 1.8.4 SVN: 57972)OS: Windows7 
32bits / Linux 64Bits

I have this code and I get a hint
-- var  Entity:Longword;FullParagraph:string; pIni:Integer; 
begin  Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== 
Hint  end; ---
Hint: Converting the operands to "Int64" before doing the add could 
prevent overflow errors.I can't see why it mentions int64, there are 
integer and longword variables, but no Int64 one.


There is you know.

https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1 




--
var
  Entity:Longword;
  FullParagraph:string;
  pIni:Integer;
begin
  
  Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== Hint
  
end;
 ---
Do you mean that Entity is promoted to int64 in a 32bits system?


--
Saludos

Santiago A.

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

Re: [fpc-pascal] Hint converting to int64

2018-09-11 Thread Mark Morgan Lloyd

On 11/09/18 10:15, Santiago A. wrote:
Hello:FPC: 3.0.4 (Realease from Lazarus 1.8.4 SVN: 57972)OS: Windows7 
32bits / Linux 64Bits

I have this code and I get a hint
-- var  Entity:Longword;FullParagraph:string; pIni:Integer; 
begin  Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== Hint 
 end; ---
Hint: Converting the operands to "Int64" before doing the add could 
prevent overflow errors.I can't see why it mentions int64, there are 
integer and longword variables, but no Int64 one.


There is you know.

https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1


I have replaced it by
Entity:=Entity*10+LongWord(ord(FullParagraph[pIni]))-48;
That is, I have casted the result of "ord()" to longword. But I get the 
same hint.What should I do to remove the hint?


--
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] Hint converting to int64

2018-09-11 Thread Santiago A.

Hello:
FPC: 3.0.4 (Realease from Lazarus 1.8.4 SVN: 57972)
OS: Windows7 32bits / Linux 64Bits

I have this code and I get a hint

-- var  Entity:Longword;FullParagraph:string; pIni:Integer; 
begin  Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== Hint 
 end; ---


Hint: Converting the operands to "Int64" before doing the add could 
prevent overflow errors.
I can't see why it mentions int64, there are integer and longword 
variables, but no Int64 one.


I have replaced it by

Entity:=Entity*10+LongWord(ord(FullParagraph[pIni]))-48;

That is, I have casted the result of "ord()" to longword. But I get the 
same hint.

What should I do to remove the hint?


--
Saludos

Santiago A.

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