AW: [fpc-pascal] is planned next 2.0.x release?
Hi, I would like to express my wish for a new 2.0.x release too. :-) We have also (minor) Problems (Dataset / Timestamp problems) with 2.0.2 and we would need a new "stable" release for a new stable ZEOS Database Tools Release for Lazarus FPC. (ZEOS works currently rather stable with the 2.0.3 Snapshots /MySQL5, PostgreSQL 8.1, Firebird and others) Greets, helmut hartl > -Ursprüngliche Nachricht- > Von: [EMAIL PROTECTED] [mailto:fpc-pascal- > [EMAIL PROTECTED] Im Auftrag von Michael Van Canneyt > Bereitgestellt: Mittwoch, 17. Mai 2006 23:34 > Bereitgestellt in: fpc > Unterhaltung: [fpc-pascal] is planned next 2.0.x release? > Betreff: Re: [fpc-pascal] is planned next 2.0.x release? > > > > On Wed, 17 May 2006, Lukas Gebauer wrote: > > > Hi, > > > > is planned some next 2.0.x release? > > > > I am adopting my Synapse library for unix based targets, and I found lot > > of problems with current FPC version 2.0.2. (like lot of bugs in netdb, > > sockets unit not have constant definitions for each targets, etc.) > > > > All this problems seems to be fixed in 2.0.x snapshots. But I need to be > > compatible with some FPC release... ;-( This is reason why I asking for > > next release of FPC. Is chance to release next 2.0.x version soon, or > you > > are waiting for 2.1.x version? > > Nothing is currently planned, but I'll bring up the matter in the FPC > devel group. > > Michael. > _______ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Problem with DateTimeToStr at midnight?
Hello, i use DateTimeToStr from unit sysutils. At midnight the Date and Time format is wrong (time is missing), is n't? For example: 20-4-07 23:57 20-4-07 23:58 20-4-07 23:59 21-4-07 21-4-07 00:00 21-4-07 00:01 21-4-07 00:02 The line "21-4-07" ist at 00:00:00 and the line "21-4-07 00:00" is later or equal then 00:00:01! Is this ok? Here is same sample source to demonstrate: --- program error_datetimetostr; uses crt,sysutils; var timeroffset:TDateTime; begin (* I will add an offset thru now-function so it is 5 seconds before midnight *) timeroffset:=1-frac(now)-5/86400; while not(keypressed) do begin writeln(DateTimeToStr(now+timeroffset)); (* Write the time by adding some offset-seconds*) end; end. _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] put data to stdout (fpc vs. gcc)
Hi I wrote two programs one in C and one in Freepascal. The program read a variable of a library and write it to stdout. I will put it into a file: ("#: ./dataprog > file.dat"). I use "printf" in the C and "writeln" in Freepascal. The problem: The fpc-based program is explicit slower than the c-based program. My questions: Why is it so? Is it possible to avoid the problem? -- C source: for (i=0;ihttp://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: put data to stdout (fpc vs. gcc)
Hi thank's at all for your help! Here some more Information: 1.) I think, that the inc(counter) procedure is faster then counter:=counter+1;. In the FreePascal book (Free Pascal; M. van Canneyt,F. Klämpfl; C&L; 2000; ISBN 3-932311-67-1; S. 519) you can find this information. 2.) I think, FreePascal produce fast programs. I look in fpc options an found: -O optimizations: -OGgenerate faster code (default) I use this default option. I use on gcc no specific optimizations. 3.)The version is "Free Pascal Compiler version 2.0.4 [2006/08/22] for i386". 4.) n is not so high (i think on 32 or 64) but the program must work in Realtime mode. The library produce an periodic callback-process and I will know some informations (out1,out2) which are in two arrays (libout1,libout2); I know, programs with a writeln() have lower performance, but I think, printf() and writeln() must do the same. This need time to calculate. But the difference between printf() and writeln() are so, that the fpc program breaks with errors. Here the Informations about the difference: You can produce with gcc an output like the example source with 80% CPU efficiency. The fpc program with only the line "writeln(out1:0:4);" works without breaking by 100% CPU efficiency. "writeln(out1:0:5);" will break. regards, Markus -- C source: for (i=0;ihttp://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: put data to stdout (fpc vs. gcc)
Hi Jonas, >> I know, programs with a writeln() have lower performance, but I think, >> printf() and writeln() must do the same. This need time to calculate. >> But the difference between printf() and writeln() are so, that the fpc >> program breaks with errors. > What kind of errors? It will break with an error from the library, if the procedure is to slow. The fpc-writeln() works fine but to slow. The gcc-printf() works fine and fast. Do you know a better way to produce a fast formated output in FreePascal. I would use FreePascal and not gcc, but the fpc result is not practical. Markus -- C source: for (i=0;ihttp://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: put data to stdout (fpc vs. gcc)
Hi I try your solutions and here are the results: 1.) TIP: set text buffer higher (using settextbuf) -> RESULT: procedure breaks later 2.) TIP: use flush() after writeln() -> RESULT: procedure breaks on first flush() 3.) TIP: convert first float to text and then put it out -> RESULT: the same breaks like the writeln()-included formating 4.) TIP: use sprintf form libc unit -> RESULT: not tested, because the file descriptors change(, isn't?) 5.) TIP: write your own writeln() -> RESULT: not tested, because is to difficult but very interesting Here an information again: If I put the output with all informations and high precision to /dev/null nothing breaks. My solution is: I write only one information and I cut the precision like writeln(stdout,out1:0:3). This works fine. Thank's at all for your help! regards, Markus -- C source: for (i=0;ihttp://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] unit system; procedure move();
Hi I need more informations about the move() procedure form unit system. I want to shift an array (values:array[0..Maximum-1] of single) like the following lines: for i:=Maximum-1 downto 1 do values[i]:=values[i-1]; values[0]:=sameothervalue; I found the move procedure (unit system) and wrote this lines: move(values[0],values[1],Maximum*sizeof(single)); values[0]:=sameothervalue; I would use the move procedure, because the move procedure is very quickly. The program runs very well with move, but I would avoid access violations in future. That are the reasons of my questions: Is the use of the move procedure right? The array length is Maximum-1. When I put this length on value[1], the last entry value[Maximum-1] would be deleted or would be shifted in an different memory area? What happens with the last entry value[Maximum-1]? Thank you. Regards, Markus -- FreePascal Mailing List: fpc-pascal@lists.freepascal.org ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re[2]: [fpc-pascal]Synapse for FPC
LG> yes, but... with other large TCP/IP libraries you MUST use threads... LG> with synapse you CAN use threads. This is mojor difference! One day LG> will be finished thread support in FPC and all will be happy. ;-) Why must I use threads? Following works perfectly for me for many years: ioctl(Sock,FIONBIO,@tmp); // nonblocking All but one applications are single thread. I'm using standard Socket/Bind/Listen/Accept/Connect socekt functions. vtech _______ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re[4]: [fpc-pascal]Synapse for FPC
ME> Use threads and blocking api. I have (almost) nothing against threads, but they definitely have disadvantages to, especially when used in a huge project: 1. synchronization - need to use critical sections / locks 2. they are very hard to debug and time dependant bugs can be introduced. 3. many libraries (general/graphic/sound/db/etc.) are NOT thread safe That's why I prefer non-blocking single thread solutions. vtech ME> It's fast and responsive and we only have to worry about ME> sharing data between threads, or use non-blocking code and then have to work ME> around the fact that tcp/ip can be slow and we will not get all my data in ME> one big chunk. Using Non blocking sockets means that your code becomes more ME> complex and convoluted because you may well have to go through the event ME> look many hundreds of times before your download or upload has completed. ME> Using multiple threads, you simple hand the data over to the thread when ME> uploading and either carry on. Downloading you simply send a message to the ME> main thread when the data is ready. It's also easy to simulate non-blocking ME> sockets with blocking code using threads. This gives you a clear seperation ME> between your tcp/ip mechanism and your application code. This is the route ME> we usually take here. ME> Swings and roundabouts, I know ;-) ME> Matt ME> ___ ME> fpc-pascal maillist - [EMAIL PROTECTED] ME> http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Best regards, vtech-fpcmailto:[EMAIL PROTECTED] ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
hello
The message contains Unicode characters and has been sent as a binary attachment. <>
Re: [fpc-pascal] FPC & Lazarus moving to gitlab
On 6/22/21 9:05 AM, Michael Van Canneyt via fpc-pascal wrote: Hello All, The Free Pascal and Lazarus teams are in the process of switching to Gitlab to manage their source code and issue reports. In order to lower maintenance of their own infrastructure, a hosted solution has been chosen, and an open source license was granted to the teams. You can see the current progress at: https://gitlab.com/freepascal.org 2 subgroups have been made: https://gitlab.com/freepascal.org/fpc https://gitlab.com/freepascal.org/lazarus-ide snip Graeme will be happy finally :) Keep up the good work guys! AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Changes in 2.4.0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, After quite a long time of absence from FPC, I decided to pick it up again. One of the first things I stumbled upon was the absence of ResourceStringTableCount, GetResourceStringHash and related functions. Is there somewhere a list that tells me all the changes between 22.4.0 and previous versions? Thanks for any help, Regards, Hans. J.D.H. Beekhuizen e-mail: jdh.beekhui...@duinheks.nl tel:+31(71)4015437 fax:+31(71)4017198 -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkuyCAUACgkQLfImQU9wLUoDMQCeJE/o7Q3ejpkYdIhAgqysjRak WWoAnjpJ+kTy9a1brV7YFAlOnfqx7Tej =K8vp -END PGP SIGNATURE- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Changes in 2.4.0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Jonas, Today, Mar 30, Jonas Maebe wrote to FPC-Pascal users discussions about Re:...: Thanks to you and Michael for the speedy reply. JM > > One of the first things I stumbled upon was the absence of JM > > ResourceStringTableCount, GetResourceStringHash and related JM > > functions. JM > The RTL sources indicate that they are only available when you compile your JM > application using Delphi (-Mdelphi or {$mode delphi}) or ObjFPC (-Mobjfpc JM > or {$mode objfpc}) syntax modes. The funny thing is, that I have that directive in all my sources, indirectly vi $I statement. I wonder if I have to give a full path name there? Will try that out tonight. JM > > Is there somewhere a list that tells me all the changes between JM > > 22.4.0 and previous versions? JM > In terms of what has been added: the various "whatsnew.txt" files in the JM > releases, or from svn-web: JM > http://svn.freepascal.org/svn/fpcbuild/tags/release_2_4_0/install/doc/whatsnew.txt JM > (that one also contains the "whatsnew" info from previous releases) I will check them out tonight. JM > In terms of things that may require you to change code or which may affect JM > the usage of the compiler: http://wiki.freepascal.org/User_Changes_2.4.0 JM > (and similar pages for previous releases, linked from the first paragraph). This as well. Regards, Hans. J.D.H. Beekhuizen e-mail: jdh.beekhui...@duinheks.nl tel:+31(71)4015437 fax:+31(71)4017198 -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkuyDucACgkQLfImQU9wLUpougCgvoQ+7MmmpWm0YAA9cAH864CI WusAoIF4DJQqFrhmuHG2C/3dq/vFKa2J =uG45 -END PGP SIGNATURE- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Changes in 2.4.0
Hallo, Mar 30, Mar 30, Michael Van Canneyt wrote to lists.fpc-pas...@duinheks.nl...: MVC > You must use -S2 or -Sd to see them. Or put {$mode objfpc} or {$mode MVC > delphi} MVC > in your sources. I tried all the hints I got. But still no luck. In all my sources include at the beginning: { Compiler options } {$mode ObjFPC} {$M 8192,0,655360} {$I-,H+} {$IFDEF Testing} {$D+,L+,R+} {$ELSE} {$D-,L-,R-} {$ENDIF} And in my compile batch I have: fpc -vw -Fi~/amc/src -FE../bin -Fu~/pascal/units -FU./ amc When I try to copileis tells me: Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for i386 Compiling amc.pp amc_directives.inc(16,3) Warning: Unsupported switch "$L" Compiling amc_global.pp amc_directives.inc(16,3) Warning: Unsupported switch "$L" Writing Resource String Table file: amc_global.rst Compiling amc_init.pp amc_directives.inc(16,3) Warning: Unsupported switch "$L" Compiling amc_gettext.pp amc_directives.inc(16,3) Warning: Unsupported switch "$L" amc_gettext.pp(89,3) Note: Local variable "s" not used amc_gettext.pp(245,40) Error: Identifier not found "ResourceStringTableCount" amc_gettext.pp(247,33) Error: Identifier not found "ResourceStringCount" amc_gettext.pp(250,57) Error: Identifier not found "GetResourceStringDefaultValue" amc_gettext.pp(251,30) Error: Identifier not found "GetResourceStringHash" amc_gettext.pp(254,31) Error: Identifier not found "SetResourceStringValue" amc_gettext.pp(313) Fatal: There were 5 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) Compilation failed! I'm still stuck. Who can tell me what's wrong? Hans. J.D.H. Beekhuizen e-mail: jdh.beekhui...@duinheks.nl tel:+31(71)4015437 fax:+31(71)4017198 _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Changes in 2.4.0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Jonas, Friday, Apr 23, Jonas Maebe wrote to FPC-Pascal users discussions about Re:...: JM > > I'm still stuck. Who can tell me what's wrong? JM > Without a self-contained compilable example that demonstrates the problem: JM > probably nobody. You are probably right. I was just hoping that in my first message I gave enough information or somebody to recognise the problem and think: "hey, I know this one and this is how I solve it". I will make an example, but it is some work: I have to go through a lot of code to do so, and often have to leave my computer .\ Regards, Hans. e-mail: jdh.beekhui...@duinheks.nl tel:+31(71)4015437 fax:+31(71)4017198 -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkvVnTUACgkQLfImQU9wLUpgXgCgkfyD0LFsjApZyJYhFZSWFSl7 NhsAn3FQRz4MpLDRpO5mcGUQORycFEwP =Cin6 -END PGP SIGNATURE- _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Linker switch
Hi, A while ago (5 years) I made an application where I had to add -k-l to the command-line the compile that application. Is there a way to add this in the source ? I spent a good time to find out how I compiled that application last time. Fortunately .bash_history saved me. TIA, Koenraad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] parameter list declaration
> I found this: http://www.freepascal.org/docs-html/ref/refse91.html but I think it's not really clear, especially for newbie Newbies often skip http://www.freepascal.org/docs-html/ref/refli5.html so they can't read the diagrams used in all later sections. > Compare that to official document from Delphi here: > http://docwiki.embarcadero.com/RADStudio/Berlin/en/Parameters_(Delphi) > which I think a bit more clear. Their wiki content is actually user contributed, no better than Lazarus/FPC wiki. It sometimes feels easier to read because it's written from user POV, while official docs are written in more in-depth technical POV. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/parameter-list-declaration-tp5728069p5728088.html Sent from the Free Pascal - General mailing list archive at Nabble.com. _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Partial text search in a dictionary
> However i would like to be able to do a partial text search on the strings, prefeably with a result as a list of matching string/object pairs but getting an index to the first matching pair would be fine. The match only has to be done from the first character of both strings, so a complex solution like Regex search is not needed. Google for prefix tree (or radix tree or trie) implementation. I believe I've seen one in either Blaise Pascal Magazine or Pascal Gamer Magazine, the topic is about building autocomplete combobox if I'm not mistaken. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Partial-text-search-in-a-dictionary-tp5728562p5728601.html Sent from the Free Pascal - General mailing list archive at Nabble.com. _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Browser and exe
> Is there a way to call an Exe (previously installed, no problem with that) to interact with an Exe, working in IE and Chrome? Not from client side AFAIK. You'll need to create a local server side app, let that one executes the exe and response back to the client (if needed). -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Browser-and-exe-tp5728798p5728804.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GLM library alternative?
> Has anyone converted these to Pascal before or having some similar I could look at? I don't usually do the matrix calculation myself, I delegate that by calling OpenGL functions in proper order. However, just a few days ago I found this: https://paginas.fe.up.pt/~paco/pmwiki/index.php?n=DynMatrix.DynMatrix which does seem to have enough matrix operations for most use cases. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/GLM-library-alternative-tp5728879p5728887.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Error building FPC 3.0.2 from svn sources on RPi3
> I do not understand what -iVSPTPSOTO is... That's what happened when the compiler cannot be called by make. Watch: > make: -iVSPTPSOTO: Command not found it's a parameter list for fpc to get (from fpc -h): -i Information ... -iSO Return compiler OS -iSP Return compiler host processor -iTO Return target OS -iTP Return target processor -iVReturn short compiler version ... -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Error-building-FPC-3-0-2-from-svn-sources-on-RPi3-tp5728941p5728942.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Using other fpc installation
For debugging reasons I have installed fpc 2.6.4 on Debian so I can compile some old SVN revisions, number 32959 for example. I want to use the fp editor to run the test, but it seems as the "systemic" 2.6.4 is being used for compiling instead of the SVN version. The bug doesn't show up in 2.6.4, only in some 2.7.1 revisions and later. How can I make sure the SVN version is used and not the systems 2.6.4? The following paths was added to fp editor in Options->Units: /home/roger/fpc/fpc_svn/lib/fpc/2.7.1/unitsx86_64-linux /home/roger/fpc/fpc_svn/lib/fpc/2.7.1/unitsx86_64-linux/* /home/roger/fpc/fpc_svn/lib/fpc/2.7.1/unitsx86_64-linux/rtl Also, both the directories of fpc and ppcx64 was added to the path from commandline: PATH=home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin export PATH=home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin Despite the path, if I run "which fpc" from commandline I get "usr/bin/fpc" anyway. How is that possible when that fpc is not in the path? ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using other fpc installation
I meant to say that system fpc is put AFTER the SVN fpc in the path. On 08/16/2017 09:09 PM, kapibara wrote: PATH=home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin export PATH=home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin Despite the path, if I run "which fpc" from commandline I get "usr/bin/fpc" anyway. How is that possible when that fpc is not in the path? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using other fpc installation
Ah, so FP has no versions other than the official releases then? (2.6.0, 2.6.2, 2.6.4 and so on) Why doesn't FP use the same compiler revision as the SVN sources it comes with? Because the fp executable is compiled at the same time as fpc? Alright then, I'll try instead: fpc test.pas Btw, why have fpc and also ppcx64? Does fpc call ppcx64? On 08/16/2017 09:45 PM, Marco van de Voort wrote: In our previous episode, kapibara via fpc-pascal said: I want to use the fp editor to run the test, but it seems as the "systemic" 2.6.4 is being used for compiling instead of the SVN version. Then you use a 2.6.4 FP. FP does not call the compiler, it has an own version of it internally. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using other fpc installation
You're right, now I fixed that and "which fpc" reports the SVN version! On 08/16/2017 10:15 PM, Tomas Hajny wrote: On Wed, August 16, 2017 21:15, kapibara via fpc-pascal wrote: I meant to say that system fpc is put AFTER the SVN fpc in the path. Due to the missing slash at the beginning of the PATH value? ;-) Obviously, that only answers the reason of the 'which fpc' command, whereas the compiler version used when compiling from the IDE has already been answered by Marco Tomas _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using other fpc installation
The old SVN version is now in play, so far so good! But then "Can't find unit system" happened: roger@bikupan:~/fpc/fptest_working$ fpc fptest.pas Free Pascal Compiler version 3.1.1 [2017/08/16] for x86_64 Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling fptest.pas Fatal: Can't find unit system used by fptest Fatal: Compilation aborted Error: /home/roger/fpc/fpc_svn/compiler/ppcx64 returned an error exitcode Before that I had changed the path: roger@bikupan:~/fpc/fptest_working$ PATH=/home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin roger@bikupan:~/fpc/fptest_working$ export PATH=/home/roger/fpc/fpc_svn/bin:/home/roger/fpc/fpc_svn/compiler:/usr/local/bin:/usr/bin:/bin roger@bikupan:~/fpc/fptest_working$ which fpc /home/roger/fpc/fpc_svn/bin/fpc On 08/16/2017 10:27 PM, Tomas Hajny wrote: On Wed, August 16, 2017 22:16, kapibara via fpc-pascal wrote: Ah, so FP has no versions other than the official releases then? (2.6.0, 2.6.2, 2.6.4 and so on) Why doesn't FP use the same compiler revision as the SVN sources it comes with? Because the fp executable is compiled at the same time as fpc? It uses the sources from which it has been compiled (the same way fpc does too). Fp is a separate make target. It may be part of a snapshot, and it may be compiled from SVN sources by you as well (it has some additional prerequisites if you want to have the debugger integrated, and it requires some additional FPC packages compiled first, but nothing special apart from that). Alright then, I'll try instead: fpc test.pas Btw, why have fpc and also ppcx64? Does fpc call ppcx64? Yes - or another compiler binary if (cross-)compiling for a different CPU/platform (e.g. ppc386, ppcarm, ppcjvm, etc.). Tomas ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using other fpc installation
To be sure fpc.cfg is found I started the compilation from fpc's bin directory where the fpc.cfg is located. roger@bikupan:~/fpc/fpc_svn/ bin$ ./fpc /home/roger/fpc/fptest_working/fptest.pas Free Pascal Compiler version 3.1.1 [2017/08/16] for x86_64 Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling /home/roger/fpc/fptest_working/fptest.pas Fatal: Can't find unit system used by fptest Fatal: Compilation aborted Error: /home/roger/fpc/fpc_svn/compiler/ppcx64 returned an error exitcode Here is the fpc.cfg # # Config file generated by fpcmkcfg on 16-8-17 - 21:46:51 # Example fpc.cfg for Free Pascal Compiler # # -- # Defines (preprocessor) # -- # # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed # # -d is the same as #DEFINE # -u is the same as #UNDEF # # # Some examples (for switches see below, and the -? helppages) # # Try compiling with the -dRELEASE or -dDEBUG on the commandline # # For a release compile with optimizes and strip debuginfo #IFDEF RELEASE -O2 -Xs #WRITE Compiling Release Version #ENDIF # For a debug version compile with debuginfo and all codegeneration checks on #IFDEF DEBUG -gl -Crtoi #WRITE Compiling Debug Version #ENDIF # assembling #ifdef darwin # use pipes instead of temporary files for assembling -ap # path to Xcode 4.3+ utilities (no problem if it doesn't exist) -FD/Applications/Xcode.app/ Contents/Developer/usr/bin #endif # # Parsing switches # # Pascal language mode # -Mfpc free pascal dialect (default) # -Mobjfpc switch some Delphi 2 extensions on # -Mdelphi tries to be Delphi compatible # -Mtp tries to be TP/BP 7.0 compatible # -Mgpc tries to be gpc compatible # -Mmacpas tries to be compatible to the macintosh pascal dialects # # Turn on Object Pascal extensions by default #-Mobjfpc # Assembler reader mode # -Rdefault use default assembler # -Ratt read AT&T style assembler # -Rintelread Intel style assembler # # All assembler blocks are AT&T styled by default #-Ratt # Semantic checking # -S2same as -Mobjfpc # -Scsupports operators like C (*=,+=,/= and -=) # -Sainclude assertion code. # -Sdsame as -Mdelphi # -Se error options. is a combination of the following: # : compiler stops after errors (default is 1) # w : compiler stops also after warnings # n : compiler stops also after notes # h : compiler stops also after hints # -Sgallow LABEL and GOTO # -ShUse ansistrings # -Sisupport C++ styled INLINE # -Skload fpcylix unit # -SI set interface style to # -SIcomCOM compatible interface (default) # -SIcorba CORBA compatible interface # -Smsupport macros like C (global) # -Sosame as -Mtp # -Spsame as -Mgpc # -Ssconstructor name must be init (destructor must be done) # -Sxenable exception keywords (default in Delphi/ObjFPC modes) # # Allow goto, inline, C-operators, C-vars -Sgic # --- # Code generation # --- # Uncomment the next line if you always want static/dynamic units by default # (can be overruled with -CD, -CS at the commandline) #-CS #-CD # Set the default heapsize to 8Mb #-Ch800 # Set default codegeneration checks (iocheck, overflow, range, stack) #-Ci #-Co #-Cr #-Ct # Optimizer switches # -Osgenerate smaller code # -Oa=N set alignment to N # -O1level 1 optimizations (quick optimizations, debuggable) # -O2level 2 optimizations (-O1 + optimizations which make debugging more difficult) # -O3level 3 optimizations (-O2 + optimizations which also may make the program slower rather than faster) # -Oo switch on optimalization x. See fpc -i for possible values # -OoNO switch off optimalization x. See fpc -i for possible values # -Op set target cpu for optimizing, see fpc -i for possible values #ifdef darwin #ifdef cpui386 -Cppentiumm -Oppentiumm #endif #endif # --- # Set Filenames and Paths # --- # Both slashes and backslashes are allowed in paths # path to the messagefile, not necessary anymore but can be used to override # the default language #-Fr/home/roger/fpc/fpc_svn/msg/errore.msg #-Fr/home/roger/fpc/fpc_svn/msg/errorn.msg #-Fr/home/roger/fpc/fpc_svn/msg/errores.msg #-Fr/home/roger/fpc/fpc_svn/msg/errord.msg #-Fr/home/roger/fpc/fpc_svn/msg/errorr.msg # searchpath for units and other system dependent things -Fu/home/roger/fpc/fpc_svn/units/$fpctarget -Fu/home/roger/fpc/fpc_svn/units/$fpctarget/* -Fu/home/roger/fpc/fpc_svn/units/$fpctarget/rtl -Fu/home/roger/fpc/pascalscript/Source #IFDEF FPCAPACHE_1_3 -Fu/home/roger/fpc/fpc_svn/units/$fpctarge
Re: [fpc-pascal] Using other fpc installation
Alright, its compiling! It was wrong path in fpc.cfg. The DEB installation creates a directory structure under the fpc directory that matches this: /lib/fpc/3.1.1/units/$fpctarget Thanks again! On 08/16/2017 11:22 PM, Tomas Hajny wrote: On Wed, August 16, 2017 23:08, kapibara via fpc-pascal wrote: The old SVN version is now in play, so far so good! But then "Can't find unit system" happened: You need RTL (and other required units, e.g. from packages) compiled with that compiler version and provide path to it either using fpc.cfg, or -Fu command line parameter(s). Parameter -vt shows the path used by the compiler when trying to find the appropriate version of a compiled unit. Tomas The working fpc.cfg # Config file generated by fpcmkcfg on 16-8-17 - 23:52:00 # Example fpc.cfg for Free Pascal Compiler # # -- # Defines (preprocessor) # -- # # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed # # -d is the same as #DEFINE # -u is the same as #UNDEF # # # Some examples (for switches see below, and the -? helppages) # # Try compiling with the -dRELEASE or -dDEBUG on the commandline # # For a release compile with optimizes and strip debuginfo #IFDEF RELEASE -O2 -Xs #WRITE Compiling Release Version #ENDIF # For a debug version compile with debuginfo and all codegeneration checks on #IFDEF DEBUG -gl -Crtoi #WRITE Compiling Debug Version #ENDIF # assembling #ifdef darwin # use pipes instead of temporary files for assembling -ap # path to Xcode 4.3+ utilities (no problem if it doesn't exist) -FD/Applications/Xcode.app/ Contents/Developer/usr/bin #endif # # Parsing switches # # Pascal language mode # -Mfpc free pascal dialect (default) # -Mobjfpc switch some Delphi 2 extensions on # -Mdelphi tries to be Delphi compatible # -Mtp tries to be TP/BP 7.0 compatible # -Mgpc tries to be gpc compatible # -Mmacpas tries to be compatible to the macintosh pascal dialects # # Turn on Object Pascal extensions by default #-Mobjfpc # Assembler reader mode # -Rdefault use default assembler # -Ratt read AT&T style assembler # -Rintelread Intel style assembler # # All assembler blocks are AT&T styled by default #-Ratt # Semantic checking # -S2same as -Mobjfpc # -Scsupports operators like C (*=,+=,/= and -=) # -Sainclude assertion code. # -Sdsame as -Mdelphi # -Se error options. is a combination of the following: # : compiler stops after errors (default is 1) # w : compiler stops also after warnings # n : compiler stops also after notes # h : compiler stops also after hints # -Sgallow LABEL and GOTO # -ShUse ansistrings # -Sisupport C++ styled INLINE # -Skload fpcylix unit # -SI set interface style to # -SIcomCOM compatible interface (default) # -SIcorba CORBA compatible interface # -Smsupport macros like C (global) # -Sosame as -Mtp # -Spsame as -Mgpc # -Ssconstructor name must be init (destructor must be done) # -Sxenable exception keywords (default in Delphi/ObjFPC modes) # # Allow goto, inline, C-operators, C-vars -Sgic # --- # Code generation # --- # Uncomment the next line if you always want static/dynamic units by default # (can be overruled with -CD, -CS at the commandline) #-CS #-CD # Set the default heapsize to 8Mb #-Ch800 # Set default codegeneration checks (iocheck, overflow, range, stack) #-Ci #-Co #-Cr #-Ct # Optimizer switches # -Osgenerate smaller code # -Oa=N set alignment to N # -O1level 1 optimizations (quick optimizations, debuggable) # -O2level 2 optimizations (-O1 + optimizations which make debugging more difficult) # -O3level 3 optimizations (-O2 + optimizations which also may make the program slower rather than faster) # -Oo switch on optimalization x. See fpc -i for possible values # -OoNO switch off optimalization x. See fpc -i for possible values # -Op set target cpu for optimizing, see fpc -i for possible values #ifdef darwin #ifdef cpui386 -Cppentiumm -Oppentiumm #endif #endif # --- # Set Filenames and Paths # --- # Both slashes and backslashes are allowed in paths # path to the messagefile, not necessary anymore but can be used to override # the default language #-Fr/home/roger/fpc/fpc_svn/lib/fpc/3.1.1/msg/errore.msg #-Fr/home/roger/fpc/fpc_svn/lib/fpc/3.1.1/msg/errorn.msg #-Fr/home/roger/fpc/fpc_svn/lib/fpc/3.1.1/msg/errores.msg #-Fr/home/roger/fpc/fpc_svn/lib/fpc/3.1.1/msg/errord.msg #-Fr/home/roger/fpc/fpc_svn/lib/fpc/3.1.1/msg/errorr.msg # searchpath for units and other system dependent things -F
Re: [fpc-pascal] Pascal support in the Kattis educational site
The results may be sorted also by language name and so all C++ results comes in before Pascal even if runtime is the same. Your program was as fast as No1 but anyway not visible among top ten. This outrageous! ;-) On 08/17/2017 10:21 AM, Ingemar Ragnemalm wrote: A bit of news which I think has some interest here: "Kattis" (open.kattis.com) is a site where students can make programming exercises. This is quite important IMHO; companies look at Kattis results when recruiting. _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpReport released
> fpreport has been committed to FPC SVN: packages/fcl-report. > It should compile on windows, linux, freebsd and darwin. From the wiki: "An important use-case was a Linux server running in a container without X libraries installed" Yep, yep, yep. Finally I can replace my old statically designed reports :) -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/fpReport-released-tp5729564p5729578.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Container class for key-value pairs
> Which container class ist the easiest to use for key-value pairs? All are just as easy. Instead you should state for non-functional requirements. Does it have to be fast? Does it have to be memory efficient? Or as long as you can access it as key-value then it would be fine no matter what the implementation is? -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to call C++ function with Vector
> I am stuck at the keyword vector. > > How is it translated into free pascal? It's hard, you must create additional wrapper that exposes simpler type (pointer or array of pchar) OR make wrapper for the vector methods and simply declare it as an opaque pointer. std::vector is template/generic C++ class that implements a dynamic array functionality, but it can't be used outside C++. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to call C++ function with Vector
> Would it be possible to do this via a Lua shim? How is it even related with that? -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to call C++ function with Vector
> I thought FPC had the ability to execute a fragment of Lua, and Lua I believe can call C++ directly. No, Lua can only call C, just like FPC. You do know the problem of C++ interfacing, don't you? -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] compiler option for $J directive
> There is my old feature request about it > https://bugs.freepascal.org/view.php?id=30344 :) You can monitor it. No one seems to care to implement it, so if you badly need it: sj.patch <http://free-pascal-general.1045716.n5.nabble.com/file/t111899/sj.patch> Apply in compiler directory (please checkout r37430 at least), I only svn diff there, not in the top level directory (I have modifications to certain packages). -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Google Drive API
Marcos Douglas B. Santos wrote > I didn't found... In this path \packages\googleapi\examples only > exists \generator directory. :( > > Trunk, rev 37453. Try this, it wasn't running well due to RTTI changes back then, but probably works now: http://free-pascal-general.1045716.n5.nabble.com/ERESTAPI-TBuckets-unsupported-array-element-type-lt-looks-like-empty-string-gt-td5726387.html -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JavaScript versions of pascal RTL functions (FormatFloat, DateToStr etc)
> The component developer is doing fantastic work with the visual components, and it starts to look really good. visual? how and/or what does it output? will be interesting if ExtPascal dream can be revived somewhat. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there any pascal interface to TensorFlow or other neural network tools?
> or even neural network libraries written in Pascal? Try contacting schuler in Lazarus forum. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiler directive to compile to 64 bits
> Hi, a newbie question but the docs aren't clear on how to say that I want to use the 64-bit compiler, not the i386 fpc -Px86_64 -Twin64 -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Object-oriented file (path) handling library
> is there something simliar to Java's java.io.File or java.nio.Path for FPC? Google makes me think there isn't... No, there isn't. Welcome to hybrid paradigm programming language. It's not difficult to make an OO wrapper for File* SysUtils functions or even the classic ones in System unit, though. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
> When I'm in doubt about the conditional defines, I either google or take advantage of Lazarus: in project->options I select the target CPU family and the target processor, and then I use "show all options" to see which defines are set. fpc -vc is your friend here. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Is there a way to execute code after 'initialization' and before 'main', i. e. AddExitProc complement?
'Initialization' sections are executed in poorly predictable order, so I want to partially order them according to some form of explicit prioritization and execute before control flow enters main block (so I won't need to run all that initialization by hand, neither I would be able to forget to do that). Like: unit UnitA; ... procedure Init; initialization RegisterUnit('UnitA', @Init); end; unit UnitB; ... procedure Init; initialization RegisterUnit('UnitB', @Init, {priority} +1); end; ... procedure SortAndInitialize; ... Can I run SortAndInitialize before 'main' without additional user actions? ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use OpenDocument (.odt) files as templates
> Does someone knows a component to use OpenDocument (.odt) files as templates to generate a .odt output file given some data? FPVectorial seems to support it: http://wiki.freepascal.org/fpvectorial_-_Text_Document_Support -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why win64 program are considerably bigger in exe size than win 32?
> Why? At least pointer size takes double space, multiply it with every instances 1.5x bigger is not impossible. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Modern Compiler Construction using Pascal
I used to play with this a bit: https://github.com/lysee/lysee It's written by a Chinese programmer and I remember reading his page about the language using google translate :p The github page is without documentation, but its older google code page is still accessible (just hope he didn't break anything lately): https://code.google.com/archive/p/lysee/ -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Get user ID for name on Linux
> Is there a complete list of packages available somewhere? $ svn co https://svn.freepascal.org/svn/fpc/trunk fpc $ cd fpc/packages $ ls tadaaa... -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CGI/FastCGI and WS request with a max time response
> The problem is that the WS could take so long time that the entire request will broke with a "time out". I suggest making the request handling asynchronous instead. So request will only register and return some unique id to the requester, then do call to the WS in background thread. An endpoint shall be provided that when given a unique id will check whether the corresponding thread has finished executing or not, returning 200 + response data when done, and 202 if still in progress. This endpoint shall be called in regular interval by the requester, until it finishes processing or your server dies (500). -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] PAS2JS: operations with array of record
ements of an array into a string, and returns the string. · Map([map function]) : creates a new array by mapping elements of the array according to a map function. The map function takes a single parameter of the type of the array items and returns the mapped value. · Peek() : returns the last item. · Pop() : returns the last item and removes it from the array. · Remove([startIndex, ]item) : removes the item if it can be found and returns its previous index, returns a negative value if not found. · Reverse() : reverses the order of the items. · SetLength(newLength) : defines the length of a dynamic array · Sort([compare function]) : sort an array according to the compare function, the comparison function can be omitted for arrays of String, Integer and Float. · Swap(index1, index2) : swaps to items of specified indexes. just an idea. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PAS2JS: operations with array of record
Thanks a lot for the feedback. it worked as expected! The solution was: /* in DWScript world */var recA : JA;recB : JB;recC : JC;for var k:=0 to 2 do begin recC.id := k; recC.name := 'abc'+IntToStr(k); recC.age := 10+k; recB.field1 := 'rec'+ IntToStr(k); recB.params.Add(recC); recA.fields.Add(recB);end;/* in Pas2JS world */var recA : JA;recB : JB; recC : JC;k:Integer;beginfor k:=0 to 2 do begin recC.id := k; recC.name := 'abc'+IntToStr(k); recC.age := 10+k; recB.field1 := 'rec'+ IntToStr(k); TJSArray(recB.params).push(recC); TJSArray(recA.fields).push(recB);end; Take a look at this array of record example, in Smart Pascal world, as long as the datatypes match (e.g. field params is a array of record), we have the pseudo methods functionality "built-in" for all arrays, for instance. Pas2JS could have this high level functionality as well. Using the Pas2JS approach with external classes interfaces it looks so powerful :) <http://free-pascal-general.1045716.n5.nabble.com/file/t339674/codeinsight.png> -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] PAS2JS: JSON suggestion
IMHO, the TJSJSON external class definition is incorrect. Currently, we have class function, if you want to use the stringify method, use this wierd way: TJSJSON.stringify( jsObject); I think code that don't have mutual dependencies should be separate in units: unit ECMA.Json;interface{$mode objfpc}{$modeswitch externalclass}type TKeyValueProcessor = function (Key: String; Value: JSValue): JSValue; JJSON = class external name 'JSON' publicfunction parse(Text: String): JSValue; overload;function parse(Text: String; Reviver: TKeyValueProcessor): JSValue; overload;function stringify(const Value: JSValue): String; overload;function stringify(const Value: JSValue; Replacer: TKeyValueProcessor): String; overload;function stringify(const Value: JSValue; Replacer: TKeyValueProcessor; Space: String): String; overload; end;var JSON: JJSON; external name 'JSON';implementationend. and use like this: JSON.stringify( JsonObject ); -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/_______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Trying to compile ZeosDBO cli program
> Never mind I have it figured out. You have to add the path to > the /etc/fpc.cfg file, such as: You can do it from command line, too. In fact, if you already have it working from Lazarus, simply open Project Options->Show Options->Command Line Parameters tab, copy the content for your fpc options, done. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Python interaction... how?
> Does anyone know of a minimal example or pseudo code or just an explanation? Python actually provides a Python.h that you can convert to a Pascal unit. But inside, it includes a bunch of other header files and conversion might be a tedious task. If you made it, though, simply call: Py_Initialize(); Py_WhateverThereAreMultipleChoicesHere(ProbablyAPythonScriptAsCString); Py_Finalize(); and you're done. But if I have to, I would take the external program approach instead using its interpreter's -c option through TProcess. Communication will then be done through pipes. It's probably slower, but quicker to work. If you take the header conversion approach, however, that might benefit everyone else needing to do the same, just like how the Lua bindings are done (but they're a lot cleaner that makes conversion simpler). -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] [FCL-WEB] Multiple Modules - On Session
> It seems that session management create one separate session by each module That's right but should be OK, as the session is created based on cookie, which if already exists, will be loaded instead of created. If memory serves right, I remember you should set one or a few of these: * fphttp.SessionFactory.SessionCookie * fphttp.SessionFactory.SessionCookiePath optionally, to easily check the created session files, you might want to also set: * (fphttp.SessionFactory as iniwebsession.TIniSessionFactory).SessionDir -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Inline scoped enums
How can this code {$scopedenums on} type Bar = set of (A, B, C); refer to A, B, C? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inline scoped enums
>> How can this code >> {$scopedenums on} >> type >>Bar = set of (A, B, C); >> refer to A, B, C? > Bar.A > Actually Bar.A won't work, notice the "set of". Same problem with var x: (a, b, c). I wonder could they make such code to not compile at all... _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpWeb: How can I use heaptrc in standalone mode?
> Create a call that calls Application.Terminate. I just call DumpHeap(false); instead -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] detecting recursive loops
> Any ideas how to identify potential unintentional loops? That depends on your design. Is it intended that the 3 procedures can call each other, directly or indirectly? If no, then things are a lot easier. You can just put on the currently entered procedure name to a map shared by the 3 (or just make it global) and on start of each procedure, you check whether the current procedure is in the map already or not. If yes, then the current call stack has formed a recursion. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on Android tablets: ARM, x86_64
> Has anybody come across https://wiki.termux.com/wiki/Main_Page which I've seen mentioned elsewhere? Yes, that's current terminal emulator in my android devices. We can contribute just by making pull request here: https://github.com/termux/termux-packages/pulls -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] השב: Re: Free e-book: Free Pascal from Square One
נשלח מסמארטפון ה-Samsung Galaxy שלי. הודעה מקורית מאת: Joost van der Sluis תאריך:27/05/2018 20:07 (GMT+02:00) אל: fpc-pascal@lists.freepascal.org נושא: Re: [fpc-pascal] Free e-book: Free Pascal from Square One Op 27-05-18 om 18:18 schreef Jonas Maebe: > See http://www.contrapositivediary.com/?p=4034 > > It's by Jeff Duntemann, and based on his 1993 book "Borland Pascal 7 > from Square One". His original book was fabulous. I've learned everything from him. Discussed with him a new version of this book years ago. This is really great! I'm very curious.. Regards, Joost. ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Default record fields
> My thinking was that because variables can assign values at declaration it would be reasonable to assume that record fields could have default values which would be assigned at declaration. It sounds like a natural extension of the syntax that already exists. Those are two different things actually: Declaration time initialization for variables vs default record field values. The former doesn't cause confusion because the value and the variable are in the same place, but the latter does, as Sven said: "On the other hand to know whether the fields are initialized or not you'd need to navigate to the type which means leaving your current zone of development." Now suppose you have that feature a record type T in unit A, then a code somewhere that uses unit A has a variable V of type T declared. How could you be sure what value that V holds? At best you have to initialize it right there anyway, making the default value useless. Certainly don't imagine you're the writer of unit A who knows that T has some default values. Other languages POV are mostly simply ease of typing, they don't think the consequences this far. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Lazarus and Linked Lists
> Is there a basic linked List object for Lazarus? https://svn.freepascal.org/svn/fpc/tags/release_3_0_4/packages/fcl-stl/src/glinkedlist.pp -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ 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
> So it can’t be done? Only through macro ATM, I believe. Note that case statement body does NOT expect a set (it expects values, list of values and/or range of values), despite the very similar look (missing enclosing angle brackets only), hence the inability to do what you want. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC_PCHAR_LENGTH dog slow
> i think i'm still waiting for the string "length byte" becoming a "length word" or possibly a "length long" so the speed of pascal strings can be reacquired -=B-) Ansi and any other dynamic strings already have length longint that allows 2GB string length with O(1) length retrieval. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC for linking only
> Is it possible to use FPC for linking only? I've asked this in the past with straight "no" answer. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Announcement GLPT
> https://github.com/daar/GLPT This is more GLFW rather than GLUT. Good, I prefer it this way as I have much greater control with regards to the event handling. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Uniform initialization?
> But *if* I had to decide I would pick #1, cause then there wouldn't be > the chance to break existing code if a user decides to add a constructor > to their record and some other code relies on there not being a > constructor. Also due to the syntax > TYPENAME(FIELDNAME:VALUE[;FIELDNAME:VALUE[;…]]) it's in principle > possible to have the parser distinguish whether it's a typecast or a > default constructor. I would pick #1, too, seems more natural to me. There's no ambiguity as well thanks to : in the syntax. I do wonder how often this would be used, though. Despite being idiomatic in many languages, it doesn't really save much typing that traditional way (if that's the main purpose). -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Running tests with FPC units only
> acording example I found in FPC examples directory, Check the one here instead: $(fpcsrcdir)/packages/fcl-fpcunit/src/demo/consolerunner/testrunner.pp It depends only on FPC units. I guess you're looking at examples from Lazarus directory instead of FPC. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] trying to use C code in .pas on WIN32
I've done research, but am just missing something. my .pas code links just fine, but doesn't RUN. ( first writeln never appears ) If I remove the external call to C code, then the writeln works as normal. Problem: I have c code, which I'm compiling on a WIN32 machine ( yes the horror ) using GCC 4.5.2 target mingw32 It generates .o files which i grouped together with ar into common.a I then renamed common.a to be libcommon.a Then I have a Common.pas file: unit Common; interface uses sysutils, dos, CTypes; {$linklib libcommon.a } procedure CutilInit; cdecl; external 'CutilInit'; implementation end. the a CommonTest.pp file: Program commonTest; uses Common; begin writeln('got here'); CutilInit(); end. fpc.exe -TWin32 -Mdelphi -vw -Sg -Ci -O1 -Cp386 -XS -gl -p- -b- is the relevant way I'm invoking fpc It links, but then does nothing on execution. If I change the C line to be: procedure CutilInit; cdecl; external; I think get a link error Undefined Symbol: _CutilInit Any ideas ? Does the linklib define need to be below where I declare the C routines ? Is it something to do with WINDOWS.. ( aka the _ in the name ) Maybe I need different options on the C compile.. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
Thanks for the suggestions.. I'm pretty sure now, that the problem is that I'm thinking that the C code is being statically linked, but right now the compiler is going for dynamic. [ I've been comparing the size of the .exe ] I also compiled with -va and note: [0.388] Number of unresolved externals in objects 214 [0.388] Number of unresolved externals after static libraries 214 [0.388] Number of unresolved externals after defining COMMON symbols 214 [0.389] Number of unresolved externals after DLL imports 0 [0.396] There were 1 errors compiling module, stopping when I don't try and call the C routine the number of unresolved objects is only 213 compiler switches: -TWin32 -va -Mfpc -vw -Sg -Ci -O1 -Cp386 -OpPENTIUM3 -Ratt -gl -p- -b- I had -XS in there, but it doesn't seem to change anything. So I'm just looking to static link external C code to a pascal program on a windows machine thanks john -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
ok. I backed up to a simple version. how I declare the C routine must be the problem, with nothing, procedure HelloC; cdecl; external; I think it's trying to static link it, and gets an pcode.pas(19,1) Error: Undefined symbol: _HelloC with anything else procedure HelloC; cdecl; external 'HelloC'; it links, but dynamically and then the routine is never found. pcode.pas program pcode; {$MODE OBJFPC} {$R+} uses ctypes, sysutils, dos, math; procedure HelloC; cdecl; external; type UINT8 = 0..255; UINT16 = 0..65535; UINT32 = Longword; begin writeln('Test'); HelloC; end. ccode.cpp #include #include void HelloC(void) { printf("Hello \n"); } makeit.bat @set ToolPath=C:\VCAST63\MinGW\bin @set cc=%ToolPath%\gcc.exe @set SAVED_PATH=%PATH% @set PATH=%ToolPath%;%PATH% @set BASE=%cd% %CC% -g -I%BASE% -DGNU_WIN32 -O1 -Wunused-variable -c ccode.c -o ccode.o fpc -MDelphi -MDelphi -vw -Sg -Ci -O1 -Cp386 -OpPENTIUM3 -Ratt ^ -Fu%FPC_BASE%\units\i386-Win32 ^ -Fu%FPC_BASE%\units\i386-Win32\* ^ -Fu%FPC_BASE%\units\i386-Win32\rtl ^ -FlC:\VCAST63\MinGW\lib ^ pcode.pas @set PATH=%SAVED_PATH% @exit /b -- so now I'm back to the error of undefined symbol C:\FPC\use_c_with_pas>fpc -MDelphi -MDelphi -vw -Sg -Ci -O1 -Cp386 -OpPENTIUM3 -Ratt -Fu\units\i386-Win32 -Fu\units\i386-Win32\* -F u\units\i386-Win32\rtl -FlC:\VCAST63\MinGW\lib pcode.pas Free Pascal Compiler version 2.4.4 [2011/04/23] for i386 Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Win32 for i386 Compiling pcode.pas Linking pcode.exe pcode.pas(19,1) Error: Undefined symbol: _HelloC pcode.pas(19,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\2.4.4\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled ) This is on an evil windows machine thanks for the help guys john -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
sven, so I just tried, what I think you said: procedure HelloC; cdecl; external name 'HelloC'; pcode.pas(19,1) Error: Undefined symbol: _HelloC sorry for complaining about windows, but i feel like this is more difficult on windows. All of the FPC examples, seem to run without this extra '_' business and i suspect they are on linux Os macOs. Here at work I'm on a windows machine, but at home I'm happily running FPC on a mac -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
THANKS GUYS. This is now working. The 'fix' was to actually install fpc 3.0.4 on this machine. My trusty 2.4.4 still compiled just fine what I use it for here at my day job. But it seems 2.4.4 was not really pulling in the static reference. { $L ccode.o } So for anyone else searching on this: ccode.cpp #include #include void HelloC(void) { printf("Hello \n"); } pcode.pas program pcode; {$L ccode.o } {$linklib msvcrt} uses ctypes, sysutils, dos, math; procedure HelloC; cdecl; external name 'HelloC'; type UINT8 = 0..255; UINT16 = 0..65535; UINT32 = Longword; begin writeln('Test'); HelloC; end. compiled on WIN32 with: @set ToolPath=C:\VCAST63\MinGW\bin @set cc=%ToolPath%\gcc.exe @set SAVED_PATH=%PATH% @set PATH=%ToolPath%;%PATH% @set BASE=%cd% %CC% -g -I%BASE% -DGNU_WIN32 -O1 -Wunused-variable -c ccode.c -o ccode.o rem %cc% -o test.exe ccode.o pcode.o -lwsock32 fpc -MDelphi -vw -Sg -Ci -O1 -OpPENTIUM3 -Ratt ^ -Fu%FPC_BASE%\units\i386-Win32 ^ -Fu%FPC_BASE%\units\i386-Win32\* ^ -Fu%FPC_BASE%\units\i386-Win32\rtl ^ -FlC:\VCAST63\MinGW\lib ^ pcode.pas @set PATH=%SAVED_PATH% @exit /b thanks again! john -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
Marc, Hmmm. Okay, I just switched it to be stdcall and had to slightly alter the name, but it compiled and ran. So my example is now with "cpp" names, so my HelloC is now: procedure HelloC; stdcall; external name '__Z6HelloCv'; vs procedure HelloC; cdecl; external name '_Z6HelloCv'; both link and run. lol - ok, this routine had no parameters. So I just added one parameter and both stdcall and cdecl work with only the name change.. even when i have the cpp routine allocate something on the stack. So, I'm not sure who's cleaning up the stack: Caller or callee Strange. from the programing guide there should be a difference between cdecl and stdcall but then we have "When linking with code blocks compiled with standard C compilers (such as GCC), the cdecl modifier should be used so as to indicate that the external routine uses C type calling conventions." so I'm going to stick with cdecl and for now it's working and will be more compatible when I also use this code on MacOs cheers john -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] How to uninstall old FPC
How do I remove all of FPC 2.6.4 from macOS (11.6.4) so that I can install the newest version? Is everything in /usr/local/bin/ppc386 (see below)? $ fpc Free Pascal Compiler version 2.6.4 [2014/02/26] for i386 Copyright (c) 1993-2014 by Florian Klaempfl and others /usr/local/bin/ppc386 [options] [options] Jerry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to uninstall old FPC
> On Feb 13, 2019, at 10:44 AM, Jonas Maebe wrote: > > On 13/02/19 10:55, list_email--- via fpc-pascal wrote: >> How do I remove all of FPC 2.6.4 from macOS (11.6.4) so that I can install >> the newest version? Is everything in /usr/local/bin/ppc386 (see below)? >> $ fpc >> Free Pascal Compiler version 2.6.4 [2014/02/26] for i386 >> Copyright (c) 1993-2014 by Florian Klaempfl and others >> /usr/local/bin/ppc386 [options] [options] > > You can just install the new version and it will become the default. If you > wish to remove the remnants of the old version, you can delete the directory > /usr/local/lib/fpc/2.6.4 At 300+ MB I think I will. Thanks! Jerry > > All fpc-related files in /usr/local/bin will be overwritten by files with the > same name of the newer version. > > > Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CopyFile for FreePascal without Lazarus?
> but that seems to only work with Lazarus. The unit is part of LazUtils package. It has no dependency on other packages but indeed can't be used as a standalone unit, you need other units from the same package but that's all. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Improve message "Wrong ppu found"
> Please provide a real example of a compiler output, cause I can't find "Wrong ppu found" in the sources. I think what he meant is: $ grep -i 'wrong ppu version' -r * pkgutil.pas: Comment(V_Error,'Wrong PPU Version '+tostr(ppuversion)+' in '+PPUFn); utils/ppufiles.pp: Error('Error: Wrong PPU Version : '+PPUFn,false); utils/ppumove.pp: Error('Error: Wrong PPU Version '+tostr(ppuversion)+' in '+PPUFn,false); -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Does FPC require glibc?
Empty Message___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Does FPC require glibc?
On Monday, May 6, 2019 10:48 PM, Sven Barth wrote: > Nozz via fpc-pascal schrieb am Mo., 6. Mai > 2019, 22:18: > >> Empty Message > > Depends on what you're using (and the platform). E.g. the compiler itself > runs without glibc on Linux, but if you need to use threads for example that > changes. Also if you link against libraries like GTK or Qt you also > indirectly link to glibc and the RTL's initialization code will change due to > this. > On some targets (e.g. macOS) using the C library is a must. > > Regards, > Sven Thanks, if I want to compile a program for Alpine Linux (musl libc instead of glibc) , is my best option to compile FPC&Lazarus from source?_______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using docker to build software
> I am curious to know if there is someone out there that have tried to > use Docker (https://www.docker.com) containers to build fpc applications? Search docker hub, you will find a lot of them, either fpc only, with lazarus, single target or even cross compiling ready. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Documentation generation
> How are the FPC RTL documentations generated? I wanted to see if I could generate .docsets files from them also. A starting point: https://wiki.freepascal.org/FPCDocs_Tutorial I believe that "write me" part is not far from calling make with certain options. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generic type conflicts
On 02/11/2019 16:55, Ryan Joseph via fpc-pascal wrote: I've wanted to make a generic version of a vector for a while but I always give up because it seems not very possible. It's probably not even a great idea because many methods don't translate between float and integer but I wanted to prevent other code duplication if possible. Here's an example of how things break down. Are there any solutions for this currently? I feel like generics need to support some compiler directives so different blocks of code can specialize different depending on the type. {$mode objfpc} {$modeswitch advancedrecords} program generic_vector_2; uses Math; type generic TVec2 = record x, y: TScalar; function Normalize: TVec2; end; TVec2f = specialize TVec2; TVec2i = specialize TVec2; function TVec2.Normalize: TVec2; var fac: TScalar; begin // Can't determine which overloaded function to call // Incompatible types: got "Extended" expected "LongInt" fac:=Sqrt(Sqr(x) + Sqr(y)); if fac<>0.0 then begin // Incompatible types: got "Single" expected "LongInt" fac:=1.0/fac; result.x:=x*fac; result.y:=y*fac; end else begin result.x:=0; result.y:=0; end; end; begin end. Regards, Ryan Joseph _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal You need to do a explicit typecasting. ... fac:=Sqrt(Sqr(TScalar(x)) + Sqr(TScalar(y))); ... fac:=1.0/TScalar(fac); _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC cannot understand 1-char string as PChar
FPC 3.3.1-r43022 [2019/09/16] for Linux x64. This code crashes, because fpc sees 'x', 'y' wrong: Py_BuildValue('{sLsisisisisisisOsOsOsisisisisisO}', 'tag', Mark.Tag, 'x', Mark.PosX, 'y', Mark.PosY, 'len', Mark.LenX, I must change it to this, it works ok: Py_BuildValue('{sLsisisisisisisOsOsOsisisisisisO}', 'tag', Mark.Tag, PChar(string('x')), Mark.PosX, PChar(string('y')), Mark.PosY, 'len', Mark.LenX, Py_BuildValue is from Python-for-Lazarus package. Py_BuildValue: function( format: PAnsiChar {;...}): PPyObject; cdecl varargs; -- Regards, Alexey _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TEventObject.Create site help
https://www.freepascal.org/docs-html/current/fcl/syncobjs/teventobject.create.html Create creates a new event object with unique name AName. The object will be created security attributes EventAttributes (windows only). - "created security" - "with" missed - "windows only"-> "parameter is used on Windows only" -- Regards, Alexey ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TEventObject.ManualReset help page
https://www.freepascal.org/docs-html/current/fcl/syncobjs/teventobject.manualreset.html text is poor, even the text in .Create (about ManualReset) is more detailed, so copy text from .Create to this page. -- Regards, Alexey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] StringList micro optimization
Procedure TStrings.SetDelimitedText(const AValue: string); has about 16 calls to Length(AValue), so make a variable NLen to speed up it. -- Regards, Alexey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TStringList.SetCommaText needs refactor
It's obvious this needs to use SetDelimetedText with other params (2nd 3rd) Procedure TStrings.SetCommaText(const Value: string); begin CheckSpecialChars; C1:=Delimiter; C2:=QuoteChar; Delimiter:=','; QuoteChar:='"'; Try SetDelimitedText(Value); Finally Delimiter:=C1; QuoteChar:=C2; end; end; it's obvious this needs to be changed too: procedure TStrings.AddCommaText(const S: String); var L: TStringList; begin L := TStringList.Create; try L.CommaText := S; AddStrings(L); finally L.Free; end; end; -- Regards, Alexey ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] DirectoryExists on FreeBSD 12 problem
freebsd src is https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h it has 2 defines for "stat": usual struct stat { dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ nlink_t st_nlink; /* number of hard links */ *mode_t st_mode; /* inode protection mode */* . and additional one for freebsd 11: #if defined(_WANT_FREEBSD11_STAT) || defined(_KERNEL) struct freebsd11_stat { __uint32_t st_dev; /* inode's device */ __uint32_t st_ino; /* inode's number */ *mode_t st_mode; /* inode protection mode */* FPC-- https://github.com/graemeg/freepascal/blob/master/rtl/bsd/ostypes.inc#L65 the 1st freebsd type is compatible with FPC (I checked only by list of fields and order of fields, w/out checking aligns). the 2nd is NOT compatible with FPC. so i wonder, which define freebsd 12 uses??? I cannot google it easily. DirectoryExists reads st_mode item. -- Regards, Alexey ___________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] DirectoryExists of FreeBSD 12- Java solution
https://github.com/jnr/jnr-posix/issues/126 these guys had found the reason of broken Java code on freebsd 12: they now detect ABI version and use different struct on freebsd 12. link shows Github patch to Java "stat" struct. -- Regards, Alexey _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Strange experience with TJsonConfig.Clear
Hi, I experienced some strange behaviour with TJSONConfig.Clear. I'm using fpc 3.0.4 32-bit on Win10-64. (While I do have fpc trunk as well, the program is a Lazaurs GUI program and I don't like using Lazarus (trunk) in combination with fpc trunk.) I have a TJSONConfig that I use to store addresses. var CFG: TJSONConfig ... Cfg.Filename:= Fn; Cfg.Clear; Cfg.Formatted := True; Cfg.JSONOptions := Cfg.JSONOptions + [joIgnoreTrailingComma]; ... //write general info Cfg.SetValue(jpInfoCopyRight, Utf8Decode(ABook.Copyright)); //write addresses, List is a TSTringList Cfg.SetValue(jpaPerson, List, True); This creates a file like "AdresBoek" : { "Info" : { "CopyRight" : "Copyright (c) 2011 by Flying Sheep Inc. & Bart Broersma", }, "Personen" : { "Persoon000" : { "Naam" : "Een", "Voornaam" : "äëï" }, } } So far so good. Now I simply run that code again and now I get: "AdresBoek" : { "Info" : { "CopyRight" : "Copyright (c) 2011 by Flying Sheep Inc. & Bart Broersma", }, "Personen" : { "Persoon000" : { "Naam" : "Een", "Voornaam" : "äëï", "Naam" : "Een", "Voornaam" : "äëï" }, } } It duplicates all entries for Persoon000 (and does that for all following Keys in Personen) and will repeat that upon each run. This of course sucks, because when I change e.g. "Naam", it still writes the old value. And since I don't write keys with empty values (if "Naam" is empty string, it is not stored), I can no longer clear "Naam", because the old value remains and will be read back. Also the filesize grows to very huge very soon. Now when I add a check in the code __after__ Cfg.Clear to see if I still can read the entry with Cfg.GetValue, it is there. Cfg.Clear; //write general info if Cfg.GetValue(jpInfoCopyRight,'')<>'' then writeln('Cfg.GetValue(jpInfoCopyRight) NOT empty'); Cfg.SetValue(jpInfoCopyRight, Utf8Decode(ABook.Copyright)); //write addresses, List,Persons,Def are TSTringList if Cfg.GetValue(jpaPerson, Persons, Def) then writeln('Cfg.GetValues ',jpaPerson,' = TRUE'); Cfg.SetValue(jpaPerson, List, True); Sure enough it ouputs: Cfg.GetValue(jpInfoCopyRight) NOT empty Cfg.GetValues /AdresBoek/Personen/Persoon000 = TRUE Isn't TJSONConfig.Clear supposed to clear all contents? The weirdness in this is: - This only started to happen after unrelated code changes (the code to save was not altered at all), before that I behaved as I expected. - Why does it duplicate the values of Person, but not the value of jpInfoCopyRight? - When I move Cfg.Clear to the line below Cfg.JSONOptions := Cfg.JSONOptions + [joIgnoreTrailingComma], then it behaves normally again. The application is build with -Criot -gh -gt. It raises no exceptions and no memory leaks are reported. I was unable to reproduce the issue in a simple test program that just writes values to a TJSONConfig. (In fact I started out writing simple test programs reading and writing TJSONConfig before trying to attempt to convince my addressbook application to write to a TJSONConfig in the first place) Before you ask: my app doesn't use threads. Any thoughts on this? -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Strange experience with TJsonConfig.Clear
On Sat, Nov 23, 2019 at 7:47 PM Bart wrote: As I was afraid: User error! Cfg.JSONOptions := Cfg.JSONOptions + [joIgnoreTrailingComma]; This forces a reload of the file (since Filename isn't empty at this point). (B.t.w. fpc trunk raise an error : An unhandled exception occurred at $00438A84: EJSON: Duplicate object member: "Naam" $00438A84 TJSONDATA__DOERROR, line 1388 of ./fcl-json/src/fpjson.pp $0043C593 TJSONOBJECT__DOADD, line 3411 of ./fcl-json/src/fpjson.pp $0043C5CA TJSONOBJECT__ADD, line 3426 of ./fcl-json/src/fpjson.pp That's better than screwing up the file ... ) -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] StringList encoding question
Hi, Consider this code: {$codepage utf8} {$mode objfpc} {$H+} uses SysUtils, Classes; var SL: TSTringList; S: String; begin writeln('DefaultSystemCodePage = ',DefaultSystemCodePage); SL := TStringList.Create; {$if fpc_fullversion > 30200} SL.WriteBom := False; {$endif} SL.SkipLastLineBreak := True; S := 'ä'; //S has CodePage CP_UTF8 SL.Add(S); SL.SaveToFile('slU.txt'{$if fpc_fullversion > 30200}, TEncoding.UTF8{$endif}); SL.SaveToFile('slA.txt'{$if fpc_fullversion > 30200}, TEncoding.ANSI{$endif}); SL.Free; end. Tested with fpc trunk (form a few days ago). It outputs: DefaultSystemCodePage = 1252 (I'm on Windows as you might have guessed) The file slA.txt contains the bytes C3 A4 (which is ä in UTF8 encoding) The file slU.txt contains the bytes C3 83 C2 A4 I struggle to understand why. What is the codepage of the stringlist's internal list of strings (array of TStringItem's)? It seems that the stringlist considers it's internal TStringItem.FString that has #$C3A#$A4 to have a codepage of CP_ACP (always)? Bart -- Bart _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Calling function pointer to main program
> I know I can use -XM to set another function name besides "main" but then how do I call back the original function "main" later? I quickly analyze the generated assembly when you don't pass -XM: .globl main .type main,@function main: .globl PASCALMAIN .type PASCALMAIN,@function PASCALMAIN: vs when you do (-XMmymain): .globl mymain .type mymain,@function mymain: .globl PASCALMAIN .type PASCALMAIN,@function PASCALMAIN: so basically the original main does nothing and jump straight to PASCALMAIN, which is always there. So you can make your own main in a separate file that must be linked in during linking which calls whatever name you pass to -XM. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TIniFile.WriteString gives file with BOM, bad
ini_lexmap:= TIniFile.Create(fn_lexmap_final); try ini_lexmap.WriteString('ref', IntToStr(i_sub), s_lexer); finally FreeAndNil(ini_lexmap); end; with FPC trunk it converts .ini file to UTF8 BOM! Bad, because then my code reads this .ini file and it cannot find its 1st section: BOMCHARS[ref] is not found, only [ref] is found in original file. So 1) don't write BOM via WriteString 2) if BOM is there, allow ReadString to find section at the file begin: BOMCHARS[ref] fpc 3.3 r43852 linux x64. -- Regards, Alexey _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad
TIniFile manually adds the BOM to the first Line. Then SaveToFile is called, which (if FEncoding = Utf8) will add the BOM again? Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad
On Fri, Jan 10, 2020 at 5:57 PM AlexeyT via fpc-pascal wrote: > 1) don't write BOM via WriteString It doesn't AFAICS. The BOM is written in UpdateFile. > 2) if BOM is there, allow ReadString to find section at the file begin: > BOMCHARS[ref] I can read/write IniFiles with BOM with fpc r43847, with and withoud DefautSystemCodePage := CP_UTF8. TIniFile might benefit from a WriteBom (Boolean) property ? -- Bart _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad
>> 2) if BOM is there, allow ReadString to find section at the file begin: I can read/write IniFiles with BOM with fpc r43847, with and withoud DefautSystemCodePage := CP_UTF8. Sorry, my mistake-- TIniFile can read this BOM file, but my software cannot: a) I've fixed one place where my app reads ini files via TextFile. b) I canNOT fix another place where PYTHON library reads ini file (Python has module for ini files). c) So yes, I want to disable BOM writing at all. -- Regards, Alexey _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad
Can you add TIniFile.WriteBom property? it's not quite enough, I need to disable it globally in entire app (I have ~10 ini objects), so additional global default is needed (like Lazarus has global variables). -- Regards, Alexey _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad
On Fri, Jan 10, 2020 at 11:30 PM AlexeyT via fpc-pascal wrote: > Can you add TIniFile.WriteBom property? it's not quite enough, I need to > disable it globally in entire app (I have ~10 ini objects), so > additional global default is needed (like Lazarus has global variables). Open a ticket in the bugtracker? -- Bart _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess and zombie processes in *nix systems
On Tue, Jan 21, 2020 at 9:41 PM Graeme Geldenhuys wrote: > 2. Anybody else experience this zombie processes hanging > around in *nix systems? Is there any option in TProcess > to prevent that? https://bugs.freepascal.org/view.php?id=11797 -- Bart _______ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal