From: Sam S. <sd...@gn...> - 2002-10-02 14:15:14
|
> * In message <DFD875E85664D3118FA6080006277DE706A84F37@U8PN2.blf01.telekom.de> > * On the subject of "[clisp-list] FFI - Creating c-places in LISP? -> READ-SOME-SEQUEN CE" > * Sent on Wed, 2 Oct 2002 10:06:45 +0200 > * Honorable "Hoehle, Joerg-Cyril" <Joe...@t-...> writes: > > Dave Richards wrote: > > >; data is allocated in initialize-instance as: > >; (make-array (nq-size nq) :element-type '(unsigned-byte 8)) > > > >My desire is to be able to call send() and recv() on the data part of > >(nq-data nq), i.e. I want a c-pointer to (aref (nq-data data) index). > > I don't understand why you need C for this. > > Suppose you had READ-SOME-BYTES > (or READ-SOME-SEQUENCE > or READ-PARTIAL-SEQUENCE > or READ-SEQUENCE-PARTIAL), you'd call > > (READ-SOME-SEQUENCE sequence socket) ;? &optional start end > > and stay in Lisp. no C. > > READ-SOME-SEQUENCE is defined as a function which does a single OS > read() resp. recv() into the supplied sequence and returns the number > of bytes/characters/elements read. Note that we already have READ-BYTE-SEQUENCE and READ-CHAR-SEQUENCE (in addition to READ-SEQUENCE). In addition to READ-SEQUENCE-ONCE, you will need also READ-CHAR-SEQUENCE-ONCE and READ-BYTE-SEQUENCE-ONCE (and make them generic functions too - see gray.lisp) -- Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/> <http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html> He who laughs last thinks slowest. |