Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Michael Van Canneyt



On Sat, 30 Jun 2018, Jim Lee wrote:




On 06/30/18 19:42, Ryan Joseph wrote:


Is that part of the RTL and if so what’s the unit name? I had a hard time 

finding good resources on classes the RTL provides.




That has been my experience as well.  Is there a definitive source of 
documentation for both Free Pascal and Lazarus?  Anyone? Please don't 
say the wiki.  And "read the source" is not useful when one doesn't even 
know where to look, given the lack of documentation on what's available 
and how it's laid out.  I have been forced to use my old Delphi 
reference manuals, and that is less than ideal.  At some point I'd even 
like to contribute to the documentation, but right now it's a Catch-22 
that has me seriously considering giving up on these tools (and that 
from 40+ years of programming veteran!)...


Can you explain what you think is wrong with or missing in the official 
documentation ?
(apart from a search mechanism)

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

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-01 Thread C Western

On 29/06/18 21:55, Sven Barth via fpc-pascal wrote:

Am 29.06.2018 um 18:45 schrieb Alan Krause:
I stumbled upon something the other day that was causing numerical 
differences between compiled Delphi and FPC code. Executing the 
following sample console application illustrates the issue clearly:


program test;

uses
  math, SysUtils;

var
  arg1 : double;
  arg2 : double;
  res  : double;
begin
  arg1 := 10.00;
  arg2 := 72500.51;
  writeln( 'arg1 = ' + FormatFloat( '0.', arg1 ) );
  writeln( 'arg2 = ' + FormatFloat( '0.', arg2 ) );

  res := arg1 - arg2;
  writeln( 'arg1 - arg2 = ' + FormatFloat( '0.', res ) );
  writeln( 'Max( arg1 - arg2, 0 ) = ' + FormatFloat( '0.', 
Max( res, 0 ) ) );
  writeln( 'Max( arg1 - arg2, 0.0 ) = ' + FormatFloat( '0.', 
Max( res, 0.0 ) ) );

end.

--- begin output (Linux x86_64) ---

arg1 = 10.
arg2 = 72500.5100
arg1 - arg2 = 27499.4900
*Max( res, 0 ) = 27499.49023438*
Max( res, 0.0 ) = 27499.4900

--- end output ---

I am guessing that the integer value of zero is causing the wrong 
overloaded function to be called? I was able to solve the problem in 
my code by replacing the 0 with 0.0.


The compiler converts the 0 to the type with the lowest precision that 
can hold the value (or the largest if none can hold it exactly). For 0 
this is already satisfied by Single, so the compiler essentially has the 
parameter types Double and Single. For some reason (I don't know whether 
it's due to a bug or by design) it picks the Single overload instead of 
the Double one.
Someone who knows more about the compiler's overload handling would need 
to answer why it favors (Single, Single) over (Double, Double) for 
(Double, Single) parameters (or (Single, Double), the order doesn't 
matter here).


Regards,
Sven



More confusingly, if a single variable is used, the expected Max(Double, 
Double) is called:


function Max(a, b: Double): Double; overload;
begin
  WriteLn('Double');
  if a > b then Result := a else Result := b;
end;

function Max(a, b: Single): Single; overload;
begin
  WriteLn('Single');
  if a > b then Result := a else Result := b;
end;

var
  v1: Double;
  v2: Single;
begin
  v1 := Pi;
  v2 := 0;
  WriteLn(v1);
  WriteLn(Max(v1,0));
  WriteLn(Max(v1,0.0));
  WriteLn(Max(v1,v2));
end.

Prints:
 3.1415926535897931E+000
Single
 3.141592741E+00
Double
 3.1415926535897931E+000
Double
 3.1415926535897931E+000

If this is not a bug, it would be very helpful if the compiler could 
print a warning whenever a value is implicitly converted from double to 
single.


Colin


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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
> Can you explain what you think is wrong with or missing in the official 
> documentation ?
> (apart from a search mechanism)

(the CHM form of the documentation has fulltext search, indexes etc. On
Windows you can just click them to open.

It also works from Lazarus, but you can also try a 3rd party CHM viewer like
kchmviewer, though in my opinion the quality of those varies)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Michael Van Canneyt



On Sun, 1 Jul 2018, Marco van de Voort wrote:


In our previous episode, Michael Van Canneyt said:

Can you explain what you think is wrong with or missing in the official 
documentation ?
(apart from a search mechanism)


(the CHM form of the documentation has fulltext search, indexes etc. On
Windows you can just click them to open.


I know. we have fpIndexer to make such an index. I just need to find time to
integrate building the index into the deployment process and add a link in
the header.

The length of my todo list can no longer be expressed in an Int64.
Maybe we need to add Int128 to the compiler...

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

Re: [fpc-pascal] Daemon using TTimer on Windows

2018-07-01 Thread Marcos Douglas B. Santos
On Sat, Jun 30, 2018 at 9:13 PM, R0b0t1  wrote:
> On Sat, Jun 30, 2018 at 3:57 PM, Marcos Douglas B. Santos
>  wrote:
>> Hi,
>>
>> I need to build a daemon app on Windows. It will need a timer to
>> performe some tasks. This timer could be big among 15 min, 30 min, 2
>> hours, etc.
>>
>> I thought that I can use TTimer but I've always heard that it's not
>> possible because some problems related with "NoGUI" stuff.
>>
>> I've found a thread[1] which talks about that but they haven't
>> provided a real solution, at least for Windows.
>>
>> My question is: Nowadays, can I use TTimer with no restrictions in a
>> daemon application on Windows? If not, which could be a possible
>> solution?
>>
>
> If all your service does is wait for the timer you should instead use
> a scheduled task.

Actually, it could be a better idea. I will check the requirements and
think if this would be possible.

> Anyway - does TTimer use the WM_TIMER message? That is the type tied
> to the GUI. Even if you need to use WM_TIMER for some reason you can,
> as services should be run in "session 0" and should have access to a
> GUI. The latter is, I think, a compatibility option you can enable.

I didn't understand this "session 0"... is it a something related to
Lazarus or Windows?

> If you are not opposed to OS-level primitives you should use waitable
> timers 
> (https://docs.microsoft.com/en-us/windows/desktop/sync/using-waitable-timer-objects).
> Using waitable timers you can also wake the computer from sleep.

I'm not opposed at all. Indeed I didn't know these functions... sounds
a good option. Thanks.

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

Re: [fpc-pascal] Daemon using TTimer on Windows

2018-07-01 Thread Marcos Douglas B. Santos
On Sun, Jul 1, 2018 at 2:15 AM, Martin Schreiber  wrote:
> On Saturday 30 June 2018 22:57:47 Marcos Douglas B. Santos wrote:
>
>>If not, which could be a possible
>> solution?
>>
> You could use a MSEgui application, instead of
> "
> uses
>  msegui;
> "
> write
> "
> uses
>  msenogui;
> "
> in "program" source file. It will have an event queue and the usual event
> driven programming paradigm including the use of datamodules and graphically
> placed non visual components. Examples are here:
>
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/attic/msedocumenting/mse/trunk/help/tutorials/nogui

Hey Martin, thanks to give me another good option. I'll check it.

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

Re: [fpc-pascal] Daemon using TTimer on Windows

2018-07-01 Thread R0b0t1
On Sun, Jul 1, 2018 at 8:06 AM, Marcos Douglas B. Santos  
wrote:
> On Sat, Jun 30, 2018 at 9:13 PM, R0b0t1  wrote:
>> Anyway - does TTimer use the WM_TIMER message? That is the type tied
>> to the GUI. Even if you need to use WM_TIMER for some reason you can,
>> as services should be run in "session 0" and should have access to a
>> GUI. The latter is, I think, a compatibility option you can enable.
>
> I didn't understand this "session 0"... is it a something related to
> Lazarus or Windows?
>

It is something related to Windows, and the reason services can not use the GUI.

A session is started for each terminal services instance. A session
contains multiple window stations, each of which contains at least one
desktop, one of which accepts keyboard/mouse input. One terminal
services instance exists by default, and it is the "local session,"
i.e. the one that consumes physical keyboard and mouse input and
outputs to the screen. It used to be that this local session was the
one that ran services in addition to logged in user programs.

This made it easier than it should have been to exploit service
processes, so they made session 0 noninteractive and now the console
logs in to session 1.

One exploit was particularly bad. You can forcibly register WM_TIMER
callbacks for an application and have that callback run in that
processes' thread. As long as services were running in the same
desktop you could trivially run code as SYSTEM.

More information at
https://blogs.technet.microsoft.com/askperf/2007/04/27/application-compatibility-session-0-isolation/
but it is not a lot. There is a better MSDN article I could not find.

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Ryan Joseph


> On Jul 1, 2018, at 6:19 AM, Marco van de Voort  wrote:
> 
> (the CHM form of the documentation has fulltext search, indexes etc. On
> Windows you can just click them to open.

The CHM reader can be searched so why doesn’t search work for the web 
interface? I would think there would be a standard script for displaying that 
format online.

Also the RTL is missing collections.generics. Is that because it’s a new 
addition?

Regards,
Ryan Joseph

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
> > (the CHM form of the documentation has fulltext search, indexes etc. On
> > Windows you can just click them to open.
> 
> I know. we have fpIndexer to make such an index.

The CHM packages has its own (afaik with phrase compression)

> I just need to find time to integrate building the index into the
> deployment process and add a link in the header.
> 
> The length of my todo list can no longer be expressed in an Int64.
> Maybe we need to add Int128 to the compiler...

True. I actually have a local webserver based helpsystem that loads the CHMs
on my todo. Even to just be able to easier check working on non Windows
systems. gnochm and kchmviewer are more often broken than not for non
trivial files.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Jim Lee



On 07/01/18 01:03, Michael Van Canneyt wrote:


Can you explain what you think is wrong with or missing in the 
official documentation ?

(apart from a search mechanism)

Michael.

Well, search is a big one, but there seems to be a lot of missing pieces 
(again, without search it's hard to tell exactly how much is missing).  
There also seems to be a lot of outdated stuff, and most of what I find 
was auto-generated from fpdoc (when? last week or 10 years ago?  no 
timestamps!), with scant (or no) explanation beyond "here is a terse, 
un-commented example".


I haven't found any sort of map or tree that shows how the rtl and fcl 
are organized, or an index that shows which types/functions/classes are 
in which units (that's hugely important).  Basically, I expected to find 
the equivalent of the old Borland programmer's reference manuals.


The most common scenario for me is this: "I wonder if fpc (or Lazarus) 
already has ".  Go to the wiki and browse 
haphazardly, looking for something named similarly.  If that something 
is found, and looks promising, follow link to a half-page of 
"documentation" which is basically just a snippet of the interface 
section in the source.  Then, try to find the referenced module in my 
local source tree and discover that it's not quite the same, or is not 
what I was looking for in the first place.  Rinse and repeat.


I would love to be able to use fpc, as it's pretty much the only game in 
town when it comes to a cross-platform Pascal able to be used for 
low-level, even bare metal programming.  I also realize that 
documentation is often low on the list of priorities - but good 
documentation is vital to build a user base, and bad documentation is 
what drives people away.


-Jim

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread wkitty42

On 07/01/2018 02:38 PM, Jim Lee wrote:

The most common scenario for me is this: "I wonder if fpc (or Lazarus)
already has ".  Go to the wiki and browse haphazardly,
looking for [...]


that may be part of your problem... you're looking in a wiki instead of a more 
proper place... all the FPC docs i read on the web are almost exactly like the 
help files you can use locally with a CHM viewer or similar... what you are 
looking for are these...


https://www.freepascal.org/docs-html/rtl/index.html
https://www.freepascal.org/docs-html/fcl/index.html

and actually, you would start here at the beginning...

https://www.freepascal.org/docs.var


it is rather interesting that the above docs.var doesn't appear to be mentioned 
in the wiki's page for Lazarus_Documentation... all the links in the 
#Free_Pascal_Compiler_Documentation section of that page point to lazarus-ccr 
instead of the above docs.var location...


i don't know which is right but i do know you're not looking in the right place 
or your google-fu is lacking a bit... i started this reply with a search for 
"freepascal runtime library" and the second hit was the docs-html one above... ;)



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list unless*
   *a signed and pre-paid contract is in effect with us.*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Jim Lee



On 07/01/18 12:07, wkitt...@windstream.net wrote:

On 07/01/2018 02:38 PM, Jim Lee wrote:

The most common scenario for me is this: "I wonder if fpc (or Lazarus)
already has ".  Go to the wiki and browse 
haphazardly,

looking for [...]


that may be part of your problem... you're looking in a wiki instead 
of a more proper place... all the FPC docs i read on the web are 
almost exactly like the help files you can use locally with a CHM 
viewer or similar... what you are looking for are these...


https://www.freepascal.org/docs-html/rtl/index.html
https://www.freepascal.org/docs-html/fcl/index.html

and actually, you would start here at the beginning...

https://www.freepascal.org/docs.var


it is rather interesting that the above docs.var doesn't appear to be 
mentioned in the wiki's page for Lazarus_Documentation... all the 
links in the #Free_Pascal_Compiler_Documentation section of that page 
point to lazarus-ccr instead of the above docs.var location...


i don't know which is right but i do know you're not looking in the 
right place or your google-fu is lacking a bit... i started this reply 
with a search for "freepascal runtime library" and the second hit was 
the docs-html one above... ;)



That is exactly the documentation I'm talking about.  I've seen all of 
them.  I got to them via the wiki, so I suppose I should have said "The 
wiki, and documentation linked to from there".


-Jim

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread wkitty42

On 07/01/2018 03:13 PM, Jim Lee wrote:
That is exactly the documentation I'm talking about.  I've seen all of them.  I 
got to them via the wiki, so I suppose I should have said "The wiki, and 
documentation linked to from there".



oh!! ok, well... i think the docs.var one i pointed out above is the better 
one... i don't know why but i do... it is where i always go... it also has dates 
at the very bottom of when it was generated... the rtl one i linked to was 
generated in 2017...


bookmark that docs.var link ;)


--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list unless*
   *a signed and pre-paid contract is in effect with us.*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Michael Van Canneyt



On Sun, 1 Jul 2018, Jim Lee wrote:




On 07/01/18 01:03, Michael Van Canneyt wrote:


Can you explain what you think is wrong with or missing in the 
official documentation ?

(apart from a search mechanism)

Michael.

Well, search is a big one, but there seems to be a lot of missing pieces 
(again, without search it's hard to tell exactly how much is missing).  
There also seems to be a lot of outdated stuff, and most of what I find 
was auto-generated from fpdoc (when? last week or 10 years ago?  no 
timestamps!), with scant (or no) explanation beyond "here is a terse, 
un-commented example".


The documentation is brought up to date at every release: all new
identifiers are documented and the documentation regenerated.
If you look in the bugtracker, you will see that I regularly fix
documentation issues.

If you think it is too terse in places, please report them in the
bugtracker. I will always fix all such reports.



I haven't found any sort of map or tree that shows how the rtl and fcl 
are organized, or an index that shows which types/functions/classes are 
in which units (that's hugely important).  Basically, I expected to find 
the equivalent of the old Borland programmer's reference manuals.


It is all there, user's guide, language reference, programmer's guide,
Reference to *all* rtl units. What do you think is missing ?

See https://www.freepascal.org/docs.var

index:
RTL: https://www.freepascal.org/docs-html/current/rtl/index-8.html
FCL: https://www.freepascal.org/docs-html/current/fcl/index-8.html




The most common scenario for me is this: "I wonder if fpc (or Lazarus) 
already has ".  Go to the wiki and browse 
haphazardly, looking for something named similarly.  If that something 
is found, and looks promising, follow link to a half-page of 
"documentation" which is basically just a snippet of the interface 
section in the source.  Then, try to find the referenced module in my 
local source tree and discover that it's not quite the same, or is not 
what I was looking for in the first place.  Rinse and repeat.


I don't know what documentation you are referring to, but as said, all basic
RTL units, and selected FCL units  are documented:
https://www.freepascal.org/docs.var

Packages are another story. I checked the packages. There are roughly 16.000 
classes.
I didn't count methods/functions, but they surely are a multiple of that.
There is 1 documenter: me.

I have toyed with the idea to run fpDoc on all packages, and put the result
online, so people can at least have a look in the index to see what's
available.,

Feel free to chip in.

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Jim Lee



On 07/01/18 12:28, Michael Van Canneyt wrote:


The documentation is brought up to date at every release: all new
identifiers are documented and the documentation regenerated.
If you look in the bugtracker, you will see that I regularly fix
documentation issues.



Thanks.  The user's guide, programmer's guide, and language reference 
manual all say they are for version 3.0.2.  Perhaps the current version 
didn't require any documentation changes?



If you think it is too terse in places, please report them in the
bugtracker. I will always fix all such reports.




That really wasn't my point.  From the point of view of someone just 
coming to fpc,  the documentation is the "face" of the product.  If that 
face is ugly or hard to navigate, they are likely to just walk away.   
Getting involved in the bugtracker is for people already invested in 
fpc, and familiar enough with it to not *need* the documentation.



It is all there, user's guide, language reference, programmer's guide,
Reference to *all* rtl units. What do you think is missing ?

See https://www.freepascal.org/docs.var



Perhaps the rtl is more complete than the rest - I'll take your word for 
it.  I know it's a tremendous amount of work!


The class library chart on that page is nice, but it's 11 years old 
(dated 2007).



index:
RTL: https://www.freepascal.org/docs-html/current/rtl/index-8.html
FCL: https://www.freepascal.org/docs-html/current/fcl/index-8.html



An auto-generated index of all identifiers used across all modules is 
useful, if you know what you're looking for.  Say I was looking for 
something like a Timer class - where do I start?  Would it be in the 
rtl, the fcl, or somewhere else?  Would it be named Timer, TTimer, or 
something else?  I can't find an index that has an entry for "timer" and 
points to all the timer-related things.


Packages are another story. I checked the packages. There are roughly 
16.000 classes.

I didn't count methods/functions, but they surely are a multiple of that.
There is 1 documenter: me.



Pardon my ignorance, but I take it that "packages" is more like an 
un-curated repository of contributions rather than an official part of 
the fpc distribution?  If so, I wasn't aware of that.  It would explain 
a big part of my frustration.


-Jim

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Ryan Joseph


> On Jul 1, 2018, at 1:28 PM, Michael Van Canneyt  
> wrote:
> 
> RTL: https://www.freepascal.org/docs-html/current/rtl/index-8.html

Without a good search feature these are really hard to use. Searching should be 
the first priority. Can’t we just make a little script to put on the server 
which searches the original indexed format which the HTML is derived from? It 
would be so easy to make something that’s cheap but at least works.


Regards,
Ryan Joseph

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

[fpc-pascal] List of chars for case

2018-07-01 Thread Ryan Joseph
Is there a way to make a constant for a list of chars which I can use in a case 
statement? I’ve got a bunch of code duplication happening I’d like to clean up.

const
  TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’);


case c of
  TChars:
...


Regards,
Ryan Joseph

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

Re: [fpc-pascal] List of chars for case

2018-07-01 Thread R0b0t1
On Sun, Jul 1, 2018 at 5:51 PM, Ryan Joseph  wrote:
> Is there a way to make a constant for a list of chars which I can use in a 
> case statement? I’ve got a bunch of code duplication happening I’d like to 
> clean up.
>
> const
>   TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’);
>
>
> case c of
>   TChars:
> ...
>

I suspect you may need to use sets and the "in" operator.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Michael Van Canneyt



On Sun, 1 Jul 2018, Ryan Joseph wrote:





On Jul 1, 2018, at 1:28 PM, Michael Van Canneyt  wrote:

RTL: https://www.freepascal.org/docs-html/current/rtl/index-8.html


Without a good search feature these are really hard to use.  Searching
should be the first priority.  Can’t we just make a little script to put
on the server which searches the original indexed format which the HTML is
derived from?  It would be so easy to make something that’s cheap but at
least works.


And to what page would this script then point when you find something ? 
If it was easy, it would have been done already.


But, here's your shot at contributing :)

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

Re: [fpc-pascal] TFPGObjectList error

2018-07-01 Thread Michael Van Canneyt



On Sun, 1 Jul 2018, Jim Lee wrote:




On 07/01/18 12:28, Michael Van Canneyt wrote:


The documentation is brought up to date at every release: all new
identifiers are documented and the documentation regenerated.
If you look in the bugtracker, you will see that I regularly fix
documentation issues.



Thanks.  The user's guide, programmer's guide, and language reference 
manual all say they are for version 3.0.2.  Perhaps the current version 
didn't require any documentation changes?


Seems I forgot to update the symlink when we released. I fixed that. Thanks
for pointing it out.




If you think it is too terse in places, please report them in the
bugtracker. I will always fix all such reports.




That really wasn't my point.  From the point of view of someone just 
coming to fpc,  the documentation is the "face" of the product.  If that 
face is ugly or hard to navigate, they are likely to just walk away.   
Getting involved in the bugtracker is for people already invested in 
fpc, and familiar enough with it to not *need* the documentation.


I consider this an error in your reasoning. 
The bugtracker is very lowlevel, and should be usable and familiar for all. 
Many of the documentation bugreports are from one-time users, people I never

have heard from.


It is all there, user's guide, language reference, programmer's guide,
Reference to *all* rtl units. What do you think is missing ?

See https://www.freepascal.org/docs.var



Perhaps the rtl is more complete than the rest - I'll take your word for 
it.  I know it's a tremendous amount of work!


The class library chart on that page is nice, but it's 11 years old 
(dated 2007).


This is known. I better remove it, it does more damage than good now.




index:
RTL: https://www.freepascal.org/docs-html/current/rtl/index-8.html
FCL: https://www.freepascal.org/docs-html/current/fcl/index-8.html



An auto-generated index of all identifiers used across all modules is 
useful, if you know what you're looking for.  Say I was looking for 
something like a Timer class - where do I start?  Would it be in the 
rtl, the fcl, or somewhere else?  Would it be named Timer, TTimer, or 
something else?  I can't find an index that has an entry for "timer" and 
points to all the timer-related things.


In the absence of a search mechanism:

You would get a long way if go to the FCL page, press ctrl-f and type timer
in the search box of your browser..
The 4th hit on the page gives you fptimer, the unit that contains a
timer.

But most of the time when I search for something, I just enter google, type
"free pascal timer". The third hit is the same as the one I mention above.
You can't beat google for ease of use and accuracy.

Packages are another story. I checked the packages. There are roughly 
16.000 classes.

I didn't count methods/functions, but they surely are a multiple of that.
There is 1 documenter: me.



Pardon my ignorance, but I take it that "packages" is more like an 
un-curated repository of contributions rather than an official part of 
the fpc distribution?  If so, I wasn't aware of that.  It would explain 
a big part of my frustration.


FPC's "packages" are not uncurated. They are mostly import units, allowing you 
to
work with all kinds of open source libraries. On top of these e.g. the data 
acces
units are built.

But I know that search is an issue, hence my question "what is the problem
with the documentation _besides_ search".

Contrary to what it may seem it is not so easy to make a search engine for
the documentation. I've had several shots at it, but have not yet come up
with a good mechanism. The last mechanism I tried ended up indexing more
than 24 hours before I killed it.

Contributions or ideas welcome.

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

Re: [fpc-pascal] List of chars for case

2018-07-01 Thread Dennis



Ryan Joseph wrote:

Is there a way to make a constant for a list of chars which I can use in a case 
statement? I’ve got a bunch of code duplication happening I’d like to clean up.

const
   TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’);


case c of
   TChars:
 ...


Regards,
Ryan Joseph



  case c of
 '[', ']', '(', ')', '{', '}', '=', ':' : result := true;
  end;



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