The argument for select seems to apply just as well to tcp as udp.
My hope is that clisp will soon support multiple threads, and at that
point I expect select will become less important. For now I suggest
that you ignore this issue in your UDP interface.
I recall select being discussed at least once before. I think the
result of the last such discsussion was the addition of SOCKET-STATUS.
On Thu, Jun 07, 2001 at 09:40:11PM +0200, Frode Vatvedt Fjeld wrote:
> I've been looking a bit into the issue of creating a reasonable lisp
> interface to UDP sockets. In my opinion, such an interface should
> include some sort of event dispatch facility (i.e. a unix select kind
> of thing). From what I've read of clisp documentation, there is no
> existing event model in clisp. For example, SOCKET:SOCKET-WAIT only
> waits for a single socket.
>
> So this is a request for comments or advice on this issue. How
> should/could synchronization to several (kinds of) sockets be
> implemented?

> * In message <2hwv6o3wpw.fsf@...>
> * On the subject of "Re: [clisp-list] UDP network streams"
> * Sent on 07 Jun 2001 21:40:11 +0200
> * Honorable Frode Vatvedt Fjeld <frodef@...> writes:
>
> And how come the socket streams extension is not present in my clisp,
> taken from either FreeBSD or NetBSD's packages?
>
> [1]> (socket:socket-server)
>
> *** - READ from #<CONCATENATED-STREAM #<STRING-INPUT-STREAM> #<SYNONYM-STREAM *TERMINAL-IO*>>: there is no package with name "SOCKET"
> 1. Break [2]>
I am not clairvoyant. Sorry. I really wish I were.
Who built your packages?
From which sources?
What is your CLISP version? (lisp-implementation-version)
What does (apropos "socket") say?
--
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel&gt;
Read what the Arab leaders say to their people on <http://www.memri.org/&gt;
Sex is like air. It's only a big deal if you can't get any.

On Thu, Jun 07, 2001 at 09:40:11PM +0200, Frode Vatvedt Fjeld wrote:
> I've been looking a bit into the issue of creating a reasonable lisp
> interface to UDP sockets. In my opinion, such an interface should
> include some sort of event dispatch facility (i.e. a unix select kind
> of thing). From what I've read of clisp documentation, there is no
> existing event model in clisp. For example, SOCKET:SOCKET-WAIT only
> waits for a single socket.
>
> So this is a request for comments or advice on this issue. How
> should/could synchronization to several (kinds of) sockets be
> implemented?
I think the Unix model is pretty good here. Something like select?
--
miles

Sam-
Ok thanks, that last patch worked. I can do everything without having
to manually edit any files. Excellent. Do you have any ideas about my
other questions? If I define all the c structs in lisp and use them as the
types in my def-c-call-outs rather than just using c-pointer, I cannot do
the following:
(let ((conn (MYSQL::mysql_init nil)))
(MYSQL::mysql_connect conn "localhost" "root" "")
(MYSQL::mysql_get_server_info conn))
NIL
I have to do:
(let ((conn (MYSQL::mysql_init nil)))
(let ((conn (MYSQL::mysql_connect conn "localhost" "root" "")))
(MYSQL::mysql_get_server_info conn)))
"3.22.32-log"
Here are the def-c-callouts using the structs used in the first example:
(def-c-call-out mysql_init (:arguments (mysql (c-ptr-null st_mysql)))
(:return-type (c-ptr-null st_mysql)))
(def-c-call-out mysql_get_server_info (:arguments (mysql (c-ptr-null
st_mysql)))
(:return-type c-string))
(def-c-call-out mysql_connect (:arguments (mysql (c-ptr-null st_mysql))
(host c-string)
(user c-string)
(passwd c-string))
(:return-type (c-ptr-null st_mysql)))
and heres how I redefined them to use c-pointer, which works, as seen in the
above second example:
(def-c-call-out mysql_init (:arguments (mysql (c-ptr-null nil)))
(:return-type c-pointer))
(def-c-call-out mysql_get_server_info (:arguments (mysql c-pointer))
(:return-type c-string))
(def-c-call-out mysql_connect (:arguments (mysql c-pointer)
(host c-string)
(user c-string)
(passwd c-string))
(:return-type c-pointer))
How can I get the pointers to work in the second example?
-Eric de Groot
mailto:eric@...

I've been looking a bit into the issue of creating a reasonable lisp
interface to UDP sockets. In my opinion, such an interface should
include some sort of event dispatch facility (i.e. a unix select kind
of thing). From what I've read of clisp documentation, there is no
existing event model in clisp. For example, SOCKET:SOCKET-WAIT only
waits for a single socket.
So this is a request for comments or advice on this issue. How
should/could synchronization to several (kinds of) sockets be
implemented?
And how come the socket streams extension is not present in my clisp,
taken from either FreeBSD or NetBSD's packages?
[1]> (socket:socket-server)
*** - READ from #<CONCATENATED-STREAM #<STRING-INPUT-STREAM> #<SYNONYM-STREAM *TERMINAL-IO*>>: there is no package with name "SOCKET"
1. Break [2]>
--
Frode Vatvedt Fjeld

> * In message <dSofO+RJsNBi6uctVaC9rRC0hHwQ@...>
> * On the subject of "[clisp-list] Error building MIT CLX under Linux"
> * Sent on Thu, 07 Jun 2001 09:23:58 +0200
> * Honorable Paolo Amoroso <amoroso@...> writes:
>
> Compiling file /home/paolo/clisp-2.26/modules/clx/mit-clx/clx.lisp ...
> *** - BOOLEAN is a built-in type and may not be redefined.
> make: *** [stamp.fas] Error 1
thanks - fixed.
get the patch in the same place as sources or do cvs up
--
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel&gt;
Read what the Arab leaders say to their people on <http://www.memri.org/&gt;
Sufficiently advanced stupidity is indistinguishable from malice.

> * In message <a05010400b74494bb1853@[192.168.1.2]>
> * On the subject of "[clisp-list] OS X install questions"
> * Sent on Wed, 6 Jun 2001 22:28:13 -0400
> * Honorable call -151 <rwts@...> writes:
>
> source clisp version 2.26, dated 2001-05-23 07:32
>
> Compiling file /Users/cleary/clisp-2.26/src/foreign1.lisp ...
> *** - There is no package with name "FFI"
> make: *** [foreign1.fas] Error 1
please get the patch
clisp-2.26-bug5-no-ffi.diff
the same place you got the sources.
thanks for reporting the bug.
--
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel&gt;
Read what the Arab leaders say to their people on <http://www.memri.org/&gt;
If a train station is a place where a train stops, what's a workstation?

More questions! I'm having a problem with number type conversions, I have
the following two C functions:
int myintfun() {
return 11;
}
unsigned long long myulonglongfun() {
return 11;
}
For the FFI lisp I have, respectively:
(def-c-call-out myintfun (:return-type int))
(def-c-call-out myulonglongfun (:return-type uint64))
'unsigned long long' is 8 bytes unsigned. uint64 is the only unsigned 8
byte type you have listed in the FFI docs. Anyways, after loading clisp up
with bindings for these, calling them gives me:
(MYSTUFF::myintfun)
11
(MYSTUFF::myulonglongfun)
52
(MYSTUFF::myulonglongfun)
0
it just gives a trash random number.
Any ideas why?? Thanks.
-Eric de Groot
mailto:eric@...

Sam-
Ok, I was just studying the lisp from the postgresql bindings in the
modules directory some more and it just clicked. Through the entire they
whoever wrote just used c-pointer, rather than defining all the structs and
everything. This will work for my mysql bindings aswell because mysql has
accessor functions for all the data needed from the structures. I don't
need the details. Damn, I wish I noticed this earlier! Anyways, changing
everything to either c-pointer or (c-ptr-null nil) works!! so far atleast;)
-Eric de Groot
mailto:eric@...

Sam-
Ok, I was having more problems with the c code in callmysql.c generated
by:
./clisp-link add-module-set mysql base base+mysql
It kept telling me the structs generated were incompatible with the structs
in mysql.h. I checked the sizeof() of everything, and everything matched up
perfectly between the structs in mysql.h and the structs clisp generated..
So i finally just deleted all the prototypes and structures clisp generates
and let it use the prototypes and structs from mysql.h, works great. Why
couldn't you just do this in the first place instead of having it generate
duplicate prototypes and structures? Anyways, with that I was able to
finally talk to mysql!! very exciting after all this;) I'm having another
problem now with the following though:
(let ((conn (MYSQL::mysql_init nil)))
(MYSQL::mysql_connect conn "localhost" "root" "")
(MYSQL::mysql_get_server_info conn))
gives me: NIL
(let ((conn (MYSQL::mysql_init nil)))
(let ((conn (MYSQL::mysql_connect conn "localhost" "root" "")))
(MYSQL::mysql_get_server_info conn)))
gives me exactly what i want: "3.22.32-log"
in the first example, why is conn not being modified by mysql_connect? The
second example works because mysql_connect both modifies the st_mysql
structure you pass it, and on a successful connection the the database
server, also returns it, otherwise returns null on failure. In C, just
doing:
mysql_connect( conn, "localhost", "root", NULL );
would be fine. The only thing I would use the returned struct for was error
checking:
if ( mysql_connect( conn, "localhost", "root", NULL ) == NULL ) {
/* error handling.. */
}
With CLISP, when you pass a var to a c-ptr argument, do you have to do
something special to allow it to be modified by the function you passed it
to?
Thanks.
-Eric de Groot
mailto:eric@...

I'm trying to get clisp installed under OS X. I have the
source clisp version 2.26, dated 2001-05-23 07:32
At first, I kept core dumping until I figured out to
increase the stacksize with
limit stacksize 8192 kbytes
and now the configuration script it gets much further, but
stops dead during the compilation with:
Compiling file /Users/cleary/clisp-2.26/src/foreign1.lisp ...
*** - There is no package with name "FFI"
make: *** [foreign1.fas] Error 1
Any ideas? Has anyone got clisp working well under Mac OS X?
I tried a binary distro of 2.25.1 earlier but wasn't able to
get that working due to hard-coded directory info in the
makefile that I couldn't seem to straighten out as well as
some initmem problems. I saw that there were comments in the list
archive about FFI but none of them seemed similar enough
to be useful. It might be worth mentioning in the install
about increasing the stacksize for OS X since for some reason
the default seems to be set pretty small.
Thanks,
-Sean Cleary.

Sam-
in C, int (*f)(); and int f(); are not equivalent. I'm trying to
declare a function pointer as a member of a structure, like:
struct mystruct {
int (*f)();
};
you cannot write:
struct mystruct {
int f();
}
this would work in c++ if mystruct::f() {} was defined elsewhere, but even
then it's still not a function pointer. Excuse me if you already know this,
but just to make sure we are both clear on function pointers..
with function pointers you can do this:
struct mystruct {
int (*f)();
};
int a() {
printf("aaaa");
}
int b() {
printf("bbbb");
}
struct mystruct mystructinst;
mystructinst.f = &a;
(*mystructinst.f)();
mystructinst.f = &b;
(*mystructinst.f)();
which will result in a call to a(), then b() and print out: aaaabbbb.
the declation of the function pointer itself has to look like <returntype>
(*<pointername>)(<args); or int (*f)(); in the above case.
-Eric de Groot
mailto:eric@...
> please send an example and then remove the patch. ;-)
>
> also, since in C
> int (*f) ();
> and
> int f()
> are equivalent, you can just write
> (error_handler (c-function))
>
> > (def-c-call-out mysql_init (:arguments (mysql (c-ptr st_mysql)))
> > (:return-type (c-ptr st_mysql)))
> >
> > Also, you can see above, it's still not doing the arguments, I just
> > get mysql_init().
>
> this should not be a problem as C does not require full prototypes.
>
> --
> Sam Steingold (http://www.podval.org/~sds)
> Support Israel's right to defend herself!
<http://www.i-charity.com/go/israel&gt;
> Read what the Arab leaders say to their people on <http://www.memri.org/&gt;
> Are you smart enough to use Lisp?
>
>