Re: [fpc-pascal] Coroutines and VirtualAlloc
On 19/04/17 20:00, Marco van de Voort wrote: In our previous episode, Daniel Gaspary said:> So..> > Any chance of an Official implementation ? I don't know. Such effort should chiefly come from the people interested init I guess. Turning it around a little: are there still FPC targets that don't have threads? Having coroutines would allow a native thread mechanism to be implemented, without relying on the underlying OS. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
On 20/04/17 07:00, Michael Schnell wrote: Again (AFAIK) NPTL had not been introduce to make threads "lighter" but to allow for threads behaving in a decently POSIX compatible way (e.g. the threads of a process getting only a common share of time slices). In any event, processes on unix are *defined* as owning resources- memory, handles and so on- while threads only manage control flow. I believe that MS also have "fibers" which are non-preemptive threads. If somebody wants to define a new kind of thread, something even lighter-weight, they're going to need a new name: inverting well-accepted precedence is not an option. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
On 04/20/2017 09:40 AM, Mark Morgan Lloyd wrote: Turning it around a little: are there still FPC targets that don't have threads? Having coroutines would allow a native thread mechanism to be implemented, without relying on the underlying OS. it would be really nice to have coroutines for the embedded targets like AVR and ARM. Regards, Bernd. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
On Thu, 20 Apr 2017 07:40:44 + Mark Morgan Lloyd wrote: > Turning it around a little: are there still FPC targets that don't have > threads? Last month Karoly added one: WASM. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *** GMX Spamverdacht *** Re: WebAssembly Target
On 2017-04-14 12:53, Michael Van Canneyt wrote: >> Why is it scripting needed to display a calendar? > > To display a popup menu, for example. But apparently you don’t need JavaScript for that either. Here is a blog post (dated 5 years ago) where the person proved just that - you can use HTML and CSS alone to accomplish popup menus and modal dialogs without JavaScript. ;-) Web developers just chose not to do so. Makes you wonder what else is possible (we all know Web Developers like to take shortcuts and live by copy-and-paste coding styles). Popup windows without JavaScript http://eichefam.net/2011/12/21/popup-windows-without-javascript/ Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] WebAssembly Target
On 2017-04-14 09:41, Jürgen Hestermann wrote: > I hate Java Script and use NoScript to block it. You don't need a browser add-on for that. Simply go to (Firefox) about:config and search for JavaScript. Double click the "javascript.enabled" preference and it will toggle between enabled true/false. There used to be days (years ago) when this setting was directly available in the Preferences dialog. Good old times. ;-) Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] WebAssembly Target
On 2017-04-14 18:56, Jürgen Hestermann wrote: > Therefor I use NoScript to prevent me from such code. > 90% of these web pages using scripting are crap anyway. It's also nice to see how fast web pages load if no JavaScript is enabled (magnitudes faster). Also most web Ads stop working too. A nice bonus. :) Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
In our previous episode, Mark Morgan Lloyd said: > > I don't know. Such effort should chiefly come from the people interested > > init I guess. > > Turning it around a little: are there still FPC targets that don't have > threads? Having coroutines would allow a native thread mechanism to be > implemented, without relying on the underlying OS. No, since the code would be for preemptive systems, and the coroutine system is cooperative. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
In our previous episode, Mark Morgan Lloyd said: > > In any event, processes on unix are *defined* as owning resources- > memory, handles and so on- while threads only manage control flow. I > believe that MS also have "fibers" which are non-preemptive threads. They are not really threads. They must be scheduled within threads. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx from the article they don't seem to have that many advantages, except to convert existing manual m:n scheduling apps. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *** GMX Spamverdacht *** Re: WebAssembly Target
On Thu, 20 Apr 2017, Graeme Geldenhuys wrote: On 2017-04-14 12:53, Michael Van Canneyt wrote: Why is it scripting needed to display a calendar? To display a popup menu, for example. But apparently you don’t need JavaScript for that either. Here is a blog post (dated 5 years ago) where the person proved just that - you can use HTML and CSS alone to accomplish popup menus and modal dialogs without JavaScript. ;-) Web developers just chose not to do so. Makes you wonder what else is possible (we all know Web Developers like to take shortcuts and live by copy-and-paste coding styles). That was only possible after CSS had been 'updated' to include some dynamic effects. And CSS will not help you for example with autocompletion in an edit box. The people fighting javascript in the browser are fighting a reargard battle. It will only get worse. As long as there is no acceptable alternative for the browser, this will continue to worsen... Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
> On Apr 20, 2017, at 3:01 PM, Bernd Mueller wrote: > > it would be really nice to have coroutines for the embedded targets like AVR > and ARM. What are people using this for btw? Personally I wanted them to solve some problems in game programming where I lots of nested loops that need to be synched with a main loop and can’t block. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
On 20/04/17 08:30, Bernd Mueller wrote: On 04/20/2017 09:40 AM, Mark Morgan Lloyd wrote:>> Turning it around a little: are there still FPC targets that don't have> threads? Having coroutines would allow a native thread mechanism to be> implemented, without relying on the underlying OS. it would be really nice to have coroutines for the embedded targets like AVR and ARM. The Topspeed family of languages also demonstrated that a coroutine could be used as the target of an interrupt. However looking at the manual I see that when the interrupt arrived the association was removed, and I can't remember what it did with interrupt acknowledgement etc. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] *** GMX Spamverdacht *** Re: WebAssembly Target
On 2017-04-20 09:40, Michael Van Canneyt wrote: > The people fighting javascript in the browser are fighting a reargard battle. > It will only get worse. Indeed, I was simply pointing out that _some_ functionality is possible without JavaScript, but the majority of what we consider "the standard web" seems to require JavaScript - if you like it or not. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
20.04.2017, 11:43, "Ryan Joseph" : >> On Apr 20, 2017, at 3:01 PM, Bernd Mueller wrote: >> >> it would be really nice to have coroutines for the embedded targets like >> AVR and ARM. > > What are people using this for btw? Personally I wanted them to solve some > problems in game programming where I lots of nested loops that need to be > synched with a main loop and can’t block. It is especially favorable for game development. All processes/objects which live across several rendering frames and have any state are greatly simplified by coroutines. e.g. living entities, animations, any game triggers, any finite state machines, etc. Proper implemented coroutines support thousands of instances. With proper (read "mostly functional"/non-shared data) approach coroutines might also be calculated within real threads in parallel. Another example is network-related code (both client and server code). Break your huge finite state machines into pipeline stages via coroutines and it gets pretty modular, extensive and simple to reason about. To say to generally, had we had coroutines in first place, no OOP crap would be necessary :) At least in game development. -- Regards, Denis Golovan ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
On 20/04/17 09:00, Marco van de Voort wrote: In our previous episode, Mark Morgan Lloyd said:> > I don't know. Such effort should chiefly come from the people interested init I guess.> > Turning it around a little: are there still FPC targets that don't have > threads? Having coroutines would allow a native thread mechanism to be > implemented, without relying on the underlying OS. No, since the code would be for preemptive systems, and the coroutine systemis cooperative. But once you have coroutines as a way of managing context it's not particularly difficult to define one which receives control on a timer tick or when nothing else is happening, and that schedules another on the basis of priority or simply round-robin. Being able to switch context, which in practice means switching the stack frame, is a prerequisite to having threads, just as threads are a prerequisite of having processes. I don't quite know where exception handling would fit into this. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] WebAssembly Target
Am 2017-04-20 um 10:25 schrieb Graeme Geldenhuys: > On 2017-04-14 09:41, Jürgen Hestermann wrote: >> I hate Java Script and use NoScript to block it. > You don't need a browser add-on for that. Simply go to (Firefox) > about:config and search for JavaScript. Double click the > "javascript.enabled" preference and it will toggle between enabled > true/false. But NoScript has comfortable functions do allow scripting for certain web pages or even only parts of them in case I am forced to use scripting on "special" cases. I can do a white-listing this way. It seems that about:config cannot distinguish between special web pages. ___ 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 20/04/17 09:00, Marco van de Voort wrote: In our previous episode, Mark Morgan Lloyd said:> > In any event, processes on unix are *defined* as owning resources- > memory, handles and so on- while threads only manage control flow. I > believe that MS also have "fibers" which are non-preemptive threads. They are not really threads. They must be scheduled within threads. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx from the article they don't seem to have that many advantages, except toconvert existing manual m:n scheduling apps. Which effectively makes them coroutines, but since they're MS-only they're nonportable. Which is more or less where Ryan started off the other thread. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use a procedural type for declare a procedure\function
Am 20.04.2017 08:44 schrieb "Andrey M, Zubarev" : > > Hi All, > > Why can't use procedural type for declare a procedure\function? > Why ever allow the exact same signature? It's uncomfortable > Maybe it makes sense to introduce into the language such a possibility? No, that makes no sense. Function/procedures/methods are independent of of function/procedure/message types, maybe even declared indifferent units not related to each other and used together only in a third unit. Also it would be harder to see easily which parameters a routine takes as you'd need to check the corresponding type first. (And if you now say that an IDE can help with that, well 1) not everyone uses one and 2) the same could be said about your original problem) Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use a procedural type for declare a procedure\function
On Wed, 19 Apr 2017, Andrey M, Zubarev wrote: Hi All, Why can't use procedural type for declare a procedure\function? Why ever allow the exact same signature? It's uncomfortable Maybe it makes sense to introduce into the language such a possibility? For example such code: [code] type TMyCommand=function(arg1:TMyArg):TMyCommandResult begin ... end; command1 TMyCommand; begin ... end; You can do this already using a macro {$define mysig:=(arg1:TMyArg):TMyCommandResult} type TMyCommand = function mysig; function command1 mysig; Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
> On Apr 20, 2017, at 4:06 PM, denisgolovan wrote: > > Another example is network-related code (both client and server code). > Break your huge finite state machines into pipeline stages via coroutines and > it gets pretty modular, extensive and simple to reason about. Nicely encapsulated in that statement. I’m building these big ugly state machines inside my classes and polluting the instance variables with muck. Coroutines would greatly clean this up and with only minimal overhead. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
In our previous episode, Mark Morgan Lloyd said: > > They are not really threads. They must be scheduled within threads. > > https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx > > from the article they don't seem to have that many advantages, except > > toconvert existing manual m:n scheduling apps. > > Which effectively makes them coroutines, but since they're MS-only > they're nonportable. What exactly makes them coroutines? Maybe that they implement a local stack concept. But you still would have to integrate that with FPC (exception handling, stack checking), so at the basic level it only saves some asm switching contexts. But maybe the OS support for stack switching makes things like keeping SEH working easier. (not that that is enabled by default for 32-bit windows x86) > Which is more or less where Ryan started off the > other thread. It suddenly occured to me that that piece of code is compatible to nothing in FPC, since the only likely target in FPC (win32 x86) doesn't use SEH. There is a define to enable it though ( -dTEST_WIN32_SEH ) ___ 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 20/04/17 10:22, Marco van de Voort wrote: In our previous episode, Mark Morgan Lloyd said:> > They are not really threads. They must be scheduled within threads.> > https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx> > from the article they don't seem to have that many advantages, except toconvert existing manual m:n scheduling apps.> > Which effectively makes them coroutines, but since they're MS-only > they're nonportable. What exactly makes them coroutines? Maybe that they implement a local stackconcept. Yes, exactly. Which I think is an abstraction that FPC doesn't have. Even Turbo Pascal interrupt handlers worked within the same stack, as distinct from TopSpeed's IOTRANSFER() which switched. But you still would have to integrate that with FPC (exceptionhandling, stack checking), so at the basic level it only saves some asmswitching contexts. It's interesting that coroutines (Modula-2, perhaps others) precede exceptions etc. (C++?). It might turn out that in practice they /have/ to be implemented first, otherwise the amount of doctrine that grows up around exceptions makes the job implausible. But maybe the OS support for stack switching makes things like keeping SEHworking easier. (not that that is enabled by default for 32-bit windows x86) Which is more or less where Ryan started off the > other thread. It suddenly occured to me that that piece of code is compatible to nothingin FPC, since the only likely target in FPC (win32 x86) doesn't use SEH.There is a define to enable it though ( -dTEST_WIN32_SEH ) I think I said at the time that he should be looking at (an equivalent of) fibers. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Can class function used in specialized class use intristic functions Low, High with generic type ?
Hi *, I have some generic class: generic T2DNumericArray = object(specialize T2DArray) public class function Truncate(Value: double): T; inline; ... In class function Truncate I want check if supplied Value is in range of T. T will be always ordinal type (byte, integer) ... (I know this, but compiler does not of course) Can I use in : class function T2DNumericArray.Truncate(Value: double): T; begin if Value > High(T) then Result := High(T) else if Value < Low(T) then Result := Low(T) else Result := Value; end; I understand, that from compiler POV T can be any type, so High() and Low() can be invalid, but I wonder if there is any way how to solve this. Thanks -Laco. ___ 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 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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can class function used in specialized class use intristic functions Low, High with generic type ?
Am 20.04.2017 13:02 schrieb "LacaK" : > > Hi *, > > I have some generic class: > > generic T2DNumericArray = object(specialize T2DArray) > public > class function Truncate(Value: double): T; inline; > ... > > In class function Truncate I want check if supplied Value is in range of T. > T will be always ordinal type (byte, integer) ... (I know this, but compiler does not of course) > > Can I use in : > > class function T2DNumericArray.Truncate(Value: double): T; > begin > if Value > High(T) then > Result := High(T) > else if Value < Low(T) then > Result := Low(T) > else > Result := Value; > end; > > I understand, that from compiler POV T can be any type, so High() and Low() can be invalid, but I wonder if there is any way how to solve this. The compiler will use dummy values while parsing the generic, but during specialization it will use the correct ones. Though it might be that you'd need 3.1.1 for it (dont know right now when I had fixed that). Regards, Sven ___ 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