-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
A character cannot store values outside the range of 0-255. if you wish to store longer values, you need to use multiple characters. For example, you can use two characters to store values in the range of 0-65535:
function encode2 x return numToChar(x div 256) & numToChar(x bitAnd 255) end encode2
function decode2 x return (charToNum(char 1 of x) * 256) + charToNum(char 2 of x) end decode2
On Apr 17, 2005, at 5:07 PM, jbv wrote:
Dar,
Thanks again for the reply, but actually I know most of what you explained, as I've already fiddled with the binaryEncode function (for sound files & other data manipulations)... Although, several issues still remain unclear : my serie of output indexes resulting from the LZW compression feature more than 256 entries. Therefore I'm wondering how this could be represented in binary, in order to be decoded by the LZW filter in pdf...
Best, JB
On Apr 17, 2005, at 2:38 PM, jbv wrote:But now I need to convert the output serie of index into binary data... Anyone familiar with this ? I guess I need to use binaryEncode, but how to set up parameters ?
Normally, we think of a value in Transcript as a sequence of characters. When we work with binary we can view each character as that for an 8-bit encoding, that is, a byte. Thus, a value can be viewed as a sequence of bytes. Just as we can concatenate characters with &, we an concatenate what we consider to be bytes sequences the same way.
To get at the numerical value of the byte, you can use charToNum(). You can also use numToChar() as the inverse.
You can also use binaryEncode() and binaryDecode(). Most formats are
in host order and so are of limited utility. However, some formats,
such as "N", are big endian. If you need small endian formatting, just
reverse. There are some formats missing, so you would want to build up
a few simple functions to help.
For example,
put binaryEncode("N",566) into aLen
would put 4 bytes (chars) into aLen.
Dar
-- ************************************************** DSC (Dar Scott Consulting & Dar's Lab) http://www.swcp.com/dsc/ Custom libraries (with externals, if needed) **************************************************
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
- ----------------------------------------------------------- Frank D. Engel, Jr. <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCY61p7aqtWrR9cZoRAmGjAKCDS+BAise+oKyQDPN+fbgwD/ACygCfb8wt qUfEbH995cVGfdm2rLI24fA= =AbNP -----END PGP SIGNATURE-----
___________________________________________________________ $0 Web Hosting with up to 200MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
