Commit Graph

152 Commits

Author SHA1 Message Date
sshlien
39d8c4bd78 2026.04.26 2026.04.26 2026-04-26 17:06:50 -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
22ad87cd72 Add GitHub Action to run the CI and output a status badge (#20)
* 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

---------

Co-authored-by: Seymour Shlien <fy733@ncf.ca>
2026-04-22 07:59:28 -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
c94cbbc062 Add configuration for CMake build system alongside autoconf (#17)
- 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)

Co-authored-by: Seymour Shlien <fy733@ncf.ca>
2026-04-22 07:52:10 -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
Seymour Shlien
41264221f4 Merge pull request #15 from hkiel/ansi_functions
ANSI function declarations
2026-04-01 06:56:26 -04:00
sshlien
7ba0b738e9 2026.02.24 2026.02.24 2026-02-24 16:02:26 -05:00
sshlien
b662440d20 2026.02.13 2026.02.13 2026-02-13 11:24:24 -05:00
sshlien
0bbb7519cb 2025.11.26 2025.11.26 2025-11-26 13:10:21 -05:00
Henning Kiel
7b0b1cc77e ANSI function declarations 2025-10-02 15:54:33 +02:00
sshlien
e392893a9a 2025.06.27 2025-06-27 13:20:43 -04:00
sshlien
1089104c37 2025.06.17 2025.06.17 2025.06.27 2025-06-17 09:04:37 -04:00
sshlien
ab7f0622c2 2025.06.14 2025.06.14 2025-06-14 20:45:16 -04:00
sshlien
d486659fdd 2025.02.16 2025.02.16 2025-02-16 20:30:44 -05:00
sshlien
907c8fa19f 2025.02.15 2025.02.15 2025-02-15 20:12:53 -05:00
sshlien
5054b25701 2025.02.07 2025.02.07a 2025-02-07 13:41:40 -05:00
sshlien
835b91dc6f 2025.02.07 2025.02.07 2025-02-07 11:46:14 -05:00
sshlien
ad766b0096 2025.02.02 2025.02.02a 2025-02-02 08:59:06 -05:00
sshlien
7f60c2ec8e 2025.02.02 2025.02.02 2025-02-02 08:46:19 -05:00
sshlien
e42463f39f 2025.01.30 2025.01.30 2025-01-30 13:20:03 -05:00
sshlien
a67babdb21 2025.01.29 2025.01.29 2025-01-29 16:43:42 -05:00
sshlien
abf7e15301 2025.01.22 2025.01.22 2025-01-22 08:14:45 -05:00
sshlien
7c7ef4c2c6 2025.01.20 2025.01.20 2025-01-20 13:40:30 -05:00
sshlien
c85053c4db 2025.01.12 2025.01.12 2025-01-12 12:39:05 -05:00
sshlien
8d5df56596 2025.01.07 2025.01.07 2025-01-07 13:06:04 -05:00
sshlien
659270b0c9 2025.01.04 2025.01.04 2025-01-04 21:01:08 -05:00
sshlien
705d9e1f73 2024.12.22 2024.12.22 2024-12-22 15:30:33 -05:00
sshlien
9b419e0128 2024.12.16 2024.12.16 2024-12-16 19:28:33 -05:00
sshlien
0907fd4941 2024.12.06 2024.12.06 2024-12-06 02:07:32 -05:00
sshlien
09254d8144 2024.10.10 2024.10.10 2024-10-10 13:30:58 -04:00
sshlien
415d770e5e 2024.08.13 2024.08.13 2024-08-13 17:15:38 -04:00
sshlien
31bc3aae7c 2024.08.11 2024.08.11 2024-08-11 17:17:02 -04:00
sshlien
4c571ebe65 2024.07.26 2024.07.26 2024-07-26 16:48:42 -04:00
sshlien
10af1c7b16 2024.06.18 2024.06.18 2024-06-18 16:59:50 -04:00
sshlien
7b8785ce0d 2024.06.12 2024.06.12 2024-06-12 12:43:40 -04:00
sshlien
13c93c3d74 2024.06.09 2024.06.09 2024-06-09 08:52:14 -04:00
sshlien
45bd1a7102 2024.06.03 2024.06.03 2024-06-03 19:34:24 -04:00
sshlien
224930548b 2024.04.30 2024.04.30 2024-05-06 11:06:48 -04:00
sshlien
328d4920c9 2024.03.21 2024.03.21 2024-03-21 13:49:52 -04:00
sshlien
b496ae8d12 2024.03.19 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 2024.03.18 2024-03-13 12:17:06 -04:00
sshlien
5175fc699e 2024.03.05 2024.03.05 2024-03-05 17:31:40 -05:00
sshlien
6db6eb0979 2024.03.02 2024.03.02 2024-03-02 19:10:18 -05:00
sshlien
4d51b779bf 2024.02.25 2024.02.25 2024-02-25 07:53:27 -05:00
sshlien
bf013dc428 2024.02.23 2024.02.23 2024-02-23 14:26:37 -05:00
sshlien
6441b47841 2024.02.22 2024.02.22 2024-02-22 21:08:16 -05:00
sshlien
6a3de68779 2024.02.19 2024.02.19 2024-02-19 12:37:50 -05:00