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

2023-06-20 Thread Giuliano Colla via fpc-pascal
Il 20/06/2023 09:05, Hairy Pixels via fpc-pascal ha scritto: Educators continuously have stupid ideas that don't work out as intended in the real world. I would love to see them make a real program that does something difficult and not use early breaks. I assume them they forbid early exits

Re: [fpc-pascal] Wrong assignment detected only run time without warning

2023-06-16 Thread Giuliano Colla via fpc-pascal
Il 16/06/23 15:02, Tomas Hajny via fpc-pascal ha scritto: If you compile with -CO, you should get at least a hint (if you enable displaying them, of course): I believed that -Co was enough. I'll add -CO to the debug options. Thanks. Giuliano ___

Re: [fpc-pascal] Wrong assignment detected only run time without warning

2023-06-16 Thread Giuliano Colla via fpc-pascal
Il 16/06/23 13:36, Peter B via fpc-pascal ha scritto: Yes. Assigning a 64bit integer to a 32bit one is fine as long as the range is within bounds. Range of a variable can only be checked at run time. I can understand that. But the compiler generates quite a number of warning for potential lo

[fpc-pascal] Wrong assignment detected only run time without warning

2023-06-16 Thread Giuliano Colla via fpc-pascal
I made a stupid error. My code: TFileObj = Class(TObject) [snip] Size: Integer; [snip] end; procedure TForm1.FillDir(FileData : TSearchRec); ... FFIleObj.Size := FileData.Size; ... but TSearchRec structure is: TRawbyteSearchRec = Record [snip] Size : Int64;

Re: [fpc-pascal] override and virtual: was SetFileTime

2023-05-03 Thread Giuliano Colla via fpc-pascal
Il 03/05/23 16:44, Steve Litt via fpc-pascal ha scritto: José Mejuto via fpc-pascal said on Wed, 3 May 2023 11:35:50 +0200 Hello, Attached is a dirty implementation of "touch" for junctions == TTouchJunction = class(TCustomApplication)

Re: [fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Giuliano Colla via fpc-pascal
Il 12/04/2023 21:17, Bo Berglund via fpc-pascal ha scritto: And if so, what is the rule for*when* to use var in function call argument lists for items that will be changed inside the called function and used afterwards? Your Wargs is defined as an open array, i.e. its length is unknown at comp

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

2023-04-01 Thread Giuliano Colla via fpc-pascal
Il 01/04/2023 21:56, Bo Berglund via fpc-pascal ha scritto: I need to read and write data to an EEPROM connected by I2C on a RaspberryPi4. The I2C channel is found in /dev as i2c-1: $ ll /dev/i2* crw-rw 1 root i2c 89, 1 2019-02-14 11:12 /dev/i2c-1 In this channel the EEPROM CAT24C128 is at

Re: [fpc-pascal] Converting Delphi7 code to FreePascal with interfacing to protection key?

2023-03-22 Thread Giuliano Colla via fpc-pascal
Il 22/03/2023 11:18, Bo Berglund via fpc-pascal ha scritto: If I have fpc 3.2.2 inbstalled on Windows 10 x64 I assume it is a 64 bit target exe which will be the output, right? If in Project Options -> Config and Target ->Target OS you specify Win32, you'll get a 32 bit exe (which is what Delph

Re: [fpc-pascal] star operator on enum types

2023-01-26 Thread Giuliano Colla via fpc-pascal
Il 26/01/2023 18:52, Sven Barth via fpc-pascal ha scritto: Giuliano Colla via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> schrieb am Do., 26. Jan. 2023, 18:43: I found in a fpc program a statement sort of: Type   TSomeType = (a,b,c)   TaType = set of TSometyp

[fpc-pascal] star operator on enum types

2023-01-26 Thread Giuliano Colla via fpc-pascal
I found in a fpc program a statement sort of: Type   TSomeType = (a,b,c)   TaType = set of TSometype var   setA,setB: TaType; . *if setA * setB = [] then doSomething*; which I found very smart to detect if the two sets have some common elements, but I've been unable to find in the fpc docum

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 22:23, Mattias Gaertner via fpc-pascal ha scritto: On Mon, 16 Jan 2023 22:12:52 +0100 Mattias Gaertner via fpc-pascal wrote: On Mon, 16 Jan 2023 19:50:34 +0100 Giuliano Colla via fpc-pascal wrote: I stumbled into a problem I don't understand. I'm developing a litt

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 20:58, Marco van de Voort via fpc-pascal ha scritto: On 16-1-2023 20:56, Giuliano Colla via fpc-pascal wrote: No chance. Addr is a pointer (of type Pin_addr) but Addr := Pin_addr(HostEnt.h_addr^) works only if mode is Delphi. In objfpc it raises exactly the same error. A

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 20:32, Michael Van Canneyt ha scritto: On Mon, 16 Jan 2023, Giuliano Colla via fpc-pascal wrote: .I stumbled into a problem I don't understand. Should that not simply be Addr := Pin_addr(HostEnt.h_addr^) (if addr is a pointer) or addr:=Pin_addr(HostEnt.h_addr^)^ if

[fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
I stumbled into a problem I don't understand. I'm developing a little program for an ftp client. In order to connect to the site I need the site address from the site name, and the libc gethostbyname() provides the required information. gethostbyname returns a PHostEnt type which is declared

Re: [fpc-pascal] Calculating CRC16?

2022-10-25 Thread Giuliano Colla via fpc-pascal
Il 25/10/22 09:58, Marco Borsari via fpc-pascal ha scritto: On Tue, 25 Oct 2022 08:30:19 +0200 Bo Berglund via fpc-pascal wrote: Is there some package or code available somewhere which can calculate the CRC16 value over a byte array of some 1000 bytes? http://www.retroarchive.org/swag/CRC/ind

Re: [fpc-pascal] Implementing a simple tcp/ip connection

2020-05-29 Thread Giuliano Colla
Il 28/05/2020 18:00, Graeme Geldenhuys ha scritto: Though in general, I would just use Indy. +1 The main reason is that I have a relevant amount of Delphi/Kylix code using Delphi's Sockets unit. That way porting that code to Lazarus becomes trivial. Secondly my applications typically involve

[fpc-pascal] Implementing a simple tcp/ip connection

2020-05-28 Thread Giuliano Colla
Hi everybody, I needed to implement a simple dedicated TCP/IP connection between a client and a server. Nothing fancy, just sending and receiving short strings. I have used in the past for that purpose the unit Sockets lifting it from Delphi/Kylix. This unit was taking advantage of libc, and t

Re: [fpc-pascal] Copying a Pchar to an array of bytes

2020-05-19 Thread Giuliano Colla
Thank you both guys. Il 19/05/2020 19:28, Alexander Grotewohl ha scritto: do move(Hello^, ... -- Do not do to others as you would have them do to you.They might have different tastes. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org htt

Re: [fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-19 Thread Giuliano Colla
Il 19/05/2020 18:57, Michael Van Canneyt ha scritto: They are not missing. How do you think fpsock and lnet implement non-blocking ? It's simply called  O_NONBLOCK. I'm using fpc 3.0.4. With just Sockets in the uses clause both SOCK_NONBLOCK and O_NONBLOCK give an Identifier not found error

[fpc-pascal] Copying a Pchar to an array of bytes

2020-05-19 Thread Giuliano Colla
I'm not too familiar with Pchar, and apparently I'm missing something. I have a Pchar string which I must copy into an array of bytes. Could someone explain me while a move doesn't work while an assignment byte by byte does? Here's a snippet of the code: buffer: array [0..1023] of byte; Hell

Re: [fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-19 Thread Giuliano Colla
I'm struggling with a similar problem. It would appear that the easiest way would be just take advantage of the Sockets unit. You only must define some more constants, such as SO_REUSEPORT and SOCK_NONBLOCK which are missing in fpc. I just made some preliminary tests, and it looks like it's no

Re: [fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-14 Thread Giuliano Colla
Thank you to all of you guys. Now I have a much better picture -- Do not do to others as you would have them do to you.They might have different tastes. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/m

[fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-14 Thread Giuliano Colla
Hi all, I need to implement a simple dedicated TCP/IP connection between a client and a server. Nothing fancy, just sending and receiving short strings. I have used in the past for that purpose the unit Sockets lifting it from Kylix. This unit was taking advantage of libc, and this rules it o

Re: [fpc-pascal] Warning: Symbol "faHidden" is not portable

2019-07-20 Thread Giuliano Colla
Il 19/07/2019 19:32, James Richters ha scritto: I'm using Windows 10, but I may in the future want to make a Linux version of my program. I guess that's what the warning is about.. that fAHidden won't detect hidden files on some operating systems? More exactly it means that fAHidden won't d

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Giuliano Colla
Il 21/05/2019 14:40, Michael Van Canneyt ha scritto: FreeThenNil should never be necessary. FreeAndNil() should be enough for all circumstances. In a perfect world maybe you're right. But if you're dealing with LCL, you'll find it sometimes necessary, less your program segfaults, because th

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread Giuliano Colla
Il 20/05/2019 15:23, James Richters ha scritto: Thank you very much for the explanation and examples of this! I am glad you pointed out the FreeAndNill() function, I will defiantly be needing that. James Then you might also appreciate the function Assign

Re: [fpc-pascal] h2pas fails on c++ header file

2019-02-01 Thread Giuliano Colla
Il 01/02/2019 10:37, Marco van de Voort ha scritto: Op 2019-01-31 om 19:00 schreef Sven Barth via fpc-pascal:     That is because h2pas is unable to handle it, or because fpc is     unable     to generate the proper code for a c++ parameter by reference The former. For the later you'd eithe

Re: [fpc-pascal] h2pas fails on c++ header file

2019-01-31 Thread Giuliano Colla
Il 30/01/2019 13:17, Marco van de Voort ha scritto: Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: What I'm doing wrong? Using a C header converter or a C++ header file.   & is not proper C. That is because h2pas is unable to handle it, or because fpc is unable to generate t

[fpc-pascal] h2pas fails on c++ header file

2019-01-30 Thread Giuliano Colla
I have a c++ module which just performs calculations, and does not use c++ objects. Just c++ syntax. The header file which is used from a c++ main, is the following: extern int delta_calcForward(float theta1, float theta2, float theta3, float &x0, float &y0, float &z0); extern int delta_calcIn

Re: [fpc-pascal] Get "disk" ID

2019-01-06 Thread Giuliano Colla
Il 05/01/2019 17:03, Bart ha scritto: I need some function to get a unique ID for a disk. I need this to identify if my program has accessed this disk previously. For that purpose on Linux, out of laziness, I usually just parse the output of command-line utilities, such as blkid or lsblk. bl

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-04 Thread Giuliano Colla
Il 03/11/2018 23:16, James ha scritto: It’s not a snippet, that’s the entire thing.   It’s pretty simple, just a sequential set of events to fix a file.  It would be a great help if you could get me an example of how to make this work. The simplest thing you can do is just to transform your app

Re: [fpc-pascal] Branch table

2018-08-26 Thread Giuliano Colla
Il 23/08/2018 11:34, Marco Borsari via fpc-pascal ha scritto: It would be for the Wirth optimization in the access of an array, when the index is 0 or 1, allowing the elimination of a multiplication. I'm afraid that this sort of optimization is rather outdat

Re: [fpc-pascal] Branch table

2018-08-20 Thread Giuliano Colla
Il 18/08/2018 15:52, Marco Borsari via fpc-pascal ha scritto: it works only for index 0, and crashes otherwise. Maybe a problem of alignment? Or must be tab declared in data section? On the Intel architecture you cannot perform pointer arithmetic as if a pointer were just a number. A pointer

Re: [fpc-pascal] Branch table

2018-08-17 Thread Giuliano Colla
Il 17/08/2018 15:46, Marco Borsari via fpc-pascal ha scritto: I found that someone made that for me at link http://www.mindfruit.co.uk/2012/01/switch-blocks-jump-tables.html and I have tried to rewrite the program in at&t syntax

Re: [fpc-pascal] Branch table

2018-08-16 Thread Giuliano Colla
Il 14/08/2018 15:21, Marco Borsari via fpc-pascal ha scritto: Why the code below does exit gracefully without prints anything? Sure, it is for my poor knowledge of the assembler, but in some details, please... program branch; {$ASMMODE intel} label next,stop,a,b,c; var idx:byte; begin write('

Re: [fpc-pascal] Syntax changes suggestions

2018-07-25 Thread Giuliano Colla
Il 23/07/2018 18:11, Ryan Joseph ha scritto: The spirit of the language is really hard to define in my opinion. To the contrary, in an Open Source project, it is the easiest thing to define. It is what the core developers deem to be the spirit of the language. That's all. One should never

Re: [fpc-pascal] How to translate Delphi Assembly MOV EAX,[EBP+4]

2018-07-18 Thread Giuliano Colla
Il 18/07/2018 17:19, Dennis ha scritto: The following delphi code when compiled by FPC, raised these errors: Compile Project, Target: lib\x86_64-win64\Project1.exe: Exit code 1, Errors: 10, Warnings: 2 StrBuffer.pas(100,19) Error: Unknown identifier "EAX" StrBuffer.pas(100,23) Error: Assemble

Re: [fpc-pascal] A new fpc desirable feature

2018-07-18 Thread Giuliano Colla
Il 17/07/2018 23:40, Tomas Hajny ha scritto: Indeed - please, everybody make sure to keep the discussion on this list on topic, this thread doesn't belong to this list. You are perfectly right that the discussions on this list should be kept on topic

Re: [fpc-pascal] A new fpc desirable feature

2018-07-17 Thread Giuliano Colla
Il 17/07/2018 14:12, Karoly Balogh (Charlie/SGR) ha scritto: I also propose that if you do not write "please" often enough, the compiler would error out, claiming the user being too rude. But if it's used too often, the source can be rejected for being excessively polite. A problem would be t

Re: [fpc-pascal] A new fpc desirable feature

2018-07-17 Thread Giuliano Colla
Il 17/07/2018 16:06, Reimar Grabowski ha scritto: I DO NOT beg the compiler for something, I command. Then I would not be astonished if it turned out that you experience more troubles than the average, such as unexpected sigsev, libraries not found, unexpected shutdowns, and disk errors. I

[fpc-pascal] A new fpc desirable feature

2018-07-17 Thread Giuliano Colla
As everybody is suggesting new fpc features, I feel it right to add my own proposal, to make the language more useful and user friendly. I propose the support for the keyword "please". The syntax is quite simple: "please:", followed by the explanation in plain English (or whatever locale is se

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

2018-07-03 Thread Giuliano Colla
Il 03/07/2018 15:14, Marcos Douglas B. Santos ha scritto: Can we sleep a thread for minutes or even hours without any problems? The OS will not kill the thread? On Linux environment, sample situation on one of our servers: ├─hald───hald-runner─┬─hald-addon-acpi │ ├─hald-addon-keyb │ └─2*[hald

Re: [fpc-pascal] Proper preprocessor?

2018-06-20 Thread Giuliano Colla
Il 20/06/2018 12:14, Michael Van Canneyt ha scritto: If you need a preprocessor, maybe you simply need to rethink your design. If you could explain your actual problem, maybe we can help solving it without resorting to preprocessing. In my experience a preprocessor comes handy mainly during

Re: [fpc-pascal] Anchors on a child form

2018-06-04 Thread Giuliano Colla
Il 04/06/2018 14:06, Martin Wynne ha scritto: uses Unit1; procedure TForm2.FormCreate(Sender: TObject); begin   Parent:=Form1;   Anchors:=[];   Visible:=True; end; 4. run it, and the debugger will show the error message. Just remove the two lines Parent:= Form1; (which is wrong, because it

Re: [fpc-pascal] Anchors on a child form

2018-06-04 Thread Giuliano Colla
Il 03/06/2018 14:06, Martin Wynne ha scritto: I'm porting a project to Lazarus from Delphi5, where it works fine. Child forms can be dragged around even with the top and left anchors set. Thanks for any help in fixing this This appears to be a topic for the Lazarus list, as it appears that y

Re: [fpc-pascal] Using constants instead of comments

2018-04-18 Thread Giuliano Colla
Il 18/04/2018 05:06, James Richters ha scritto: is there a better way to optionally exclude diagnostic information entirely from the compiled program? Did you consider to replace your Writeln with a DiagWrite (or whatever name you prefer), and have a DiagWrite such as: DiagWrite: Procedu

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Giuliano Colla
Il 08/01/2018 21:30, Graeme Geldenhuys ha scritto: I was horified to find out how much slower Delphi's Generics were compared to TList and TObjectList I don't expect FPC behave much better. Whenever you move something from compile time to execution time you may gain in flexibility, but you s

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Giuliano Colla
Il 06/01/2018 01:39, Darius Blaszyk ha scritto: #define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) & (((MyStruct *)0)->next h2pas translates it into the enclosed file. Hope that it helps. Giuliano darius.pp Description: application/wine-extension-pp

Re: [fpc-pascal] Get user ID for name on Linux

2018-01-03 Thread Giuliano Colla
Il 03/01/2018 01:12, Tobias Giesen ha scritto: I would like to get the user ID for a Linux user name. You might execute from the application the "/usr/bin/id" command which should exist in any Linux flavour passing the required user name ( if it's th

Re: [fpc-pascal] What happened to FileOpen in trunk?

2017-12-27 Thread Giuliano Colla
Il 27/12/2017 18:40, Michael Van Canneyt ha scritto: Your code was simply lucky to work in the beginning. It's not guaranteed that passing OS-Specific options to FileOpen will work. using fpOpen is the correct method, since you're using OS-specific features. Understood. Thanks a lot. Gi

[fpc-pascal] What happened to FileOpen in trunk?

2017-12-27 Thread Giuliano Colla
In multi-thread applications in Linux environment, I'm using FIFO's for communicating between threads. In order to make it work properly, the FIFO must be opened in non blocking mode. Up to fpc 3.0.4 I've been successfully using code like this: fdc := FileOpen(myFifo,fmOpenWrite or O_NONBLOCK

Re: [fpc-pascal] Is there some example of an FPC program for use in svn hook calls (email)?

2017-12-14 Thread Giuliano Colla
Il 14/12/2017 18:02, Bo Berglund ha scritto: But*sending email* is not the problem, I have done this in many applications using Indy TIdSMTP. Instead it is getting data out oof svn and formatting these in a friendly looking email to be sent You might find useful guidelines in the fpcup an

Re: [fpc-pascal] Unable to compile fpc 3.0.4

2017-12-09 Thread Giuliano Colla
Il 09/12/2017 22:06, Pierre Muller ha scritto: Simply try to run make but adding -n to Free Pascal compiler options, simply by using make OPT=-n or make OPT="-n ALL_OPTIONS_YOU_USED_BEFORE" OPT=-n did the trick. It remains obscure to me while paszlib did origin to the problem, while other pa

[fpc-pascal] Unable to compile fpc 3.0.4

2017-12-09 Thread Giuliano Colla
I've stumbled into a problem. On one platform (linux x86_64, distro is CentOs6) I'm unable to compile fpc packages of fpc 3.0.4 The compiler is successful but the package compilation fails on package paszlib. The error given is zbase.pas(446,7) Error: Illegal expression zbase.pas(447,36) Er

Re: [fpc-pascal] OT: what happened with the Lazarus mailing list?

2017-11-25 Thread Giuliano Colla
Il 25/11/2017 09:29, Lubos Pintes ha scritto: I don't know if the problem is somewhere on my side, but the latest message in Lazarus mailing list on gmane.org is from November 17. Same here. I'm subscribed to the Lazarus mailing list, but last message i got is of nov 17, 10:23. Giuliano _

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Giuliano Colla
Il 09/11/2017 22:56, Marc Santhoff ha scritto: I see, so when using fpc for ARM these define is automatically set? Yes And would that be CPUAVR for Atmels chips? Not sure about that. I never used fpc on Atmel chips. When I'm in doubt about the conditional defines, I either google or take adva

Re: [fpc-pascal] installing cross fpc in parallel to systems fpc

2017-11-09 Thread Giuliano Colla
Il 09/11/2017 02:36, Marc Santhoff ha scritto: how does fpc and it's makefiles handle the case of installing a cross compiler on a system having fpc installed? The target path will differ and I can set that, but how is the config file .fpc.cfg handled? You may edit your fpc.cfg for your diffe

Re: [fpc-pascal] Error building FPC 3.0.2 from svn sources on RPi3

2017-06-04 Thread Giuliano Colla
Il 04/06/2017 08:02, Bo Berglund ha scritto: But I also have other systems where a real time system would be handy. Do you have more info on this? Yes. There was a bug in the way the FIQ was handled in a multicore ARM CPU (i.e. RPi2 and RPi3) , which was causing random freezes, not much freq

Re: [fpc-pascal] Error building FPC 3.0.2 from svn sources on RPi3

2017-05-30 Thread Giuliano Colla
Il 29/05/2017 23:28, Bo Berglund ha scritto: I have bought and initialized a new RPi3 today. It runs Raspbian Jessie PIXEL latest version. I don't know what you're going to use your RPi3 for, but just in case, are you aware that now you can install an RT_PREEMPT kernel, and enjoy the real-time

Re: [fpc-pascal] Correct syntax for initialized constants/variables

2017-04-27 Thread Giuliano Colla
Il 27/04/2017 20:49, Ralf Quint ha scritto: I see in the reference docs (section 4.4) examples for arrays and examples for records, but in my case, I would need to properly define an array of records. Any hint/example for the proper syntax in that case would be deeply appreciated, it's probably

Re: [fpc-pascal] Hash List

2017-04-13 Thread Giuliano Colla
Il 12/04/2017 15:57, Michael Van Canneyt ha scritto: we could put it in contnrs, and alias it in inifiles.pp +1 Giuliano ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Threading vs Parallelism ?

2017-04-12 Thread Giuliano Colla
Il 30/03/2017 00:26, fredvs ha scritto: Perfect, I have now all the arguments to defend the "Dinosaur Threading" choice. When I'm charged of not using the most cool and new technology, my favourite argument are the tombstones. They're made out of stone, which is a stone-age technology. But, a

Re: [fpc-pascal] Good FFT example anywhere?

2017-04-09 Thread Giuliano Colla
Il 09/04/2017 10:06, Bo Berglund ha scritto: I am looking for some good example of FFT functions in pascal but it seems like what Google serves up is rather old and refers to Turbo-pascal and the like... So maybe someone here knows about some open-source example of FFT using FreePascal (or Delph

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Giuliano Colla
Il 05/04/2017 18:09, Bart ha scritto: http://www.freepascal.org/docs-html/current/rtl/system/random.html "Random returns a random number larger or equal to 0 and strictly less than L" However random(a negative number) returns a number <= 0 and > L program r; begin randomize; writeln('Ra

Re: [fpc-pascal] INVALID_SOCKET constant not defined for Linux

2017-03-28 Thread Giuliano Colla
Il 28/03/2017 12:34, LacaK ha scritto: This technique is used in fcl-net which should be cross-platform. So I am right, when I say that also in Linux invald socket = -1 (in other words: in case of error syscall() returns always -1) Becuase in other place I see another test "if socket < 0 then ..

Re: [fpc-pascal] Delphi for Linux is out

2017-03-23 Thread Giuliano Colla
Il 23/03/2017 17:19, Sven Barth via fpc-pascal ha scritto: In the end you'll just need the correct units to do GUI applications as well though one would need to do everything by hand as there'd be no VCL or FM :P IOW with the newest Delphi for Linux you're in a worse condition than using old

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-03-22 Thread Giuliano Colla
Il 22/03/2017 14:21, Karoly Balogh (Charlie/SGR) ha scritto: Hi, On Wed, 22 Mar 2017, Giuliano Colla wrote: Il 22/03/2017 13:20, James Richters ha scritto: No, it is not only freepascal, but not every program either. A wild guess. The vilain could be the journal logic. Wild indeed

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-03-22 Thread Giuliano Colla
Il 22/03/2017 13:20, James Richters ha scritto: No, it is not only freepascal, but not every program either. A wild guess. The vilain could be the journal logic. The journal tells that the write operation has not been completed at power off, and restores the last valid version of the file, wh

Re: [fpc-pascal] Hash List

2017-03-17 Thread Giuliano Colla
Il 18/03/2017 00:29, African Wild Dog ha scritto: Ia there any hash list implementation in free Pascal? The IniFiles unit (fpc/packages/fcl-base/src/inifiles.pp) provides a THashedStringList (descendant from TstringList) which I'm using reliably since many years. Giuliano ___

Re: [fpc-pascal] Linking to Linux on a FreeBSD system with Linux emulated ?

2016-09-09 Thread Giuliano Colla
Il 09/09/2016 10:17, Graeme Geldenhuys ha scritto: Unfortunately I don't have any other 32-bit FreeBSD VM where I can install FPC 3.0.0 on. I know that you don't like automated scripts, but you should consider fpcup (or fpclazup), in order to experiment with different fpc/Lazarus versions.

Re: [fpc-pascal] THashedStringList doesn't honour CaseSensitive?

2016-09-06 Thread Giuliano Colla
Il 02/09/2016 14:20, Michael Van Canneyt ha scritto: On Fri, 2 Sep 2016, Giuliano Colla wrote: In my application I stumbled into a problem with a search in a HashedStringList: IndexOfName doesn't return the proper index if the search string doesn't match the name case, even if Cas

[fpc-pascal] THashedStringList doesn't honour CaseSensitive?

2016-09-02 Thread Giuliano Colla
In my application I stumbled into a problem with a search in a HashedStringList: IndexOfName doesn't return the proper index if the search string doesn't match the name case, even if CaseSensitive is set to false. For common sense and Delphi compatibility (http://docwiki.embarcadero.com/Libra

Re: [fpc-pascal] old school crc32

2016-07-24 Thread Giuliano Colla
Il 24/07/2016 01:18, wkitt...@windstream.net ha scritto: this is driving me battier than i already am :( i have a binary file that contains a record of data... the first field of the data is a crc32 value of a string of characters... the string of characters is lower cased before being fed to

Re: [fpc-pascal] unable to compile 3.0.0 both Linux x86_64 and arm-linux

2016-07-17 Thread Giuliano Colla
Il 17/07/2016 20:01, Jonas Maebe ha scritto: Could you edit that wiki page and remove the -Sd so other people won't run in the same problem? Thanks. Sorry, bad link. That's the good one: http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM#Create_custom_fpc.cfg Giuliano _

Re: [fpc-pascal] unable to compile 3.0.0 both Linux x86_64 and arm-linux

2016-07-17 Thread Giuliano Colla
Il 17/07/2016 20:01, Jonas Maebe ha scritto: Could you edit that wiki page and remove the -Sd so other people won't run in the same problem? Thanks. Done. http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM#Configure_Lazarus_for_cross_Compile I was planning to edit this page when I was c

Re: [fpc-pascal] unable to compile 3.0.0 both Linux x86_64 and arm-linux

2016-07-17 Thread Giuliano Colla
Il 17/07/2016 17:34, Jonas Maebe ha scritto: Try adding OPT=-va FPMAKEOPT=-v to the make invocation and check the output to see whether the compiler is picking up any extra configuration files or options somehow. That's it! I had just pasted from the wiki page an extra fpc.cfg for cross com

Re: [fpc-pascal] unable to compile 3.0.0 both Linux x86_64 and arm-linux

2016-07-16 Thread Giuliano Colla
Il 16/07/2016 15:52, Jonas Maebe ha scritto: These errors suggest you are not compiling that unit in FPC mode. If you use the top level Makefile in the fpcsrc directory, it will compile the packages directory with RELEASE=1, which in turn causes -n to be added to the FPC command line options s

[fpc-pascal] unable to compile 3.0.0 both Linux x86_64 and arm-linux

2016-07-16 Thread Giuliano Colla
Hello, I'm trying to upgrade from fpc 2.6.4 to 3.0.0 but make all fails both in Linux x86_64 platfoms and in arm-linux (Raspbian) plaform. I've downloaded a precompiled 3.0.0 in order to be able to compile. I have also tried using fpcup, but the result is the same in all cases: while compil

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Giuliano Colla
Il 14/02/2016 10:51, Adrian Veith ha scritto: When I change the programm to run inside a procedure (because this would be the more realistic scenario) the performance decreases about 15% - 160ms in global vs 185ms inside procedure. Using Florian's suggestion, performance outside and inside a pr

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Giuliano Colla
Il 14/02/2016 12:56, Florian Klaempfl ha scritto: In theory, a compiler could decide very good if add or lea is better. But this decision applies only to a certain core and not in general. So for a all-purpose compiler this makes little sense. If your application really depends on this, rewrite t

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Giuliano Colla
Il 14/02/2016 11:12, Graeme Geldenhuys ha scritto: But then, I think such non-realword tests don't prove much. Except that the implementation of inc(something) should be given a look, as it's always been sold as faster than something:=something+1 Giuliano __

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Giuliano Colla
Il 14/02/2016 11:09, Florian Klaempfl ha scritto: But actually, before bothering randomly with command line options, I would just rewrite the inner loop. Something like for n7 := 0 to 9 do if n1 + n2 + n3 + n4 - n5 - n6 - n7 in [0..9] then Inc(Ti

Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-05 Thread Giuliano Colla
Il 05/02/2016 10:58, Michael Van Canneyt ha scritto: And please remember, we do not NEED this construct; the added value is marginal as I indicated. Simply not adding is an option. Not all change is necessarily progress. +1 C philosophy is to save *typing* time. Pascal philosophy is to save

Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread Giuliano Colla
sak/sak/sakit/liblinux64/ ? Once supplied the right folder, this should be sufficient to make the loader search the proper file. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? ___ fpc-pasca

[fpc-pascal] THashedStringList.IndexOfName returns bogus value for empty string

2015-03-15 Thread Giuliano Colla
er an issue in the bugtracker? Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FormatSettings not updated in Linux

2015-01-02 Thread Giuliano Colla
Il 02/01/2015 13:47, Jonas Maebe ha scritto: On 02/01/15 13:35, Giuliano Colla wrote: Contrary to what written in docs, DefaultFormatSettings aren't adjusted to the current locale in Linux at the startup of an application both on fpc 2.6.4 and on fpc 2.7.1. Where is this written? At least

[fpc-pascal] FormatSettings not updated in Linux

2015-01-02 Thread Giuliano Colla
e proper locale settings. Did someone forget to add cloclale to the uses section of /rtl/unix/sysutils.pp or there's another reason for this? Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? __

Re: [fpc-pascal] Trying to register a Windows Service gives error

2014-10-10 Thread Giuliano Colla
ust trash it. Marauders will try to take advantage from it, no matter how long is the disclaimer. Giuliano -- Giuliano Colla Project planning question: when it's 90% done, are we halfway or not yet? ___ fpc-pascal maillist - fpc-pascal@lists.fr

Re: [fpc-pascal] Mapping Cairo pixmap to FPC Bitmap and back

2014-09-22 Thread Giuliano Colla
access (possible also with LCL.TBitmap in some cases) https://code.google.com/p/luipack/source/browse/trunk/cairo/imaging/cairoimaging.pas#116 Luiz 2014-09-21 19:10 GMT-03:00 Giuliano Colla mailto:giuliano.co...@fastwebnet.it>>: Could anyone more knowledgeable than me point me

[fpc-pascal] Mapping Cairo pixmap to FPC Bitmap and back

2014-09-21 Thread Giuliano Colla
Could anyone more knowledgeable than me point me in the right direction to find how a Cairo pixmap maps into a FPC Bitmap, and possibly to some existing code for doing the trick of converting from the one to the other, thus saving me hours of searching? Thanks in advance for any hint. Giulian

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-16 Thread Giuliano Colla
Il 16/09/2014 12:26, Philippe ha scritto: could the compiler avoid "with" pitfalls? The "with" construct can be very handy, but should be used with caution, like a lot of other constructs, declarations, etc. E.g. for symbols present with the same name in different units, depending on the o

Re: [fpc-pascal] how to activate debug info

2014-07-18 Thread Giuliano Colla
Il 18/07/2014 14:30, Sven Barth ha scritto: Am 18.07.2014 14:09 schrieb "Giuliano Colla" mailto:giuliano.co...@fastwebnet.it>>: > > Hi fpc team. > When I need to understand how some code works, I frequently use the debugger, and single-step. > But when debugging

[fpc-pascal] how to activate debug info

2014-07-18 Thread Giuliano Colla
Hi fpc team. When I need to understand how some code works, I frequently use the debugger, and single-step. But when debugging Lazarus applications, I can single-step through user code and Lazarus code only, while fpc code is skipped. I presume that this is happening because my fpc binary is str

Re: [fpc-pascal] nonlcl widgetsets

2014-06-11 Thread Giuliano Colla
Il 11/06/2014 14:11, Sven Barth ha scritto: You should better ask this on Lazarus list. It might be non-LCL, but it's not non-Lazarus ;) I was mistaken because I found the reference on a post of Michael in this list. Sorry for the noise. Giuliano __

[fpc-pascal] nonlcl widgetsets

2014-06-11 Thread Giuliano Colla
Hi fpc wizards, I'm interested in the nonlcl topic, and I tested the source found in the examples (designnonlcl). But, getting it from trunk I stumbled into an error: in the module mywidgetdesigner.pas, /procedure GetObjInspNodeImageIndex(APersistent: TPersistent; var AIndex: integer); overr

[fpc-pascal] Re: [fpc-devel] Lazarus 1.0.8 Release

2013-04-07 Thread Giuliano Colla
Il 19/03/2013 10:28, Mattias Gaertner ha scritto: The Lazarus team is glad to announce the release of Lazarus 1.0.8. This is a bug fix release, built with the current fpc 2.6.2. The previous release 1.0.6 was built with 2.6.0. Although with the last updates RHEL5.x and CentOs 5.x do claim to

[fpc-pascal] Re: [fpc-other] Lazarus 1.0.8 Release

2013-04-07 Thread Giuliano Colla
Il 19/03/2013 10:28, Mattias Gaertner ha scritto: The Lazarus team is glad to announce the release of Lazarus 1.0.8. This is a bug fix release, built with the current fpc 2.6.2. The previous release 1.0.6 was built with 2.6.0. Although with the last updates RHEL5.x and CentOs 5.x do claim to

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-14 Thread Giuliano Colla
gue that an additional branch would increase readability, but I personally don't see a real use for it... You're right. At first glance it appeared to me a good idea, but actually it wouldn't provide anything useful. -- Giuliano Colla Whenever people agre

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-14 Thread Giuliano Colla
broader range of cases. Then, sometimes someone will still need nested try..whatever, to deal with situations which do really require the HOLES you mentioned. Giuliano -- Giuliano Colla Whenever people agree with me, I always feel I must be wrong (O. Wilde) ___

Re: [fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.

2013-02-13 Thread Giuliano Colla
e new construct, he can use the old one, and put in as many holes as he want. After all one is free to insert anywhere in the code a few assembler lines and to break anything fpc developers had in mind.. Giuliano -- Giuliano Colla Before activating the tongue, make sure

  1   2   >