From 224930548bde2ba5e6e18ba19eb3ea7708e050fe Mon Sep 17 00:00:00 2001 From: sshlien Date: Mon, 6 May 2024 11:06:48 -0400 Subject: [PATCH] 2024.04.30 --- VERSION | 2 +- doc/CHANGES | 19 ++++++++++ doc/abcguide.txt | 7 ++-- doc/readme.txt | 8 ++--- matchsup.c | 4 ++- parseabc.c | 2 +- parseabc.h | 6 ++-- parser2.c | 92 +++++++----------------------------------------- store.c | 67 ++++++++++------------------------- toabc.c | 13 ++++--- yapstree.c | 7 ++-- 11 files changed, 79 insertions(+), 148 deletions(-) mode change 100644 => 100755 matchsup.c mode change 100644 => 100755 parseabc.c mode change 100644 => 100755 parseabc.h mode change 100644 => 100755 parser2.c mode change 100644 => 100755 store.c mode change 100644 => 100755 toabc.c mode change 100644 => 100755 yapstree.c diff --git a/VERSION b/VERSION index 4ccabc4..d4d48b5 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -March 21 2024 +April 30 2024 diff --git a/doc/CHANGES b/doc/CHANGES index 1b71f87..9a8e2f7 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -15450,3 +15450,22 @@ d8 |\ [V:1 transpose=0] d8 |] +April 30 2024 + +According to the abc standards 2.1 and 2.2 the %% (pseudo comment) +and the I: (stylesheet directive) should access the same functionality +in the same way. Thus if +%%MIDI program 10 +should appear in an I: command as I:MIDI program 10 and not as +I:MIDI= program 10. James Allwright has updated abcMIDI C code +to comply with the standards. If you need to run some of the older +abc files that do not obey this standard and you do not want +to edit these files, then you should use an older version of +the abcMIDI package. + +The following files were updated: matchsup.c, parseabc.h, pareseabc.c +parser2.c, store.c, toabc.c. and yapstree.c. Look for the comments +[JA] 2024-04-30. + + + diff --git a/doc/abcguide.txt b/doc/abcguide.txt index 392caeb..38a69e9 100644 --- a/doc/abcguide.txt +++ b/doc/abcguide.txt @@ -3,6 +3,9 @@ Guide to writing abc for abc2midi - minor revision [JA] 2021-05-24 Updated June 1 2017. %%MIDI program ranges from 0 to 127 not 1 to 128. +Updated April 30 2024: The [I:MIDI= ..] no longer works. You +must use [I:MIDI ...] instead (without the equal sign). + The abc notation language is described by the version 1.6 specification document and later modifications to this document referred to as version 2.1 and version 2.2. These can be found at abcnotation.com . @@ -1244,12 +1247,12 @@ C2 D2| you can place the MIDI instruction inside an info field using the following syntax. -A2 B2|[I:MIDI= drumon] C2 D2| +A2 B2|[I:MIDI drumon] C2 D2| The '=' following the MIDI is very important. The info field syntax allows you to place several MIDI commands in one inline block, for example -[I: MIDI = program 73 MIDI=chordprog 29] +[I: MIDI program 73 MIDI chordprog 29] (Spaces are optional.) Other examples can be seen in the file CHANGES in the following the March 25 2005 entry. diff --git a/doc/readme.txt b/doc/readme.txt index cd6dc02..ada3013 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,9 +1,9 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.59 February 08 2023 -abc2midi version 4.91 March 02 2024 -abc2abc version 2.21 February 19 2024 -yaps version 1.93 February 19 2024 +abc2midi version 4.92 April 30 2024 +abc2abc version 2.22 April 30 2024 +yaps version 1.94 April 30 2024 abcmatch version 1.83 February 19 2024 midicopy version 1.39 November 08 2022 midistats version 0.91 March 21 2024 @@ -14,7 +14,7 @@ jamesallwright@yahoo.co.uk University of Westminster, London, UK -August 2023 +May 2024 Copyright Seymour Shlien fy733@ncf.ca Ottawa, Canada diff --git a/matchsup.c b/matchsup.c old mode 100644 new mode 100755 index 7a14b87..a4dfff3 --- a/matchsup.c +++ b/matchsup.c @@ -422,8 +422,10 @@ char *s; } -void event_specific (package, s) +/* [JA] 2024-04-30 added in_I argument */ +void event_specific (package, s, in_I) char *package, *s; +int in_I; { } diff --git a/parseabc.c b/parseabc.c old mode 100644 new mode 100755 index fccd682..0d15e11 --- a/parseabc.c +++ b/parseabc.c @@ -2100,7 +2100,7 @@ parse_precomment (s) { p = s + 1; readstr (package, &p, 40); - event_specific (package, p); + event_specific (package, p, 0); /* [JA] 2024-04-30 */ } else { diff --git a/parseabc.h b/parseabc.h old mode 100644 new mode 100755 index 60daba2..6c495b8 --- a/parseabc.h +++ b/parseabc.h @@ -116,7 +116,7 @@ extern void event_startmusicline(void); extern void event_endmusicline(char endchar); extern void event_eof(void); extern void event_comment(char *s); -extern void event_specific(char *package, char *s); +extern void event_specific(char *package, char *s, int in_I); extern void event_specific_in_header(char *package, char *s); extern void event_startinline(void); extern void event_closeinline(void); @@ -133,7 +133,7 @@ extern void event_refno(int n); extern void event_tempo(int n, int a, int b, int rel, char *pre, char *post); extern void event_timesig(timesig_details_t *timesig); extern void event_octave(int num, int local); -extern void event_info_key(char *key, char *value); +/* extern void event_info_key(char *key, char *value); [JA] 2024-04-30 */ extern void event_info(char *s); extern void event_key(int sharps, char *s, int modeindex, char modmap[7], int modmul[7], struct fraction modmicro[7], @@ -203,7 +203,7 @@ extern void event_refno(); extern void event_tempo(); extern void event_timesig(); extern void event_octave(); -extern void event_info_key(); +/* extern void event_info_key(); [JA] 2024-04-30 */ extern void event_info(); extern void event_key(); extern void event_microtone(); diff --git a/parser2.c b/parser2.c old mode 100644 new mode 100755 index cb44dd8..3beb5d9 --- a/parser2.c +++ b/parser2.c @@ -9,89 +9,21 @@ #include "parseabc.h" #include "parser2.h" -void event_info(s) -char* s; -/* An I: field has been encountered. This routine scans the following - text to extract items of the form key=value. The equal sign is optional - if only one key (eg MIDI, octave, vol, etc.) occurs in the I: field. - Otherwise we need to follow each key with an equal sign so that we - know that the preceding item was a key. +/* [JA] 2024-04-30 */ +void event_info(char* s) +/* An I: field has been encountered. The 2.1 and 2.2 abc standards + specify that this field (stylesheet directive) is handled in the + same way as %% (pseudo-comment). If it isn't recognized it should + be silently ignored. */ { - char* key; - char* endkey; - char* value; - char* endvalue; - char* lastendvalue; - char* newword; - char* lastnewword; - char* ptr; - int doval; + char package[40]; + char *p; - ptr = s; - doval = 0; - while (*ptr != '\0') { - if (doval == 0) { - /* look for key */ - skipspace(&ptr); - key = ptr; - while ((*ptr != '\0') && (*ptr != ' ') && (*ptr != '=')) { - ptr = ptr + 1; - }; - endkey = ptr; - skipspace(&ptr); - if (*ptr == '=') { - doval = 1; - ptr = ptr + 1; - skipspace(&ptr); - value = ptr; - newword = ptr; - endvalue = NULL; - lastendvalue = NULL; - } else { - /* [SS] 2015-09-08 */ - /* assume only one I: key occurs; grab the rest in value */ - *endkey = '\0'; /* end the key ptr */ - value = ptr; /* start the value ptr here */ - event_info_key(key,value); - return; - }; - } else { - /* look for value */ - skipspace(&ptr); - while ((*ptr != '\0') && (*ptr != ' ') && (*ptr != '=')) { - ptr = ptr + 1; - }; - lastendvalue = endvalue; - endvalue = ptr; - skipspace(&ptr); - lastnewword = newword; - newword = ptr; - if (*ptr == '\0') { - *endkey = '\0'; - *endvalue = '\0'; - event_info_key(key, value); - } else { - if (*ptr == '=') { - *endkey = '\0'; - if (lastendvalue == NULL) { - event_error("missing key or value in I: field"); - } else { - *lastendvalue = '\0'; - event_info_key(key, value); - }; - key = lastnewword; - endkey = endvalue; - doval = 1; - ptr = ptr + 1; - skipspace(&ptr); - value = ptr; - endvalue = NULL; - lastendvalue = NULL; - }; - }; - }; - }; + p = s; + skipspace(&p); + readstr (package, &p, 40); + event_specific (package, p, 1); } diff --git a/store.c b/store.c old mode 100644 new mode 100755 index 6b43d43..6f8e683 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.91 March 02 2024 abc2midi" +#define VERSION "4.92 April 30 2024 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -1936,6 +1936,11 @@ char *s; skipspace(&p); readstr(command, &p, 40); + if (s[0] == '=') { + event_warning("Do not use MIDI= in I: command. Just use MIDI"); + done = 0; + } /*[SS] 2024.04.30 */ + if (strcmp(command, "channel") == 0) { skipspace(&p); ch = readnump(&p) - 1; @@ -2362,10 +2367,9 @@ char *s; }; } - -void event_specific(package, s) /* package-specific command found i.e. %%NAME */ -char *package, *s; +/* [JA] 2024.04.30 introducing in_I */ +void event_specific(char *package, char *s, int in_I) { char msg[200], command[40]; char *p; @@ -2386,7 +2390,6 @@ char *package, *s; process_midix(s); } - if (strcmp(package, "MIDI") == 0) event_midi(s); else { @@ -2507,7 +2510,6 @@ char *package, *s; } #endif - event_comment(msg); } } } @@ -3148,38 +3150,7 @@ int local; }; } -void event_info_key(key, value) -char* key; -char* value; -{ - int num; - char midicmd[64]; - char errmsg[80]; - - if (strcmp(key, "octave")==0) { - num = readsnumf(value); - event_octave(num,0); - }; - /* [SS] 2015-06-02 */ - if (strcmp(key, "MIDI") == 0 || strcmp(key, "MIDIx") == 0 ) - event_specific(key, value); - - else if(strcmp(key, "volinc") == 0 || strcmp(key,"vol") == 0) - { - midicmd[0] = 0; - strcat(midicmd, key); - strcat(midicmd, " "); - strcat(midicmd, value); - event_specific("MIDI",midicmd); - } - else if (is_abcm2ps_option (key)) return; - - else { - /* [KG] 2022-01-13 stack overflow */ - snprintf(errmsg, 80, "I: key \' %s\' not recognized", key); - if (quiet == -1 && silent == 0) event_error(errmsg); /* [SS] 2018-04-01 */ - } -} +/* deleted event_info_key(key,value) [JA] 2024-04-30 */ static void stack_broken(v) /* store away broken rhythm context on encountering grace notes */ @@ -4618,42 +4589,42 @@ char* s; /* add nofnop ... */ if (nofnop == 0) { if (strcmp(p, "ppp") == 0) { - event_specific("MIDI", "beat 30 20 10 1"); + event_specific("MIDI", "beat 30 20 10 1", 0); /* [JA] 2024-04-30 and etc */ done = 1; }; if (strcmp(p, "pp") == 0) { - event_specific("MIDI", "beat 45 35 20 1"); + event_specific("MIDI", "beat 45 35 20 1", 0); done = 1; }; if (strcmp(p, "p") == 0) { - event_specific("MIDI", "beat 60 50 35 1"); + event_specific("MIDI", "beat 60 50 35 1", 0); done = 1; }; if (strcmp(p, "mp") == 0) { - event_specific("MIDI", "beat 75 65 50 1"); + event_specific("MIDI", "beat 75 65 50 1", 0); done = 1; }; if (strcmp(p, "mf") == 0) { - event_specific("MIDI", "beat 90 80 65 1"); + event_specific("MIDI", "beat 90 80 65 1", 0); done = 1; }; if (strcmp(p, "f") == 0) { - event_specific("MIDI", "beat 105 95 80 1"); + event_specific("MIDI", "beat 105 95 80 1", 0); done = 1; }; if (strcmp(p, "ff") == 0) { - event_specific("MIDI", "beat 120 110 95 1"); + event_specific("MIDI", "beat 120 110 95 1", 0); done = 1; }; if (strcmp(p, "fff") == 0) { - event_specific("MIDI", "beat 127 125 110 1"); + event_specific("MIDI", "beat 127 125 110 1", 0); done = 1; }; if ((strcmp(p,"crescendo(") == 0) || (strcmp(p,"<(") == 0) || (strcmp(p,"crescendo)") == 0) || (strcmp(p,"<)") == 0)) { sprintf(midimsg,"beatmod %d",velocitychange); - event_specific("MIDI", midimsg); + event_specific("MIDI", midimsg, 0); /* [JA] 2024-04-30 */ done = 1; } @@ -4661,7 +4632,7 @@ if (nofnop == 0) { (strcmp(p,"diminuendo)") == 0) || (strcmp(p,">)") == 0) || (strcmp(p,"diminuendo(") == 0) || (strcmp(p,">(") == 0)) { sprintf(midimsg,"beatmod -%d",velocitychange); - event_specific("MIDI", midimsg); + event_specific("MIDI", midimsg, 0); done = 1; } diff --git a/toabc.c b/toabc.c old mode 100644 new mode 100755 index 19098c2..02ca992 --- a/toabc.c +++ b/toabc.c @@ -21,7 +21,7 @@ /* back-end for outputting (possibly modified) abc */ -#define VERSION "2.21 Feb 19 2024 abc2abc" +#define VERSION "2.22 April 30 2024 abc2abc" /* for Microsoft Visual C++ 6.0 or higher */ #ifdef _MSC_VER @@ -908,13 +908,18 @@ char *s; inmusic = 0; } -void event_specific(package, s) -char *package, *s; +/* [JA] 2024-04-30 */ +void event_specific(char *package, char *s, int in_I) { char command[40]; int ch; char *p; - emit_string("%%"); + + if (in_I) { /* [JA] 2024-04-30 */ + emit_string("I:"); + } else { + emit_string("%%"); + } emit_string(package); emit_string(s); inmusic = 0; diff --git a/yapstree.c b/yapstree.c old mode 100644 new mode 100755 index 5372a21..febc353 --- a/yapstree.c +++ b/yapstree.c @@ -22,7 +22,7 @@ /* yapstree.c - back-end for abc parser. */ /* generates a data structure suitable for typeset music */ -#define VERSION "1.93 February 19 2024 yaps" +#define VERSION "1.94 April 30 2024 yaps" #include #ifdef USE_INDEX #define strchr index @@ -1525,9 +1525,8 @@ int make_open() return(1); } -void event_specific(p, str) -char *p; /* first word after %% */ -char *str; /* string following first word */ +/* [JA] 2024-04-30 introducing in_I */ +void event_specific(char *p, char *str, int in_I) /* The special comment %% has been found */ /* abc2midi uses it for the %%MIDI commands */ /* yaps implements some of the abc2ps commands */