Commit Graph

71 Commits

Author SHA1 Message Date
sshlien
39d8c4bd78 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
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
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
Henning Kiel
7b0b1cc77e ANSI function declarations 2025-10-02 15:54:33 +02: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
ad766b0096 2025.02.02 2025-02-02 08:59:06 -05:00
sshlien
7f60c2ec8e 2025.02.02 2025-02-02 08:46:19 -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
09254d8144 2024.10.10 2024-10-10 13:30:58 -04: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
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
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
9fa917b1bd 2023.12.23 2023-12-23 17:06:59 -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
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
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
Seymour Shlien
ff3200286b 2022.06.14 2022-06-14 14:46:35 -04:00
Seymour Shlien
2b697536dc 2022.05.20 2022-05-20 16:25:40 -04:00
Seymour Shlien
181f2022f3 2022.04.27 2022-04-28 09:51:13 -04:00
Seymour Shlien
47a0cecc5d 2022.03.20 2022-03-21 08:39:17 -04:00
Seymour Shlien
eaf451d6ad 2022.02.21 2022-02-21 17:13:57 -05:00
Seymour Shlien
cded63b590 2022.02.18 2022-02-18 12:33:35 -05:00
Seymour Shlien
57a5ae2ba7 2022.02.13 2022-02-13 14:33:57 -05:00
Seymour Shlien
0b83ee2c7b 2022.01.27 2022-01-27 12:46:08 -05:00
Seymour Shlien
fb5479e801 2022.01.13 2022-01-13 18:08:38 -05:00
Seymour Shlien
402f1ba212 2021.12.12 2021-12-12 15:59:49 -05:00
Seymour Shlien
3e1306aa26 2021.12.10 2021-12-10 12:08:42 -05:00
Seymour Shlien
e9c2aee88b 2021.10.11 2021-10-12 09:09:45 -04:00
Seymour Shlien
c9d2c0f33b 2021.09.15 2021-09-15 16:25:29 -04:00
Seymour Shlien
19fbb6b7e7 2021.06.27 2021-06-27 17:09:51 -04:00