129 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
0bbb7519cb 2025.11.26 2025-11-26 13:10:21 -05:00
sshlien
e392893a9a 2025.06.27 2025-06-27 13:20:43 -04:00
sshlien
1089104c37 2025.06.17 2025-06-17 09:04:37 -04: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
835b91dc6f 2025.02.07 2025-02-07 11:46:14 -05:00
sshlien
7f60c2ec8e 2025.02.02 2025-02-02 08:46:19 -05:00
sshlien
e42463f39f 2025.01.30 2025-01-30 13:20:03 -05:00
sshlien
a67babdb21 2025.01.29 2025-01-29 16:43:42 -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
31bc3aae7c 2024.08.11 2024-08-11 17:17:02 -04:00
sshlien
4c571ebe65 2024.07.26 2024-07-26 16:48:42 -04:00
sshlien
10af1c7b16 2024.06.18 2024-06-18 16:59:50 -04:00
sshlien
7b8785ce0d 2024.06.12 2024-06-12 12:43:40 -04:00
sshlien
13c93c3d74 2024.06.09 2024-06-09 08:52:14 -04:00
sshlien
45bd1a7102 2024.06.03 2024-06-03 19:34:24 -04:00
sshlien
224930548b 2024.04.30 2024-05-06 11:06:48 -04:00
sshlien
328d4920c9 2024.03.21 2024-03-21 13:49:52 -04:00
sshlien
b496ae8d12 2024.03.19 2024-03-19 19:58:41 -04:00
sshlien
cb0a6541f2 2024.03.18 2024-03-18 15:24:12 -04:00
sshlien
34f6ef01e2 2024.03.13 2024-03-13 12:17:06 -04:00
sshlien
5175fc699e 2024.03.05 2024-03-05 17:31:40 -05: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
b9c48dc778 2024.02.11 2024-02-11 13:59:25 -05:00
sshlien
79e7ac2d97 2024.01.15 2024-01-15 17:22:56 -05:00
sshlien
ad41b9b053 2024.01.02 2024-01-03 09:41:14 -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