Re: Re : [Chicken-users] thread-sleep! for less than a second
On 1/16/07, felix winkelmann <[EMAIL PROTECTED]> wrote: On 1/16/07, Daishi Kato <[EMAIL PROTECTED]> wrote: > > BTW, timeout is also used for thread-join!, mutex-lock! and > mutex-unlock! in srfi-18. > It'd be more consistent to have */ms procedures for these above. > Or, since timeout for these procedures including thread-sleep! can be > a time object, > introducing time->milliseconds and milliseconds->time would be sufficient. > I prefer the latter solution. Could you write a ticket at http://trac.callcc.org for this? Sure, and done. With the latter solution, we don't need thread-sleep!/ms, right? --daishi ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: Re : [Chicken-users] thread-sleep! for less than a second
On 1/16/07, Daishi Kato <[EMAIL PROTECTED]> wrote: BTW, timeout is also used for thread-join!, mutex-lock! and mutex-unlock! in srfi-18. It'd be more consistent to have */ms procedures for these above. Or, since timeout for these procedures including thread-sleep! can be a time object, introducing time->milliseconds and milliseconds->time would be sufficient. I prefer the latter solution. Could you write a ticket at http://trac.callcc.org for this? cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] delete-file* not working as advertised.
On 1/15/07, Robin Lee Powell <[EMAIL PROTECTED]> wrote: This code: (if (file-exists? file) (delete-file* file)) where file is a symbolic link is giving me: Error: (delete-file) can not delete file - Permission denied: "ltest" Now, this system is wierd in that unlink is re-mapped, but I thought the documentation for delete-file* was pretty clear that it shouldn't return any errors? The documentation reads: (delete-file* FILENAME) If the file FILENAME exists, it is deleted and #t is returned. If the file does not exist, nothing happens and #f is returned. Although I agree that the section should not be titled, "Deleting a file without signalling (sic) an error", it's pretty clear that the error being consumed is a file-existence error, not a file-permission error. The current definition has a nice property, idempotence: whether you call (delete-file* "foo") once or a hundred times, the effect is the same, that is, you are assured that the file "foo" does not exist. That property would be lost if file-permission errors were silenced. You can always use (condition-case) to silence other errors if that's your wish, right? Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] delete-file* not working as advertised.
This code: (if (file-exists? file) (delete-file* file)) where file is a symbolic link is giving me: Error: (delete-file) can not delete file - Permission denied: "ltest" Now, this system is wierd in that unlink is re-mapped, but I thought the documentation for delete-file* was pretty clear that it shouldn't return any errors? -Robin -- http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ Reason #237 To Learn Lojban: "Homonyms: Their Grate!" Proud Supporter of the Singularity Institute - http://singinst.org/ ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Fwd: Re : [Chicken-users] thread-sleep! for less than a second
This is supposed to go the chicken ML. -- Forwarded message -- From: Daishi Kato <[EMAIL PROTECTED]> Date: Jan 16, 2007 10:43 AM Subject: Re: Re : [Chicken-users] thread-sleep! for less than a second To: felix winkelmann <[EMAIL PROTECTED]> Thanks a lot! BTW, timeout is also used for thread-join!, mutex-lock! and mutex-unlock! in srfi-18. It'd be more consistent to have */ms procedures for these above. Or, since timeout for these procedures including thread-sleep! can be a time object, introducing time->milliseconds and milliseconds->time would be sufficient. Comments are welcome. Daishi On 1/16/07, felix winkelmann <[EMAIL PROTECTED]> wrote: On 1/13/07, Daishi Kato <[EMAIL PROTECTED]> wrote: > Hi, > > That was something that I could not notice either at first. > Another issue for me is that I want to declare fixnum > when all other procedures are fixnum arithmetic. > So, I wished thread-sleep-millis! > Any workaround for this? Maybe making a tiny egg for this? > I have added it (called `thread-sleep!/ms') to srfi-18. Here is the patch: diff -rN -u old-chicken/srfi-18.scm new-chicken/srfi-18.scm --- old-chicken/srfi-18.scm 2007-01-15 20:18:45.0 +0100 +++ new-chicken/srfi-18.scm 2007-01-15 20:18:45.0 +0100 @@ -281,16 +281,25 @@ (##sys#setslot thread 3 'ready) (##sys#add-to-ready-queue thread) ) ) -(define thread-sleep! - (lambda (tm) -(unless tm (##sys#signal-hook #:type-error 'thread-sleep! "invalid timeout argument" tm)) +(define thread-sleep!) +(define thread-sleep!/ms) + +(let () + (define (sleep limit loc) (##sys#call-with-current-continuation (lambda (return) - (let ([limit (##sys#compute-time-limit tm)] -[ct ##sys#current-thread] ) + (let ((ct ##sys#current-thread)) (##sys#setslot ct 1 (lambda () (return (##core#undefined (##sys#thread-block-for-timeout! ct limit) -(##sys#schedule) ) ) ) ) ) +(##sys#schedule) ) ) ) ) + (set! thread-sleep! +(lambda (tm) + (unless tm (##sys#signal-hook #:type-error 'thread-sleep! "invalid timeout argument" tm)) + (sleep (##sys#compute-time-limit tm)) ) ) + (set! thread-sleep!/ms +(lambda (ms) + (##sys#check-exact ms 'thread-sleep!/ms) + (sleep (fx+ (##sys#fudge 16) ms)) ) ) ) cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Anonymous trac access
Arto just informed me that anonymous access to trac.callcc.org has now been enabled, so everybody (even without an svn account) can now enter tickets. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] trac instance running - public rejoices - Arto for president!
On Mon, Jan 15, 2007 at 09:41:29PM +0100, felix winkelmann wrote: > Hi, folks! > > Arto has set up the bug tracker now. Everybody with an SVN account > can now add and edit tickets at: > > http://trac.callcc.org Hurray! All hail Arto! :) Regards, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth pgpEDgyjeTFn4.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: trac instance running - public rejoices - Arto for president!
BTW, it's fine to create tickets regarding features you'd like to see, or eggs that you think would be nice to have. That way it might be easier to coordinate efforts working into a specific direction and avoiding double-work. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] trac instance running - public rejoices - Arto for president!
Hi, folks! Arto has set up the bug tracker now. Everybody with an SVN account can now add and edit tickets at: http://trac.callcc.org Note: before you can assign tickets to yourself (something that you are more than eager to do, I hope! ;-) you must go to "Settings" and register a name. The ticket entry form may change slightly in the future, but not very much. If you write tickets applying to specific eggs, enter them in the keywords field (I find this easier than to handle an always out-of-date, huge drop-down menu). Suggestions are of course very welcome. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wierd behaviour of process.
On 1/15/07, Graham Fawcett <[EMAIL PROTECTED]> wrote: #;2> (my-process-wait 2) Error: unbound variable: ##sys#process-wait Oh, that was exposed recently, for the osprocess egg. I forgot about that. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wierd behaviour of process.
On 1/15/07, felix winkelmann <[EMAIL PROTECTED]> wrote: On 1/15/07, Graham Fawcett <[EMAIL PROTECTED]> wrote: > > You can't just drop this in an egg, though; the definintion of > ##sys#process-wait is not public, and your compile will fail. Add it > to posixuinx.scm in your Chicken source tree, and then rebuild and > reinstall Chicken. That's a bit extreme, I suppose. :-) But perhaps a > build-guru on the list has a way to build this as a normal extension. ##sys#process-wait is private, but not hidden. You can access it from user code without problems. Are you sure, Felix? Maybe I'm doing something wrong here: mypw.scm (use posix) (define my-process-wait (lambda args (let-optionals* args ([pid #f] [nohang #f]) (let ([pid (or pid -1)]) (##sys#check-exact pid 'process-wait) (receive [epid enorm ecode] (##sys#process-wait pid nohang) (if (fx= epid -1) (values #f #f #f) (values epid enorm ecode) ) ) ) ) ) ) ;;; -- end of file [EMAIL PROTECTED]:/tmp$ csc -s mypw.scm [EMAIL PROTECTED]:/tmp$ csi ___| |_) | | __ \ | __| | / _ \ __ \ | | | | | ( < __/ | | \|_| |_|_|\___|_|\_\\___|_| _| Version 2.5 - linux-unix-gnu-x86 - [ libffi dload ptables applyhook ] (c)2000-2006 Felix L. Winkelmann ; loading /home/graham/.csirc ... #;1> (use mypw) ; loading ./mypw.so ... #;2> (my-process-wait 2) Error: unbound variable: ##sys#process-wait Not that it really matters. :-) --Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: Re : [Chicken-users] thread-sleep! for less than a second
On 1/13/07, Daishi Kato <[EMAIL PROTECTED]> wrote: Hi, That was something that I could not notice either at first. Another issue for me is that I want to declare fixnum when all other procedures are fixnum arithmetic. So, I wished thread-sleep-millis! Any workaround for this? Maybe making a tiny egg for this? I have added it (called `thread-sleep!/ms') to srfi-18. Here is the patch: diff -rN -u old-chicken/srfi-18.scm new-chicken/srfi-18.scm --- old-chicken/srfi-18.scm 2007-01-15 20:18:45.0 +0100 +++ new-chicken/srfi-18.scm 2007-01-15 20:18:45.0 +0100 @@ -281,16 +281,25 @@ (##sys#setslot thread 3 'ready) (##sys#add-to-ready-queue thread) ) ) -(define thread-sleep! - (lambda (tm) -(unless tm (##sys#signal-hook #:type-error 'thread-sleep! "invalid timeout argument" tm)) +(define thread-sleep!) +(define thread-sleep!/ms) + +(let () + (define (sleep limit loc) (##sys#call-with-current-continuation (lambda (return) - (let ([limit (##sys#compute-time-limit tm)] -[ct ##sys#current-thread] ) + (let ((ct ##sys#current-thread)) (##sys#setslot ct 1 (lambda () (return (##core#undefined (##sys#thread-block-for-timeout! ct limit) -(##sys#schedule) ) ) ) ) ) +(##sys#schedule) ) ) ) ) + (set! thread-sleep! +(lambda (tm) + (unless tm (##sys#signal-hook #:type-error 'thread-sleep! "invalid timeout argument" tm)) + (sleep (##sys#compute-time-limit tm)) ) ) + (set! thread-sleep!/ms +(lambda (ms) + (##sys#check-exact ms 'thread-sleep!/ms) + (sleep (fx+ (##sys#fudge 16) ms)) ) ) ) cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wierd behaviour of process.
On 1/15/07, Graham Fawcett <[EMAIL PROTECTED]> wrote: You can't just drop this in an egg, though; the definintion of ##sys#process-wait is not public, and your compile will fail. Add it to posixuinx.scm in your Chicken source tree, and then rebuild and reinstall Chicken. That's a bit extreme, I suppose. :-) But perhaps a build-guru on the list has a way to build this as a normal extension. ##sys#process-wait is private, but not hidden. You can access it from user code without problems. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wierd behaviour of process.
On 1/14/07, Robin Lee Powell <[EMAIL PROTECTED]> wrote: That made me think that doing a "wait" on the process *is* behaviour I want, and I should do that. However, process-wait throws an error if the process has already exited, and I can't seem to trap it. I tried: (condition-case (process-wait pid) (var () #t)) and (with-exception-handler (lambda (x) #f) (lambda () (process-wait pid))) But in both cases it just errors out with: Error: (process-wait) waiting for child process failed - No child processes: 21505 You could define a variant of process-wait that throws no errors. Perhaps it might help you to debug the problem. Here's the current definition, from posixunix.scm: (define process-wait (lambda args (let-optionals* args ([pid #f] [nohang #f]) (let ([pid (or pid -1)]) (##sys#check-exact pid 'process-wait) (receive [epid enorm ecode] (##sys#process-wait pid nohang) (if (fx= epid -1) (posix-error #:process-error 'process-wait "waiting for child process failed" pid) (values epid enorm ecode) ) ) ) ) ) ) (Note that ##sys#process-wait is defined in the same file.) You could add a version that returns three #f values in the case of a failed wait, instead of raising an error: (define process-wait* (lambda args (let-optionals* args ([pid #f] [nohang #f]) (let ([pid (or pid -1)]) (##sys#check-exact pid 'process-wait) (receive [epid enorm ecode] (##sys#process-wait pid nohang) (if (fx= epid -1) (values #f #f #f) (values epid enorm ecode) ) ) ) ) ) ) A rigged demo: #; 3> (process-wait 2) Error: (process-wait) waiting for child process failed - No child processes: 2 #; 4> (process-wait* 2) #f #f #f You can't just drop this in an egg, though; the definintion of ##sys#process-wait is not public, and your compile will fail. Add it to posixuinx.scm in your Chicken source tree, and then rebuild and reinstall Chicken. That's a bit extreme, I suppose. :-) But perhaps a build-guru on the list has a way to build this as a normal extension. -- Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] String compression?
On 1/14/07, Alejandro Forero Cuervo <[EMAIL PROTECTED]> wrote: > Does anyone have code for compressing strings using zlib, lzo or some > other common llibrary/algorithm? Well, a long time ago I wrote some code to compress/decompress with zlib algorithms: http://anonymous:@freaks-unidos.net/azul-home/src/chicken-eggs-original/stream-zlib/stream-zlib.scm Since it uses streams, I doubt it's gonna be fast for your purposes. Hi Alejo -- thanks, and yes, probably streams would make it a bit too slow :-) I'm going to try Felix's whole-buffer procedures in z3. Best, Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] RedHat and Debian packages
I think the problem is thinking about Linux as an OS, it is just a kernel. If we considered RedHat as different to Debian, as FreeBSD is to Plan 9, then we'd be delighted of how compatible they are and how easy it is to port from one to the other. The same thing happens with Schemes, one could argue that the Scheme comunity is very fragmented because a program for Chicken Scheme takes a lot to work to run in Scheme 48, yet, if you consider Chicken Scheme as different to Scheme 48 as Perl and PHP are, then it is quite good that rewriting a program in Chicken Scheme when it was written in Scheme 48 doesn't take a huge effort. What we could argue is that the free software comunity is very disperse and indeed it is, but that is because it is a comunity... every comunity is disperse... you have people using Debian, others using FreeBSD, others using Ubuntu, others using OpenBSD, all different OS... you have people using C, others C++, many use Python and there are a bunch of freaks using that language with lots of parethesis. But arguing about it doesn't get us anywhere because it won't change it. Each part of the comunity is totally independent and chooses to go in a different direction. One could try to unite parts of the comunity and indeed, for example, Ubuntu united a big part of the desktop comunity. I believe that this is a disavantage, but also an advantage because it helps the comunity survive. In your particular case, if someone distributes some program only as RPM, then they are making a big mistake by supporting only one distribution. You should ask them to also distribute a tar.gz or tar.bz2 with the sources that can be compiled more or less anywhere. Submit bugs when you can't compile it in your platform and submit bugs about packaging to your OS provider (be it Debian, Ubuntu, RedHat or Suse). It actually works very well. I have submitted lots of these bugs and I've got lot's of packages included in different distros. Obviously it helps if you provide an initial package to work with. On Monday January 15 2007 04:04, Brandon J. Van Every wrote: > Harri Haataja wrote: > > On 12/01/07, Peter Busser <[EMAIL PROTECTED]> wrote: > >> Integrating these packages in Debian means that only Debian users > >> benefit from this effort. My idea is to support as many distributions as > >> possible, not only Debian. That way this effort benefits users of > >> Adamantix, > >> Ubuntu, Progeny, Knoppix, etc., etc. as well, not just users of > >> Debian. And > >> it has the following advantages for Chicken users: > > > > But sadly many of those may have a completely different (and possibly > > ancient) version in themselves that the installer and possibly the > > packager has to work around or clash with. > > The fragmentation in the Linux world is ridiculous. I'm on my 4th OS > installation attempt in 3 weeks, trying to get either dual boot or > triple boot systems going, because of RedHat vs. Debian issues. All the > Cell SDK stuff is RPM based, and it hadn't dawned on me that I simply > couldn't use Debian. Not unless I wanted to rebuild all the packages > from scratch, which probably wouldn't work, and would be very time > consuming even if it did. So to get the various Linuxes to play ok with > each other, I'm becoming far more of a boot and partition expert than I > ever wanted to be. > > I hope CMake / CPack starts performing some miracles sometime, because > otherwise, I couldn't possibly take Linux packaging seriously. It's way > too much of a mess. > > > Cheers, > Brandon Van Every > > > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > http://lists.nongnu.org/mailman/listinfo/chicken-users -- Pupeno <[EMAIL PROTECTED]> (http://pupeno.com) pgpSKRdFfQbpr.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users