+ }),
+ }
+}
+
+#[derive(FromPrimitive)]
+enum Extension {
+ /// Machine integer info.
+ Integer = 3,
+ /// Machine floating-point info.
+ Float = 4,
+ /// Variable sets.
+ VarSets = 5,
+ /// DATE.
+ Date = 6,
+ /// Multiple response sets.
+ Mrsets = 7,
+ /// SPSS Data Entry.
+ DataEntry = 8,
+ /// Extra product info text.
+ ProductInfo = 10,
+ /// Variable display parameters.
+ Display = 11,
+ /// Long variable names.
+ LongNames = 13,
+ /// Long strings.
+ LongStrings = 14,
+ /// Extended number of cases.
+ Ncases = 16,
+ /// Data file attributes.
+ FileAttrs = 17,
+ /// Variable attributes.
+ VarAttrs = 18,
+ /// Multiple response sets (extended).
+ Mrsets2 = 19,
+ /// Character encoding.
+ Encoding = 20,
+ /// Value labels for long strings.
+ LongLabels = 21,
+ /// Missing values for long strings.
+ LongMissing = 22,
+ /// "Format properties in dataview table".
+ Dataview = 24,
+}
+
+struct ExtensionRecord {
+ /// Offset from the start of the file to the start of the record.
+ offset: u64,
+
+ /// Record subtype.
+ subtype: u32,
+
+ /// Size of each data element.
+ size: u32,
+
+ /// Number of data elements.
+ count: u32,
+
+ /// `size * count` bytes of data.
+ data: Vec<u8>,
+}
+
+fn extension_record_size_requirements(extension: Extension) -> (u32, u32) {
+ match extension {
+ /* Implemented record types. */
+ Extension::Integer => (4, 8),
+ Extension::Float => (8, 3),
+ Extension::VarSets => (1, 0),
+ Extension::Mrsets => (1, 0),
+ Extension::ProductInfo => (1, 0),
+ Extension::Display => (4, 0),
+ Extension::LongNames => (1, 0),
+ Extension::LongStrings => (1, 0),
+ Extension::Ncases => (8, 2),
+ Extension::FileAttrs => (1, 0),
+ Extension::VarAttrs => (1, 0),
+ Extension::Mrsets2 => (1, 0),
+ Extension::Encoding => (1, 0),
+ Extension::LongLabels => (1, 0),
+ Extension::LongMissing => (1, 0),
+
+ /* Ignored record types. */
+ Extension::Date => (0, 0),
+ Extension::DataEntry => (0, 0),
+ Extension::Dataview => (0, 0),