Re: [fpc-pascal] fpc code for Java class and Android.
In our previous episode, Paul Breneman said: > > 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. > > > > I'm pretty sure that the Turbo Pascal text mode IDE offered mouse > support (under MS-DOS), and also the Free Pascal IDE (which you can try > under Linux). > > Thanks again Jon for your notes. I've know about PascalGUI for a while > and have a little doc about it near the bottom of this page: >http://turbocontrol.com/helloworld.htm Sure, I used mouse support in the IDE running in a putty to a linux machine for years to do minor FPC development in an environment where I didn't have a fixed PC. Requires some minor tweaking of putty properties though. ___ 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 2017-04-18 18:13, Jon Foster wrote: > I can't think of any terminal based programs I use > that offer mouse support. No idea what this thread is about really, but as for the above statement. I use plenty terminal apps that have mouse support. Midnight Commander (2 panel file manager), Free Pascal Text IDE (in a pinch), htop (*nix process manager), many text installers etc. 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
On 19/04/17 05:00, Ryan Joseph wrote: On Apr 19, 2017, at 2:34 AM, Daniel Gaspary wrote:> > Using SetJmp and LongJmp?> > I believe some months ago it was a discussion on the list on why this> was not really the way to implement coroutines.> > Searching for longjmp/setjmp you can find the thread, I guess. I never heard of those functions and I did find a thread about them but it seemed inconslusive. Here’s a little test I made not knowing exactly how those functions work. I expected the stack to be restored and “i” incremented but that’s not what happens. The program jumps in and out of the loop but “i” remains the same each time. Is this not how to use those functions? I thought that Windows implemented "fibers" for this sort of thing? It is possible to partially-simulate coroutines with setjmp/longjmp, but you need to store state outside the function. The key thing about coroutines, at least as implemented by Wirth in Modula-2, is that you can transfer arbitrarily between them i.e. it's not just a case of a scheduler selecting one specific task which runs and then returns. -- 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 Apr 19, 2017, at 3:28 PM, Mark Morgan Lloyd > wrote: > > It is possible to partially-simulate coroutines with setjmp/longjmp, but you > need to store state outside the function. The key thing about coroutines, at > least as implemented by Wirth in Modula-2, is that you can transfer > arbitrarily between them i.e. it's not just a case of a scheduler selecting > one specific task which runs and then returns. I only used coroutines in Lua and they were basically a way for a control structure like a loop to return control the main program without using threading. From the descriptions it sounds like longjmp moves the current point of execution of the program (if that concept exists like I imagine it does) so you could step in and out of loops or functions. If not that then what do those functions actually do? 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
Am 19.04.2017 06:35 schrieb "Ryan Joseph" : > > > > On Apr 19, 2017, at 2:34 AM, Daniel Gaspary wrote: > > > > Using SetJmp and LongJmp? > > > > I believe some months ago it was a discussion on the list on why this > > was not really the way to implement coroutines. > > > > Searching for longjmp/setjmp you can find the thread, I guess. > > I never heard of those functions and I did find a thread about them but it seemed inconslusive. Those functions simply store (setjmp) and restore (longjmp) register values (and setjmp also returns the value passed to longjmp if it had been reached by a longjmp). Nothing more, nothing less. So while the stack register while be changed, the contents on the stack will not. Regards, Sven ___ 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 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal > wrote: > > Those functions simply store (setjmp) and restore (longjmp) register values > (and setjmp also returns the value passed to longjmp if it had been reached > by a longjmp). Nothing more, nothing less. So while the stack register while > be changed, the contents on the stack will not. Why doesn’t “i” in my example increment? The value keeps going back to 1 even after I used += 1 so its like the old copy of the stack before the jump got pushed back on top and it started over. I don’t understand how assembly works but I thought it would just start over and the state of the stack in that function would still be the same as before so I could keep adding 1 every pass. 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 Wed, 19 Apr 2017, Ryan Joseph wrote: On Apr 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal wrote: Those functions simply store (setjmp) and restore (longjmp) register values (and setjmp also returns the value passed to longjmp if it had been reached by a longjmp). Nothing more, nothing less. So while the stack register while be changed, the contents on the stack will not. Why doesn’t “i” in my example increment? The value keeps going back to 1 even after I used += 1 so its like the old copy of the stack before the jump got pushed back on top and it started over. I don’t understand how assembly works but I thought it would just start over and the state of the stack in that function would still be the same as before so I could keep adding 1 every pass. The stack remains untouched by setjmp/longjmp. Your reasoning contains a wrong assumption, namely that I is on the stack. If I is a register variable, then it is not on the stack, and will be reset with each longjmp. 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
Am 19.04.2017 11:26 schrieb "Ryan Joseph" : > > > > On Apr 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > Those functions simply store (setjmp) and restore (longjmp) register values (and setjmp also returns the value passed to longjmp if it had been reached by a longjmp). Nothing more, nothing less. So while the stack register while be changed, the contents on the stack will not. > > Why doesn’t “i” in my example increment? The value keeps going back to 1 even after I used += 1 so its like the old copy of the stack before the jump got pushed back on top and it started over. I don’t understand how assembly works but I thought it would just start over and the state of the stack in that function would still be the same as before so I could keep adding 1 every pass. Ah, I didn't catch that earlier. Probably "i" is kept in a register due to optimization. You should check the generated assembler code to be sure. Regards, Sven ___ 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 Wed, 19 Apr 2017, Sven Barth via fpc-pascal wrote: Am 19.04.2017 11:26 schrieb "Ryan Joseph" : On Apr 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: Those functions simply store (setjmp) and restore (longjmp) register values (and setjmp also returns the value passed to longjmp if it had been reached by a longjmp). Nothing more, nothing less. So while the stack register while be changed, the contents on the stack will not. Why doesn’t “i” in my example increment? The value keeps going back to 1 even after I used += 1 so its like the old copy of the stack before the jump got pushed back on top and it started over. I don’t understand how assembly works but I thought it would just start over and the state of the stack in that function would still be the same as before so I could keep adding 1 every pass. Ah, I didn't catch that earlier. Probably "i" is kept in a register due to optimization. You should check the generated assembler code to be sure. Glad we responded the same thing :) 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 19/04/17 09:30, Ryan Joseph wrote: On Apr 19, 2017, at 3:28 PM, Mark Morgan Lloyd wrote:> > It is possible to partially-simulate coroutines with setjmp/longjmp, but you need to store state outside the function. The key thing about coroutines, at least as implemented by Wirth in Modula-2, is that you can transfer arbitrarily between them i.e. it's not just a case of a scheduler selecting one specific task which runs and then returns. I only used coroutines in Lua and they were basically a way for a control structure like a loop to return control the main program without using threading. From the descriptions it sounds like longjmp moves the current point of execution of the program (if that concept exists like I imagine it does) so you could step in and out of loops or functions. If not that then what do those functions actually do? SetJmp records the current state, LongJmp reverts to it. There's some common-sense limitations. I've got an example program of about 100 lines that would demonstrate what I've hacked together, I could tack it onto a message if the ML managers consider that acceptable. -- 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 Apr 19, 2017, at 4:57 PM, Mark Morgan Lloyd > wrote: > > SetJmp records the current state, LongJmp reverts to it. There's some > common-sense limitations. > > I've got an example program of about 100 lines that would demonstrate what > I've hacked together, I could tack it onto a message if the ML managers > consider that acceptable. yes, I’d like to see that so I know why my example doesn’t work as I expected. Everything I’m hearing makes me think “i” should keep incrementing after I call SetJmp and then return with JongJmp but there’s something I’m missing obviously. 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 Apr 19, 2017, at 4:33 PM, Michael Van Canneyt > wrote: > > Your reasoning contains a wrong assumption, namely that I is on the stack. > > If I is a register variable, then it is not on the stack, and will be reset > with each longjmp. I thought all variables declared inside a function (like below) were “on the stack” and I don’t even know what a register variable is honestly. Is there a way to make my example work and not have “i” reset each jump by declaring it differently or is that the choice of the compiler? procedure TCoroutine.Start; var i: integer = 0; begin end; 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 Wed, 19 Apr 2017, Ryan Joseph wrote: On Apr 19, 2017, at 4:33 PM, Michael Van Canneyt wrote: Your reasoning contains a wrong assumption, namely that I is on the stack. If I is a register variable, then it is not on the stack, and will be reset with each longjmp. I thought all variables declared inside a function (like below) were “on the stack” and I don’t even know what a register variable is honestly. It's a variable which the compiler does not put on the stack, it exists just in a register. Is there a way to make my example work and not have “i” reset each jump by declaring it differently or is that the choice of the compiler? The compiler chooses this. But you can disable it, I think, by disabling optimizations. 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 19, 2017, at 5:17 PM, Michael Van Canneyt > wrote: > > It's a variable which the compiler does not put on the stack, it exists just > in a register. That kind of defeats the purpose then if you can’t rely on function scoped variables to be restored. Maybe that’s what the code in the original link did? I was going to try it but I never figured out how to replace VirtualAlloc without Windows (I’m on a Mac). Thanks. 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
Hi, On Wed, 19 Apr 2017, Ryan Joseph wrote: > yes, I?d like to see that so I know why my example doesn?t work as I > expected. Everything I?m hearing makes me think ?i? should keep > incrementing after I call SetJmp and then return with JongJmp but > there?s something I?m missing obviously. Your example is simply broken. A few points: First, When you're LongJmp'ing to entry state in Resume, you're expecting the Start stack state (and with that, your "i" variable's state) to be intact. This is not the case. After the Start method returns (stepped out) it's stack contents are destroyed, and even get overwritten by the next 'writeln' method call, so the next time Resume is called, you get unpredictable behavior by jumping into the stack state of Start, which no longer exist and was overwritten since. For example, it simply crashes with Runtime Error 216 on Mac OS X 32 bit. For you, it just uses some "random" value on the stack (or register), which happens to be 1. I get this even without register variables, so I doubt it has anything to do with that... (Sorry Michael/Sven... ;) Basically, you can only jump to a "higher" level on the stack, not equal (from a different function) and not to a "deeper" level. Second, if you really want to use SetJmp/LongJmp states you can use SetJmp return value for that. If SetJmp returns 0, it wasn't returning from a LongJmp. If it returns 1, it was returning from a LongJmp. You don't need external state to track that. Charlie ___ 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 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 ___ 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 19, 2017, at 5:37 PM, Karoly Balogh (Charlie/SGR) > wrote: > > Your example is simply broken. A few points: Thanks for the description. Yeah, I assumed the stack would be restored but that isn’t the case apparently. I think the coroutine implementation in the link below tries to manage the stack frames and restore them but it requires Windows for the VirtualAlloc function and I’m on a Mac. No idea if that code works or not and it looks kind of risky honestly. http://www.festra.com/wwwboard/messages/12899.html 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
In our previous episode, Ryan Joseph said: > > Your example is simply broken. A few points: > > Thanks for the description. Yeah, I assumed the stack would be restored but > that isn?t the case apparently. > > I think the coroutine implementation in the link below tries to manage the > stack frames and restore them but it requires Windows for the VirtualAlloc > function and I?m on a Mac. No idea if that code works or not and it looks > kind of risky honestly. > > http://www.festra.com/wwwboard/messages/12899.html Not just virtual alloc, nearly the whole of the asm is accessing SEH via fs and thus Windows dependent. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
So.. Any chance of an Official implementation ? On Wed, Apr 19, 2017 at 10:50 AM, Marco van de Voort wrote: > In our previous episode, Ryan Joseph said: >> > Your example is simply broken. A few points: >> >> Thanks for the description. Yeah, I assumed the stack would be restored but >> that isn?t the case apparently. >> >> I think the coroutine implementation in the link below tries to manage the >> stack frames and restore them but it requires Windows for the VirtualAlloc >> function and I?m on a Mac. No idea if that code works or not and it looks >> kind of risky honestly. >> >> http://www.festra.com/wwwboard/messages/12899.html > > Not just virtual alloc, nearly the whole of the asm is accessing SEH via fs > and thus Windows dependent. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Coroutines and VirtualAlloc
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 in it I guess. ___ 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/19/2017 09: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. :-) 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. ___ 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 14.04.2017 09:36, Sven Barth via fpc-pascal wrote: A process definitely is less "light" than threads even on Unix systems: a process has its own address space Not really true (see below). Why do you think the concept of threads was introduced in Unix? Early Unix systems only had processes. Because if you do something that is usually called "Thread" you _want_ shared memory in the same address space, not because of that being "light" but because the way you want to handle your memory based objects in your user code needs this. In fact the "real" difference between Threads and processes (i.e. the Kernel knows that a processing entity is supposed to be a "Thread" associated with other threads of a process) in Linux only had been introduced with the "Native POSIX Thread Library" ("NPTL") -> https://en.wikipedia.org/wiki/Native_POSIX_Thread_Library. Before NPTL, you just used processes for your threads telling the system that for the new thread you wanted a shared address space. 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). -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] WebAssembly Target
On 14.04.2017 10:41, Jürgen Hestermann wrote: I can't understand why scripting is needed for a web page. Regarding the discussion here, the term is "Rich Internet Application" ("RIA") -> https://en.wikipedia.org/wiki/Rich_Internet_application Here, a server based application (e.g. done in Pascal / fpc / Lazarus) shows a GUI within a browser. The connection between the Browser and the program being done via a standard HTTP server. -Michael ___ 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 14.04.2017 12:56, Jürgen Hestermann wrote: Why is it scripting needed to display a calendar? Most obviously: (OK. I do know that there is a timed reload instruction in HTML, that I malevolently ignore in this post, but it would be a PITA to use same in a more complex example, as it would reload everything instead of updating e.g. just a single number, as often needed in a RIA GUI.) You keep the Browser Window open and at midnight the sheet for the new day should automatically be displayed. HTTP/HTML can't do that, It's strictly unidirectional request->answer. (Which in fact is completely silly, but we need to live with that). So Java script can do the necessary polling. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Use a procedural type for declare a procedure\function
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; function command1(arg1:TMyArg):TMyCommandResult; begin ... end; function command2(arg1:TMyArg):TMyCommandResult; begin ... end; function command100500(arg1:TMyArg):TMyCommandResult; begin ... end; var ... com:TMyCommand; ... com:=GetNeededCommand; res:=com(arg1:TMyArg) [/code] Could look like this [code] type TMyCommand=function(arg1:TMyArg):TMyCommandResult begin ... end; command1 TMyCommand; begin ... end; command2 TMyCommand; begin ... end; command100500 TMyCommand; begin ... end; ... var com:TMyCommand; .. com:=GetNeededCommand; res:=com(arg1:TMyArg) [/code] -- Best regards, Zubarev mailto:zam...@gmail.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal