-DataWorks Database Format
+DataWorks Database Format 1.0
==============================================
Extension should be .dwf
+All numbers MUST use big-endiam
-First 3 bytes should be 7F 44 57 (\x7F DW)
+First 3 bytes MUST be 7F 44 57 (\x7F DW) (`signature`)
-Every entries should look like this:
-type: 1 byte ASCII
-length: 4, uint32_t
+Database entry (`dbentry`) MUST be in this format:
+length : 4 bytes uint32_t
+size : 4 bytes uint32_t
+type : 1 byte ASCII
+flag : 1 byte uint8_t
+field_index: 1 byte uint8_t
+db_index : 1 byte uint8_t
+count : 8 bytes uint64_t
+data : [size] bytes ASCII (but you SHOULD read only [length] bytes. Use [size] to skip paddings!)
+
+There are 5 types for `dbentry`:
+String : 'S' ASCII
+Integer : 'I' uint64_t
+Double : 'D' double
+Logical : 'L' uint8_t (0 for false, other value for true)
+Help : '?' ASCII, should be just ignored
+
+and 1 flag for `dbentry`:
+Used : 0b10000000 Flag this if you are using the entry.
+
+Index entry (`indexentry`) MUST be in this format:
+flag : 1 byte uint8_t
+count : 8 bytes uint64_t
+dbname_len : 8 bytes uint8_t
+dbname : 256 bytes ASCII
+fields : 4096 bytes ASCII (Separate field names using NUL. Put NUL twice on the last field name.)
+
+There is 1 flag for `indexentry`:
+Used : 0b10000000 Flag this if you are using the entry.
+
+Info entry (`infoentry`) MUST be in this format:
+version : 2 bytes uint16_t (MUST be 1 for 1.0)
+`infoentry` IS the only thing which SHOULD be compatible in later format.
+
+File MUST look like this:
+ `signature`
+ `infoentry`
+ 256 `indexentry`
+ `dbentry` 0
+ `dbentry` 1
+ ...
+ `dbentry` n
==============================================
$Id$