Meanwhile, I managed to express the data of a 32-bit big-endian two's complement integer as a sequence of 4 characters. But you are probably right: I have to re-do the job and it rather inefficient.. Problem is only my shaky C programming experience ;-)

Torsten

On Aug 15, 2007, at 8:20 PM, Pavel wrote:
I would solve this by finding an implementation in C (googling for osc implementation gives me this: http://liblo.sourceforge.net/) and then write an interface to OZ. That's usually easier than doing everything yourself. In this case you get the added bonus of being able to cast between 32 bit and 64 bit values whenever you need.
/pavel

On Wed, 15 Aug 2007 18:32:26 +0200, Torsten Anders <[EMAIL PROTECTED]> wrote:

Dear all,

currently, I am trying to talk to other applications via some communication protocol (more specifically, it is OpenSound Control, see http://www.cnmat.berkeley.edu/OpenSoundControl/). The syntax of this protocol requires that I send/receive data of formats such as 32-bit integer (big-endian) and 32-bit floats (big- endian). The communication itself happens via sockets.

Oz floats are internally 64 bits (according to CTM). Their print representation (Float.toString) is less, but not fixed in size (BTW: it does not use Oz syntax, the negation sign is - instead of ~). Oz integers can be of any size. I assume BitArray or BitString don't help me either, because I can not output them. Also, ByteString is intended for textual data.

Any idea how I can control the size of integers and floats send across a socket?

Thank you!

Best
Torsten

--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
strasheela.sourceforge.net
www.torsten-anders.de




_____________________________________________________________________ ____________ mozart-users mailing list mozart- [EMAIL PROTECTED]
http://www.mozart-oz.org/mailman/listinfo/mozart-users


______________________________________________________________________ ___________ mozart-users mailing list mozart- [EMAIL PROTECTED]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
strasheela.sourceforge.net
www.torsten-anders.de




_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to