At 03:10 PM 9/14/2001 -0500, Brian Wheeler wrote:
>I've been thinking alot about the bytecode file format lately.  Its
>going to get really gross really fast when we start adding other
>(optional) sections to the code.
>
>So, with that in mind, here's what I propose:
>
>* All data sizes are in longwords (4 bytes) because that's just the way
>things are :)

Nope. At the very least, a bytecode file needs to start with:

8-byte word:    endianness (magic value 0x123456789abcdef0)
byte:           word size
byte[7]:        empty
word:           major version
word:           minor version

Where all word values are as big as the word size says they are.

The magic value can be something else, but it should byteswap such that if 
you read it in you can tell whether it was a big-endian write or a 
little-endian write.

Followed by the offsets to the various segments in the file. The directory 
(basically the offsets) *must* be at the very beginning, right after the 
header.

Also, don't choose a stream format that makes writing the file easy--choose 
one that makes reading easy and fast. Two or three passes before writing 
are fine.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to