Re: [fpc-pascal] Directory Tree

2021-04-18 Thread Jean SUZINEAU via fpc-pascal
Le 18/04/2021 à 16:10, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree I getuFileVirtualTree.pas(533,9) Error: identifier idents no member "DefaultEncoding" It seems, using svn blame, that DefaultEncoding has been added in FreePascal source trunk on the svn server on

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
Indeed, I think it's difficult (if possible) to change the behaviour of the multiselection this way. The TTreeview.MultiSelectStyle property allows you to change from CtrL+Click to Shift+Click. https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tmultiselectstyle.html To make the multi

Re: [fpc-pascal] Directory Tree

2021-04-08 Thread Jean SUZINEAU via fpc-pascal
If you just select files, as Bart stated in another message, I think TShellTreeView will be more adequate and easier than TTreeView (actually TShellTreeView is a file tree specific descendent TTreeView). In TTreeView (and TShellTreeView) you can enable multiselection by adding

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
TStringList works pretty much like an inifile section. The index corresponds to the line number in you text block. The Names property corresponds to the part of the line before the '=' char. The ValueFromIndex property corresponds to the part of the line after the '=' char. So if you line i

Re: [fpc-pascal] Directory Tree

2021-04-11 Thread Jean SUZINEAU via fpc-pascal
I have updated the VirtualTreeView example with sub-totals of time. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Directory Tree

2021-04-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/04/2021 à 23:17, James Richters via fpc-pascal a écrit : For some reason the ODT file wants to know if I want to translate it from French, and while the font is “Courier New” for anything I would type into the document, the font of the text itself is “Liberation Serif” If I change the

Re: [fpc-pascal] Directory Tree

2021-04-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/04/2021 à 22:17, James Richters via fpc-pascal a écrit : RE: [fpc-pascal] Directory Tree My system could not find DejaVuSans, You can find it in C:\lazarus\fpc\3.2.0\source\packages\fcl-report\demos\fonts. May be you don't need to install the font, just add on the line below where

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-30 Thread Jean SUZINEAU via fpc-pascal
May be something like "Snap!" ? https://snap.berkeley.edu/snap/snap.html#present:Username=trev1315=plane%202 https://snap.berkeley.edu/project?user=trev1315=plane%202 On my own, I think starting with Lazarus and GUI apps would be far easier. If you create a new app from a template, you can

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-30 Thread Jean SUZINEAU via fpc-pascal
I've forgotten to add the link to "Snap!" manual: https://snap.berkeley.edu/snap/help/SnapManual.pdf ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Explicit Interface implementation and inheritance

2021-08-15 Thread Jean SUZINEAU via fpc-pascal
Ooops, may be I hit reply too fast. It looks like when you write " TObjB = class(TObjA, IBBB)" you just implement IAAA twice. If you comment out IBBB   TImpB = class(TImpA{, IBBB})   public     procedure CallOfB;     //procedure IBBB.MethodB = CallOfB;   end; then the "No matching

Re: [fpc-pascal] Explicit Interface implementation and inheritance

2021-08-14 Thread Jean SUZINEAU via fpc-pascal
Le 15/08/2021 à 00:43, Dmitry Boyarintsev via fpc-pascal a écrit : Why is interface implementation not inherited, if explicit implementation is used. I guess this is because you can implement an interface through delegation too: https://www.freepascal.org/docs-html/ref/refse48.html type   

Re: [fpc-pascal] Conversion from C to Pascal - Left bit shift

2021-09-03 Thread Jean SUZINEAU via fpc-pascal
I made a few tests on Ubuntu 64 bits (arch x86_64) with variations on a small test program: var    E2: Byte= 3;    E1: LongWord= 1;    E: QWord; begin E:= (1000*E1) shl E2; writeln( 'E2', E2); writeln( 'E1', E1); writeln( 'E', E); end. In the assembly window, shl is computed

Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?

2021-10-05 Thread Jean SUZINEAU via fpc-pascal
I don't know if it's related, but I experienced a similar problem a few years ago. It's a console dll written in Freepascal and compiled for Win64 and Linux (Ubuntu). It uses several threads and uses CheckSynchronize to make calls in the main thread. The dll is loaded and used by a 4gl

Re: [fpc-pascal] FPC and WebAssembly

2021-12-24 Thread Jean SUZINEAU via fpc-pascal
Wonderful ! Thank you very much for all your work and all the work of the FPC / Lazarus team ! And Merry Christmas for all ! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] BoolToStr

2022-08-29 Thread Jean SUZINEAU via fpc-pascal
Le 29/08/2022 à 01:41, James Richters via fpc-pascal a écrit : If a special function is needed for some COM thing or weird Winapi thing, then that function should be part of the unit that needs it, not modifying the generic function intended to be used for general purpose applications output

Re: [fpc-pascal] I am offering a $100 reward for linking static libraries

2022-09-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/09/2022 à 07:50, Michael Van Canneyt via fpc-pascal a écrit : The file seems corrupt. I tried several programs, none managed to open it. Indeed more than corrupt. For me, file is just empty (size 0 byte) ___ fpc-pascal maillist -

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/10/2022 à 23:37, Bo Berglund via fpc-pascal a écrit : If I could get at each output that mosquitto_cli writes into a script or such then I would be good to go. Maybe with a redirection ( > ) to a file in bash ? ___ fpc-pascal maillist -

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Jean SUZINEAU via fpc-pascal
I couldn't verify the code but it should be  relatively close to your  c++ example. Not sure of the width of int type, I supposed it's 16 bits wide: function CRC16( crc: Word; buf: PByte; len: Word; Poly:Word=$A001): Word; var    pos: Word;    i: Word; begin for pos:= 0 to len-1 do   

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-24 Thread Jean SUZINEAU via fpc-pascal
Le 23/10/2022 à 23:59, Bo Berglund via fpc-pascal a écrit : Might get stuck at readln(s) if no messages are sent, i.e. no carriage-return coming along? AFAIK readln is blocking, right? I've made a test with mosquitto_pub, it seems there is a line ending at the end of each message, so you will

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-24 Thread Jean SUZINEAU via fpc-pascal
If your main program is a console program, it's likely that you'll need to call CheckSynchronize( from unit Class) in your main program/main thread from time to time in order to allow the execution of calls of methods specified in Synchronize in your thread (which reads mqtt messages). I'm

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-23 Thread Jean SUZINEAU via fpc-pascal
May be with a pipe |  ? Something like mosquitto_sub -h 192.168.117.131 -F '@Y-@m-@d @H:@M:@S ; %t ; %p' -t '#' | SomePascalProgram This way you'll receive the output of mosquitto_sub on the standard input of SomePascalProgram. I've tested locally on an Apache log with    tail -f

Re: [fpc-pascal] MQTT package for freepascal/lazarus?

2022-10-23 Thread Jean SUZINEAU via fpc-pascal
Le 23/10/2022 à 22:50, Jean SUZINEAU via fpc-pascal a écrit : This way you'll receive the output of mosquitto_sub on the standard input of SomePascalProgram. A very small example for SomePascalProgram for  use with pipe, reading on standard input and writing on standard output : var    s

Re: [fpc-pascal] mciSendString with long file names

2022-09-20 Thread Jean SUZINEAU via fpc-pascal
May be by escaping the spaces with ^ ? Something like:  MyFileName:= StringReplace(MyFileName, ' ', '^ ', [rfReplaceAll]); ^ is the escape char for cmd.exe but may be it is active in this context too ? Le 20/09/2022 à 18:31, James Richters via fpc-pascal a écrit : I just tried it that

Re: [fpc-pascal] Get highest element of a StringList

2022-09-12 Thread Jean SUZINEAU via fpc-pascal
As Bart suggested, you can use too the for/in loop:  for s in sl do WriteLn( s); For example: var    sl: TStringList;    s: String; begin sl:= TStringList.Create; try     sl.Add('1');     sl.Add('2');     for s in sl do WriteLn( s); finally     FreeAndNil(

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
May the solution to your problem should be just :  TDataExample  =   record     case integer     of   0: (mData: Int64);   1: (mByte: packed array[0..7] of Byte);   2: (UnionField: Int64);   end; ? You aren't going to define a getter or setter method on your property, just an

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
For this particular error I think you should just follow the advice of compiler in the error message : Le 14/08/2022 à 11:49, Skybuck Flying via fpc-pascal a écrit : // normal/standard property property StandardField : integer read mStandardField write mStandardField;

Re: [fpc-pascal] Union field after property violates "field before property" rule + property of union field not possible.

2022-08-15 Thread Jean SUZINEAU via fpc-pascal
An if you eventually need a read only UnionField :  TmByte= packed array[0..7] of Byte;  TDataExample2  =   record     internal     : record    case integer    of 0: (mData: Int64); 1: (mByte: TmByte); end;    property mByte : TmByte read internal.mByte;   

Re: [fpc-pascal] Why does RunCommand not produce the correct output?

2023-05-01 Thread Jean SUZINEAU via fpc-pascal
Le 01/05/2023 à 17:00, Bo Berglund via fpc-pascal a écrit : I have created a shellscript with the same command string May be running directly your script in bash: RunCommand('/bin/bash', ['your_script.sh' ], OutData) ___ fpc-pascal maillist -

Re: [fpc-pascal] Why does RunCommand not produce the correct output?

2023-05-01 Thread Jean SUZINEAU via fpc-pascal
I don't have an example at hand but I think you should run a bash interpreter, something like : RunCommand('/bin/bash', ['-c', ListCmd], OutData) but I'm not 100% sure. There is a good documentation at: https://wiki.freepascal.org/Executing_External_Programs May be you need to split your

Re: [fpc-pascal] Pause Key

2023-04-14 Thread Jean SUZINEAU via fpc-pascal
... I wouldn't be surprised that James's program is a console one, not using TForm nor any windows message loop to process WM_ messages, but I may be wrong. It can be more tricky in this case. ___ fpc-pascal maillist -

Re: [fpc-pascal] FPC/Lazarus on RPi4 - How to read/write I2C connected EEPROM?

2023-04-05 Thread Jean SUZINEAU via fpc-pascal
May be you could get the source code of i2ctransfer from i2c-tools and compare it with the code in i2c.pas ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-13 Thread Jean SUZINEAU via fpc-pascal
Le 12/06/2023 à 19:05, Steve Litt via fpc-pascal a écrit : Busted! I used Pascal 1984-1993 So I guess you are not familiar too with the "Result" variable which appeared with Delphi 1 in 1995 if I remember correctly. nextt:= num; can be written to as : Result:= num;

Re: [fpc-pascal] Function to create a record ?

2023-06-05 Thread Jean SUZINEAU via fpc-pascal
Hello, I have a hard time trying to understand what you want to test. In your functions, you are using a record, not a class or a pointer to record or an object. The personrecord just behave in your parameters and return value as an Integer or a String, and your fillchar doesn't write

Re: [fpc-pascal] Function to create a record ?

2023-06-05 Thread Jean SUZINEAU via fpc-pascal
Oops, I hit "Send message" too quickly. The only difference in the second code is: - personrecord renamed to personclass and declared as "personclass = class" - "newp:= personclass.Create;" added in function newperson Of course for a clean code, you'll need to call something like

Re: [fpc-pascal] fpc isn't optimised for tail recursion, is it?

2023-06-12 Thread Jean SUZINEAU via fpc-pascal
According to you other posts, I won't be surprised that you think in a C/C++ way. This doesn't change anything in your last example, but particularly  : nextt := num; doesn't behave like in C : return num; In pascal I think the equivalent would be : nextt := num; exit;

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Jean SUZINEAU via fpc-pascal
Le 17/06/2023 à 20:07, Travis Siegel via fpc-pascal a écrit : Is this a relatively new addition to fpc or something? I 've just found it in my Delphi 7 code (and code very likely written for Delphi 4), so I think it's there since at least 2000-2001 ... May be it appeared with Delphi 1 ?

Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Jean SUZINEAU via fpc-pascal
It sounds like "SpVoice := CreateOleObject('SAPI.SpVoice');" is failing and then SpVoice is nil ? May be try with an OleVariant instead of a simple Variant ? (i.e declare var SpVoice: OleVariant; ) ___ fpc-pascal maillist -

Re: [fpc-pascal] Floating point question

2024-02-06 Thread Jean SUZINEAU via fpc-pascal
I've just made a small test with the old Borland Delphi 7.0 build 4453 from 2002 : ... type TForm1 = class(TForm) m: TMemo; procedure FormCreate(Sender: TObject); end; ... procedure TForm1.FormCreate(Sender: TObject); var    GG: Extended;    S: String; begin GG :=

Re: [fpc-pascal] Floating point question

2024-02-09 Thread Jean SUZINEAU via fpc-pascal
Le 09/02/2024 à 20:53, Jonas Maebe via fpc-pascal a écrit : However, adding support for an option called -CFMax or similar should be no problem. It would be very nice to compile old code ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Labels

2023-12-18 Thread Jean SUZINEAU via fpc-pascal
Le 17/12/2023 à 17:47, Adriaan van Os via fpc-pascal a écrit : Turbo Pascal (5.5) defines label = digit-sequence . Are you sure ? I had a doubt and I had a look in some very old source code from 1990 made with tp 5.5, it seems you could have letters in labels. Excerpt of the code:

Re: [fpc-pascal] case statement

2023-12-15 Thread Jean SUZINEAU via fpc-pascal
Le 15/12/2023 à 10:39, Adriaan van Os via fpc-pascal a écrit : I don't see a semicolon in the formal syntax. May be included in the ' "DO" statement ' ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] What's in Hello World

2024-01-08 Thread Jean SUZINEAU via fpc-pascal
Le 08/01/2024 à 13:51, Peter B via fpc-pascal a écrit :    or if not, is there another way to turn it on in the textmode IDE? No idea. Its easy enough if you compile from the command line. fpc -Os -XX hello.pas If stripping is not on by default, also use -Xs I guess that in the textmode IDE

Re: [fpc-pascal] Floating point question

2024-02-22 Thread Jean SUZINEAU via fpc-pascal
Le 22/02/2024 à 15:08, Thomas Kurz via fpc-pascal a écrit : But it's supported on Linux but not on Windows? Huh? As far as I know Extended is not supported on Linux.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Floating point question

2024-02-22 Thread Jean SUZINEAU via fpc-pascal
I see that Wikipedia is not very clear on this,  you just find "x86" mentioned, but for Pascal: "this Extended type is available on 16, 32 and 64-bit platforms, possibly with padding" https://en.wikipedia.org/wiki/Extended_precision ___ fpc-pascal

Re: [fpc-pascal] Type-casting a class variable

2024-05-01 Thread Jean SUZINEAU via fpc-pascal
I didn't tested but I imagine it could be done with something like this ? type    TWindow_Class= class of TWindow; begin   ...   (myClass as TWindow_Class).CreateNewWindow( ); ___ fpc-pascal maillist -

<    1   2