* data type ByteBuffer @ 2004-05-06 7:39 Steven Wu 2004-05-06 9:53 ` Andreas Rottmann 2004-05-08 15:44 ` Clinton Ebadi 0 siblings, 2 replies; 4+ messages in thread From: Steven Wu @ 2004-05-06 7:39 UTC (permalink / raw) I wonder if there is a built-in simple data type like ByteBuffer in Java, or Message_Block in ACE. It seems to me, when dealing with network programing, such a data type can be very efficient. The Message_Block in ACE emulates SysV message block used in device driver with reference counting, and the concept of adding continue blocks. It shouldn't be very hard to implement the similar thing in guile. steve _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: data type ByteBuffer 2004-05-06 7:39 data type ByteBuffer Steven Wu @ 2004-05-06 9:53 ` Andreas Rottmann 2004-05-08 15:44 ` Clinton Ebadi 1 sibling, 0 replies; 4+ messages in thread From: Andreas Rottmann @ 2004-05-06 9:53 UTC (permalink / raw) "Steven Wu" <wus@qwest.net> writes: > I wonder if there is a built-in simple data type like ByteBuffer in > Java, or Message_Block in ACE. It seems to me, when dealing with > network programing, such a data type can be very efficient. The > Message_Block in ACE emulates SysV message block used in device driver > with reference counting, and the concept of adding continue blocks. It > shouldn't be very hard to implement the similar thing in guile. > I've lately added GString support to the Guile GLib bindings, which can be used like a ByteBuffer, but isn't refcounted. I agree that such a data type would indeed be useful. Andy -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62 Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: data type ByteBuffer 2004-05-06 7:39 data type ByteBuffer Steven Wu 2004-05-06 9:53 ` Andreas Rottmann @ 2004-05-08 15:44 ` Clinton Ebadi 2004-05-08 16:09 ` Steven Wu 1 sibling, 1 reply; 4+ messages in thread From: Clinton Ebadi @ 2004-05-08 15:44 UTC (permalink / raw) [-- Attachment #1.1: Type: text/plain, Size: 1017 bytes --] On Thu, 2004-05-06 at 03:39, Steven Wu wrote: > I wonder if there is a built-in simple data type like ByteBuffer in > Java, or Message_Block in ACE. It seems to me, when dealing with > network programing, such a data type can be very efficient. The > Message_Block in ACE emulates SysV message block used in device driver > with reference counting, and the concept of adding continue blocks. It > shouldn't be very hard to implement the similar thing in guile. > > steve Would a uniform byte vector (or array if you need more than one dimension) work? (make-uniform-vector size #\nul &fill) You can use the helper procedures uniform-vector-read! and uniform-vector-write to read and write data from/to a port or a file descriptor. Uniform vectors and arrays are documented in the Guile manual, (guile)->Compound Data Types->Arrays->Uniform Arrays. -- http://unknownlamer.org AIM:unknownlamer IRC:unknown_lamer@freenode#hprog I use Free Software because I value freedom over features. [-- Attachment #1.2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] [-- Attachment #2: Type: text/plain, Size: 142 bytes --] _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: data type ByteBuffer 2004-05-08 15:44 ` Clinton Ebadi @ 2004-05-08 16:09 ` Steven Wu 0 siblings, 0 replies; 4+ messages in thread From: Steven Wu @ 2004-05-08 16:09 UTC (permalink / raw) Cc: guile-devel On May 8, 2004, at 8:44 AM, Clinton Ebadi wrote: > On Thu, 2004-05-06 at 03:39, Steven Wu wrote: >> I wonder if there is a built-in simple data type like ByteBuffer in >> Java, or Message_Block in ACE. It seems to me, when dealing with >> network programing, such a data type can be very efficient. The >> Message_Block in ACE emulates SysV message block used in device driver >> with reference counting, and the concept of adding continue blocks. It >> shouldn't be very hard to implement the similar thing in guile. >> >> steve > > Would a uniform byte vector (or array if you need more than one > dimension) work? > > (make-uniform-vector size #\nul &fill) > uniform vector can be used to implement the Message_Block, or Message_Block, however, if we extend the guile and make Message_Block into a compound type, it certainly increase the efficiency. The difference between uniform vector and Message_Block is that the Message_Block is a list of uniform vectors, but it is seen to users as one continuous block. Especially, when it can be easily convert to iovec, and write to a fd with one sys-call writev, and that is certainly more effective then multiple write. steve _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-08 16:09 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-05-06 7:39 data type ByteBuffer Steven Wu 2004-05-06 9:53 ` Andreas Rottmann 2004-05-08 15:44 ` Clinton Ebadi 2004-05-08 16:09 ` Steven Wu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).