Re: [fpc-pascal] Small OSX GUI apps
Thank you for your replies Jonas > if you're coming from Win32 programming, you may want to read this: > http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html Interesting document. Do I have to install Interface Builder and XCode to use FPC? > > Are any *simple* examples available for creating OSX gui apps? > > There's one here (using Carbon): > http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/univint/examples/ Excellent, just what I was after. Are there any more, especially Cocoa? > > - and which is best? > > Depends on who you ask. But Apple has made it clear that they want to > move forward primarily with Cocoa. How good is the FPC for each? Is there a separate install for both? Best regards, Jon ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can I make this with Free Pascal?
> Michael, you are time travelling a bit. Current time here is > 8:32 AM. I sometimes receive replies you posted before I get > the original message. Weird. I guess the mailing list caches the > messages somewhat before they are passed to everybody else, and > then does it ordered by time. > > The following should sort out your time: :-) > sudo ntpdate -u ntp.ubuntulinux.org > Maybe this is the cause: > Welcome to the fpc-pascal@lists.freepascal.org mailing list! > Note: HTML emails always are held for moderator approval, and > thus may take a while before they appear on the list. The easiest > remedy is to disable HTML email in your mail client: > http://www.expita.com/nomime.html ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] UDF+FREEBSD+FIREBIRD
Should there be a 'uses' line somewhere? > > library tkes2; > > {$mode objfpc} > {$PACKRECORDS C} > > > function somefn: integer; cdecl; export; > begin > somefn:= 3; > end; > > exports > //I do not do as: > // somefn name 'somefn'; // because of this cause > error tkes2(17,1) Error: Asm: Duplicate label somefn > > //so I do as: > somefn name '_somefn'; > > end. > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC for ARMv4
Hi I have a board running Linux - it reports itself as armv4tl: root@phidgetsbc:~# uname -a Linux phidgetsbc 3.1.6 #3 PREEMPT Fri Jan 6 13:05:50 MST 2012 armv4tl GNU/Linux root@phidgetsbc:~# cat /etc/issue Debian GNU/Linux 6.0 \n \l After trying and failing to install a cross-compiler on my Linux x64 system, I want to install FPC directly onto the system. Can you advise the best procedure. After downloading and installing fpc-2.6.2.arm-linux.tar I get errors: root@phidgetsbc:~# fpc An unhandled exception occurred at $D210 : EAccessViolation : Access violation $D210 $8374 $8B34 An unhandled exception occurred at $D210 : EAccessViolation : Access violation $D210 $000133E0 An unhandled exception occurred at $D210 : EAccessViolation : Access violation $D210 $000133E0 $00014604 $000133E0 An unhandled exception occurred at $D210 : EAccessViolation : Access violation $D210 $000133E0 $00014604 $000133E0 $00014604 $000133E0 ...and so on for ever. The system can compile with gcc, but I loath it and would dearly love to run FPC on it. Any suggestions welcome. Many thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC for ARMv4
> On Friday, 7 March 2014, 11:04, Jonas Maebe wrote: > > > On 05 Mar 2014, at 19:41, Jon wrote: > >> I have a board running Linux - it reports itself as armv4tl: >> >> root@phidgetsbc:~# uname -a >> Linux phidgetsbc 3.1.6 #3 PREEMPT Fri Jan 6 13:05:50 MST 2012 >> armv4tl GNU/Linux >> >> root@phidgetsbc:~# cat /etc/issue >> Debian GNU/Linux 6.0 \n \l >> >> >> After trying and failing to install a cross-compiler on my Linux x64 >> system, I want to install FPC directly onto the system. >> >> Can you advise the best procedure. After downloading and installing >> fpc-2.6.2.arm-linux.tar I get errors: > > That compiler is probably built for ARMv6, so it's normal that it > doesn't work on your system. Additionally, you first have to determine > the ABI in use on your system. To do so, run "objdump -p /bin/ls" and > > have a look at the "private flags" section near the end. > > If it contains "EABI", then you have to build an EABI cross-compiler > (compile the ARM compiler with -dFPC_ARMEL in the make OPT parameter), > otherwise you have to build an old ABI cross-compiler (compile the ARM > compiler with no specific parameters in the make OPT parameter, but > add -Cfsoft to CROSSOPT to ensure the created native compiler uses > software floating point). > > > Jonas > If I understand you correctly, I don't use the prebuilt package but instead use the source package (fpc-2.6.2.source.tar.gz) and build it on the unit itself? Do I need binutils or anything else? Cross-compiling has always been very difficult for me, I follow the instructions at http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM but is that the best place? Thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] How do you build FPC?
I'm using i386 32bit Linux for most of my development and currently using FPC 2.6.0. I'm trying to understand how to build FPC for various scenarios: Cross-compiling FPC for another architecture. Building FPC crosscompilers and related units so I can compile for them from my Linux machine. And building new FPC versions. There seems to be a massive lack of documentation about the FPC build process and many things I try get me know where. I'll do something like "make deb" and I get "/bin/cp: cannot stat `logs': No such file or directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32 packages!?!? I've tried building on I386 Linux, PPC Linux, PPC OSX, just to name the ones that I remember. I've tried simple builds of newer FPCs, cross compiling FPC, building crosscompilers and units. Building Debian packages. Not once have I ever been able to get it to do what I want. There is obviously a lot of pieces I'm missing from what I've dug up on the wiki, docs and included text files. Is there documentation for compiling FPC? Am I just missing it somewhere? FPC seems incredibly flexible and I'd like to take advantage of it on some other platforms but so far it looks like that is reserved for a wizard elite somewhere and nobody is saying how to get there. TIA - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How do you build FPC?
Mark Morgan Lloyd wrote: > Jon Foster wrote: >> [...] >> There seems to be a massive lack of documentation about the FPC build >> process and many things I try get me know where. I'll do something like >> "make deb" and I get "/bin/cp: cannot stat `logs': No such file or >> directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES >> DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32 >> packages!?!? >> [...] > > The document that is usually cited is > http://www.stack.nl/~marcov/buildfaq.pdf which I think is still > generally valid. I don't know whether this is the only URL, or if it's > also hosted on the FreePascal site. > > [...] Thanks for that link! I have something to read tonight. :-) -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] GCC -PIE equivalent?
I'm building native code compilers for Android. I've been assisting the PascalDevelop project available in the Play Store: https://play.google.com/store/apps/details?id=com.assoft.PascalDevelop I'm working with the 3.0.0rc2 release and building whichever units will. The current version of the app ships with the older 2.6.x compiler. What we've discovered is that if we try to run the compiler on Android 5 (Lollipop) or greater the binary won't load and complains that it isn't a "Position Independent Executable" (PIE). This is a feature similar to PIC. In GCC they have a separate flag -fPIE as opposed to the -fPIC. The purpose is to make the whole executable relocatable to facilitate "randomized address spaces". If I build a standard "program" (not library) with -Cg do I get a PIE... or does that only affect linking for libraries? I haven't been able to find anything on the iNet regarding PIE and FPC. THX - Jon -- Sent from my Debian Linux laptop -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC 3.0 deb packages?
I'm trying to get FPC to build again and although I'm getting along a lot better I still don't seem to be able to get the knack of it. First I'd like to know if anyone has any updated build instructions? I've been on the wiki and read the "build faq" PDF document. Both are good as far as they go. But neither is anywhere near complete. My first major dilemma, and what this email pertains to, is building Debian packages. I went to grab the latest FPC 3 from SF and found that the usual tarball of Debian packages doesn't exist. So I downloaded the "fpcbuild" tarball for FPC 3.0.0 and tried the "make deb". After I banged on it for many hours applying several crude patches it finally makes packages again. But all of this leads me to believe that Debian packages for FPC are no longer maintained / supported? If so what's the story? Maybe my crude hacks could be put to use or I could help out some way? After installing the packages and doing some simple builds I thought all was good... Nope! Turns out several of the compiled units, from the packages folder aren't getting packaged. I fixed a few of the *.install.in files to include the missing package unit folders. However, at least in some situations, it looks like some of the additional unit files are getting missed by the deb packaging. My current need is the StrUtils unit, which I must say I'm shocked to find is not part of the core RTL but is in a package?!?! I don't get that but that's your decision. Through injecting breakpoints in the package build process I have found that the unit files are getting built and installed into the temporary distribution folders. But somehow they aren't making it into the final packages. I'm still working on it but I thought I'd ask and see if anyone knows where in the Debian package building stuff things are getting lost? I do want to commend the FPC developers. There are only two pieces of software that continue to impress me release after release: the Linux kernel and FreePascal compiler (not Lazarus). My system stats: Debian 7 i386. FPC 3.0.0 as the currently installed compiler, first from the binary tarball package and then from my package build attempts, which are mostly functional. TIA - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] ppcjvm issues
I've been working on building an app for Android using the FPC's JVM target. I'm using fpc 3.0.0. I've run into a couple of things that I'm not sure if they're bugs or I just don't know what I'm doing. I was using fpc to avoid having to learn Java and have discovered that's not entirely possible. :-/ The first issue I ran into is this: procedure Cppp1Activity.onResume; begin inherited onResume; with AAAlertDialog.InnerBuilder(self) do begin setTitle(R.strings.app_name); end; end; Cppp1Activity is a descendant of AAActivity. I'm overriding the onResume method. The problem I ran into was with the AAAlertDialog.InnerBuilder class. I can create an object of that class without incident. However if I try to call any of the methods (tried several) I get a "Class Cast" exception reported in the Android log and the app goes *poof*. I also tried just chaining the call like "AAAlertDialog.InnerBuilder(self).setTitle(R.strings.app_name);", and I tried this in the "Activity.onCreate" method with the same result. And yes "R.strings.app_name" points to an actual resource and I generated a "resources.pas" with the "R" class fresh for this test. The second issue I ran into: function f(x, y: integer): float; begin result:=float(dy)/float(dx) end; When attempting to compile this it tells me that "float" is undefined. I think I'm missing something here. "float" is the native Java name for their base floating point type and its a valid type for FPC. If I use "single" instead it will compile. Seems odd. THX - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/07/2017 03:06 AM, Tomas Hajny wrote: On Sat, January 7, 2017 03:12, Jon Foster wrote: Hello, You didn't mention that you weren't subscribed to the list, but since this seemed to be the case, I included your address in Cc:. Thanks for this. I get a lot of mail from the FPC lists ... but it looks like its from the devel list. I originally subscribed to this list in Feb. 2015. I must have been evicted. Not sure why. I've re-subscribed. I'll try not to get booted again. The second issue I ran into: function f(x, y: integer): float; begin result:=float(dy)/float(dx) end; When attempting to compile this it tells me that "float" is undefined. I think I'm missing something here. "float" is the native Java name for their base floating point type and its a valid type for FPC. If I use "single" instead it will compile. Seems odd. I can't comment the first part, but where exactly is a type named "float" defined in FPC (which unit)? E.g. single is defined in unit System and thus available for all FPC programs automatically. If some unit defines "float" (not sure about that, but it might be the case). I can see the System unit for Java defining "jfloat" as an alias to single - maybe you meant that one? Hope this helps Yes, you're right. Sorry too many languages to deal with. And working in this quasi-java-fpc world is bending my brain. So to sum up: fpc doesn't have a float type. Java does. Since its in the "java" namespace its named "Jfloat" in FPC. The native FPC equivalent is single. THX - Jon -- Sent from my Debian Linux laptop -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/07/2017 10:39 AM, leledumbo wrote: The first issue I ran into is this: procedure Cppp1Activity.onResume; begin inherited onResume; with AAAlertDialog.InnerBuilder(self) do begin setTitle(R.strings.app_name); end; end; I don't check by running the code directly, but looking at the source code: AAAlertDialog = class external 'android.app' name 'AlertDialog' (AADialog, ACDialogInterface) public type InnerBuilder = class; Arr1InnerBuilder = array of InnerBuilder; Arr2InnerBuilder = array of Arr1InnerBuilder; Arr3InnerBuilder = array of Arr2InnerBuilder; InnerBuilder = class external 'android.app' name 'Builder' (JLObject) InnerBuilder doesn't look like anything callable. Reading the offical reference (https://developer.android.com/guide/topics/ui/dialogs.html#AlertDialog), I guess you need to instantiate it first and only then call its methods: var Builder: AAAlertDialog.InnerBuilder; Dialog: AAAlertDialog; ... Builder := AAAlertDialog.InnerBuilder.Create(Self); // inside any Cppp1Activity method so Self refers to Cppp1Activity instance Dialog := Builder.setTitle(R.strings.app_name).create_; // note the '_' Thanks! Yes, you're right. I'm having a hard time understanding how the FPC semantics fit the Java semantics. This is complicated because I'm trying to learn Android, and to some extent, by extension, I'm getting forced into Java too. So I'm real unclear about what all the Java examples I'm seeing are actually doing. Been working with "object pascal" since Delphi 1/2. :-) So the take away I see here is that I have to remember to use class.create(...) to create objects from any Java class, not just FPC ones. So that leaves me with the question: What about destructors? Must I call free/destroy on all objects I create, or do they self-destruct? If so destroy or free? From what I've seen of Java everything self destructs, probably when a usage count hits 0. But I don't know. Perhaps calling "destroy" is needed to release my claim on it? I was going to try calling it and see if it blows. :-D Yes, I figured out "create_" just as I figured out "InnerBuilder", instead of "Builder". Not sure why that name was changed. I've learned I need to cross reference the Android docs back to androidr14.inc & pas. When attempting to compile this it tells me that "float" is undefined. I think I'm missing something here. "float" is the native Java name for their base floating point type and its a valid type for FPC. If I use "single" instead it will compile. Seems odd. Pascal's Single maps to Java's float. There's another float type defined in Math unit but that's created for the routines inside the unit. Java's primitive type is not available in FPC JVM, use Pascal's type after mapping from Java. The class version (which should automatically (un)box) is available, though. So if you insist, simply use JLFloat. Yes, thank you. Tomas set me straight on this. -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/08/2017 02:57 AM, Sven Barth wrote: On 07.01.2017 03:12, Jon Foster wrote: I've been working on building an app for Android using the FPC's JVM target. I'm using fpc 3.0.0. I've run into a couple of things that I'm not sure if they're bugs or I just don't know what I'm doing. I was using fpc to avoid having to learn Java and have discovered that's not entirely possible. :-/ The first issue I ran into is this: procedure Cppp1Activity.onResume; begin inherited onResume; with AAAlertDialog.InnerBuilder(self) do begin setTitle(R.strings.app_name); end; end; Cppp1Activity is a descendant of AAActivity. I'm overriding the onResume method. The problem I ran into was with the AAAlertDialog.InnerBuilder class. I can create an object of that class without incident. However if I try to call any of the methods (tried several) I get a "Class Cast" exception reported in the Android log and the app goes *poof*. I also tried just chaining the call like "AAAlertDialog.InnerBuilder(self).setTitle(R.strings.app_name);", and I tried this in the "Activity.onCreate" method with the same result. And yes "R.strings.app_name" points to an actual resource and I generated a "resources.pas" with the "R" class fresh for this test. Here's what I had done in my Android application way back at Christmas 2011 ( http://lists.lazarus-ide.org/pipermail/lazarus/2011-December/134414.html ): === code begin === function TTrainTypeActivity.onCreateDialog(aID: jint): AADialog; var builder: AAAlertDialog.InnerBuilder; begin case aID of DialogIDDelete: begin builder := AAAlertDialog.InnerBuilder.Create(Self); builder.setMessage(JLString('Are you sure you want to delete train ' + 'type ''' + fDataHelper.NameOfTrainType[fSelectedID] + '''?')); builder.setPositiveButton(JLString('Yes'), Self); builder.setNegativeButton(JLString('No'), Self); Result := builder.create_; end; else Result := Nil; end; end; === code end === I know it's onCreateDialog() and not onResume(), but it should be the same principle. Though doesn't an activity itself already have a setTitle() method? At least that's what I had used in my onCreate()... Regards, Sven Yes, same principal. Since this is a one time in the lifetime of the app use dialog I didn't see the point of building it into the onCreateDialog() / onPrepareDialog() methods. Its going to be shown the first time someone launches my app and then never seen again unless uninstalled / reinstalled, data erased, installed on another device, ... What I don't quite get from your example is using "self" as the second argument to setPositiveButton() & setNegativeButton. That parameter is asking for an OnClickListener() class. When I tried that I received a compile time error as I expected. Yes, the AAActivity class has a "setTitle()" method. However it sets the title for the activity. Where as the AAAlertDialog.InnnerBuilder.setTitle() method sets a title on the dialog window. I actually decided I like it better without, but I'm still experimenting. THX - Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] javapp
In figuring out Android programming with FPC I've read about the "javapp" tool. However when I try to do anything with it spends some time doing nothing and then outputs empty files. I downloaded and am using the prebuilt jasmin and javapp that was provide by a link to an archive in the wiki pages. Its been several months so sorry I don't remember much more than that. I can dredge up more info if needed. Javapp doesn't spit out a version number when run with "-help". My scenario: It seemed like Javapp should be able to convert the "R.java" produced by "aapt" into the "resources.pas" (or whatever you want to call it). Rather than manually tweaking it every time you change a resource. This would also allow "make" to auto-determine when to rebuild it and do so as needed. So from the top of my android project folder I used the following: $ java -jar /usr/lib/fpc/3.0.0/javapp.jar -classpath gen -o resources -private com.jfpossibilities.test It ran for several seconds and produced the following output to the console: default charset: UTF-8 Determining short Pascal class names... Indexing classes under com/jfpossibilities/test... Printing classes... Done! It produced a "resources.pas" file with the correct skeleton of a unit, including "resources.inc". It made an empty "resources.inc" (0 bytes). So I'm obviously missing something. THX - Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/11/2017 02:25 AM, Sven Barth wrote: Am 11.01.2017 08:54 schrieb "Michael Schnell" <mailto:mschn...@lumino.de>>: > > On 10.01.2017 05:13, Jon Foster wrote: >> >> On 01/07/2017 10:39 AM, leledumbo wrote: >> >> So that leaves me with the question: What about destructors? Must I call free/destroy on all objects I create, or do they self-destruct? If so destroy or free? > > > AFAIU, in fpc destroying any objects is mandatory. And this close to always needs to be done with "Free" (which inside the class finally calls Destroy). > > If destroying an object is not necessary, the class should provide a dummy Free procedure. So the application programmer always can/should use Free. We're talking about JVM here where garbage collections *must* be used. So FPC does as well for that target. It goes against s many years of working with Object Pascal... but I'll let the JVM destroy them. Thanks! -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/18/2017 01:16 AM, Michael Schnell wrote: On 17.01.2017 19:07, Lars wrote: If you have a jvm project with lots of code and now want to start using this code in another regular mode objfpc unix/win32 application... Exactly this as the point I wanted to express. Even when coding an fpc application or library for use with jvm, free (and destroy) should be used and provided in the normal way good old Object Pascal requires. If jvm does garbage collection under the hood (and not momentarily adheres to free, as we are used to with Object Pascal) this should be handled as a hidden implementation detail and as little as possible be communicated outside, so that using this code in another regular mode objfpc unix/win32 application can be done as seamlessly as possible . I agree for seamless compatibility "free" / "destroy" should be provided. As far as I can tell the JVM implementation of TObject does provide these. Using the native Java/Android objects is a lot like using Lazarus / Delphi / TComponent based classes. You create them and whoever you specify as the owner frees them. In this case the JVM is freeing them. But that's not a detail I need concern myself with. That said, all of the code in my project was written and tested in plain old native compiled code running on my Linux box. Only the UI code is unique to Android. As such I've not run into any problems creating and freeing my native FPC based components. I haven't tried freeing/destroying Java/Android components. I imagine its going to tell me that those methods don't exist on those objects, since those class libraries don't provide them. But maybe FPC has hidden that detail as well. When I get a moment I'll give it a whirl, 'cause I've had many years of training to free what I create. I started my Pascal journey with Delphi 1/2 in '96. THX - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/26/2017 01:30 PM, Jon Foster wrote: On 01/18/2017 01:16 AM, Michael Schnell wrote: On 17.01.2017 19:07, Lars wrote: If you have a jvm project with lots of code and now want to start using this code in another regular mode objfpc unix/win32 application... Exactly this as the point I wanted to express. Even when coding an fpc application or library for use with jvm, free (and destroy) should be used and provided in the normal way good old Object Pascal requires. If jvm does garbage collection under the hood (and not momentarily adheres to free, as we are used to with Object Pascal) this should be handled as a hidden implementation detail and as little as possible be communicated outside, so that using this code in another regular mode objfpc unix/win32 application can be done as seamlessly as possible . I agree for seamless compatibility "free" / "destroy" should be provided. As far as I can tell the JVM implementation of TObject does provide these. Using the native Java/Android objects is a lot like using Lazarus / Delphi / TComponent based classes. You create them and whoever you specify as the owner frees them. In this case the JVM is freeing them. But that's not a detail I need concern myself with. That said, all of the code in my project was written and tested in plain old native compiled code running on my Linux box. Only the UI code is unique to Android. As such I've not run into any problems creating and freeing my native FPC based components. I haven't tried freeing/destroying Java/Android components. I imagine its going to tell me that those methods don't exist on those objects, since those class libraries don't provide them. But maybe FPC has hidden that detail as well. When I get a moment I'll give it a whirl, 'cause I've had many years of training to free what I create. I started my Pascal journey with Delphi 1/2 in '96. So as I thought Java/Android objects don't apparently have a free or destroy method, simulated or otherwise. But any classes defined in Pascal provide those methods, if they descend from the default TObject. I think I read somewhere that classes can be defined that descend from the base Java class but I haven't done it. - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Any use notes for javapp
So does anyone have any hints, tips, use notes, instructions, ... for how to use the "javapp" tool? - Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/27/2017 06:36 AM, Dmitry Boyarintsev wrote: On Tue, Jan 10, 2017 at 6:14 AM, Michael Schnell <mailto:mschn...@lumino.de>> wrote: If destroying an object is not necessary, the class should provide a dummy Free procedure. So the application programmer always can/should use Free. Why dummy? if it should be like this procedure TObject.Free; begin if Self<>nil then Self:=nil; end; Destroying object is not necessary, but dereferencing is. If the code keeps the reference to an object, it would not be collected. [...] Correct me if I'm wrong: It would seem like that your free implementation doesn't actually do anything, other than fulfilling the obligation of having a "free". If I do this: var o: TObject; begin o:=TObject.create; { do something ... } o.free; end. Wouldn't "o" still contain a reference after "free" is called? In non-JVM FPC "self" is just another variable, who's origin is somewhat hidden by the compiler. The call to "o.free" would do something like "TObject.free(o)" where "o" is passed by *value* into the procedure variable "self". "Self" comes and goes with the scope of the "TObject.free" procedure. Which is why if I'm concerned about detecting whether or not "o" still contains a correct object reference I would need to do something like this: "o.free; o:=nil;" so I can test for "nil" later. Although I think FPC added a procedure to do that some time back. Yup, I see it "SysUtils.FreeAndNil". I'm not sure of the specific semantics of the JVM calls but from what I read in the various FPC JVM related pages on the wiki it would seem to use similar semantics. - Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ppcjvm issues
On 01/27/2017 08:48 AM, Jonas Maebe wrote: On 27/01/17 02:31, Jon Foster wrote: But any classes defined in Pascal provide those methods, if they descend from the default TObject. I think I read somewhere that classes can be defined that descend from the base Java class but I haven't done it. All classes on the JVM descend from a Java class. The Java Runtime does not support classes that don't descend directly or indirectly from java.lang.Object. Yes, BUT: TObject is provided by the "system" unit in FPC and although it descends from JLObject it provides basic FPC like semantics, including free/destroy. FPC treats " TMyClass = class ..." just like it does in the native code versions and TMyClass would descend from TObject inheriting its methods. So unless you tried to create a class which directly descended from JLObject, instead of TObject you inherit "free" and "destroy", so you can call them as you usually would. Other than missing unit functionality I've found the JVM implementation makes Java seem very Pascal like. The devs have done a splendid job IMO. It did take me a while to find the Java lib equivalent of StrToInt. :-D -Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Any use notes for javapp
On 01/28/2017 05:17 AM, Jonas Maebe wrote: On 27/01/17 02:34, Jon Foster wrote: So does anyone have any hints, tips, use notes, instructions, ... for how to use the "javapp" tool? I had accidentally disabled my subscription when you sent your previous question about this. At first sight, the problem is that javapp does not work right now if the classes are not packed in a jar. Can you try putting everything in a jar and trying again? Also note that javapp is based on javap from JRE 1.6, so if you use classes compiled for later JRE versions, you may get errors. Thanks Jonas! I used "javac" to compile a file and "jar" to put it in a jar and passed the jar to javapp via the "-classpath" switch and I'm now getting a set of files with the expected output. Thanks for the help! I was thinking to use "javapp" to convert an Android "aapt" generated "R.java" file into a "resources.pas" file but its way too verbose... I think I'll just whip up a pas program to perform some simple string transforms on the R.java file. THX - Jon -- Jon Foster JF Possibilities, Inc. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.4 for Free Pascal 3.0.2
On 02/14/2017 06:51 AM, Martin Schreiber wrote: Hi, MSEide+MSEgui 4.4 for Free Pascal 3.0.2 has been released: https://sourceforge.net/projects/mseide-msegui/ There are also new versions of the ARM (Raspberry Pi) cross and native environments for Free Pascal: https://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/ https://sourceforge.net/projects/mseide-msegui/files/fpcarm/ and new versions of MSEgit, MSEspice and MSErun: https://sourceforge.net/projects/mseuniverse/ Ooh! I'll have to take a look. I was impressed with MSEgui in the past *it actually worked*! The Lazarus team seems more interested in features than in quality and I have not moved beyond v0.9.30.x since v1+ broke way too many things that used to work and bloated a large amount, so after a decade or more of trying to use it I gave up. I'm still looking for a decent GUI system to match the awesomeness of FPC and MSEgui and fpGUI are the current contenders. My only issue in the past with MSEgui was a lack of cross-platform capability. It seemed everyone thought I was insane for wanting to use it on OS X and it wouldn't compile for PowerPC (something blow up about initializing the math-co). PowerPC isn't a contender anymore but ARM/Linux is and it appears you have that covered. I'm using CHIPs (http://getchip.com). And I still want to use it on all current desktop platforms (*nix/X, OS X, 'doze). Thanks for the work I'll have to take another look! -- Jon Foster JF Possibilities, Inc. ___ 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 03/29/2017 01:15 PM, Michael Van Canneyt wrote: On Wed, 29 Mar 2017, Dimitrios Chr. Ioannidis via fpc-pascal wrote: Hi, On 29/3/2017 9:57 μμ, fredvs wrote: Hello. Some developers treat me as dinosaur because I use threads in place of doing parallelism. Huh, ok, but why parallelism is better and how to do it with fpc ? a nice article I've found long ago when I was researching the same topic "Threading/Concurrency vs. Parallelism" is the following : http://tutorials.jenkov.com/java-concurrency/concurrency-vs-parallelism.html and I tried the multithreadprocslaz package in Lazarus : http://wiki.freepascal.org/Parallel_procedures Showing nicely that parallelism in a single process implies threads. I would not pay too much attention to what these developers are saying. Either I'm dense, which is entirely possible, or the author of that article didn't do a good job of making his point, even assuming he had one. Thinking about this a bit more I would say that "threads" are a means (vehicle) to achieve parallelism. I think that in the majority of programming contexts they are synonymous. But I can think of other contexts where they may not be: Say animating a film. You have 1000 computers generating frames to be assembled into a final sequence. The process of dispatching each frame render is most likely not going to be done with the OSes thread call, but through a networked work queue of some sort (ala Torque or something). So you have the "task" (rendering the movie) being worked on in "parallel" via a networked job dispatch mechanism. Or the case of using "make -j ..." which "forks" multiple jobs (compile, link, ...) in parallel based on a dependency tree. I say threading is parallelism, even if just one form of it. The other methods of parallelism I mentioned here could also be done in FPC with the appropriate code. But that is a rather nebulous topic to discuss. Concrete answers for which are only available when you know how a specific job needs to be broken up. I'm still looking for a good easy to use job queue myself... -Jon -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
I kept the same core code and wrote a new Dalvik front end in FPC, using the JVM target. But its very time consuming and fraught with peril. The Android UI does many unexpected things and the Java environment has many obstacles that we FPC users don't expect. And FPC hasn't ported their units so you'll need the Android API reference handy and will have to dig for normal things like converting an integer to a string. And then there is the renaming of stuff done by the FPC API converter and ... I'm sure I haven't listed all of the obstacles. But those are the majors. I also don't have a single solution that will work reliably. Depending on needs/wants you may be able to work out something that you can use. Right now I'm looking over fpGUI with an eye to porting it to Android to make a more sane environment. -- Sent from my Debian Linux laptop -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/15/2017 12:14 PM, fredvs wrote: Jon Foster wrote The only thing that console apps need is a terminal emulator. Huh, yes, when I re-read my mail, I see directly that this will be the problem. The "One only library-method used by the Java Class" needs of course a terminal to show his output. Jon Foster wrote Linux (Android kernel) only runs executables from a file system that allows you to set the "execute" permission For Java-native libraries too ? If I understand your question correctly: No, since the library isn't "executed" (in the traditional *nix sense) its "loaded" and used. As you stated you need an Android Java (Dalvik) app, which gets executed, and then it loads the library and calls the functions in it. But never forget you need someway to display stuff... and the normal Pascal methods of providing user interaction are not available on Android. Take this simple program: program hello; uses SysUtils; var s: string; begin write('Enter your name: '); ReadLn(s); WriteLn('Hello ', s); end. Assuming you made it into a library and write a Dalvik wrapper you still need some place for the input to come from and the output to go to. On Linux this would be "standard in" and "standard out", attached to a terminal somewhere/somehow (VGA adapter, xterm, pipes, ...). Technically all you need to do this with Android is a compiler for the architecture of the Android device (usually ARM) and a terminal app. Once compiled you can place the app on an SD card (typically available) then launch your terminal app, copy the app from the SD card into "/data/tmp", "chmod a+x /data/tmp/myapp" (change "myapp" to the name of yours) and then launch it and interact with it via the terminal app. You have to copy the app to "/data/tmp" as that is usually the only place on Android with a Linux file system that all users have access to. You can't look in there so you kind of have to fly blind. :-) "Terminal IDE" makes this easier, assuming you have a compatible Android version, since it provides the Linux file system space, term emulator and easy access. This was what I thought Paul was looking to do. FreeVision might work depending on a number of variables... but I'm not familiar with it. Most Android terminal apps would provide some kind of VT100 like emulation so you may have to force FreeVision to output for that emulation. If it tries to use a "termcap" through normal means it probably will crash. -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/18/2017 04:38 AM, Paul Breneman wrote: On 04/17/2017 08:42 PM, Jon Foster wrote: ... You have to copy the app to "/data/tmp" as that is usually the only place on Android with a Linux file system that all users have access to. You can't look in there so you kind of have to fly blind. :-) "Terminal IDE" makes this easier, assuming you have a compatible Android version, since it provides the Linux file system space, term emulator and easy access. This was what I thought Paul was looking to do. FreeVision might work depending on a number of variables... but I'm not familiar with it. Most Android terminal apps would provide some kind of VT100 like emulation so you may have to force FreeVision to output for that emulation. If it tries to use a "termcap" through normal means it probably will crash. Thanks Jon *very* much for the details that you shared! I hope to get time to get back into this soon and I'm sure that your notes will help. The last problem that I had *three years* ago was that I failed to get the mouse to work in the text mode IDE (I did have a keyboard and mouse that worked in Android). The mouse is not absolutely required for the simple programs I'd like to do. Regards, Paul The "mouse" will more than likely be unavailable. Most people don't think "terminal" and "mouse". Still if you can find an Android terminal app with "gpm" or xterm style mouse support it could work. I've never used a "text mode" mouse in Linux. I can't think of any terminal based programs I use that offer mouse support. :-) And then you could always download an OpenSource terminal app and hack it to provide that support. The "xterm" man page documents its mouse protocol, which is probably the defacto standard. THX - Jon -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/18/2017 10:13 AM, Jon Foster wrote: On 04/18/2017 04:38 AM, Paul Breneman wrote: On 04/17/2017 08:42 PM, Jon Foster wrote: ... You have to copy the app to "/data/tmp" as that is usually the only place on Android with a Linux file system that all users have access to. You can't look in there so you kind of have to fly blind. :-) "Terminal IDE" makes this easier, assuming you have a compatible Android version, since it provides the Linux file system space, term emulator and easy access. This was what I thought Paul was looking to do. FreeVision might work depending on a number of variables... but I'm not familiar with it. Most Android terminal apps would provide some kind of VT100 like emulation so you may have to force FreeVision to output for that emulation. If it tries to use a "termcap" through normal means it probably will crash. Thanks Jon *very* much for the details that you shared! I hope to get time to get back into this soon and I'm sure that your notes will help. The last problem that I had *three years* ago was that I failed to get the mouse to work in the text mode IDE (I did have a keyboard and mouse that worked in Android). The mouse is not absolutely required for the simple programs I'd like to do. Regards, Paul The "mouse" will more than likely be unavailable. Most people don't think "terminal" and "mouse". Still if you can find an Android terminal app with "gpm" or xterm style mouse support it could work. I've never used a "text mode" mouse in Linux. I can't think of any terminal based programs I use that offer mouse support. :-) And then you could always download an OpenSource terminal app and hack it to provide that support. The "xterm" man page documents its mouse protocol, which is probably the defacto standard. THX - Jon I should also mention that PascalGUI is probably the most mature FPC+term+editor app that I know of. Its been a while but it seems they've added some nice touches. I had been using "Pascal Develop" since I could download the source and alter its compile target. But it doesn't provide proper terminal emulation and came packaged with FPC 2.6 pre v3 beta, which was good at the time since 3 hadn't been out yet. :-D I patched and added many FPC units to his original set, which I think he released. -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/19/2017 06:01 AM, Paul Breneman wrote: On 04/18/2017 07:38 AM, Paul Breneman wrote: On 04/17/2017 08:42 PM, Jon Foster wrote: ... You have to copy the app to "/data/tmp" as that is usually the only place on Android with a Linux file system that all users have access to. You can't look in there so you kind of have to fly blind. :-) "Terminal IDE" makes this easier, assuming you have a compatible Android version, since it provides the Linux file system space, term emulator and easy access. This was what I thought Paul was looking to do. FreeVision might work depending on a number of variables... but I'm not familiar with it. Most Android terminal apps would provide some kind of VT100 like emulation so you may have to force FreeVision to output for that emulation. If it tries to use a "termcap" through normal means it probably will crash. Thanks Jon *very* much for the details that you shared! I hope to get time to get back into this soon and I'm sure that your notes will help. Well, I tried a bit this morning but have failed so far. With GNURoot Debian it comes up as Debian version 8.1 but I upgraded to 8.7 using the instructions near the bottom of this page: http://turbocontrol.com/gnuroot.htm The 2.6.0 ppcarm itself fails to run with: Illegal instruction I also posted a new zip (not yet on web page) and tried that: HelloWorld-fpc-3.0.2.arm-linux-041917.zip The 3.0.2 ppcarm itself fails with: Segmentation fault Thanks in advance for *any* suggestions. As soon as I get this working I hope to create a new wiki page so it is easier for others to share. :) Thanks, Paul Breneman www.ControlPascal.com I don't know anything about your environment but a few possibilities spring to mind: 1. Newer version of Android which requires a PIC/PIE binary and you aren't running one or maybe even the inverse. Although I think this normally gives an error about "PIE" being needed, at least in the Android 5+ case. 2. An ABI mismatch. 3. Running on an FPU-less device with a compiler that wasn't built with emulation. I can't imagine what the compiler would need with an FPU though. 4. The ppcarm binary was built with a set of ARM instructions your device doesn't support. They've added many extensions to the core ARM instruction set over the years and different chip foundries can choose which they want to include or not. 5. Bad RAM? Since FPC is completely self contained I can't imagine anything in the actual Linux install would be a problem. I'm certain they are using the Android kernel and not doing something like UML, but I don't know anything about the GNUroot project. I used someone else's Linux installer once, originally titled "Lil' Debbie". They had to change their name for obvious reasons. I couldn't find a VNC client that worked well enough to use it though, even though my Iconia tablet sports a standard USB A connector and it had no trouble with a stock keyboard and mouse. I don't think the VNC clients I tried were expecting real input hardware. :-) -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/19/2017 06:48 PM, Jon Foster wrote: On 04/19/2017 06:01 AM, Paul Breneman wrote: On 04/18/2017 07:38 AM, Paul Breneman wrote: On 04/17/2017 08:42 PM, Jon Foster wrote: ... You have to copy the app to "/data/tmp" as that is usually the only place on Android with a Linux file system that all users have access to. You can't look in there so you kind of have to fly blind. :-) "Terminal IDE" makes this easier, assuming you have a compatible Android version, since it provides the Linux file system space, term emulator and easy access. This was what I thought Paul was looking to do. FreeVision might work depending on a number of variables... but I'm not familiar with it. Most Android terminal apps would provide some kind of VT100 like emulation so you may have to force FreeVision to output for that emulation. If it tries to use a "termcap" through normal means it probably will crash. Thanks Jon *very* much for the details that you shared! I hope to get time to get back into this soon and I'm sure that your notes will help. Well, I tried a bit this morning but have failed so far. With GNURoot Debian it comes up as Debian version 8.1 but I upgraded to 8.7 using the instructions near the bottom of this page: http://turbocontrol.com/gnuroot.htm The 2.6.0 ppcarm itself fails to run with: Illegal instruction I also posted a new zip (not yet on web page) and tried that: HelloWorld-fpc-3.0.2.arm-linux-041917.zip The 3.0.2 ppcarm itself fails with: Segmentation fault Thanks in advance for *any* suggestions. As soon as I get this working I hope to create a new wiki page so it is easier for others to share. :) Thanks, Paul Breneman www.ControlPascal.com I don't know anything about your environment but a few possibilities spring to mind: 1. Newer version of Android which requires a PIC/PIE binary and you aren't running one or maybe even the inverse. Although I think this normally gives an error about "PIE" being needed, at least in the Android 5+ case. 2. An ABI mismatch. 3. Running on an FPU-less device with a compiler that wasn't built with emulation. I can't imagine what the compiler would need with an FPU though. 4. The ppcarm binary was built with a set of ARM instructions your device doesn't support. They've added many extensions to the core ARM instruction set over the years and different chip foundries can choose which they want to include or not. 5. Bad RAM? Since FPC is completely self contained I can't imagine anything in the actual Linux install would be a problem. I'm certain they are using the Android kernel and not doing something like UML, but I don't know anything about the GNUroot project. I used someone else's Linux installer once, originally titled "Lil' Debbie". They had to change their name for obvious reasons. I couldn't find a VNC client that worked well enough to use it though, even though my Iconia tablet sports a standard USB A connector and it had no trouble with a stock keyboard and mouse. I don't think the VNC clients I tried were expecting real input hardware. :-) One other thing to try is: If you install PascalGUI or Pascal Develop do their compilers run? Might reveal some clue. -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc code for Java class and Android.
On 04/20/2017 05:17 AM, Paul Breneman wrote: On 04/19/2017 10:49 PM, Paul Breneman wrote: I'm using a Nexus 7 tablet with Android 6.0.1. GNURoot provides a chroot with Debian? It has been *three* years since I did this before and things worked then so I don't know what might have changed so ppcarm doesn't even run now. Android? GNURoot? ppcarm? I'm trying the *most simple* thing, so no x11 or VNC needed. Actually, the FPC 2.6.0 *ppcarm* worked three years ago but not now. What can cause it to have an *Illegal instruction* error? There is a *simple* procedure near the bottom of this page: http://turbocontrol.com/gnuroot.htm So what changed in those three years? 1. Pretty sure Android 6 wasn't out three years ago? Yeah, I see it was released 10/2015. 2. New device? 3. Did you use the same ppcarm you downloaded three years ago or did you download it again? 4. Do you have your older device you could try your ppcarm on? You will have to address the PIC/PIE issue but you could be looking at the compiler using machine language instructions that aren't supported by your hardware (as previously described). If my guess about the tablet being newer is correct, I doubt it. Still it looks like my ppcarm supports over a dozen different instruction sets. And their is always the chance some other form of crash is causing that message. Android 6 *definitely* requires PIC binaries, that *definitely* changed in the past three years. A three year old version of FPC would not have been compiled that way. FYI: a PIE binary won't load on a non-PIE enabled OS. I had been reading about ways Google devs were trying to work around that. Of course Google wouldn't want that to happen... so I imagine their efforts were squashed. - On 11/16/2015 Yuri Sidorov wrote: -- Subject: Re: [fpc-devel] PIE compatible output? Hi, The 3.0 release for android is not able to produce correct PIC executables and libraries. You need build an svn trunk version of FPC to produce PIC/PIE binaries for android. [...] - If you look in the archives of this mail list you should be able to view our exchange. So my money is on you needing to build your own version of ppcarm with PIC enabled. And you may need to fiddle with the instruction set used. You can either do this by cross compiling on another FPC supported platform, which typically means building your own "binutils". Or, depending on what you have available, the needed prebuilt binaries to cross compile may already be available through the usual FPC channels (I think I saw windoze zips). Or you can leverage a *real* Linux based ARM platform such as Rpi or CHIP. That was actually one of my motivating factors to get involved with CHIP. A native ARM platform to build binaries, specifically units, for Android for only $9 USD! I still want to cluster a bunch of these things in a stock PC tower case to use as compiling nodes. Too many cool projects and so little time! :-( -- Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ 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/08/2017 11:34 AM, Mark Morgan Lloyd wrote: On 08/05/17 18:30, Felipe Monteiro de Carvalho wrote: On Sun, May 7, 2017 at 8:33 PM, Mark Morgan Lloyd wrote:> Can anybody give me a quick summary of the position of FPC on Android etc.? Works fine like via JNI, you can do most stuff in Pascal using JNI butpart still needs to be in Java. some info here: http://wiki.lazarus.freepascal.org/Android_Programming Thanks Felipe, noted. I rather lost track when therewere (at least) two competing approaches. Yeah. The wiki is cluttered with inaccurate and abandoned information for Android development. It needs a serious scrubbing. And access to needed sources is somewhat hidden. I've combed it for a few years, now, to try and deduce what's real and what's not. I'm not even sure where I got the bits of source I'm using now. I've just been clinging to it like a shipwreck survivor clinging to flotsam. So, does anyone know, is this the "official" Android dev page? I can testify that it is possible to write Android apps with FPC 3+. So far its been the most frustrating effort of my programming life. FPC does amazingly well but Android is chalk full of hidden gotchas and things that simply don't work as described. I finally settled on the approach of using the JVM target to compile my app. I used GNU "make" to coordinate compiling and packaging. I used a few of the CLI tools from the Android SDK and "jarsigner" from the JDK to do the packaging and generating the resource identifiers. I used a stupid simple FPC program to perform a bunch of StringReplace() calls to convert the "aapt" created "R.java" (resource ID constants) file into Pascal. I also threw some headers and cruft-stripping in for good measure. The biggest problem with doing it this way, besides the Google widgets doing things that I just can't fathom, is the lack of the FPC libraries we all love and have come to expect. You do have to bend your mind to fit the Java paradigm and sift through the Android/Java docs to find the things you normally use. Something as simple as converting a number to a string needed to be found. Actually I think I finally just wrote an IntToStr() because it was quicker than digging through docs. I was thoroughly frustrated with the experience. Having previously tried to go all native code, which would be my preference anyways, I decided to revisit that idea before I do more with Android. As Graeme mentioned, I decided to try and leverage fpGUI into the Android environment. But with the extreme differences in execution model between Android and everything else, its kind of like fitting a square peg into a round hole. It will be a while. :-/ Speaking of frustrations. I don't envy you with your vehicle issue. I did some experimenting with a USB OBD-II dongle some time back. I was looking at building an FPC/Lazarus based diagnostic system. This was mostly spurred by the fact that my '99 Dodge Dakota ran well... but sometimes it ran REALLY AWESOM! I wanted it the latter way all the time. In short I found that a huge amount of diagnostic data and interfaces are proprietary. The auto manufacturers don't want us lowly individuals to have it unless we're willing to shell out tons of money. One source I read said Ford was licensing their full PID data for $100K per year! Since I discovered the fpGUI gauges and the PocketCHIP I'm thinking I'd like to tinker with the OBD-II stuff again. But that probably won't help you. I've never used the serial unit. It seems odd that you would have to patch "serial.pp" if the hardware is capable. Are there some non-OS imposed restrictions in there? I wrote some code back in the Kylix days to manipulate the Linux serial devices and that is my go-to lib for anything serial. Really all it does is provide an interface to ioctl() to set line disciplines. Other than that the serial device is just another file. My only concern with 800 baud is if the clock divider in the serial chip can go that low. Its also an odd step (300, 600, 1200, ... being the standards). THX - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ 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/11/2017 01:29 AM, Felipe Monteiro de Carvalho wrote: On Thu, May 11, 2017 at 1:19 AM, Jon Foster wrote: Yeah. The wiki is cluttered with inaccurate and abandoned information for Android development. It needs a serious scrubbing. And access to needed sources is somewhat hidden. I've combed it for a few years, now, to try and deduce what's real and what's not. I'm not even sure where I got the bits of source I'm using now. I've just been clinging to it like a shipwreck survivor clinging to flotsam. I don't think the wiki page I posted is inaccurate, all the stuff there is valid AFAIK, but it is simply very incomplete. A lot more should be written, and also note that there are 2 different ways: 1> Via NDK combining native Pascal + Java 2> Via JVM compiler The wiki I posted is only for approach 1, even a link to a full compilable example is posted there (thought it is for OpenGL). I never used approach 2 and dont plan on using it. Thanks for the info Felipe. I'll bookmark that page somewhere. I was also referring to the many other Android pages on the wiki that are misleading. Its hard for us outsiders to know what's authoritative and current. I would like to hazard there is, yet, another way: 3> #1 w/o Java - pure native. However that would never be entirely accurate as all "native activities" have to be chaperoned by a Java "Activity". And JNI will have to be used to interface to any Android supplied services as everything else is stuck in Dalvik land. All part of what makes Android so inefficient. But my intent is not to have to do Java once an FPC based activity is launched. Might have to build a better "NativeActivity" class with ppcjvm too... I think that's something Lazarus did/does. I should also throw out here that it would be *REALLY* nice, and even somewhat needful on the Android front, if FPC could interface directly with C++ libs and use their classes and objects. Besides Java, Google prefers to use C++ (for obvious reasons) and their supplied native code libraries are C++. If you look at Google's software architecture diagram they say they use FreeType2. But, even rooted, if you search the Android file system you won't find a FT2 lib anywhere. Digging through the AOSP source base it turns out that FT2 is statically linked into Skia. Skia is a C++ library used by Dalvik (and other places) to do the usual 2D text/graphics rendering. This acts much like AggPas, used by Graeme's AggCanvas. I did find it exports a limited set FT2 functions in standard C style. But it looks like, for full functionality, I'm going to have to bridge the C++ divide. Anyhow tips on the FPC->C++ front would be appreciated. I will probably search the list archives as I know this topic comes up repeatedly. I don't understand how ginormous an undertaking this might be but maybe I can contribute something on this front. -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ 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/11/2017 09:37 AM, Sven Barth via fpc-pascal wrote: Am 11.05.2017 18:14 schrieb "Jon Foster" <mailto:jon-li...@jfpossibilities.com>>: > Anyhow tips on the FPC->C++ front would be appreciated. I will probably search the list archives as I know this topic comes up repeatedly. I don't understand how ginormous an undertaking this might be but maybe I can contribute something on this front. I can't speak for other approaches to interface with C++ code, but patches to the compiler's cppclass support are definitely welcome :D It will never support everything there is in C++, but if we'd manage to interface with most library code that would be something... @@ <- me being bug eyed cppclass?!?! Where? When? How? What? I still can't find any mention of C++ support in the FPC 3.0 doc PDFs. I've just grepped the source and I see something... Still trying to figure out what it means. But to put it more specifically: What support is there? How is it used? Where are the docs, if any? When did it sneak in? (not really important, just curious) -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/11/2017 02:48 PM, Graeme Geldenhuys wrote: On 2017-05-11 19:43, James Richters wrote: Any Suggestions? Speed: In recent graphics work I've done, I've noticed that FPC is fantastic at created cross-platform applications. But the generated binaries are NOT fast at all - no matter how many compiler parameters and artificial speed optimisations we tried to implement. Sloppy Java code ended up 3x faster than the best I could get out of FPC generated binaries. I'm not saying this is your performance problem (especially comparing a 3Ghs PC vs a 233Mhz PC) - there certainly seems to be another problem contributing to your speed issue. Wow, Graeme! That's harsh. One of the last set of benchmarks I did that focused on integer math and procedure call speed came out as follows: Run 1M numbers Intel 2GHz 2016: === pascal:2:09s - 2:12 c: 2:06s - 3:05 Java 2:11s - 2:24 js (JIT): 2:23s - 2:27 python: 36:43s - 37:02 php: 38:16s - 40:45 js (interp): 60:51s - 64:10 perl: 69:19s - 74:26 Times are in minutes:seconds. "Pascal" is, of course, FPC. I believe I used fpc 2.6.4 w/ -O2 on that run. Its been a while. The code that was used was as identical as it could be for each of the languages represented. I was interested in the speed of the languages' general mechanics, not special features that one might have over the others. These are the performance ranges from my Linux box running at 2GHz. I ran four runs each. On average the Pascal code performed about the same for each run and the C code, for whatever reason, tended to get slower. Two things surprised me when I ran this: the Java speed and the speed of the initial JavaScript run. I used SpiderMonkey (Mozilla) for the JS test and OpenJDK 6 for Java. Both apparently have *VERY* effective JIT compilers. You can see from the "js (interp)" entry what you would expect if the benchmark were run in a browser. But I think Chrome(ium) is/are starting to ship with JIT enabled in V8. I didn't bother to find out how to turn off JIT in OpenJDK. If I had, I'd expect it to fall in the 40minut range like the rest of the interpreters. As far as raw computational power I'd pit FPC against any native-code-compiled language, especially considering the register calling convention. I've rewritten several of the standard *nix routines provided by GNU simply because I can do it 100x or more faster in FPC. In short if your suffering a performance issue I'd look to the libraries in use for poor implementations. Like anything else, bad software can be written with FPC too. A funny story: Back in 2000 I wrote a TStringList replacement because the Delphi/Kylix version was astoundingly slow (specifically TStringList.IndexOf()). I thought I'd get fancy and provide a mode where I'd keep the list sorted and use a binary search to find elements. I figured it'd be fast because reordering the list was just moving pointers. In either mode it was way faster than the Borland's implementation. Fast forward to about 2010 and I was parsing millions of Apache log lines and using my trusty string list when I noticed it was taking a LOT longer than expected. I turned off the fancy sorted-binary-search mode and performance was significantly better. But that left me scratching my head. What was wrong with my logic? Last year I finally got mad at it and took a closer look. Since I could not find a flaw in my logic I looked at the assembly code produced by FPC. Turns out that every time you assign a long string to a variable it makes a function call to inc & dec the use counter as necesary. This was adding a *HUGE* performance penalty! I now fake FPC out by casting to pointers to move the strings in the list, since I'm not actually changing the use count. The performance gain was staggering! -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/12/2017 03:11 AM, Graeme Geldenhuys wrote: On 2017-05-12 00:57, Jon Foster wrote: One of the last set of benchmarks I did that Please note, I did not set out to implement a benchmark. I think all purpose written benchmarks are bias and unrealistic. I implemented a legit software raycaster for a game I was developing. Initially I was going to implement it in Java, but then thought I would rather like to use my much loved Object Pascal language. That plan failed in the end. Two things surprised me when I ran this: the Java speed and the speed of the initial JavaScript run. I used SpiderMonkey (Mozilla) for the JS test and OpenJDK 6 for Java. I was developing with Java 8 (OpenJDK). And yes, Java speed is phenomenal these days. A far cry from the performance seen in the late 90's. In short if your suffering a performance issue I'd look to the libraries in use for poor implementations. Like anything else, bad software can be written with FPC too. Both the Java and Object Pascal code was poorly written - because they were very closely based on a JavaScript implementation which was meant for a 4KBytes competition (see how much your can do in just 4KB). Still, the Java compiler did a better job in optimising the final binary code. The developers in the Lazarus Forum made numerous suggestions on how to improve the speed of the Object Pascal version. I tried everything they suggested and maybe gained 2-5 FPS in the end. Still nothing compared to the performance of the Java or C versions, where no manual optimisation was applied. I don't suppose you could post a link to the Lazarus forum discussion. I'm extremely curious and so far my hunting on the forum hasn't turned up anything. THX! -- Sent from my Debian Linux laptop -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/12/2017 03:43 AM, Michael Schnell wrote: On 12.05.2017 01:57, Jon Foster wrote: One of the last set of benchmarks I did that focused on integer math and procedure call speed came out as follows: Thanks for sharing ! You're welcome. pascal:2:09s - 2:12 js (JIT): 2:23s - 2:27 python: 36:43s - 37:02 Funny that JS (Text) with JIT is so good, and that Python (binary byte-code, also supposed to use a kind of JIT), is so bad. As you can tell from the figures Python, at least v2.7.x as supplied with Deb7, does not perform any kind of native-code compilation. The performance hit of interpretation is unavoidable. Python does provide tools to byte-code compile into *.pyc or *.pyo files and attempts to do so automatically (if it has write perms). This removes the parsing step and is essentially what PHP "accelerators" (other than HipHop) do. Parsing can really add to "launch" time, which really hurts web app performance, since so little is accomplished with each invocation. There is also "cython" which turns a variation of Python into C usable as a Python extension. But this is not an automatic process. So to compare apples to apples you have to compare Python to the "JS (interp)" time. However interpreter bench marking is fraught with even more peril than compiler bench marking since so much of interpreter performance is based on what can be offloaded to the machine code parts. Something like a routine to XOR encode a string will be 100x (or more) faster if provided in a language construct or native-code backed method, rather than writing the same thing with the language itself. In fact this is one of the things that Python might suck at since it has immutable strings. You have to decompose it to a "list" of "characters", do the transform, then recompose it back to a string. This would hurt Java too as its string implementation is immutable as well. Speaking of Java ... that's a hard comparison to make. There are so many Java implementations. Good performance with OpenJDK does not necessarily make good Android performance, or good performance using any other Java environment. Just at SpiderMonkey's JS times are not necessarily indicative of Google's V8. I should load NodeJS and try it out. :-) But I really don't care enough to. This is also why Google has been "silently" moving towards a compile-at-install-time methodology. About bloody time! I was looking for a way to do that in the mid '80s. -- Sent from my Debian Linux laptop Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/13/2017 12:24 PM, Graeme Geldenhuys wrote: On 2017-05-13 18:02, Jon Foster wrote: Speaking of Java ... that's a hard comparison to make. There are so many Java implementations. Doesn't IBM, Linux, FreeBSD etc use OpenJDK? I was also under the impression that Oracle now also uses OpenJDK as the base for their releases - with some of their own additions. If this is all correct, it means they all pretty much use the same Java VM and Compiler implementations. I can't really speak for most of those as I'm not interested in the Java platform. The language is too inflexible and on some, if not many platforms its interpreted. As you saw in my chart that hurts. Linux doesn't use Java. Its just another piece software installed by the user when they want it. Which means they are free to install whatever derivative of Java they choose. I imagine that most distributions will provide OpenJDK as a default Java solution, because its Open Source. For FreeBSD OpenJDK may be the only option. But I suppose my point was more for things that are off the typical desktop. There are others, like Google, that provide Java implementations that are free to do whatever the author wishes so long as they adhere to the byte-code standard. The short of it is: when developing for various platforms Java performance is likely to vary more widely than expected. There are probably a number of platforms that still use or fallback to interpretation and other implementation details will vary. Just as using M$ C, GCC, ... for a windoze platform may produce different performance results. But Java has the potential for a much broader range of variance. So to say, "Java is fast." Is not necessarily true depending on who's implementation you're using. I tested OpenJDK 1.6.0 on Linux. I didn't test anyone else's implementation. Would be interesting to compare OpenJDK on the ARM powered CHIP vs. Dalvik on a similarly spec'd Android device. :-) -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/15/2017 03:27 PM, Graeme Geldenhuys wrote: On 2017-05-15 22:50, nore...@z505.com wrote: Graeme will need to clarify whether he was trying to be harsh on FPC entirely, or just specifically in some areas.. :-) I'll try and clarify... I believe FPC generates slow (or slower than Delphi, GCC and Java) code no matter what. The saving grace is that you don't really notice it on normal event-based desktop applications. Writing a game is a whole different story. Games are way more sensitive to performance. Now the game I wrote, was a desktop GUI application. It was slow under Linux, FreeBSD and Windows. So the results were consistent, no matter what GUI API was used Be that fpGUI (via GDI), fpGUI (via X11) or LCL-GTK2. In all cases, game rendering was to a memory image, then once done, that memory image was bitblit to the Window Canvas. The Java and GCC versions did the same, but were faster. That's all I can say about. Make your own assumptions - read into it any conspiracy theories or what-not. ;-) At this point I don't really care, as I already moved on with that project, using OpenGL instead (both for Java and Object Pascal). I think the key word in Graeme's complaint is "game". And I'm willing to bet that most of his envisioned gaming scenarios deal with a lot of floating point math and the more advanced math functions. A quick glance over his example code and I'm willing to bet that the "math" unit providing the sqrt(), cos(), sin() and others is the bottle neck. But that's just a knee-jerk reaction. Seems to me I read a while back that a ton of effort had not gone into them. There are only two software projects in the world that continue to impress me with each new release: the Linux Kernel and FPC, which amuses me since I remember the first version of FPC I saw. '99 I think it was. I laughed and moved on. I wish I had the time provide some concrete info on where Graeme's problem is because I'd really like to see FPC shine here too. But it will probably be a while before I can give it proper treatment. -- Sent from my Debian Linux laptop Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] List pre-defined defines
I've looked several times over the years for a way to get fpc to dump all of the predefined "defines" for the target selected. Things like "fpc", "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what else. Seems like there ought to be an "-i?" switch for this. Have I just missed it? Is there something to dump all of the built in defines for the current target? I have a couple of needs for this: 1. A "menu" of sorts to figure out which is the best define to make my code adapt to a given target, like when I wrote something for i386 and then discover I need to do something different for x64 or arm. 2. I have tools to extract code sections from Pascal sources. but I don't always know which ifdefs to follow. 3. Just 'cause I'm curios... I guess that's more than 2. :-) TIA - Jon -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List pre-defined defines
On 05/16/2017 02:53 PM, Mattias Gaertner wrote: On Tue, 16 May 2017 14:45:42 -0700 Jon Foster wrote: I've looked several times over the years for a way to get fpc to dump all of the predefined "defines" for the target selected. Things like "fpc", "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what else. Seems like there ought to be an "-i?" switch for this. Have I just missed it? Is there something to dump all of the built in defines for the current target? touch mytest fpc -vc mytest Thanks fellas! I guess I always figured that was source code specific information. Works good, even without source. Just have to ignore the exit code. :-D THX! -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/18/2017 07:19 AM, Reimar Grabowski wrote: On Thu, 18 May 2017 20:32:57 +0700 Ryan Joseph wrote: On May 18, 2017, at 8:23 PM, Graeme Geldenhuys wrote: The compiler must be doing something really stupid for it mess up like that but how can we know? By getting the source of Graemes test, using a profiler on it and having a look at the results? I compiled Graeme's code which was surprisingly easy. I guess I already had SDL installed with the dev files. FPC on my old 2GHz Intel gets 2fps. With Java (OpenJDK 1.6.x) I get a pretty steady 14fps. On my 3yr notebook with a 1.9GHz Intel I get 4fps for FPC and 18fps for Java. I find it amusing the slower chip is faster. But there has been significant hardware improvements over the years. I would have provided the fps for C++ but I haven't figured out how to get it to render the same content. It was doing half the resolution. I upped the window size which was obvious but it appears to be magnifying the same low pixel count. I've got to get back to work so I'll have to stop fiddling with this. Both devices are multi-core Intel processors, obviously two different families, running 32bit Linux with Xorg for the display. FPC is version 3.0.0. For the benchmark runs I used "-XXs -O3" for compiler switches. I limited run time to 10secs, and used "time" to verify actual run time. Here are the results, time output listed first and the first section of the gprof output without comments: 10.05user 0.01system 0:10.11elapsed 99%CPU (0avgtext+0avgdata 9188maxresident)k 0inputs+272outputs (0major+1010minor)pagefaults 0swaps Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds secondscalls Ts/call Ts/call name 62.44 1.33 1.33 fpc_frac_real 26.76 1.90 0.57 MATH_$$_FLOOR$EXTENDED$$LONGINT 10.33 2.12 0.22 FPC_DIV_INT64 0.47 2.13 0.01 SYSTEM_$$_GENRAND_MT19937$$LONGINT 0.00 2.13 0.00 43 0.00 0.00 P$TEST_$$_RENDER 0.00 2.13 0.008 0.00 0.00 P$TEST_$$_INTTOSTR$LONGINT$$ANSISTRING 0.00 2.13 0.001 0.00 0.00 P$TEST_$$_INIT 0.00 2.13 0.001 0.00 0.00 main The code that is slow appears to be all standard floating point and integer math (* / mod + - >> <<). All of the time is spent in the render() function's main loops (lines 191-282 inclusive). I might have missed something but I didn't see any function calls of any concern. I rem'd those lines out and my frame rate jumped to ~1200. Obviously all I saw was a black screen. But I wanted to eliminate the SDL calls from the suspect list and make sure I had targeted the right lines. I'm convinced that its not the integer math from the benchmarks I published earlier. And I thought everyone used the FPU so I never imagined there could be a significant speed difference with floating point. But this feels like the compiler is using software math instead of the FPU. I tried various -Cf... switches and either got the same results or "Access Violation". Even tried "-Ce" and the compiler said it was an invalid switch. I suppose there could be something else I'm missing. Much more work to do to find the culprit. Seems like the compiler team should be very interested in this. Fortunately I don't do much with floating point math or I'd probably be heading back to C/C++. Ugg. I can still churn through millions of web log lines in pretty quick order. :-D -- -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List pre-defined defines
On 05/17/2017 04:52 AM, Graeme Geldenhuys wrote: On 2017-05-16 23:25, Jon Foster wrote: Works good, even without source. With a source file it gives a few more options. Thanks Graeme! -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List pre-defined defines
On 05/17/2017 05:40 AM, Ewald wrote: On 16/05/17 23:53, Mattias Gaertner wrote: touch mytest fpc -vc mytest Perhaps a one-liner: fpc -vc /dev/null ? Saves one the need to create a dummy file and remove it afterward ;-) I like it! -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List pre-defined defines
On 05/18/2017 08:46 AM, Jon Foster wrote: On 05/17/2017 05:40 AM, Ewald wrote: On 16/05/17 23:53, Mattias Gaertner wrote: touch mytest fpc -vc mytest Perhaps a one-liner: fpc -vc /dev/null ? Saves one the need to create a dummy file and remove it afterward ;-) I like it! Although that won't work on windoze! ;-) -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/18/2017 08:56 AM, Reimar Grabowski wrote: On Thu, 18 May 2017 08:40:43 -0700 Jon Foster wrote: I limited run time to 10secs, and used "time" to verify actual run time. Here are the results, time output listed first and the first section of the gprof output without comments: A little of topic but did gprof just work like it used to? I remember last time I tried to profile with gprof I could not get it to work and even asked about this on this list and was suggested alternatives. Has there been something fixed or is it by chance that it works? It just worked for me. I'm using FPC 3.0.0 with gprof 2.22. Probably an older version as I'm still running Debian 7 32bit. If it hadn't just worked I wouldn't have been able to post anything more useful in a timely fashion. The code that is slow appears to be all standard floating point and integer math AFAIK floating point math is done using the extended type (as the gprof output shows) and there are no optimizations for single or double. Correct me if I am wrong. I read that some were having trouble compiling Graeme's code because of SDL version differences so I stripped out the SDL code and replaced the timing function with traditional time/now calls. I then realized I still had Kylix buried in some recess of all these excess terabytes and thought I'd see what happens if I compiled the code with that. So I went through another set of changes taking out all of the neat FPC C style operators and returning them to the traditional ones. And put "inline" declarations and other useful FPC defines in ifdefs. I then back ported all of those changes into the SDL enabled code just to make sure it still rendered accurately. You can find both versions in my GitHub account: https://github.com/jafcobend/fpcflop Graeme, I assume you don't mind me reposting that code on GuitHub? If so I can take it down. The headless code when compiled with "fpc -XXs -O3" on my 32bit Linux box produces the preset 100 frames in about 32secs, a tad over 3fps. When compiled with "dcc" (Kylix v3) using whatever its default optimizations are and losing the FPC inlining, runs just slightly faster averaging 29sec for the 100 frame runs. Not much better, but not worse either. Kind of thought that loss of inlining would have hurt more. Or maybe it does and that's why it didn't do much better.-- -- Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/18/2017 07:21 PM, Ryan Joseph wrote: On May 19, 2017, at 8:01 AM, Jon Foster wrote: You can find both versions in my GitHub account: https://github.com/jafcobend/fpcflop Thanks again, I was finally able to get this complied. No idea why the inclusion of SDL 2 was crashing at that line. If I remember right your crash was in the call to plot(). The SDL plot used pointers the non-SDL plot writes to a static global array. It would seem a logical assumption that the pointer weren't initialized appropriately. -- Sent from my Debian Linux laptop Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Graphics options?
On 05/19/2017 04:11 AM, Nikolay Nikolov wrote: On 05/19/2017 03:54 AM, Ryan Joseph wrote: On May 18, 2017, at 10:40 PM, Jon Foster wrote: 62.44 1.33 1.33 fpc_frac_real 26.76 1.90 0.57 MATH_$$_FLOOR$EXTENDED$$LONGINT 10.33 2.12 0.22 FPC_DIV_INT64 Thanks for profiling this. Floor is there as I expected and 26% is pretty extreme but the others are floating point division? How does Java handle this so much better than FPC and what are the work arounds? Just curious. As it stands I can only reason that I need to avoid dividing floats in FPC like the plague. [...] The default options for the i386 compiler is to target the Pentium CPU, which does not have SSE. This gives most compatibility and least performance, but that's what's appropriate for most users, because for most desktop applications, CPU speed is no longer an issue. Only very specific tasks, such as software 3D rendering need high CPU performance, and people doing that stuff, usually know very well their compiler options and how to enable support for modern instruction extensions for maximum performance. Of course, people coming from a Java background might not be used at all to having to do this kind of stuff, but it's really not that hard. As stated I tried *ALL* of the FPU settings and received the same result or an "access violation", which I assumed meant my FPU did not support that feature set. I even tried to enable emulation, to see what the difference would be, but ppc386 said it was an invalid switch even though it lists it in the help output. -- Sent from my Debian Linux laptop -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc. j...@jfpossibilities.com 541-410-2760 Making computers work for you! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal]Class Identification?
Heya ^_^ Is it possible to identify the class type? For example TypeOf(MyClass) = TypeOf(MyClass)? Is it possible to register diffrent types of classes at startup and then identify them later? This is probably a simple matter solvable with a few calls from the System unit that are well documented. But honestly.. I didn't see any! ^_^ Any hints/suggestions would be much appreciated. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Class Identification?
> for descendants of TObject, there's a method 'ClassType', e. g. > > *** > begin > if MyObject.ClassType = CCalculator then begin > bla bla > end else bla bla > end; > *** > > see reference manual - system unit. this only works if a descendant of > TObject has been assigned to MyObject. > > Anton. Thanks. ^_^ I just maid my base class a descendant of TObject and that took care of it! ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Class Identification?
> btw, all classes are implicit descendants of TObject. If you don't > specify any base class, the class will be derived from TObject directly: > > type > TMyClass = class > procedure Something; > ... > end; > > TMyClass is automatically inherited from TObject > > Both postings sound like this wasn't clear... > > > - Sebastian Indeed.. I did not know this. ^_^ Thank you very much. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Arrays with Undefined Ranges.
I seem to remember being able to declare something like: MyArray = Array of Byte; Useing "MyArray" as an easy way to get a pointer to a memory location. Now if I do something similar: tQPixelArray = Array of tQPixel; I get a compiler error telling me it Expected [ and got Array. Is there any way of being able to declare an array without a range? If not is there a index larger than WORD that will work with arrays? QWord will not work and for some reason the compiler does not recognize DWord ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Arrays with Undefined Ranges.
On Thu, 2003-03-27 at 03:36, Michael Van Canneyt wrote: > > > On 26 Mar 2003, Jon David Sawyer wrote: > > > I seem to remember being able to declare something like: > > MyArray = Array of Byte; > > > > Useing "MyArray" as an easy way to get a pointer to a memory location. > > > > Now if I do something similar: tQPixelArray = Array of tQPixel; I get a > > compiler error telling me it Expected [ and got Array. > > > > Is there any way of being able to declare an array without a range? > > Only in the 1.1 development compiler. The 1.0 compiler doesn't support > dynamic arrays. > > > > > > If not is there a index larger than WORD that will work with arrays? > > Yes. > > > QWord will not work and for some reason the compiler does not recognize > > DWord > > Qword is 64 bit, that will not work, but Cardinal (=DWord) should work. > > But you can just as well use the 'pointer math' approach and declare > > Type > tQPixelArray = ^tQPixel; > var > Arr : TQPixelArray; > > Then > GetMem(Arr,1000*SizeOf(tqPixel)); > Arr[0]:=.. > Arr[1]:=.. > will do what you expect. Only the memory management you must do > yourself. > > Michael. > The 'Pointer Math' is EXACTLY what I was looking for. Thank you. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Defining Records on the fly:
If I have this type: Type tMyRec = Record X, Y: Integer; End; and can do this: Const ARec : tMyRec = (X:12; Y:25); why can't I do this? var AnotherRec: tMyRec; begin AnotherRec := (X:12; Y:25); end. ** Feel free to smack me around. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Defining Records on the fly:
Here is why I was wondering why you couldn't, say I have this type: Type tMyRec = Record X, Y : Real; End; And I have this function: Function CheckPoint(aPoint: tMyRec): Boolean; Begin {Does something here..} end; begin CheckPoint((X:1.2;Y:2.2)); end. In short I think it would be a nifty feature.. but hey.. I was just wondering. On Mon, 2004-02-16 at 04:46, Shawn Tan Ser Ngiap wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Monday 16 February 2004 00:40, Jon D. Sawyer wrote: > > > Const ARec : tMyRec = (X:12; Y:25); > > > > why can't I do this? > > > > var > > AnotherRec: tMyRec; > > begin > > AnotherRec := (X:12; Y:25); > > It's just the way the language is... you could do this... > > AnotherRec.X := 12; > AnotherRec.Y := 25; > > or this, if i'm not mistaken... > > with AnotherRec do begin > X := 12; > Y := 25; > end; > > with metta, > Shawn Tan. > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.2.3 (GNU/Linux) > > iD8DBQFAMJGK9KUEj/m6O5oRAgFLAJ9P8GoTc62l310Zq99F1g6RujOuwgCgsdc7 > liXNcgoLQIPREr7BbN0lG6c= > =u2G5 > -END PGP SIGNATURE- > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]My object function is overriding real function
If the function you wish to call is apart of another unit you can call i.g.: UnitName.Close(sin); UnitName.Close(sout); ** That may work from within the same unit but I'm not certain. ** Free pascal is great about name spaces and allowing you to specify which function you wish to call. On Wed, 2004-02-18 at 20:50, Jeremy Cowgar wrote: > Greetings. > > I have a object that connects to a speech server, festival. In my > object, I define a function called close. This must close the socket > connection, which is done by the function close. Therefore, I am having > a problem, because simply calling close with the sin and sout parameters > results in an error because it is calling my objects close function > which takes no parameters. > > How can I call a function that is not part of my object, but has the > same name as one of my object functions? Here is my simple code, for > example: > > function TFestival.Open(host : string; port : integer) : integer; > var > h : THost; > addr : TInetSockAddr; > begin > h.NameLookup(host); > if h.LastError <> 0 then > begin > Open := 1; > Exit; > end; > > addr.family := AF_INET; > addr.port := ShortHostToNet(port); > addr.addr := HostTonet(longint(h.IPAddress)); > > sock := Socket(AF_INET, SOCK_STREAM, 0); > if Not Connect(sock, addr, sin, sout) then > begin > Open := 2; > Exit; > end; > > rewrite(sout); > reset(sin); > > Open := 1; > end; > > procedure TFestival.Close(); > begin > close(sin); > close(sout); > > Close := 0; > end; > > I realize that I can simply rename my close procedure but I imagine that > I will run into similar situations as I continue to use Free Pascal. > > Thank you for your help, > > Jeremy > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]RE: Defining Records on the fly:
^_^ Thats how its working at the moment and I've known that FPC doesn't do that kinda definition on the fly. My real question was why not? On Wed, 2004-02-18 at 21:34, Adam Victor Nazareth Brandizzi wrote: > You can also define a function that returns the record you need: > > function NewMyRec( X, Y : double ) : TMyRec; > begin >NewMyRec.x := X; >NewMyRec.y := Y; > end; > > I think it's really better than declare a new variable and initialize it > by the code. > > if CheckPoint(NewMyRec(1.2, 2.2)) then ... > > Be well... > > Jeff Pohlmeyer wrote: > > >Since Free Pascal supports function overloading, > >you could do something like this: > > > > > >Function CheckPoint(X, Y:real): Boolean; > >Begin > > {Does something here..} > >end; > > > > > >Function CheckPoint(aPoint: tMyRec): Boolean; > >Begin > > Result:=CheckPoint(aPoint.X, aPoint.Y); > >end; > > > > > >// So you can use it either way: > > > >var > > MyRec:tMyRec; > >begin > > if CheckPoint(MyRec) then {do stuff}; > > if CheckPoint(1.2, 2.2) then {do more stuff}; > >end; > > > > > > > > > >>Here is why I was wondering why you couldn't, say I have this type: > >>Type tMyRec = Record X, Y : Real; End; > >> > >>And I have this function: > >> > >>Function CheckPoint(aPoint: tMyRec): Boolean; > >>Begin > >> {Does something here..} > >>end; > >> > >>begin > >> CheckPoint((X:1.2;Y:2.2)); > >>end. > >> > >> > > > > > >__ > >Do you Yahoo!? > >Yahoo! Mail SpamGuard - Read only the mail you want. > >http://antispam.yahoo.com/tools > > > >___ > >fpc-pascal maillist - [EMAIL PROTECTED] > >http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > > > > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]fpcmake
Is there a way to get FPC Make to enter its target DIRS before compiling the units in the current directory? I've got a unit that depends on another unit being compiled first that is in a sub-directory, even though I list the dirs first Make trys to compile the current dir first. Thx.. ^_^ ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]fpcmake
Thanks Micheal & Peter, I kinda figured that was the case. I think I'll just move it to a sub-directory like you suggested peter because I'd rather not have to re-edit the raw Makefile every time I generate it. Thanks again! This newsboard is part of what makes FPC so damn great! All of you guys rawk! On Tue, 2004-02-24 at 03:47, Peter Vreman wrote: > > Is there a way to get FPC Make to enter its target DIRS before compiling > > the units in the current directory? > > > > I've got a unit that depends on another unit being compiled first that > > is in a sub-directory, even though I list the dirs first Make trys to > > compile the current dir first. > > There is no way without hacking the Makefile/fpcmake. You can workaround > not having files in the current dir, but also in a subdir. > > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Using UInt32 {LongWords} as Indexes for Properties.
Ran into a problem of where I'm not sure how the code will work once I'm finished and I'd rather not write all this if its not going to work: I want to provide access to Bit-Flags that control a class of mine: ig: Property SWSurface : Boolean Index SDL_SWSurface Read GetFlags Write SetFlags; If I declare Get/Set Flags as the following: Function GetFlags(aBit: UInt32): Boolean; Procedure SetFlags(aBit: UInt32; aBool: Boolean); I of course get a bunch of: cqsdl_surface.pp(17,6) Error: Illegal symbol for property access So I set it to read: Function GetFlags(aBit: Integer): Boolean; Procedure SetFlags(aBit: Integer; aBool: Boolean); And it compiles fine. What I'm worried about is that if aBit is a Signed Integer and the constant SDL_SWSurface was meant to be treated as an Unsigned Integer can this code work the same? This works: Property Flags[aBit: UInt32]: Boolean Read GetFlag Write SetFlag; Function GetFlags(aBit: UInt32): Boolean; Procedure SetFlags(aBit: UInt32; aBool: Boolean); BUT it means that the programmer has to supply the Bit mask and THAT means yet-another-uses statement just for a few damned constants. The entire point of me providing these specifically named properties was to stop that. Any Suggestions? Feel free to smack me around for being an idiot. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Using UInt32 {LongWords} as Indexes for Properties.
I appreciate the help but I'm not sure if you understand what it is I'm trying to do. SetFlag() and GetFlag() do binary operations on the flags controling an SDL Surface. Passing the BitMask to the GetFlag() will return weither or not the bit is on in the flags variable. Passing the BitMask and a boolean will turn on / off the bit in the flags variable. I wanted to provide shortcuts to GetFlag(SDL_SWSurface) and SetFlag(SDL_Surface, TRUE) so you could say: SWSurface := TRUE; If I understand correctly Indexed properties have to be signed interger type... which would ruin the bitwise comparison because the Bit Mask is a Unsigned integer type. On Tue, 2004-04-06 at 06:29, Matt Emson wrote: > > Property SWSurface : Boolean Index SDL_SWSurface > > Read GetFlags Write SetFlags; > > > > If I declare Get/Set Flags as the following: > > Function GetFlags(aBit: UInt32): Boolean; > > Procedure SetFlags(aBit: UInt32; aBool: Boolean); > > Looks like you're tying to use an indexed property. Dunno what mode you're > using, but in Delphi mode: > > unit Example; > > interface > > type > > t = class > private > FSurface: SDL_SWSurface; > > function GetSWSurfaceFlags(index: integer): Boolean; > procedure SetSWSurfaceFlags(index: integer; const Value: Boolean); > public >property SWSurfaceFlags[index: integer] : Boolean read GetSWSurfaceFlags > write SetSWSurfaceFlags; > end; > > implementation > > { t } > > function t.GetSWSurfaceFlags(index: integer): Boolean; > begin > /// do stuff with FSurface > end; > > procedure t.SetSWSurfaceFlags(index: integer; const Value: Boolean); > begin > /// do stuff with FSurface > end; > > end. > > > You would then implement the get/set by implementing read/writes to > SDL_SWSurface... > > I would have thought that this is quite limiting though. I would also have > a: > > property SWSurfaceColor[index: uint32] : TColor > read GetSWSurfaceColor write SetSWSurfaceColor; > > > function t.GetSWSurfaceColor(index: uint32): TColor; > > procedure t.SetSWSurfaceColor(index: uint32; const value: TColor); > > The params are not me being pedantic, by the was, but the way in which > Delphi implements properties. Other FPC modes may be a little more > forgiving. > > Hope that helps, > > Matt > > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Using UInt32 {LongWords} as Indexes for Properties.
To give a better picture of my problem: Type tQSDL_Surface = Class (SomeClass) Protected fFlags : UInt32; {LongWord} Function GetFlag(aBit: UInt32): Boolean; Function SetFlag(aBig: UInt32; aBool: Boolean); Public Constructor Create(); Destructor Destroy(); PropertyHWSurface : Boolean Index SDL_HWSurface Read GetFlag Write SetFlag; PropertySRCAlpha : Boolean Index SDL_SrcAlpha ReadGetFlag Write SetFlag; end; SDL_HWSurface and SDL_SRCAlpha are constants defined in the SDL_Video unit. They are meant for Boolean operations. More specificly they are meant to be ORed togeather to create a flag list and ANDed with fFlags to check for there state. I'm trying to do two things with these properties: 1# Not force a programmer to include the SDL Unit to get these constants. 2# Improve the readability of my code by using these properties to control flags. For instance a child object, SDL_VideoSurface, would have extra flags such as FullScreen. Calling the following: MyVideoSurface.FullScreen := TRUE; would cause the fullscreen bit to be set to true and when the screen is allocated it will fill the entire screen. The Problem is that if I define a constant index {$Mode ObjFPC} requires that index to be an Signed Integer value which it cannot be because that would change its binary value and the bitwise operations would be based on the wrong values. My solution is to simply create methods for each flag individualy that calls GetFlag/SetFlag with the correct paramaters. I was just wondering if there was a way to get around this. If not, thanks anyways. I just learned something new about indexes and and making sure I understand there limitation correctly. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal