Commit Graph

96 Commits

Author SHA1 Message Date
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
Seymour Shlien
b3562b0c92 2022.08.24 2022-08-24 13:49:25 -04:00
Seymour Shlien
47181bf504 2022.08.01 2022-08-01 17:17:39 -04:00
Seymour Shlien
e74fd94609 2022.07.22 2022-07-31 12:16:26 -04:00