rust: Remove `sack` standalone program.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 12 Jul 2025 17:17:44 +0000 (10:17 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 12 Jul 2025 17:17:44 +0000 (10:17 -0700)
It wasn't really useful and it didn't make sense to run it as a test.

rust/Cargo.lock
rust/pspp/Cargo.toml
rust/pspp/src/sys/sack.rs
rust/pspp/tests/sack.rs [deleted file]

index 1e7795ae4c280b42dcec9e59bae4062a254e8125..52e85441602feeb03ca58b72132e3486acca2924 100644 (file)
@@ -2749,18 +2749,18 @@ dependencies = [
 
 [[package]]
 name = "zerocopy"
-version = "0.8.25"
+version = "0.8.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb"
+checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
 dependencies = [
  "zerocopy-derive",
 ]
 
 [[package]]
 name = "zerocopy-derive"
-version = "0.8.25"
+version = "0.8.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef"
+checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
 dependencies = [
  "proc-macro2",
  "quote",
index 043fbae2a42f7cc885972aa7fea79ea7ad51d044..73a2188660e13e1a99f66f05ac3b7c5ca335c911 100644 (file)
@@ -55,7 +55,6 @@ windows-sys = { version = "0.48.0", features = ["Win32_Globalization"] }
 
 [build-dependencies]
 anyhow = "1.0.69"
-flate2 = "1.0.26"
 
 [[bin]]
 name = "pspp"
@@ -64,11 +63,6 @@ path = "src/main.rs"
 [lib]
 path = "src/lib.rs"
 
-[[test]]
-name = "sack"
-path = "tests/sack.rs"
-harness = false
-
 [dev-dependencies]
 diff = "0.1.13"
 rand = "0.9.0"
index 99484e373582e4ebb11bc52c4f4a44c374693afa..c6695bd1bef026e3f5dd2ccb7313a75c48a0cfc7 100644 (file)
@@ -71,6 +71,47 @@ impl Display for Error {
     }
 }
 
+/// SAv Construction Kit
+///
+/// The input is a sequence of data items, each followed by a semicolon.  Each
+/// data item is converted to the output format and written on stdout.  A data
+/// item is one of the following:
+///
+///   - An integer in decimal, in hexadecimal prefixed by `0x`, or in octal
+///     prefixed by `0`.  Output as a 32-bit binary integer.
+///
+///   - A floating-point number.  Output in 64-bit IEEE 754 format.
+///
+///   - A string enclosed in double quotes.  Output literally.  There is no
+///     syntax for "escapes".  Strings may not contain new-lines.
+///
+///   - A literal of the form `s<number>` followed by a quoted string as above.
+///     Output as the string's contents followed by enough spaces to fill up
+///     `<number>` bytes.  For example, `s8 "foo"` is output as `foo` followed
+///     by 5 spaces.
+///
+///   - The literal `i8`, `i16`, or `i64` followed by an integer.  Output
+///     as a binary integer with the specified number of bits.
+///
+///   - One of the literals `SYSMIS`, `LOWEST`, or `HIGHEST`.  Output as a
+///     64-bit IEEE 754 float of the appropriate PSPP value.
+///
+///   - `PCSYSMIS`.  Output as SPSS/PC+ system-missing value.
+///
+///   - The literal `ENDIAN`.  Output as a 32-bit binary integer, either with
+///     value 1 if `--be` is in effect or 2 if `--le` is in effect.
+///
+///   - A pair of parentheses enclosing a sequence of data items, each followed
+///     by a semicolon (the last semicolon is optional).  Output as the enclosed
+///     data items in sequence.
+///
+///   - The literal `COUNT` or `COUNT8` followed by a sequence of parenthesized
+///     data items, as above.  Output as a 32-bit or 8-bit binary integer whose
+///     value is the number of bytes enclosed within the parentheses, followed
+///     by the enclosed data items themselves.
+///
+/// optionally followed by an asterisk and a positive integer, which specifies a
+/// repeat count for the data item.
 pub fn sack(input: &str, input_file_name: Option<&Path>, endian: Endian) -> Result<Vec<u8>> {
     let mut symbol_table = HashMap::new();
     let output = _sack(input, input_file_name, endian, &mut symbol_table)?;
diff --git a/rust/pspp/tests/sack.rs b/rust/pspp/tests/sack.rs
deleted file mode 100644 (file)
index 3e47847..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-// PSPP - a program for statistical analysis.
-// Copyright (C) 2025 Free Software Foundation, Inc.
-//
-// This program is free software: you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free Software
-// Foundation, either version 3 of the License, or (at your option) any later
-// version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with
-// this program.  If not, see <http://www.gnu.org/licenses/>.
-
-use std::fs::read_to_string;
-use std::path::PathBuf;
-
-use anyhow::{anyhow, Result};
-use clap::Parser;
-use pspp::endian::Endian;
-use pspp::sys::sack::sack;
-
-/// SAv Construction Kit
-///
-/// The input is a sequence of data items, each followed by a semicolon.  Each
-/// data item is converted to the output format and written on stdout.  A data
-/// item is one of the following:
-///
-///   - An integer in decimal, in hexadecimal prefixed by `0x`, or in octal
-///     prefixed by `0`.  Output as a 32-bit binary integer.
-///
-///   - A floating-point number.  Output in 64-bit IEEE 754 format.
-///
-///   - A string enclosed in double quotes.  Output literally.  There is no
-///     syntax for "escapes".  Strings may not contain new-lines.
-///
-///   - A literal of the form `s<number>` followed by a quoted string as above.
-///     Output as the string's contents followed by enough spaces to fill up
-///     `<number>` bytes.  For example, `s8 "foo"` is output as `foo` followed
-///     by 5 spaces.
-///
-///   - The literal `i8`, `i16`, or `i64` followed by an integer.  Output
-///     as a binary integer with the specified number of bits.
-///
-///   - One of the literals `SYSMIS`, `LOWEST`, or `HIGHEST`.  Output as a
-///     64-bit IEEE 754 float of the appropriate PSPP value.
-///
-///   - `PCSYSMIS`.  Output as SPSS/PC+ system-missing value.
-///
-///   - The literal `ENDIAN`.  Output as a 32-bit binary integer, either with
-///     value 1 if `--be` is in effect or 2 if `--le` is in effect.
-///
-///   - A pair of parentheses enclosing a sequence of data items, each followed
-///     by a semicolon (the last semicolon is optional).  Output as the enclosed
-///     data items in sequence.
-///
-///   - The literal `COUNT` or `COUNT8` followed by a sequence of parenthesized
-///     data items, as above.  Output as a 32-bit or 8-bit binary integer whose
-///     value is the number of bytes enclosed within the parentheses, followed
-///     by the enclosed data items themselves.
-///
-/// optionally followed by an asterisk and a positive integer, which specifies a
-/// repeat count for the data item.
-#[derive(Parser, Debug)]
-struct Args {
-    /// Big-endian output format (default)
-    #[arg(long = "be")]
-    be: bool,
-
-    /// Little-endian output format
-    #[arg(long = "le")]
-    le: bool,
-
-    /// Input file.
-    #[arg(required = true, name = "input")]
-    input_file_name: PathBuf,
-
-    /// Output file.
-    #[arg(required = true, name = "output")]
-    output_file_name: PathBuf,
-}
-
-fn main() -> Result<()> {
-    let Args {
-        be,
-        le,
-        input_file_name,
-        output_file_name,
-    } = Args::parse();
-    let endian = match (be, le) {
-        (false, false) | (true, false) => Endian::Big,
-        (false, true) => Endian::Little,
-        (true, true) => return Err(anyhow!("can't use both `--be` and `--le`")),
-    };
-
-    let input_file_str = input_file_name.to_string_lossy();
-    let input = read_to_string(&input_file_name)
-        .map_err(|err| anyhow!("{input_file_str}: read failed ({err})"))?;
-
-    let output = sack(&input, Some(&input_file_name), endian)?;
-
-    let output_file_str = output_file_name.to_string_lossy();
-    std::fs::write(&output_file_name, output)
-        .map_err(|err| anyhow!("{output_file_str}: write failed ({err})"))?;
-
-    Ok(())
-}