Commit Graph

99 Commits

Author SHA1 Message Date
Ronan Keryell
ba603c3175 build: lower CMakePresets.json schema to v3 for older cmake compat (#27)
The preset file declared "version": 6 (cmake >= 3.25), causing
"Unrecognized 'version' field" on cmake releases as common as the
3.22.1 shipped by Ubuntu 22.04 LTS.  None of the v4/v5/v6 schema
features are used here -- the file only relies on
configurePresets/buildPresets/testPresets with cacheVariables,
binaryDir, displayName, output.outputOnFailure, and environment.
v3 (cmake >= 3.21) is the lowest schema where "generator" remains
optional so cmake can pick a default; v2 would have required adding
"generator" to every preset.

cmakeMinimumRequired lowered from 3.25 to 3.21 to match.

Verified locally that all three presets (default, debug, sanitize)
configure, build, and pass ctest --preset default (19/19 tests).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 15:14:57 -04:00
Ronan Keryell
1d8d1f621c Unify package version on VERSION file; bump abc2midi to 5.03 (#25)
- abc2midi 5.03 (April 2026): bumped #define VERSION in store.c to reflect this branch's accumulated fixes
(error exit status, missing C:/R:/X: header emission, %%MIDIdef macros allowed anywhere) plus the
build-system additions.
- Single source of truth for the package release date: the VERSION file is now consumed by both build
paths.
  - CMakeLists.txt reads it via file(STRINGS VERSION ABCMIDI_VERSION ...); the previously hard-coded
project(VERSION 2026.02.24) (an unused PROJECT_VERSION) is dropped because the date format isn't
MAJOR.MINOR.PATCH.
  - configure.ac uses m4_esyscmd_s([cat VERSION]) in AC_INIT, replacing the very stale hard-coded
2011-08-03.
  - The two build paths remain independent — no cross-generation between CMake and autoconf.
- Test normalization fix (tests/run_test.cmake): the version-banner regex now requires a capitalized month
and accepts a date with or without a day number. The previous regex was lowercase-permissive and silently
ate PostScript lines like 0.5 setlinewidth 0 0 moveto in yaps output — tests/golden/yaps_coleraine.txt is
regenerated to reflect the now-correctly-preserved PostScript.
- Docs:
  - doc/CHANGES: April 25 2026 entry covering the version bump and VERSION-file unification.
  - doc/readme.txt: per-tool listing updated (abc2midi 5.03 April 2026, midistats 1.03 February 20 2026
synced to source).
  - doc/abc2midi.1: header label bumped to 5.03 April 2026 (content not audited).
  - README.md: new Maintainers / releasing section documenting the release procedure, including the
requirement to run autoreconf -f so the committed configure picks up the new AC_INIT arguments.
2026-04-27 21:13:26 -04:00
Ronan Keryell
6ecbbde0fd abc2midi: allow %%MIDIdef macros to be defined anywhere (#23)
* abc2midi: allow %%MIDIdef macros to be defined anywhere

Fix also some lost CHANGES from previous commit.

abc2midi: allow %%MIDIdef macros to be defined anywhere, including before the first X: field (outside any tune). Previously %%MIDIdef was only handled inside event_specific() after the started_parsing check,so macros defined in the file header were silently ignored.
The %%MIDIdef handling has been moved before the started_parsing check in event_specific() in store.c since macro definitions are context-independent.

* Update the golden test files since X:, R: and C: are now emitted
2026-04-23 09:21:48 -04:00
Ronan Keryell
ce70bc4d4e Add missing C: (composer), R: (rhythm) and X: fields and return error (#21)
* Add configuration for CMake build system alongside autoconf

- Add a modern CMake build system (`CMakeLists.txt`, `CMakePresets.json`) that coexists with the legacy
autoconf/Makefile build
- Shared source files (`midifile.c`, `parseabc.c`, `music_utils.c`, `parser2.c`) are compiled once via OBJECT
libraries and linked into the 8 binaries
- Three presets: `default` (Release), `debug`, `sanitize` (ASan + UBSan)
- Generates `compile_commands.json` for clangd/LSP editor support
- Install rules match the legacy Makefile (binaries, doc files, man pages)
- Pinned to `-std=gnu89` because the codebase mixes K&R `()` and ANSI typed prototypes — in C23/gnu23 (GCC 15+
default), `()` means `(void)`, making these a hard error. Note: **the existing autoconf build is also broken with
GCC 15** for the same reason

```sh
cmake --preset debug
cmake --build --preset debug
cmake --install build/debug --prefix /usr/local

Documentation

- README.md: added Building section with both autoconf and CMake instructions
- doc/readme.txt: added build instructions in the existing preamble
- doc/CHANGES: added changelog entry

Test plan

- All 3 presets configure and build with GCC 15
- Smoke test: abc2midi samples/coleraine.abc produces valid MIDI through mftext
- Sanitizer build (--preset sanitize) runs clean on sample files
- Install layout verified: 8 binaries, 10 doc files, 8 man pages in correct paths
- Build on macOS (untested, should work with AppleClang)

* Implement basic testing infrastructure

The CMake build includes a test suite covering all 8 programs:

- **Smoke tests** verify each binary runs cleanly with `-ver`.
- **Golden-file tests** run each program on a sample input and compare the
  (normalized) output to a checked-in reference. Binary MIDI outputs are
  piped through `mftext` to produce diffable text. Volatile lines (version
  banners, dates, temporary paths) are stripped before comparison.

```sh
ctest --preset debug

ctest --preset debug -L golden
ctest --preset debug -L smoke
```

To regenerate the golden files after an intentional behavioural change,
review the diff, then commit:

```sh
cmake --build build/debug --target update-golden
git diff tests/golden/
```

* Factorize more the test CMake code

* Add GitHub Action to run the CI and output a status badge

* Add GitHub Action workflow dispatch to allow running from the UI

* Now abc2midi exits 1 if an error occurs

Before it was always returning 0, hiding failures complicated to track in
complex build systems.

* Output missing C:, R: and X: headers as MIDI text meta-events

* Update changelog and comments

---------

Co-authored-by: Seymour Shlien <fy733@ncf.ca>
2026-04-22 07:58:22 -04:00
Ronan Keryell
1d766a85d2 Implement basic testing infrastructure (#19)
* Add configuration for CMake build system alongside autoconf

- Add a modern CMake build system (`CMakeLists.txt`, `CMakePresets.json`) that coexists with the legacy
autoconf/Makefile build
- Shared source files (`midifile.c`, `parseabc.c`, `music_utils.c`, `parser2.c`) are compiled once via OBJECT
libraries and linked into the 8 binaries
- Three presets: `default` (Release), `debug`, `sanitize` (ASan + UBSan)
- Generates `compile_commands.json` for clangd/LSP editor support
- Install rules match the legacy Makefile (binaries, doc files, man pages)
- Pinned to `-std=gnu89` because the codebase mixes K&R `()` and ANSI typed prototypes — in C23/gnu23 (GCC 15+
default), `()` means `(void)`, making these a hard error. Note: **the existing autoconf build is also broken with
GCC 15** for the same reason

```sh
cmake --preset debug
cmake --build --preset debug
cmake --install build/debug --prefix /usr/local

Documentation

- README.md: added Building section with both autoconf and CMake instructions
- doc/readme.txt: added build instructions in the existing preamble
- doc/CHANGES: added changelog entry

Test plan

- All 3 presets configure and build with GCC 15
- Smoke test: abc2midi samples/coleraine.abc produces valid MIDI through mftext
- Sanitizer build (--preset sanitize) runs clean on sample files
- Install layout verified: 8 binaries, 10 doc files, 8 man pages in correct paths
- Build on macOS (untested, should work with AppleClang)

* Implement basic testing infrastructure

The CMake build includes a test suite covering all 8 programs:

- **Smoke tests** verify each binary runs cleanly with `-ver`.
- **Golden-file tests** run each program on a sample input and compare the
  (normalized) output to a checked-in reference. Binary MIDI outputs are
  piped through `mftext` to produce diffable text. Volatile lines (version
  banners, dates, temporary paths) are stripped before comparison.

```sh
ctest --preset debug

ctest --preset debug -L golden
ctest --preset debug -L smoke
```

To regenerate the golden files after an intentional behavioural change,
review the diff, then commit:

```sh
cmake --build build/debug --target update-golden
git diff tests/golden/
```

* Factorize more the test CMake code
2026-04-22 07:42:29 -04:00
Ronan Keryell
c7f4015945 Add -PMAR option to emit MIDI marker meta-events for P: part labels (#16)
* Add -PMAR option to output `P:` information as MIDI part meta-event

* Update man page and comments

* Add the instance number of a part like `Part T-4`

This allows better tracking of parts played more than once with complex `P:`
header.

* Updated CHANGES file and added author change comments in the code
2026-04-01 07:12:55 -04:00
sshlien
7ba0b738e9 2026.02.24 2026-02-24 16:02:26 -05:00
sshlien
b662440d20 2026.02.13 2026-02-13 11:24:24 -05:00
sshlien
d486659fdd 2025.02.16 2025-02-16 20:30:44 -05:00
sshlien
907c8fa19f 2025.02.15 2025-02-15 20:12:53 -05:00
sshlien
7f60c2ec8e 2025.02.02 2025-02-02 08:46:19 -05:00
sshlien
abf7e15301 2025.01.22 2025-01-22 08:14:45 -05:00
sshlien
7c7ef4c2c6 2025.01.20 2025-01-20 13:40:30 -05:00
sshlien
c85053c4db 2025.01.12 2025-01-12 12:39:05 -05:00
sshlien
8d5df56596 2025.01.07 2025-01-07 13:06:04 -05:00
sshlien
659270b0c9 2025.01.04 2025-01-04 21:01:08 -05:00
sshlien
705d9e1f73 2024.12.22 2024-12-22 15:30:33 -05:00
sshlien
9b419e0128 2024.12.16 2024-12-16 19:28:33 -05:00
sshlien
0907fd4941 2024.12.06 2024-12-06 02:07:32 -05:00
sshlien
415d770e5e 2024.08.13 2024-08-13 17:15:38 -04:00
sshlien
7b8785ce0d 2024.06.12 2024-06-12 12:43:40 -04:00
sshlien
224930548b 2024.04.30 2024-05-06 11:06:48 -04:00
sshlien
6db6eb0979 2024.03.02 2024-03-02 19:10:18 -05:00
sshlien
4d51b779bf 2024.02.25 2024-02-25 07:53:27 -05:00
sshlien
bf013dc428 2024.02.23 2024-02-23 14:26:37 -05:00
sshlien
6441b47841 2024.02.22 2024-02-22 21:08:16 -05:00
sshlien
6a3de68779 2024.02.19 2024-02-19 12:37:50 -05:00
sshlien
c4c489d111 2024.02.14 2024-02-14 13:49:35 -05:00
sshlien
79e7ac2d97 2024.01.15 2024-01-15 17:22:56 -05:00
sshlien
b3d18d9722 2023.12.28 2023-12-28 14:57:49 -05:00
sshlien
9fa917b1bd 2023.12.23 2023-12-23 17:06:59 -05:00
sshlien
0dd1e063ae 2023.12.17 2023-12-17 08:46:38 -05:00
sshlien
d93cb473dc 2023.11.08 2023-11-08 10:57:05 -05:00
sshlien
4e0266179b 2023.10.25 2023-10-25 19:43:27 -04:00
sshlien
3f405a1aba 2023.08.22 2023-08-22 09:21:59 -04:00
sshlien
5534c8935d 2023.06.25 2023-06-25 14:17:21 -04:00
Seymour Shlien
afe323d8b7 2023.05.30 2023-05-30 09:22:17 -04:00
Seymour Shlien
5202b73bac 2022.02.08 2023-02-08 13:00:26 -05:00
Seymour Shlien
c01220de2d 2023.02.07 2023-02-07 09:34:58 -05:00
Seymour Shlien
a9e10a7229 2022.01.22 2023-01-22 06:58:58 -05:00
Seymour Shlien
ea71f7963b 2023.01.10 2023-01-10 13:26:52 -05:00
Seymour Shlien
d73b3682e1 2023.01.08 2023-01-08 11:10:49 -05:00
Seymour Shlien
c981535a2a 2023.01.06 2023-01-06 14:22:28 -05:00
Seymour Shlien
7fae7302c3 2022.01.05 2023-01-05 15:53:13 -05:00
Seymour Shlien
166a28d182 2022.12.30 2022-12-30 11:08:38 -05:00
Seymour Shlien
cc1a30b3b4 2022.12.27 2022-12-27 15:22:18 -05:00
Seymour Shlien
2baecffc37 2022.12.22 2022-12-22 12:08:00 -05:00
Seymour Shlien
c24f1ffdc1 2022.12.09 2022-12-09 13:31:50 -05:00
Seymour Shlien
80e8dbf505 2022.12.07 2022-12-07 16:50:19 -05:00
Seymour Shlien
13b922827d 2022.09.01 2022-09-01 14:06:21 -04:00