Gwyddion native data files consists of a tree-like structure of serialized objects. Generally, these objects can be of various kind and contain other embedded objects (hence the tree-like structure). It can be instructive to play with gwydump, a simple file structure visualizer available in on the project's web, for a while and examine the contents of various files.
First of all, we will describe physical file structure without regard to possible interpretation of contained data.
The file header consists of four bytes (magic number) with the
values of ASCII characters GWYP
.
This is the new file format, an older version of file format with magic
header GWYO
also exists. It will not be discussed
here.
The rest of the file consists of a serialized GwyContainer object that contains all the data. It is stored exactly the same way as any other object, that is as described in the next section.
An object consists of three parts (in the following order):
NUL
-terminated string of
ASCII characters. This is the type name in GObject type system.
Each component consits of three parts (in the following order):
NUL
-terminated string.
Available atomic data types are listed in following table:
Type | Character | Note |
---|---|---|
boolean | b | Stored as a byte, zero is false, nonzero (normally 1) is true |
character | c | |
32bit integer | i | |
64bit integer | q | |
double | d | IEEE 754 double precession floating point number |
string | s |
NUL -terminated
|
object | o | Serialized object as described above |
Each atomic type except boolean has its array counterpart. The type character of array types is the same as of the corresponding atomic type, except it is uppercase. Arrays are stored as unsigned 32bit array length (the number of items), followed by the item values. Array data types are listed in following table:
Type | Character | Note |
---|---|---|
array of characters | C |
Not NUL -terminated
|
array of 32bit integers | I | |
array of 64bit integers | Q | |
array of doubles | D | |
array of strings | S | |
array of objects | O | Uppercase Oh, not zero |