spv writing mostly works
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 16 May 2025 00:23:02 +0000 (17:23 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 16 May 2025 00:23:02 +0000 (17:23 -0700)
rust/pspp/src/output/spv.rs

index 11391e5eb38ad9257cc824f08ac979a2f4b4cd55..a5de5e971af68bc72c746f9243449f41b173f02f 100644 (file)
@@ -99,6 +99,7 @@ where
         let mut content = Vec::new();
         let mut cursor = Cursor::new(&mut content);
         pivot_table.write_le(&mut cursor).unwrap();
+        println!("{}", content.len());
 
         let table_name = light_table_name(table_id);
         self.writer
@@ -560,7 +561,10 @@ impl BinWrite for Dimension {
             .write_options(writer, endian, ())?;
 
         let mut data_indexes = self.presentation_order.iter().copied();
-        self.root.write_le(writer, &mut data_indexes)
+        for child in &self.root.children {
+            child.write_le(writer, &mut data_indexes)?;
+        }
+        Ok(())
     }
 }
 
@@ -1134,14 +1138,15 @@ impl BinWrite for Value {
     ) -> binrw::BinResult<()> {
         match &self.inner {
             ValueInner::Number(number) => {
+                let format = SpvFormat {
+                    format: number.format,
+                    honor_small: number.honor_small,
+                };
                 if number.var_name.is_some() || number.value_label.is_some() {
                     (
                         2u8,
                         ValueMod::new(self),
-                        SpvFormat {
-                            format: number.format,
-                            honor_small: number.honor_small,
-                        },
+                        format,
                         number.value.unwrap_or(-f64::MAX),
                         SpvString::optional(&number.var_name),
                         SpvString::optional(&number.value_label),
@@ -1152,8 +1157,8 @@ impl BinWrite for Value {
                     (
                         1u8,
                         ValueMod::new(self),
+                        format,
                         number.value.unwrap_or(-f64::MAX),
-                        Show::as_spv(&number.show),
                     )
                         .write_options(writer, endian, args)?;
                 }