Re: [fpc-pascal] TThread.FreeOnTerminate

2018-12-14 Thread el es
On 14/12/2018 10:08, Michael Van Canneyt wrote:

> And now we have come to the root of the problem:
> 
> Threads are unpredictable, and hence evil in programming :-)
> 

Aye, but the evil is necessary, for example if one has to 
a program that needs to do GUI AND handle background communication/protocol 
tasks...

Even with TTimer to fire up periodically, the one main context can only do 
_one_ thing at a time.

> Michael.

el_es

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

Re: [fpc-pascal] TThread.FreeOnTerminate

2018-12-14 Thread el es
On 13/12/2018 22:23, Michael Van Canneyt wrote:
> 
> 
> On Thu, 13 Dec 2018, Martin Frb wrote:
> 
>> 
>>  Besides, the documentation does not say that FreeOnTerminate
>> is limited to be used in the thread construction. Especially since
>> its effect is not due until "terminate"
> 
> For me this is a given.
> 
> Almost by definition, changing anything in a thread after the
> constructor has returned, is dangerous. You should set up everything
> in the constructor.


Then this TThread.FreeOnTerminate property should not really be public,
if it's only to be used in 'private' context of the constructor?
(or as Martin says, it should be documented as such?)

> 
> You can try to do so later on, but then you're on your own.
> 
> Michael.

el es

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

Re: [fpc-pascal] First pas2js public release

2017-12-21 Thread el es
On 21/12/17 11:53, Ryan Joseph wrote:
> 
> 
>> On Dec 20, 2017, at 9:14 PM, Ingemar Ragnemalm  wrote:
>>
>> Absolutely, and I don't mind sharing the code. It is in the same folder! 
>> Very small and simple program, and all FPC. :)
> 
> Can you post the code? I haven’t actually seen any examples so I have no idea 
> how it works.
> 
> Regards,
>   Ryan Joseph
> 

Code seems to be in http://ragnemalm.se/images/santa/
(there is no 'index' page so it shows files)

-L.

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

Re: [fpc-pascal] FPC attributes / annotations support

2017-12-01 Thread el es
On 01/12/17 13:24, Marcos Douglas B. Santos wrote:
> On Thu, Nov 30, 2017 at 5:35 PM, Graeme Geldenhuys
>  wrote:
>
[...]
>>> If we have a better marketing, maybe more programmers could have more
>>> interest to use the language.
>>

Given ESR's recent (or not so recent, as I only found it today) rant
http://esr.ibiblio.org/?p=7711
there may be unexpected support in unexpected places, as even the old towers of 
C seem to crumble ;)

(lwn.net seems to be attracting a lot of various articles about a lot of 
languages,
 but I haven't seen one about Pascal like, ever...)

>> Yeah, if the FPC Foundation could help with marketing the language and FPC
>> (and Lazarus), that would be a great step in the right direction.
> 

(I am not even a subscriber to lwn so my emails probably go to /dev/null,
 but if the Foundation put up a press release or two there, maybe they'd 
publish that)

> I agree.
> 
> Best regards,
> Marcos Douglas

-l.

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

Re: [fpc-pascal] FPC Debug line numbers

2017-11-07 Thread el es
On 06/11/17 21:49, James Richters wrote:
> I've noticed that line numbers are sometimes off, sometimes quite a
> bit when I receive a run-time error.  I had one today, it specified
> the correct function that was responsible for generating the error,
> however the line number was way off,  it reported line 1463 but the
> entire function in question goes from line 708 to line 785.  There is
> nothing remotely related at line 1463,  it's a completely unrelated
> procedure that could not have possibly been called at the point the
> runtime error was received.The list of procedure/function calls
> was accurate, just not the line number, which makes it very difficult
> to figure out exactly what part of the function had the problem.
> 
> I am using FPC 3.0.4rc1, compiling with the text IDE and I have
> option "Generate also backtrace line information" selected.
> 
> Does anyone know what might cause the line numbers to be incorrect?
> 
> James
> 
> 
I vaguely recall reading something to the sense of:
this could be related to the optimization level used;

I can't remember where I read that; 

-l.

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

Re: [fpc-pascal] Using Serial in a TCP/RS232 gateway, how to set buffer sizes?

2017-09-08 Thread el es
On 08/09/17 09:34, Bo Berglund wrote:

> 6) Then I rebuilt my application, but I have no idea if this actually
> caused any buffer change. I know too little about the inner workings
> of the Lazarus/FPC system...
> 
> So it might still use the tiny 2K buffer???
> 
> 

I would decouple the log display from the serial handling routines -
by delegating the serial task to a thread, only display of log is handled in
the main thread (this is true whether your application is cli-only or gui - 
have the tasks that should not be interrupted, like bulk serial communication, 
handled by a thread, and whatever the thread wants to display, use a buffer 
(like TThreadList) to
communicate to the main thread.

-L.

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

Re: [fpc-pascal] H2pas tool vs others, C header translation

2017-08-30 Thread el es
On 28/08/17 03:12, Paulo Costa wrote:
> On 27-Aug-17 23:47, Dmitry Boyarintsev wrote:
>> Is 2 neither true, nor false? 3? 4?
>>
>> If false is zero,
>> Then true is not false.
>>
>> Also C doesn't have a boolean type per se. Iirc it was introduced in some 
>> version of c++ standard.
>>
>> In C it's very strange to see code like that:
>>
>> If (b==1)
>>
>> It's always
>> If (b)
>> Or
>> If (!b)
> 
> Of course, that is because, in C, any value that is not zero, is true.
> 
> So you can not compare with 1 or -1 or any other value to test if it is 
> true...
> 
> Paulo Costa

Even more 'proliferated' may be usage like

- function returns = 0 on success 

- function returns > 0 for a success-with-a-hint or soft-failure (allowing for 
retry)

- returns negative error code on hard-failure (not-allowing for retry)

-L.

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

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread el es
On 24/08/17 13:26, Sven Barth via fpc-pascal wrote:
[...]
> 
> Note: FPC (and Delphi) has a single fixed point type which is
> Currency. AFAIK it uses four digits after the comma and 28 in front
> of it.
> 
> Regards, Sven
> 

There was a project I remember, that I was told, for some e.g. tax purposes,
4 digits after the decimal point are not enough to round them properly...
That is because, the calculation of e.g. VAT has to work out both ways 
(total=net+VAT and
has to work out in every way, including when a bigger package is split into 
smaller units)
and 4 decimal digits are not always enough to ensure this (and the program had 
to work
internationally with all the different tax rules too) for arbitrarily large 
quantities, prices and tax bands.

I don't remember the exact details (it long time ago and couple of workplaces 
ago), of what they did,
but the team developing it (in D7) was pretty stressed... 

-l.

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

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-17 Thread el es
On 16/08/17 15:45, Benito van der Zander wrote:
> Hi,

[sorry I could not stop myself from reordering your top-post]

> Am 16.08.2017 um 15:48 schrieb Gabor Boros:
>> 2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta:
>>> Because the quotes must be the first and last character of each
>>> string (or "cell").
>>> 
>>> As noted in another reply, set the quote character to something
>>> unused, and it will disable (or circumvent) quoting altogether.
>> 
>> SL2.QuoteChar:=#0; solved my problem. But strange if the
>> TStringList think from a starting " the string is quoted. For
>> example if data.cvs contains "abc|89|0 I got the next result with
>> my example program (without QuoteChar trick): 0 * abc|89|0
>> 
>> Gabor ___
> 
> very stupid defaults indeed.
> 
> I just had a bug last week, because I was using TStringList as map
> and forgot to change it to case-sensitive
> 

Because the default format of QuotedText is actually 'csv',
which goes like "field 1 = value 1","value 2","field 3" 
and StringList was created to deal with that  (I think).
You can bend QuotedText to do amazing things but the quote detector
is set for the default "" here.

> 
> 
> Cheers, Benito
> 
> 
> 
el es

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