[fpc-pascal] SimpleIPC examples in docs
I thought I remember some simpleipc examples in the documentation a while ago (years ago).. Can't seem to find them in the current docs. Were they moved elsewhere or did I miss finding them? For what I need I will probably not be using any lazarus components, but rather ipc without LCL involved. There are indeed lazarus examples kicking around. The fpc documentation has: [Overview][Resource strings][Constants][Types][Classes][Variables][Index] Maybe an [Examples] would be a handy link, but some examples are hidden away in specific pages. Could index all the examples I suppose, with fpdoc tool, but not sure if that would be useful to people. Or there could already be an examples feature in the docs that I don't know about. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] simpleIPC strings
With simpleipc you can send a string. I am wondering what type of string is safe to send? i.e. what happens with utf8 or unicode? Is it meant to send a regular string (like a pointer to char) and not more complex strings? Both? Because if a string is being sent across two different separate processes (exe's) and possibly in different programming languages (when I make simpleipc DLL) it will be handy to know what exact type of string this communication is meant for: english characters, unicode, utf8, all of the above. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Record operator for assignment
> On May 8, 2017, at 10:47 AM, nore...@z505.com wrote: > > It's always easier said than done, to say "Why can't" and then have to write > the actual parser code to do it ;-) Yes indeed. I just looked over svn to see where Sven added his new dynamic array initializers and I’m still totally confused. It’s really a miracle anyone is able to contribute to such a large code base without any documentation. Since we have record constructors and static class functions for records now it seems like the language is going out of its way to provide the simplest solution. Yeah Golang has the same thing: c := Circle{x: 0, y: 0, r: 5} and basically the same syntax as Pascal or Swift. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
On 2017-05-05 14:27, Brian wrote: Affinity If a thread is dedicated to say , polling a serial or Ethernet port which has a high input data rate , then dedicating one CPU to that task/thread is useful. Isn't the speed of serial (so slow) that it would be overkill to dedicate a Cpu to it? Maybe usb 2 or 3, or possibly Gigabyte ethernet 1000 speed ;-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Vehicle management
On 05/07/2017 11:11 PM, nore...@z505.com wrote: On 2017-05-07 13:33, Mark Morgan Lloyd wrote: Has anybody used FPC to talk to a vehicle via the OBD connector? Can anybody give me a quick summary of the position of FPC on Android etc.? (Graeme, that includes FPCgui if it's relevant). We've been caught short by a vehicle problem that appears to be only fixable by a VB.NET program. However it's GPLed and we're trying to lean on the (reluctant) author for the source, it would be a natural to transcribe to e.g. a tablet or possibly a bratphone. I was looking in to this idea too. The only sources I found was some plain C or some kind of C code on sourceforge, which could (painfully) be converted or at least derived from to get ideas for FPC. The downside is that this did not work on a windows Tablet, it has some GUI issues that doesn't work right on a tablet, but works fine on a desktop pc. Can't remember the name of the software and don't remember what platforms it ran on.. maybe could find it by going to https://www.google.ca/search?q=obd+sourceforge But there is also github... But as for FPC code or lazarus code? I have no idea. Would be interesting to know. www.ctrlterm.com (fpGUI) works *very* well on a Windows 8.1 tablet with no extra worked needed for the touch screen! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] machine readable grammar of object pascal?
On 2017-05-03 06:49, Peter wrote: On 03/05/17 00:53, Marc Santhoff wrote: Hi, for playing around I would need a grammar of Object Pascal. I do not care for which tool it is written or at best if it is plain EBNF. Does such grammar exist? TIA, Marc I found grammar for Delphi once. Trying to attach it. Which version? Delphi 5? 4? 7? There is really no such thing as "delphi" language since there are more than 10 versions of it ;-) But to find even a subset, would be handy. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Record operator for assignment
On 2017-04-28 01:01, Ryan Joseph wrote: On Apr 28, 2017, at 12:43 PM, Sven Barth via fpc-pascalwrote: It would introduce an ambiguity as "(x" could also complete to other expressions (e.g. "(x + y) * 2" or even merely "(x)"). Especially older Pascal compilers were geared towards the simplicity of the language and thus they didn't add it. For FPC it simply never came up. I never thought about it either until I saw some c++ code doing it. Despite having overlooked it, it’s basically a built in record constructor that’s been in the language since forever. You can also look into GoLang for struct ideas, as golang is simpler than C++ rec := (x: (x + y) * 2; y: 0; z: 0); Why can’t everything between : and ; just be treated like a normal assignment? “x” is already defined but it’s just a label and not part of the assignment. It's always easier said than done, to say "Why can't" and then have to write the actual parser code to do it ;-) I think fpc is based on wirth's simplicity, and even wirth's languages probably did not have the ability to setup a record initially with default record as another poster said. I do like this feature a lot , but can see why a minimalist like worth would avoid it. It's similar to this feature: x,y,z := 1, 12, 7 It's neat to be able to assign multiple variables on a single line. But necessary? mandatory? Again, could look into golang for ideas.. may have something like it too, without becoming a large C++ mammoth. In fact that's how golang's error checking works. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] simpleIPC for all programming languages ?
I was thinking, that I need a way to use IPC (inter process communication) in all languages, so for example I could compile a plain C exe, Delphi exe, Rust exe, Nimrod exe, or GoLang exe and communicate back with fpc (very powerful idea). But simpleIPC is only available for FPC/lazarus, not other tools, so really it's only good for fpc to fpc communication. But the whole point of IPC is that it's general purpose for any exe/elf. So rather than rewrite simpleIPC in every language out there, (big waste of time), why not just load SimpleIPC.dll where the fpc compiled dll contains simpleipc functions? Any programming language that can load a DLL (virtually all languages these days) can now use simpleIPC. Each program that wants to use ipc, simply loads the simple ipc dll written in fpc. So this way delphi could communicate with fpc/lazarus programs, golang could communicate, nimrod, rust, c, c++, etc. Then I would create a simpleIPC website advertising this idea, as an alternative to say ZeroMQ. Then some small questions arise: is it possible to statically link fpc code into other programs rather than it being a DLL? for example .a files instead of a dll at runtime? Then theoretically, IPC could be linked in statically, not just as a dll. Indeed the dll functions will need to be flattened out (non object oriented) so all languages can use IPC, but that's not a problem for me - simply I write some wrappers around SimpleIPC objects and make them plain C/pascal like procedures, which is not so hard. I have forgotten if fpc can generate .a files to statically link? I know it can link in AFAIK .a static files, for example sqlite? But the other way around: fpc generating static .a files? This is not mandatory for this idea to work, just would be interesting to know, as an alternative to a run time loaded IPC dll. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Translation C to Pascal
On 2017-05-02 18:49, Marc Santhoff wrote: On Di, 2017-05-02 at 08:33 -0700, fredvs wrote: Hello. The best (IMHO) is c2pas32 --> http://www.astonshell.com/freeware/c2pas32/ Nice program, i fed the adc.c source from STMs fwlib for stm32f4 through and the generated code looks fine. There is some guessing on type casts, but I hope those can be cleared using simple scripting or the like. There was also a mailing list thread about this a few weeks/months ago, where I was discussing the idea with a few other people on the list. Another idea is to link in C source as .a files into your fpc program? If you want to write wrappers around the C code and use the C code directly as .a files from gcc generated... But depends.. what you need. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] machine readable grammar of object pascal?
On 2017-05-03 04:37, Michael Van Canneyt wrote: On Wed, 3 May 2017, denisgolovan wrote: On 2017-05-03 00:53, Marc Santhoff wrote: Does such grammar exist? Well, it depends on what you are trying to solve. If you want to parse Pascal using FPC - that's one way. If you want to get some king of AST using any available [command-line] tools - that's another one. Talking about latter - I would take LPEG (Lua+PEG) and create a parser myself. It comes quite simple and intuitive (contrary to LL,LR,LALR,...). Most of Object Pascal is done right (minus sets/open arrays), Add generics to the 'minus' list. Does it take into account little bizarre things like writable consts (assignable consts) like const i: integer = 0; which is like a variable, but called a const ;-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] machine readable grammar of object pascal?
On 2017-05-02 18:53, Marc Santhoff wrote: Hi, for playing around I would need a grammar of Object Pascal. I do not care for which tool it is written or at best if it is plain EBNF. Does such grammar exist? The issue is that there is no object pascal, or in other words, there's about 5 million different versions of it. Delphi 5 is different than delphi 6, 7, 8, as things keep changing... It's not like Plain C which stays mostly the same. So in order to get a grammar, you'd need to only include a subset of object pascal in a certain version. Delphi 5 compatibility would be a good candidate (subset)... as it is a fairly small language or subset (well, no, actually it's Big like Ada..) but would not include generics and all the other features of object pascal. This is one of the biggest issues object pascal faces is that it is not very standard and keeps changing, but C++ is very similar to this, despite supposed standards existing ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Vehicle management
On 2017-05-07 13:33, Mark Morgan Lloyd wrote: Has anybody used FPC to talk to a vehicle via the OBD connector? Can anybody give me a quick summary of the position of FPC on Android etc.? (Graeme, that includes FPCgui if it's relevant). We've been caught short by a vehicle problem that appears to be only fixable by a VB.NET program. However it's GPLed and we're trying to lean on the (reluctant) author for the source, it would be a natural to transcribe to e.g. a tablet or possibly a bratphone. I was looking in to this idea too. The only sources I found was some plain C or some kind of C code on sourceforge, which could (painfully) be converted or at least derived from to get ideas for FPC. The downside is that this did not work on a windows Tablet, it has some GUI issues that doesn't work right on a tablet, but works fine on a desktop pc. Can't remember the name of the software and don't remember what platforms it ran on.. maybe could find it by going to https://www.google.ca/search?q=obd+sourceforge But there is also github... But as for FPC code or lazarus code? I have no idea. Would be interesting to know. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Vehicle management
On 05/07/2017 02:33 PM, Mark Morgan Lloyd wrote: Has anybody used FPC to talk to a vehicle via the OBD connector? Can anybody give me a quick summary of the position of FPC on Android etc.? (Graeme, that includes FPCgui if it's relevant). We've been caught short by a vehicle problem that appears to be only fixable by a VB.NET program. However it's GPLed and we're trying to lean on the (reluctant) author for the source, it would be a natural to transcribe to e.g. a tablet or possibly a bratphone. Last year I used www.CtrlTerm.com to talk to OBD using one of these boards: https://www.sparkfun.com/products/10769 There are links to the "ELM327 Command Set" near the bottom of those pages. The best site for the OBD codes that I found is: www.autocodes.com Please update us with what you end up doing. Regards Paul www.ControlPascal.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] silly question
I got stuck with the symlinks. The level of indirection is rather complex. Finally I 1. reinstalled v. 2.6.2 from scratch 2. copied directory zeosdbo from server A to server B 3. copied file /etc/fpc.cfg from server A to server B now (finally!) everything works as expected. Thank you Peppe 2017-05-07 17:13 GMT+02:00 Michael Van Canneyt: > > > On Sun, 7 May 2017, duilio foschi wrote: > >> I am have FPC v. 2.6.2 installed on linux/ubuntu server A. >> >> I am sure I did some change to zeos library in server A, but I cannot >> remember details. >> >> I'd like to have the same version of FPC installed on a new >> linux/ubuntu server B. >> >> I found that FPC v. 3.0.2 was already installed on server B. >> >> Using my poor skills in linux, I took the following steps: >> >> 1. deleted directory /usr/lib/fpc/3.0.2 of server B > > > That was not necessary. You can perfectly have 2 versions of FPC > co-existing. > >> 2. copied directory /usr/lib/fpc/2.6.2 of server A into server B (used >> scp) >> >> Now a few strange things happen: >> >> a. if I try to run fpc from - say - /usr/lib/cgi-bin , I get the message >> Error: ppcx64 can't be executed, error message: Failed to execute >> "ppcx64", error code: 127 > > > Did you correct the symlink /usr/bin/ppcx64 ? it should point to > /usr/lib/fpc/2.6.2/ppcx64 > > >> >> b. if I try to run fpc from /usr/lib/fpc/2.6.2, a lot of Zeos lib >> units are compiled EVERY TIME. This for sure was not happening before >> (see below). >> >> I did something silly, right ? > > > Ill-advised, perhaps. > > >> Any help in order to fix the install ? > > > The above should help you to get things compiling again. > > About recompilation of zeos units; 2.6.2 may work differently to 3.0.2 > regarding circular units which causes a recompile. Or the zeeos units in > your search path are the old ones. > > Michael. > ___ > 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
[fpc-pascal] Vehicle management
Has anybody used FPC to talk to a vehicle via the OBD connector? Can anybody give me a quick summary of the position of FPC on Android etc.? (Graeme, that includes FPCgui if it's relevant). We've been caught short by a vehicle problem that appears to be only fixable by a VB.NET program. However it's GPLed and we're trying to lean on the (reluctant) author for the source, it would be a natural to transcribe to e.g. a tablet or possibly a bratphone. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] silly question
On Sun, 7 May 2017, duilio foschi wrote: I am have FPC v. 2.6.2 installed on linux/ubuntu server A. I am sure I did some change to zeos library in server A, but I cannot remember details. I'd like to have the same version of FPC installed on a new linux/ubuntu server B. I found that FPC v. 3.0.2 was already installed on server B. Using my poor skills in linux, I took the following steps: 1. deleted directory /usr/lib/fpc/3.0.2 of server B That was not necessary. You can perfectly have 2 versions of FPC co-existing. 2. copied directory /usr/lib/fpc/2.6.2 of server A into server B (used scp) Now a few strange things happen: a. if I try to run fpc from - say - /usr/lib/cgi-bin , I get the message Error: ppcx64 can't be executed, error message: Failed to execute "ppcx64", error code: 127 Did you correct the symlink /usr/bin/ppcx64 ? it should point to /usr/lib/fpc/2.6.2/ppcx64 b. if I try to run fpc from /usr/lib/fpc/2.6.2, a lot of Zeos lib units are compiled EVERY TIME. This for sure was not happening before (see below). I did something silly, right ? Ill-advised, perhaps. Any help in order to fix the install ? The above should help you to get things compiling again. About recompilation of zeos units; 2.6.2 may work differently to 3.0.2 regarding circular units which causes a recompile. Or the zeeos units in your search path are the old ones. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] silly question
I am have FPC v. 2.6.2 installed on linux/ubuntu server A. I am sure I did some change to zeos library in server A, but I cannot remember details. I'd like to have the same version of FPC installed on a new linux/ubuntu server B. I found that FPC v. 3.0.2 was already installed on server B. Using my poor skills in linux, I took the following steps: 1. deleted directory /usr/lib/fpc/3.0.2 of server B 2. copied directory /usr/lib/fpc/2.6.2 of server A into server B (used scp) Now a few strange things happen: a. if I try to run fpc from - say - /usr/lib/cgi-bin , I get the message Error: ppcx64 can't be executed, error message: Failed to execute "ppcx64", error code: 127 b. if I try to run fpc from /usr/lib/fpc/2.6.2, a lot of Zeos lib units are compiled EVERY TIME. This for sure was not happening before (see below). I did something silly, right ? Any help in order to fix the install ? Thank you Peppe root@web:/usr/lib/fpc/2.6.2# fpc 106693.pp Compiling 106693.pp Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling 106693.pp Compiling ./zeosdbo/component/ZConnection.pas Compiling ./zeosdbo/component/ZAbstractConnection.pas Compiling ./zeosdbo/dbc/ZDbcDbLib.pas Compiling ./zeosdbo/dbc/ZDbcConnection.pas Compiling ./zeosdbo/core/ZClasses.pas Compiling ./zeosdbo/core/ZMessages.pas Compiling ./zeosdbo/core/ZCompatibility.pas ZCompatibility.pas(426,33) Warning: Some fields coming after "ZAlias" weren't initialized ZCompatibility.pas(431,28) Warning: Some fields coming before "ClientCodePage" weren't initialized ZCompatibility.pas(457,10) Warning: Some fields coming after "WriteFormatSettings" weren't initialized Writing Resource String Table file: ZMessages.rst Compiling ./zeosdbo/dbc/ZDbcIntfs.pas Compiling ./zeosdbo/core/ZCollections.pas Compiling ./zeosdbo/core/ZTokenizer.pas Compiling ./zeosdbo/core/ZFastCode.pas ZFastCode.pas(2511,25) Warning: Function result variable does not seem to initialized ZFastCode.pas(2573,18) Warning: Function result variable does not seem to initialized ZFastCode.pas(2633,18) Warning: Function result variable does not seem to initialized ZFastCode.pas(3191,18) Warning: Function result variable does not seem to initialized ZFastCode.pas(3246,18) Warning: Function result variable does not seem to initialized ... This is what happens when I try to compile a small application in server B root@KedekUbuntu:/usr/lib/cgi-bin# fpc 106693.pp Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling 106693.pp Linking 106693 /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T? 43 lines compiled, 0.2 sec root@KedekUbuntu:/usr/lib/cgi-bin# ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interfaces works in FPC 2.6.4 but not in 3.0.2
On Sat, May 6, 2017 at 7:37 PM, Graeme Geldenhuyswrote: > var > cmd: ICmdLineParams; > begin > if Supports(fpgApplication, ICmdLineParams, cmd) then // Never works > begin > ... > end; > end. > > > fpgApplication is a global instance of TfpgApplication. > > The line marked with "Never works" never works with FPC 3.0.2, but > it does with FPC 2.6.4. > > Can anybody explain this? The same here. It did not work neither CORBA nor COM. I've tried to use the property as public too, but did not work either. I use delegation by properties a lot, but this haven't broke my code because I do not use inheritance... but definally this is a bug. Best regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal