From bc20b423c8374c825a116e2a0727b83dce1e7641 Mon Sep 17 00:00:00 2001 From: Yoav Nir Date: Thu, 30 Jan 2025 19:25:08 +0200 Subject: [PATCH 1/3] Start work on 0.9.5-hf1 --- .github/workflows/c-cpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 64e3024..0d96926 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -2,9 +2,9 @@ name: C/C++ CI on: push: - branches: [ dev, stable, dev-0.9.2, dev-0.9.3, dev-0.9.4, dev-0.9.5, dev-0.9.9, dev-1.0.0] + branches: [ dev, stable, dev-0.9.2, dev-0.9.3, dev-0.9.4, dev-0.9.5, dev-0.9.5-hf1, dev-0.9.9, dev-1.0.0] pull_request: - branches: [ dev, stable, dev-0.9.2, dev-0.9.3, dev-0.9.4, dev-0.9.5, dev-0.9.9, dev-1.0.0] + branches: [ dev, stable, dev-0.9.2, dev-0.9.3, dev-0.9.4, dev-0.9.5, dev-0.9.5-hf1, dev-0.9.9, dev-1.0.0] jobs: build: From 442e22a9a786c765186548fe565e50f9ebee4de4 Mon Sep 17 00:00:00 2001 From: Yoav Nir Date: Thu, 30 Jan 2025 19:26:38 +0200 Subject: [PATCH 2/3] Issue #277 - Fix implementation of RECNO/NUMBER keyword --- README.md | 16 ++++++++-------- manpage | 2 +- specs/src/specitems/InputPart.cc | 2 +- specs/src/test/ProcessingTest.cc | 5 +++++ specs/tests/valgrind_unit_tests.py | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1f50469..bb30cb5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ This version is liberally based on the [**CMS Pipelines User's Guide and Referen News ==== +03-Jan-2025: Version 0.9.5-HF1 is here +What's new: + * Fixes a bug where `RECNO` within a loop returned the number of iterations of the loop rather than the numbers of records read. + +NOTE: This is a non-backwards-compatible change. + + 29-Dec-2024: Version 0.9.5 is here What's New: * The `exact()` function prototype for compatibility. @@ -22,13 +29,6 @@ What's New: * A new `--progress` command-line switch to allow the user to monitor progress in reading records. * Bug fixes -10-May-2024: Version 0.9.2 is here -What's New: -* An unthreaded mode of operation -* Compound `SET` statements -* Reduced necessity of quoting complex conditions for `if` and `while` -* Bug fixes - Sources ======= @@ -40,7 +40,7 @@ Building ======== If you have downloaded a git repository, first make sure to check out a stable tag such as v0.9.5: ``` -git checkout v0.9.5 +git checkout dev-0.9.5-hf1 ``` A simple way to get the latest stable release is to check out the `stable` branch and rebase to its tip: ``` diff --git a/manpage b/manpage index 175d74b..38af063 100644 --- a/manpage +++ b/manpage @@ -1,7 +1,7 @@ .\" Manpage for specs. .\" Open an issue at https://github.com/yoavnir/specs2016 to correct errors or typos .mso www.tmac -.TH man 1 "1 Jan 2025" "0.9.5" "specs man page" +.TH man 1 "1 Jan 2025" "0.9.5-HF1" "specs man page" .SH NAME specs \- a text processing tool .SH SYNOPSIS diff --git a/specs/src/specitems/InputPart.cc b/specs/src/specitems/InputPart.cc index 89fbd50..11b74ec 100644 --- a/specs/src/specitems/InputPart.cc +++ b/specs/src/specitems/InputPart.cc @@ -142,7 +142,7 @@ std::string NumberPart::Debug() PSpecString NumberPart::getStr(ProcessingState& pState) { - std::string s = std::to_string(++m_Num); + std::string s = std::to_string(pState.getRecordCount()); s = std::string(NUMBER_PART_FIELD_LEN - s.length(), ' ') + s; return std::make_shared(s); } diff --git a/specs/src/test/ProcessingTest.cc b/specs/src/test/ProcessingTest.cc index 3610ec7..e624a9f 100644 --- a/specs/src/test/ProcessingTest.cc +++ b/specs/src/test/ProcessingTest.cc @@ -741,6 +741,11 @@ int main(int argc, char** argv) spec = "SUBSTR WS / WORD 3 of FS i FIELD 2"; VERIFY2(spec, "The Epic: 1/Jan/1970 at midnight", "1970 at m"); // Test #186 + // RECNO - Issue #277 + spec = "WORD 1 a: IF a%2==0 THEN RECNO 1"; + VERIFY2(spec, "1\n2\n3\n4\n5", " 2\n 4"); // Test #187 + + if (errorCount) { std::cout << '\n' << errorCount << '/' << testCount << " tests failed.\n"; std::cout << "Failed tests: "; diff --git a/specs/tests/valgrind_unit_tests.py b/specs/tests/valgrind_unit_tests.py index c5136a8..f47334d 100644 --- a/specs/tests/valgrind_unit_tests.py +++ b/specs/tests/valgrind_unit_tests.py @@ -1,7 +1,7 @@ import sys, memcheck, argparse count_ALU_tests = 749 -count_processing_tests = 186 +count_processing_tests = 187 count_token_tests = 17 # Parse the one command line options From 6d8596e80d7d34ade6278a8d375fc07eceebd77c Mon Sep 17 00:00:00 2001 From: Yoav Nir Date: Sat, 1 Feb 2025 23:59:22 +0200 Subject: [PATCH 3/3] Issue 277 - remove superfluous member --- specs/src/specitems/item.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/specs/src/specitems/item.h b/specs/src/specitems/item.h index 35e97e4..acd76d6 100644 --- a/specs/src/specitems/item.h +++ b/specs/src/specitems/item.h @@ -101,13 +101,11 @@ typedef std::shared_ptr PSubstringPart; #define CLOCKDIFF_PART_FIELD_LEN 12 class NumberPart : public InputPart { public: - NumberPart() {m_Num = 0;} - virtual ~NumberPart() {} + NumberPart() {} virtual std::string Debug(); virtual PSpecString getStr(ProcessingState& pState); virtual bool readsLines() {return true;} private: - unsigned long m_Num; }; typedef std::shared_ptr PNumberPart;