Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?
On Sun, 24 Oct 2021 08:18:31 +, Alexander Grotewohl via fpc-pascal wrote: >In the end we have a black box with Indy that isn't going to be opened.. >and from the sound of it, a dated method of manually checking for i/o >(in this case likely with select() and a zero timeout..). Calling that >and sleep() over and over millions of times.. > >I'm sorry to the OP if I'm assuming a lot but my guess is the code is >a bit old and could use some refactoring to do away with the old Pascal >"active loop." Yes it is *old* code written with Delphi starting from about 2004 and "maintained" on Windows up until 2012 or thereabouts. Issues were discovered on Windows7 but these were fixed and then Windows 10 made it so much worse that I decided to try and port it over to Linux. It is a Windows TService application ported to a command line program on Linux so the base framework had to be modified a lot... But the majority of the code is only modified wherever it deals with protection dongles and read/write the Windows Registry. Plus all file system accesses using \ separators and drive letters... And of course the event driven model as a whole... As long as it does not eat up more than 10% or so CPU I might have to swallow it. And maybe schedule a regular restart of the server to clear whatever builds up. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Lazbuild error on Windows
I'm trying to build a Lazarus project on Windows and I've ran into a problem. Since I barely know Windows all I have known to do is download the latest version of the compiler and Lazarus then install them via their installers. I expected then to be able to use lazbuild like I do on macOS but I got an error that some file is missing. Here's the part which fails. How could lazfileutils.pas not be found? I actually see the .ppu file where it should be so it feels like the compiler and the version of Lazarus are not matching or something. Free Pascal Compiler version 3.2.2 [2021/05/15] for i386 Copyright (c) 1993-2021 by Florian Klaempfl and others (1002) Target OS: Win32 for i386 (3104) Compiling weblaz.pas (3104) Compiling fpideexteditorinsertfilenameunit.pas (10001) PPU Loading C:\lazarus\components\lazutils\lib\i386-win32\lazfileutils.ppu (10011) PPU Source: lazfileutils.pas not found (10011) PPU Source: lazutils_defines.inc not available (10011) PPU Source: lazfileutils.inc not available (10011) PPU Source: winlazfileutils.inc not available (10028) Recompiling LazFileUtils, checksum changed for C:\FPC\3.2.2\units\i386-win32\rtl\system.ppu C:\lazarus\components\fpweb\fpideexteditorinsertfilenameunit.pas(37,22) Fatal: (10022) Can't find unit LazFileUtils used by fpIDEExtEditorInsertFileNameUnit Fatal: (1018) Compilation aborted Error: C:\FPC\3.2.2\bin\i386-Win32\ppc386.exe returned an error exitcode Error: (lazarus) Compile package weblaz 1.0: stopped with exit code 1 Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 1" Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
> On Oct 16, 2021, at 5:18 AM, Anthony Walter via fpc-pascal > wrote: > > Source code for the test scene is included on that page. If you want to help, > I need to bounce ideas off people as well as test on Raspberry Pi, Mac, and > Windows. Message me and maybe we can try to meet on a Discord channel. > Just seeing this now but this looks pretty useful. I once made a Pascal wrapper for Box2D but this looks like a better more complete solution. Do you have the Pascal unit for Chipmunk2D where we can download and try it? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
Thanks for the interest Ryan. I am preparing to push my code to a public git repository with a FOSS license. In order to get this out soon it will be broken into a few releases. The first release, which is 100% done but needs accompanying documentation, might be out in a week's time. It includes an OpenGL vector graphics system based on NanoVG, with a friendly object oriented interface and some examples programs. I am also writing a basic widget system to render controls such as buttons, sliders, and text boxes that are rendered by the same vector graphics system. This will be in the first release Here is a small selection of the examples / demos I've written thus far. Text paint: https://streamable.com/m4e4qn Curtains: https://streamable.com/6o5y5o Mouse track: https://streamable.com/uk8ak7 Crowd walk: https://streamable.com/mc3he6 Fire spark: https://streamable.com/fm02c4 The second release will include the complete physics system. It's about 80% done and again will be a friendly object oriented wrapper around the Chipmunk2D physics library. I will add to the same documentation system I am writing for the first release. The third release will likely include a full object oriented wrapper about the Nuklear widget library using my vector graphics system as the renderer. It hasn't been started yet. If anyone is interested, here is the interface to the graphics system. It centers on the idea of an ICanvas interface I've designed: https://gist.github.com/sysrpl/6119ed313c8382004131761d6e292b3b ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Lazbuild error on Windows
> On Oct 28, 2021, at 9:39 PM, Dennis Lee Bieber via fpc-pascal > wrote: > > Are you actually running on a 32-bit system? You appear to have > installed a 32-bit compiler. I think I may have downloaded the 32 bit version of the compiler and then the 64 bit Lazarus! That would make sense it would fail then. Let me try downloading the correct version and I'll report back. If Lazarus installed the compiler also maybe I just need to update my paths so "fpc" points to the version in Lazarus... Thanks. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
> On Oct 29, 2021, at 4:25 AM, Anthony Walter via fpc-pascal > wrote: > > Thanks for the interest Ryan. I am preparing to push my code to a public git > repository with a FOSS license. In order to get this out soon it will be > broken into a few releases. Nice let us know when it's finished. What I did some years ago was make a plain c wrapper around Box2D so that I could then call it from Pascal (it was c++ originally). I think the library you used is already C so it should be easy to call from Pascal anyways event without the OOP wrapper. Much better than Box2D which was C++ only. https://github.com/thealchemistguild/Box2DC Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Lazbuild error on Windows
Sorry I didn't look up high enough in the output to see this before. It looks like lazbuild can't find the correct version of the compiler that is packaged. I can confirm that path exists but I think the variable $Lazarusdir may be wrong. What could be wrong here? I got Lazarus via an installer so I don't know how else to set it up. PS C:\Users\Ryan Joseph\Desktop\Developer\pascal-language-server> C:\lazarus\lazbuild.exe pasls.lpi SetupCompilerFilename: The compiler path "$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe" => "C:\lazarus\$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe" is invalid (Error: file not found) Searching a proper one ... SearchCompilerCandidates Value=$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe File=C:\lazarus\$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe SearchCompilerCandidates Value=$Lazarusdir\fpc\3.2.0\bin\i386-win32\\fpc.exe File=C:\lazarus\$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe SearchCompilerCandidates Value=$Lazarusdir\fpc\3.2.0\bin\i386-win32\\fpc.exe File=C:\lazarus\$Lazarusdir\fpc\3.2.0\bin\i386-win32\fpc.exe SearchCompilerCandidates Value=fpc.exe File=C:\FPC\3.2.2\bin\i386-Win32\fpc.exe > On Oct 29, 2021, at 9:46 AM, Ryan Joseph wrote: > > I think I may have downloaded the 32 bit version of the compiler and then the > 64 bit Lazarus! That would make sense it would fail then. Let me try > downloading the correct version and I'll report back. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Writing Pascal Physics and Vectors
Ah, so that was you who wrote the C wrapper? I saw that a while ago and considered using it, but after looking at and exploring how Chimpmunk2D works, I decided it was smaller, pretty darn good. That and Chipmunk2D is already C, so very little work was needed from me to convert it to work with Pascal. Again, the physics part will be in my second release. The first part is just getting the vector graphics and a minimal GUI toolkit in OpenGL working. That plus an overview and reference website similar to my https://docs.getlazurs.org website. If anyone cares to know more, here is a brief description of how my object oriented wrapper around Chipmunk2D physics is organized. ISpace is the base object to work with physics. If you use the TPhyiscsScene class it's created and managed for you automatically. ISpace provides properties for controlling gravity, bodies, and joints. There is one ISpace object per physics simulation. IBody objects are added to ISpace using ISpace.NewBody, ISpace.NewDynamic, and ISpace.NewStatic methods which create kinematic, dynamic, and static bodies respectively. Kinematic bodies react to collisions with each other and are affected by forces such as gravity. Dynamic bodies can be moved manually by the programmer, but are otherwise unaffected by forces and collisions. Static bodies cannot move but kinematic bodies may bounce off them. IShape objects are added to bodies using IBody.NewCircle, IBody.NewRect, IBody.NewSegment, and IBody.NewPolygon method. A body by itself has no shape. Its shape is defined by the shapes you add to it. Shapes within the same body do not collide with each other or move with respect to the other shapes within the body. Each shape within a body can have different friction, density, and elasticity (or bounciness). The mass and center of gravity of a body is calculated by its constituent shapes. IJoint includes a list of several joint types (I will not list them all here), and they can be used to connect two bodies together. Some joint types are motors, other are springs, and some are hinges or pivots. Collisions between bodies connected by a joint can be set to be ignored for those two bodies. IArbitors allow you to either detect and handle collisions between body types you define. You can ignore them if you simply want the physics system to handle collisions for you. Masks can be applied to body types, allowing you to say which bodies can collide with which other bodies. For example, if you were writing a game you could setup enemy bullets bodies to pass through enemy bodies using a simple mask. The enemy bullet bodies could then be setup to collide with the player body and wall bodies. There is a lot more to the physics system, but my object orient design, plus some documentation and examples ought to get most people running in short order. I have been mostly working on the graphics portion for the past week and haven't been working with the physics system in that time. Last time I was working on it I was trying to figure how how to make a decent rope. I am not at all satisfied with my initial work, and maybe someone can help me get rope physics working better, but below is the result of my first attempt. Rope test : https://streamable.com/lli866 I'll put all the information above and the source code online in a git repository soon with a FOSS license. If anyone wants to help, let me know. Join me in the discord channel listed in my initial message, or see me on liberachat irc in the #fpc channel. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal