work
[pspp] / rust / src / lib.rs
index 680d3a3a51673b5e93601ca48fa3c457582ad6ff..482bd081979a8ec060945304729680ad8c081323 100644 (file)
@@ -6,6 +6,7 @@ pub mod raw;
 pub mod cooked;
 pub mod sack;
 pub mod encoding;
+pub mod format;
 
 #[derive(ThisError, Debug)]
 pub enum Error {
@@ -92,4 +93,34 @@ pub enum Error {
 
     #[error("At offset {offset:#x}, {record} has bad count {count} instead of the expected {expected_count}.")]
     BadRecordCount { offset: u64, record: String, count: u32, expected_count: u32 },
+
+    #[error("The encoding record at offset {offset:#x} contains an encoding name that is not valid UTF-8.")]
+    BadEncodingName { offset: u64 },
+
+    #[error("In long string missing values record starting at offset {record_offset:#x}, value length at offset {offset:#x} is {value_len} instead of the expected 8.")]
+    BadLongMissingValueLength { record_offset: u64, offset: u64, value_len: u32 },
+
+    #[error("This file has corrupted metadata written by a buggy version of PSPP.  To ensure that other software can read it correctly, save a new copy of the file.")]
+    BadLongMissingValueFormat,
+
+    #[error("File creation date {creation_date} is not in the expected format \"DD MMM YY\" format.  Using 01 Jan 1970.")]
+    InvalidCreationDate { creation_date: String },
+
+    #[error("File creation time {creation_time} is not in the expected format \"HH:MM:SS\" format.  Using midnight.")]
+    InvalidCreationTime { creation_time: String },
+
+    #[error("Details TBD")]
+    TBD,
+}
+
+#[derive(Copy, Clone, Debug)]
+pub enum Compression {
+    Simple,
+    ZLib,
+}
+
+#[derive(Clone, Debug)]
+pub enum CategoryLabels {
+    VarLabels,
+    CountedValues,
 }