Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Graeme Geldenhuys
On 21 December 2011 18:06, Henry Vermaak wrote: > embedded devices, laptops have batteries, too.  You're wasting CPU and power > just spinning around a loop, so even if your app isn't active, it's still > waking up every 50ms.  I don't consider this very good programming practice. I'm always inter

Re: [fpc-pascal] inline and other modifiers

2011-12-21 Thread noreply
> On 12/21/2011 20:27, nore...@z505.com wrote: >> >> Also delphi is >> more strict when it comes to PROGRAM name parsing. In freepascal the >> program name can mismatch the file name, whereas delphi stops compiling >> and tells you error. > > i've never known this (program name must equal filename)

Re: [fpc-pascal] inline and other modifiers

2011-12-21 Thread waldo kitty
On 12/21/2011 20:27, nore...@z505.com wrote: Also delphi is more strict when it comes to PROGRAM name parsing. In freepascal the program name can mismatch the file name, whereas delphi stops compiling and tells you error. i've never known this (program name must equal filename) to be a require

Re: [fpc-pascal] inline and other modifiers

2011-12-21 Thread noreply
> > On 17 Dec 2011, at 11:29, Bernd wrote: > >> But I am still surprised that inline can be declared in either of the >> two sections ( I am not complaining, I am actually glad it works for >> my particular application). Is there any recommended style, is it bad >> practice to put it into the imple

Re: [fpc-pascal] alias a function + overload 'in'

2011-12-21 Thread noreply
> two little questions > > 1. Is it possible to make an alias to a function ... so rather than just > re-calling with the same parameters, it's actually the same thing? like > the way > we can do, e.g., type natural = cardinal, or const GG = 6, but with a > function? > You can also define procedur

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
Marcos wrote: > I use Exceptions to check the integrity of classes. I have one > Exception for each class (E), most of the time. Another problem with errors is that sometimes it is hard for a class to return errors. In procedural programming you can usually return an error as a parameter but some

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
> In our previous episode, ik said: >> But we use exceptions even on places such as StrToInt, when the string >> is >> not an integer number, but we can expect to either have a number or >> something else. So why use an exception there ? > > Because much used routines like strtoint are often used w

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
> Hello, > > Exceptions like the name suggested, is to mark something that you are not > suppose to expect. > For example while getting a data something went wrong, like disconnection, > wrong size of data etc... > > The usage of exception is very costly in performance, and there for should > use o

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Martin Schreiber
On Wednesday 21 December 2011 20:10:49 Marco van de Voort wrote: > > I've been thinking about this myself, and if you don't want bad timers, the > most logical route would be to write a scheduler implementation where the > scheduler > > 1) in principle waits till the next registered event (events c

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > > Not likely with Linux-only stuff in the same msg. That's where I stopped > > reading pretty much. > > What linux only stuff? Since when does posix mean linux only? Spare > us the linux phobia, please. Googling for timer_create bsd shows that > at

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21 December 2011 18:06, Marco van de Voort wrote: > > Not likely with Linux-only stuff in the same msg. That's where I stopped > reading pretty much. What linux only stuff? Since when does posix mean linux only? Spare us the linux phobia, please. Googling for timer_create bsd shows that at

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 6:24 PM, Henry Vermaak wrote: > select() on linux will actually modify the timeout (fpc overloads select(), > but presumably this will still happen when you use ptimeval for the > timeout).  You shouldn't rely on this, though, read the man page for more > info.  This is wha

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > >> select() doesn't time out. So your error can be as much as 990ms per > >> iteration of the loop. So much for precision then. > > > > select() doesn't seam to return how much time has passed, so how do > > select() on linux will actually modify th

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 17:00, Felipe Monteiro de Carvalho wrote: On Wed, Dec 21, 2011 at 5:46 PM, Henry Vermaak wrote: You're still "guessing" a timer interval of 10ms to add to the timer if the select() doesn't time out. So your error can be as much as 990ms per iteration of the loop. So much for preci

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 5:46 PM, Henry Vermaak wrote: > You're still "guessing" a timer interval of 10ms to add to the timer if the > select() doesn't time out.  So your error can be as much as 990ms per > iteration of the loop.  So much for precision then. select() doesn't seam to return how muc

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 16:26, Felipe Monteiro de Carvalho wrote: I tested with top and it doesn't even show my application in the top 20 users of CPU. Anyway, I changed in this rev: http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&root=lazarus&revision=34354 It now adjusts the interval acoording to t

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 16:11, Martin Schreiber wrote: On 12/21/2011 04:53 PM, Henry Vermaak wrote: On 21/12/11 14:53, Felipe Monteiro de Carvalho wrote: wow, I started taking a look at how to do it and as always with anything related to X11 it is terribly complicated ... but luckly I am not alone here usi

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 16:25, michael.vancann...@wisa.be wrote: On Wed, 21 Dec 2011, Henry Vermaak wrote: On 21/12/11 15:56, Felipe Monteiro de Carvalho wrote: On Wed, Dec 21, 2011 at 4:53 PM, Henry Vermaak wrote: Spinning like this is bad news for efficiency and battery life of embedded devices. We

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 5:06 PM, Henry Vermaak wrote: > Better tell Maemo they've made a very bad choice, then.  It's not just > embedded devices, laptops have batteries, too.  You're wasting CPU and power > just spinning around a loop, so even if your app isn't active, it's still > waking up ever

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread michael . vancanneyt
On Wed, 21 Dec 2011, Henry Vermaak wrote: On 21/12/11 15:56, Felipe Monteiro de Carvalho wrote: On Wed, Dec 21, 2011 at 4:53 PM, Henry Vermaak wrote: Spinning like this is bad news for efficiency and battery life of embedded devices. Well, using X11 in an embedded device by itself is a ver

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Martin Schreiber
On 12/21/2011 04:53 PM, Henry Vermaak wrote: > On 21/12/11 14:53, Felipe Monteiro de Carvalho wrote: >> wow, I started taking a look at how to do it and as always with >> anything related to X11 it is terribly complicated ... but luckly I am >> not alone here using FPC, so I shamelessly stole code

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 15:56, Felipe Monteiro de Carvalho wrote: On Wed, Dec 21, 2011 at 4:53 PM, Henry Vermaak wrote: Spinning like this is bad news for efficiency and battery life of embedded devices. Well, using X11 in an embedded device by itself is a very bad choice Better tell Maemo they've made

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 4:53 PM, Henry Vermaak wrote: > Spinning like this is bad news for efficiency and battery life of embedded > devices. Well, using X11 in an embedded device by itself is a very bad choice =D And that's why it is very rare and linux-based phones don't use it. But what do you

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 14:53, Felipe Monteiro de Carvalho wrote: wow, I started taking a look at how to do it and as always with anything related to X11 it is terribly complicated ... but luckly I am not alone here using FPC, so I shamelessly stole code from fpgui, hammered it a little bit to fit TTimer and

[fpc-pascal] Re: FpGetRLimit and FpSetRLimit reference an undefined symbol

2011-12-21 Thread Seth Grover
>> Yes, it seems like a missing public alias for the FpGetRLimit function in >> the Linux system unit. > I added it. Thank you both. -SG -- This email is fiction. Any resemblance to actual events or persons living or dead is purely coincidental. Seth Grover ` _

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
wow, I started taking a look at how to do it and as always with anything related to X11 it is terribly complicated ... but luckly I am not alone here using FPC, so I shamelessly stole code from fpgui, hammered it a little bit to fit TTimer and TCDTimer and already have a initial TTimer for X11. If

Re: [fpc-pascal] FpGetRLimit and FpSetRLimit reference an undefined symbol

2011-12-21 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: > > undefined reference to `FPC_SYSC_GETRLIMIT' > > Yes, it seems like a missing public alias for the FpGetRLimit function in > the Linux system unit. I added it. ___ fpc-pascal maillist - fpc-pascal@lists.fr

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 12:36, Mark Morgan Lloyd wrote: Henry Vermaak wrote: On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote: Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Coco

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 11:53, Henry Vermaak wrote: On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote: Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Cocoa and Android (but Android

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Mark Morgan Lloyd
Henry Vermaak wrote: On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote: Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the best tested

Re: [fpc-pascal] FpGetRLimit and FpSetRLimit reference an undefined symbol

2011-12-21 Thread Jonas Maebe
On 20 Dec 2011, at 20:54, Seth Grover wrote: > When I attempt to use fpgetrlimit and fpsetrlimit from the baseunix > unit (see http://www.freepascal.org/docs-html/rtl/baseunix/fpgetrlimit.html > and http://www.freepascal.org/docs-html/rtl/baseunix/fpsetrlimit.html), > compilation fails with: >

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Henry Vermaak
On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote: Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the best tested of them), but it look

Re: [fpc-pascal] Timer in X11

2011-12-21 Thread michael . vancanneyt
On Wed, 21 Dec 2011, Felipe Monteiro de Carvalho wrote: Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the best tested of them), but it

[fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
Hello, Does anyone know what would be the solution for implementing timer support in a X11 toolkit? I already have TTimer support implemented for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the best tested of them), but it looks like X11 has no support for timers, so I wonder what t