[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interview

Steve Baker wrote:

>> It's planned, but I'm not 100% sure about how it will look like. Most
>> likely there will be a read/write function for each basic data type (char
>> (?), int, double etc) and some config parameter to tell PFile "assume all
>> values are little(big) endian".
>A more elegant thing is to store a 'magic number' at the top of the
>ALL Binary files should start with a 4 byte magic number anyway so that
>you can check that you aren't being fed a file of the wrong kind - and
>also so that the Linux/UNIX 'file' command can be set to recognise your
>file type using /etc/magic.
>Suppose we choose:  0x1234  (a short).
>When you read a file, first read the magic number. If you see 0x1234
>byte swap - if you see 0x3412, you need to swap.
>The joy of this is that you don't have to byte swap when WRITING files,
>so it halves the amount of work you have to do.  Hence, since each
>writes files in it's native format, but can read either swapped or not.

Actually PFile PakFiles already contain information about what endianness
and native int size the building system had, so for files in PFile Paks
it's no problem.


Drive A: not responding...Formatting C: instead