I've been working on a python parser for GFF files (to do a level hieghtmap tool) and have nearly got a working parser, with only the generic lists left to do. I've been working from the
http://social.biowar...t/index.php/GFF page, and will add some updates once I have completed writing a GFF file using my parser.
The file is broken up as:
Header
Structure list (the first is the structure representing the file itself, so there is always atleast one per file)
Field list ( structure 0's stored first, then structure1's and so on,
Raw Data Block
The structure at position 0 in the structure list contains all the other structures and fields etc, the actual start position of the data is at the Raw Data Block offset. Each field in the structure can be accessed using the offset in the appropriate field list the current structure.
There are several different types of field data that can be found within a structure, inline-value, list of specific type, list of structures, generic lists (essentially a list that can contain any type of information), structures and finally references. As it stands in my test data I haven't hit a reference field, and I am currently stuck on parsing generic lists.
A structure field for a list contains a 4 byte offset/reference from the start of the current structure position. The data there is then a 4 byte unsigned integer representing the size of the list, followed by size * whatever type the list consists of. If the list is empty, the 4 byte offset/reference will be 0xFFFFFFFF.
A list of structures is much the same, with the exception that instead of the field type flag representing a specific type, it represents the structure array index for the structure that makes up the list.
ECStrings are considered a list of 2 byte characters, and follow the same setup as a list. The difference is that the field flag does not indicate that the ECString is a list, so you will need to watch for fields with a type of 14 (that aren't a structure type)
Generic Lists (lists where the field type is 0x0000FFFF) appear to follow the same as a list, except that it is a list of references. However this part is a work in progress/hack at it until it works scenario, and I may be well off base at this time.
There are reference fields, but I have not had a specific example of this yet, but they seem pretty straightforward on the GFF file format web page, and in-line value fields which you can get to by moving the field array index value from the start of the structure in the datablock.