[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Re: Server sockets with GCL?
From: |
Chris Hall |
Subject: |
[Gcl-devel] Re: Server sockets with GCL? |
Date: |
Wed, 05 May 2004 11:37:44 -1000 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.2 (gnu/linux) |
Jeff Dalton <address@hidden> writes:
> When I did socket stuff in GCL in order to write an HTTP server,
> I wrote a function called accept-socket-connection that returned
> an df (ie, an int), and I wrote something called fdopen that
> would return a Lisp input or output stream. Then
>
> (defun socket-connection-stream (s)
> (let ((fd (accept-socket-connection s)))
> (make-two-way-stream
> (fdopen fd :input)
> (fdopen fd :output))))
>
> fdopen was named after the C procedure that makes a FILE from an fd.
>
> I could then do normal I/O with the resulting stream.
>
I found an 'accept-socket-connection' in the GCL Tk support code, for
use with the GCL Tk server, apparently. Camm has mentioned though, that
TK-oriented socket C code seems to expecting magic numbers in the packet
headers - whatever that mean, I haven't gotten that far with C sockets
yet.
> All of this was reasonably straightforward to do using the C
> interface.
>
> I'm not sure how freely available my code is, though it's supposed
> to become open source as part of O-Plan (an AI planning system)
> at some point.
>
> However, I'd be ahppy to try to help other people with such
> things where I can.
Thanks! Hopefully, it won't be necessary, though. ;-D
>
> BTW, is there any documentation for the GCL C interface.
> My copy of the KCL manual was destroyed in a fire, and I
> couldn't find anything on-line.
As for 'official' docs, in gcl-si.info (gcl-si.info-4, to be precise), I
found:
* DEFENTRY - appears to be the GCL eqivalent of the FFI? A way to
call C routines from Lisp. Minimal example, I haven't tried it
(yet!), but it looks sufficient from here.
* DEFCFUN - the reverse of DEFENTRY, apparently. Allows calling GCL
Lisp functions from C. Minimal example, haven't tried.
* CLINES - embed line(s) of C in an GCL function. Inline C? The
hacker in me immediately thinks "And if the C compiler on your
system supports inline assembler . . ." :-D
This may be enough to get me started, at least.
I also poked around a bit in the source for GCL - there are some _old_
examples of calling X11 from GCL, and some interesting Tk examples -
there is also gcl-tk.info, FWIW.
Thanks again,
+Chris
--
What is life? It is the flash of a firefly in the night. It is the
breath of a buffalo in the wintertime. It is the little shadow which
runs across the grass and loses itself in the sunset.
--- Crowfoot's last words (1890), Blackfoot warrior and orator.
pgphONcKv_85S.pgp
Description: PGP signature
- [Gcl-devel] Server sockets with GCL?, tdjohns1, 2004/05/04
- [Gcl-devel] Re: Server sockets with GCL?, Chris Hall, 2004/05/05
- [Gcl-devel] Re: Server sockets with GCL?, Jeff Dalton, 2004/05/05
- Re: [Gcl-devel] Re: Server sockets with GCL?, Camm Maguire, 2004/05/06
- Re: [Gcl-devel] Re: Server sockets with GCL?, Helmut Eller, 2004/05/06
- Re: [Gcl-devel] Re: Server sockets with GCL?, Jeff Dalton, 2004/05/06
- [Gcl-devel] Re: Server sockets with GCL?, Chris Hall, 2004/05/07
- Re: [Gcl-devel] Re: Server sockets with GCL?, Dennis Decker Jensen, 2004/05/08
- [Gcl-devel] Re: Server sockets with GCL?, Chris Hall, 2004/05/10
- Re: [Gcl-devel] Re: Server sockets with GCL?, Dennis Decker Jensen, 2004/05/11
- Re: [Gcl-devel] Re: Server sockets with GCL?, Michael Koehne, 2004/05/06
- Re: [Gcl-devel] Re: Server sockets with GCL?, Wolfgang Zocher, 2004/05/07