[Chicken-users] wishlist: tcp.scm (tcp-port-numbers)
As far as I understand, there is no way in tcp.scm, to get port numbers of connected sockets. tcp-addresses is available, which returns only IP addresses. tcp-addresses could be modified so that it returns four values including port numbers, however, for backward compatibility I would suggest tcp-port-numbers that returns two values. It would be something like this: (define (tcp-port-numbers p) (let ([fd (##sys#tcp-port-fileno p)]) (values (or (##net#getsockport fd) (##sys#signal-hook #:network-error 'tcp-port-numbers (##sys#string-append can not compute local port - strerror) p) ) (or (##net#getpeerport fd) (##sys#signal-hook #:network-error 'tcp-port-numbers (##sys#string-append can not compute remote port - strerror) p) ) ) ) ) (define ##net#getpeerport (foreign-lambda* int ([int s]) struct sockaddr_in sa; int len = sizeof(struct sockaddr_in); if(getpeername(s, (struct sockaddr *)sa, (socklen_t *)(len)) != 0) return(-1); else return(ntohs(sa.sin_port));) ) [just copied from tcp.scm and slightly modified.] Any comments? Daishi ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] foreign record and names
On 11/13/05, Pupeno [EMAIL PROTECTED] wrote: Hello, Is there any way to define how the selectors and setters are going to be called in a foreign record ? XEvent-sent_event is... well, not nice. I have added a declaration construct to `define-foreign-record', so you would want to do something like that: (require-for-syntax 'srfi-13) (define-foreign-record Some_Struct (rename: (compose string-downcase (cut string-translate _ -))) (constructor: make-some-struct) (destructor: free-some-struct) (int xCoord) (int yCoord) ) Which would generate: (make-some-struct) -- C-POINTER (free-some-struct C-POINTER) (some-struct-xcoord C-POINTER) -- NUMBER (some-struct-ycoord C-POINTER) -- NUMBER (some-struct-xcoord-set! C-POINTER NUMBER) (some-struct-ycoord-set! C-POINTER NUMBER) Attached a new version of `define-foreign-record'. Alternatively, you can use the current darcs version (2.212). cheers, felix frecord.scm Description: Binary data ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] udp.scm on cygwin
On 11/12/05, David Janssens [EMAIL PROTECTED] wrote: Hello, udp-recvfrom doesnt seem to work under cygwin with chicken v2.2. (Bad address error) The problem is actually not the `let-location', but the type of the last parameter to `udp-recvfrom'. I have fixed that and uploaded a new version, which seems to work according to a few simple tests. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Re: a http-server bug
On 11/10/05, Daishi Kato [EMAIL PROTECTED] wrote: Well, here is another bug report for http-server. When a client requests to a server with HTTP/1.1 or HTTP/1.0 with a Connection: keep-alive header, and the server does not have the resouce and responsing 404, the server sends Connection: close header, however the connection is not closed. IE doesn't like it and waits forever untill a user press a stop button. I have modified the http server to force a closing of the connnection on error responses and uploaded a new version of the http egg. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] sassy
Hi! sassy, Jonathan Kraut's x86 assembler is available as an egg now: http://www.call-with-current-continuation.org/eggs/sassy.html cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
A word about serialization (Re: [Chicken-users] s11n + rpc)
Some technical information about the current implementation of serialization may be in order: As long as no procedures or continuations are serializated, it shouldn't be too hard to add more robustness and portability to its format. But once procedures enter the scene things can get so ugly, that I ask me whether it makes sense to actually even try to approach portability. Currently, when chicken is configured with --enable-procedure-tables, a static array is generated for each file/unit that holds a string ID (made from the internal lambda-ID, which is locally unique and the source file-name) and a void* to the procedure/continuation code. Compiling the same file with different compiler versions, compiler options or only a few procedures more or less will shift the lambda-ID counter arbitrary, so any serialized data refering to the older set of IDs will not work or worse, will work and fail for weird reasons. Now, one could go to great lengths about ensuring more robustness here, but I wonder if it's worth the trouble. As long as serialization is used for quick, local, short-range communiation, or communication of a rigidly controlled set of machines one might be able to handle the needed steps of keeping the code-base in sync. Another example is locally storing session-data (i.e. web-servers). But for larger-scale communication, or communication across a heterogenous network, I highly recommend S-expressions, which are just as portable as XML, but need less bandwidth (and are easier to parse). cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] sassy and libffi
felix winkelmann wrote: Hi! sassy, Jonathan Kraut's x86 assembler is available as an egg now: http://www.call-with-current-continuation.org/eggs/sassy.html I notice it requires libffi. Anyone know how deeply tied to libffi it is? As a Windows guy who'd like to get away with MinGW for everything, but probably can't because it's a VC++ world out there, I'm leery of this dependency. I'm also leery of libffi itself as a project. When I read mailing list archives and Google around for info about it, it seems like a project whose authors can't make up their minds about how it's going to be deployed. They don't update their ancient webpage, one version is in the GCC sources, people feel it's a pain to pull out of the GCC sources so they bundle custom tarballs for their own projects (including Chicken), the libffi authors talk about releasing it standalone again... especially on Windows, it all sounds like a recipe for build disasters. Cheers, Brandon Van Every The pioneer is the one with the arrows in his back. - anonymous entrepreneur ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] sassy and libffi
At Tue, 15 Nov 2005 16:52:21 -0800, Brandon J. Van Every wrote: felix winkelmann wrote: Hi! sassy, Jonathan Kraut's x86 assembler is available as an egg now: http://www.call-with-current-continuation.org/eggs/sassy.html I notice it requires libffi. Anyone know how deeply tied to libffi it is? You can't even load sassy without it - the syntax-case implementation itself makes heavy use of apply. -- Alex ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] tagging pointers.
Hello, I am playing with tagging pointers, I get a pointer somehow [1] and then try to tag it: #;4 (tag-pointer dpy 'x-display) Error: unprintable non-immediate object encountered As Riastradh suggested, it seems the printer can't deal with tagged pointers. So I thought about working with it without printing (although printing tagged pointers would be nice and useful): #;5 (define t (tag-pointer dpy 'x-display)) #;6 t Segmentation fault I'd say there's something wrong there, maybe at my code [2]. In a different case: #;4 (define t (tag-pointer dpy 'x-display)) #;5 (pointer-tag t) Error: unprintable non-immediate object encountered #;6 (tagged-pointer? t 'x-display) Segmentation fault Am I doing something wrong or did I hit a bug ? Just in case, I installed 2.207, and there I got: #;2 (define dpy (x-open-display)) #;3 (tag-pointer dpy 'x-display) Error: unprintable non-immediate object encountered Call history: eval (tag-pointer dpy (quote x-display)) -- #;4 (define t (tag-pointer dpy 'x-display)) #;5 t Error: unprintable non-immediate object encountered #;6 (tagged-pointer? t 'x-display) Segmentation fault Thank you. -- Pupeno [EMAIL PROTECTED] (http://pupeno.com) [1] #;1 (use xlib posix syntax-case) ; loading /usr/local//lib/chicken/syntax-case.so ... ; loading /usr/local//lib/chicken/syntax-case-chicken-macros.scm ... ; loading /usr/local//lib/chicken/xlib.so ... ; loading library posix ... #;2 (define dpy (x-open-display)) #;3 dpy #pointer 80bf740 #;4 [2] http://pupeno.com/software/chicken-xlib/ pgpvuIw2uFen9.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] tagging pointers.
I tried with the lattest from darcs, same result. -- Pupeno [EMAIL PROTECTED] (http://pupeno.com) pgpQqzu4fQbXp.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users