"M. Uli Kusterer" wrote:
> A "bit" chunk type sounds perfectly reasonable to me.

> we'd have to care about big-endian vs. little-endian bits. Use
> the one of the current platform, one for all stacks, or have a property to
> switch ... it's not that easy.

I'd say "network order" ;-)


> I'm not sure how a range of bits should be returned:

You already can easily convert numbers to binary form and lots of other
things. What I was thinking of was accessing any string bitwise. The
problems that come up then are that the length of a string is always a
multiple of 8 bits, but bitstrings can be of arbitrary length so you can
simply add them together. It would be a short form of binaryEn/Decode.
Say you have two bit strings s1 = "101" and s2 = "011" (note the leading zero!):

put s2 after s1 --> "101011"
set bit 3 of s1 to 0 --> "100011"

You can do the same thing by decoding the bitstring into a string of
zeros and ones and then accessing it with the char token type:

get binaryDecode("B*","30",s1) --> s1 = "0011001100110000"
put 1 into char 6 of s1        --> s1 = "0011011100110000"
get binaryEncode("B*",s1)      --> "70"

And I guess this moves my request off the feature request list (if it
ever got there ;-) ... it would be a mere syntactical addon, not really
a new feature. And it proves again that most things are already "in there".

I thought I'd share it with the list, because it is a handy technique
that makes the use of MetaCard even more attractive (have you ever tried
to understand C++ code that works with bit strings?!?... especially if
they are more than 32 bit long!!!)


Regards
  R�diger

-- 
   GINIT Technology GmbH    [EMAIL PROTECTED]
   Ruediger zu Dohna
                                    phone:        +49-721-96681-0
   Technologiepark                    fax:        +49-721-96681-11
   Emmy-Noether-Str. 9
   D-76131 Karlsruhe                       www.ginit-technology.de

Reply via email to