diff --git a/NOTICE b/NOTICE index 6c94c50..d2767f8 100644 --- a/NOTICE +++ b/NOTICE @@ -1,7 +1,7 @@ PHILIP'S MUSIC WRITER --------------------- -Copyright (c) 2003 - 2021 Philip Hazel +Copyright (c) 2003 - 2022 Philip Hazel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/README b/README index 73a0229..6eba9e9 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ Copyright (c) 2022 Philip Hazel DISCUSSION GROUP ---------------- -There is a Google group mailing list for discussion of PMW issues. You can +There is a Google group mailing list for discussion of PMW issues. You can access the archives and also subscribe or manage your subscription here: https://groups.google.com/g/pmw_music diff --git a/doc/ChangeLog b/doc/ChangeLog index 26790aa..c1d5d1e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Change Log for Philip's Music Writer (Linux/Unix version) --------------------------------------------------------- -Version 5.10 xx-xxxx-2022 +Version 5.10 08-June-2022 ------------------------- 1. Fixed an obscure spacing infelicity when, after an item such as a time @@ -30,24 +30,24 @@ mark instead of an implied [name] argument. 9. Arrange for vertical stave name strings on a single stave (those with /v but not /m) to have their midpoint aligned with the centre of the stave. -10. Reduce severity of "Unexpected end of slur or line" error so that output is +10. Reduce severity of "Unexpected end of slur or line" error so that output is still generated. 11. Fixed a bad spacing bug that happened when a bar on a stave other than the first contained [reset] and the notes before [reset] were shorter than the bar length. -12. Bad MIDI was generated if a note's pitch was outside the range supported by +12. Bad MIDI was generated if a note's pitch was outside the range supported by MIDI. It now gives an error and ignores such notes. -13. Added check for absolute pitch (after transposition) being within the +13. Added check for absolute pitch (after transposition) being within the supported range. Hard error if not. 14. Added the SystemSeparator directive to support system separators. 15. Extended RepeatStyle to allow for "wings". -16. Implemented 10 additional text sizes that cannot be changed, but can be +16. Implemented 10 additional text sizes that cannot be changed, but can be accessed by /S instead of /s. This is for the benefit of "standard" macros. 17. Added /fbu for figured bass text at the underlay level. @@ -58,25 +58,25 @@ caused underlay/overlay that was not preceded nor followed by any notes in the bar to be positioned at the stave level instead of a default above/below position. -19. The "undef" condition was not working if the macro name being tested began +19. The "undef" condition was not working if the macro name being tested began with a digit or contained upper case letters. -20. Fixed an obscure but with buffer extension when expanding macros, which -showed up if there were a lot of macros in a line. The effect was to add +20. Fixed an obscure bug with buffer extension when expanding macros, which +showed up if there were a lot of macros in a line. The effect was to add nonsense to the line, giving weird input errors or crashes. -21. Created some "standard macro" files, and arranged for them to be picked up +21. Created some "standard macro" files, and arranged for them to be picked up by "*include" if no other file of that name exists. -22. Updated the PSheader file by removing a test for a font's being in the +22. Updated the PSheader file by removing a test for a font's being in the PostScript FonDirectory after "findfont" because (a) the test is clearly -redundant if "findfont" succeeds and (b) a user reported getting the "unknown" +redundant if "findfont" succeeds and (b) a user reported getting the "unknown" error, even though the font had been loaded. -23. When a Unicode code point was translated to a code point in a font with -non-standard encoding, if the string was underlay or overlay and the resulting -code point was the Unicode code point for hyphen or equals or sharp, it was -erroneously given the special underlay/overlay treatment. Such translations are +23. When a Unicode code point was translated to a code point in a font with +non-standard encoding, if the string was underlay or overlay and the resulting +code point was the Unicode code point for hyphen or equals or sharp, it was +erroneously given the special underlay/overlay treatment. Such translations are now made to behave as if the input were escaped. diff --git a/doc/pmw.1 b/doc/pmw.1 index 0f919ee..bc2b270 100644 --- a/doc/pmw.1 +++ b/doc/pmw.1 @@ -31,11 +31,11 @@ The paper is A4, but the printer feeds it sideways, so rotate the page images before printing. .TP \fB-C\fR \fI\fR -Show a compile-time option; exit with its value (0 or 1). Possible arguments +Show a compile-time option; exit with its value (0 or 1). Possible arguments are: .sp b2pf suport for B2PF processing - musicxml support for MusicXML input + musicxml support for MusicXML input .TP \fB-c\fR \fI\fR Arrange to print \fI\fR copies. This number is honoured by PostScript diff --git a/doc/spec.pdf b/doc/spec.pdf index 4acb430..6ad252f 100644 Binary files a/doc/spec.pdf and b/doc/spec.pdf differ diff --git a/doc/spec.xfpt b/doc/spec.xfpt index 0329a0f..19c4799 100644 --- a/doc/spec.xfpt +++ b/doc/spec.xfpt @@ -152,13 +152,13 @@ Philip's Music Writer (PMW) A Music Typesetting Program PMW -09 April 2022 +08 June 2022 PhilipHazel PH
Cambridge, England
5.10 - 09 April 2022 + 08 June 2022 PH 2022Philip Hazel @@ -401,6 +401,15 @@ The files that are installed in the prefix directory are as follows: &_man/man1/pmw.1_& is a short `man' page that describes the command options for PMW. .next +&_share/pmw/macros_& is a directory that contains files of `standard macros' +(&R; &<>&). +.next +&_share/pmw/MIDIperc_& contains translations between names such as `acoustic +bass drum' and MIDI pitches for untuned percussion voices. +.next +&_share/pmw/MIDIvoices_& contains translations between names such as `piano' +and MIDI voice numbers. +.next &_share/pmw/PSheader_& is the PostScript header file for PMW output. .next &_share/pmw/psfonts/PMW-Music.pfa_& is the main PostScript music font. As of @@ -2165,8 +2174,7 @@ default setting, which is to bracket all the staves of the system. .index "text" "at stave start" At the start of a piece it is common to show the names of the voices and/or instruments to the left of the first system. This is done by giving a string in -quotes as part of the &%[stave]%& directive, immediately after the stave -number. +quotes as part of the &%[stave]%& directive. .code [stave 1 "Clarinet" treble 1] .endd @@ -2624,7 +2632,7 @@ be output at the cue note size. .index "standard macros" .index "macros" "standard" The use of macros is introduced above. Several files of pre-defined macros are -provided with PMW. They provide shorthands for a number of common requirements. +provided with PMW. They contain shorthands for a number of common requirements. Suggestions for additions are welcome. .ilist @@ -3056,10 +3064,8 @@ outputting reminders to the user. .index "&%*define%&" The &%*define%& directive is used to define &'macros'&. A macro is a name for a string of characters, usually for something that is needed more than once. -Using a macro ensures consistency, and a short name saves typing. The file -named &_MacroCollection_& in the &_contrib_& directory contains copies of the -macro definitions discussed in this manual. The format of &%*define%& for a -simple macro is: +Using a macro ensures consistency, and a short name saves typing. The format of +&%*define%& for a simple macro is: .display &`*define`& <&'name'&> <&'rest of line'&> .endd @@ -3279,8 +3285,10 @@ in quotes: If the name does not start with a slash, it is interpreted relative to the directory containing the current input file, unless the current input is the standard input, in which case a non-absolute path name is taken relative to the -current directory. Included files may be nested. That is, an included file may -contain further &%*include%& directives. +current directory. If a file whose name contains no slashes cannot be found, it +is sought in the `standard macros' directory (&R; &<>&). Included +files may be nested. That is, an included file may contain further &%*include%& +directives. @@ -4311,22 +4319,29 @@ effect as using &`\mu\`&. .index "fonts" "sizes" .index "size" "of fonts" The header directives that specify page headings and footings allow arbitrary -sizes to be given for those texts. Text within a stave uses 10-point fonts by -default, but various facilities are provided for changing this. +font sizes to be given for those texts. Text within a stave uses 10-point fonts +by default, but there are various ways of changing this. + +The &%textsizes%& header directive defines up to 20 settable text sizes, which +can be accessed by any text string within a stave by means of the &`/s`& +option. The default for all these sizes is 10 points. Whenever the size of a +text font is specified, an associated aspect ratio and/or shearing angle may +also be specified (&R; &<>&). In addition there are 10 fixed +sizes that are accessed by &`/S`& (&R; &<>&). + .index "figured bass" "default size" .index "underlay" "default size" .index "fonts" "default sizes" -Underlay, overlay, figured bass, and other text each have their own separate -default sizes, which are set up by header directives. In addition the user may -specify up to nineteen additional sizes that can be requested for any -particular item of text (&R; &<>&, &<>&). +Underlay, overlay, and figured bass have their own separate default sizes, +which are set up by header directives. All other text defaults to a settable +size that can specified by the &%[textsize]%& directive, with the ultimate +default being settable size 1. -Whenever the size of a text font is specified, an associated aspect ratio -and/or shearing angle may also be specified (&R; &<>&). Stave text strings that are not underlay or overlay can be rotated so that they -appear at an angle (&R; &<>&). Text at the start of a stave can -be rotated so as to run vertically instead of horizontally &-- see the -description of &%[stave]%& in section &<>&. +appear at an angle. Text at the start of a stave can be rotated so as to run +vertically instead of horizontally &-- see the description of &%[stave]%& in +section &<>&. More detail about text items in stave data is given +below (&R; &<>&). @@ -4592,11 +4607,11 @@ rest is not a completely empty bar. .index "crop marks" PMW contains a facility for drawing simple shapes, defined by the user, positioned relative to notes, bar lines, headings, stave names, or gaps in -slurs and slur-like lines. This makes it possible to create music notation -that is not provided explicitly by PMW. For example, the facility can be used -to draw piano pedal marks, boxes round notes, vertical brackets between -notes, and other unusual marks above or below the stave. It can be used -with headings or footings to rule lines across the page or to output crop marks. +slurs and slur-like lines. This makes it possible to create music notation that +is not provided explicitly by PMW. For example, the facility can be used to +draw boxes round notes, vertical brackets between notes, and other unusual +marks above or below the stave. It can be used with headings or footings to +rule lines across the page or to output crop marks. This chapter is placed here because there are references to the drawing facilities in what follows. However, unless you plan to make use of these @@ -5169,7 +5184,7 @@ of the following options: .row &`/r`&<&'n'&> "move the string right by <&'n'&> points" .row &`/ring`& "enclose the string in a ring (circular if a short string)" .row &`/rot`&<&'n'&> "rotate the string by <&'n'&> degrees (&R; &<>&)" -.row &`/s`&<&'n'&> "output the string at size <&'n'&> (&R; &<>&)" +.row &`/s`&<&'n'&> "output the string at settable size <&'n'&> (&R; &<>&)" .row &`/S`&<&'n'&> "output the string at fixed size <&'n'&> (&R; &<>&)" .row &`/u`&<&'n'&> "move the string up by <&'n'&> points" .endtable @@ -6213,8 +6228,8 @@ can be used to place them nearer the middle of the text characters. .index "&%fbsize%&" .index "figured bass" "size" By default, text that is specified as being part of a figured bass is output -at the same size as other textual items (10 points). This directive enables a -different point size to be chosen for the figured bass text. +at the same default size as other textual items (10 points). This directive +enables a different point size to be chosen for the figured bass text. .code fbsize 8.2 .endd @@ -8443,10 +8458,10 @@ This example causes them to be slightly smaller than the default. .tocsubsecton .chapter "Stave data" CHAPstavedata .index-from I06 "stave data" -This is the first of two chapters in which we describe the format of the -data for a single stave, which consists of a sequence of notes and rests, -interspersed with other items such as bar lines, key and time signatures, -clefs, text strings, etc. The items that are not notes or rests are as follows: +This is the first of two chapters that describe the format of the data for a +single stave, which consists of a sequence of notes and rests, interspersed +with other items such as bar lines, key and time signatures, clefs, text +strings, etc. The items that are not notes or rests are as follows: .ilist A few common items that can conveniently be represented in the computer's character set are represented by one or more special characters. An example is @@ -8466,9 +8481,9 @@ described in alphabetical order in section &<>&. Notes, rests and other items may be interspersed freely, as required. .index "space character" Space characters and line breaks can be used to separate items, in order to -make the input easier to read, though they are not necessary. PMW makes no -attempt to check on the musical sense of what it is asked to typeset, other -than to check bar lengths. +make the input easier to read, though they are not necessary except to avoid +ambiguity . PMW makes no attempt to check on the musical sense of what it is +asked to typeset, other than to check bar lengths. .index "bar lengths" When there is more than one stave, the length of the notes in each bar must be the same for all staves, though it is possible to handle some special cases @@ -8496,7 +8511,7 @@ To encode a totally empty bar it is necessary to include at least one space between two vertical bar characters. .index "bar lines" "styles" -There six different styles for barlines (&R; &<>&). The +There are six different styles for barlines (&R; &<>&). The default style can be set by &%barlinestyle%& (for the whole piece) or &%[barlinestyle]%& (for an individual stave). In addition, the style of any individual bar line may be specified by following the vertical bar character @@ -8574,7 +8589,7 @@ can be used: You can also use &`\r2\`&, which does the same thing, but starting at the second bar; nothing is inserted in the first repeated bar. This makes it possible to put something different on the first bar. Note the use of &`/cb`& -in this example to centre each text string in its bar. See section +in the next example to centre each text string in its bar. See section &<>& for details of string options. .code @@ -9620,8 +9635,8 @@ without a staccato dot. [\.\] a b c d\x\ e f g [\\] .endd Expression/option items are processed from left to right. If there are two or -more options being defaulted, &`x`& cancels them all, but one can be put back -again afterwards. +more options being defaulted, &`x`& cancels them all, but any of them can be +put back again afterwards. @@ -10432,15 +10447,15 @@ default output in the roman typeface. The directives &%[underlayfont]%&, &%[overlayfont]%&, and &%[fbfont]%& can be used to change the default font for these kinds of text on individual staves. -Text strings are coded in among the notes of a stave, and are, like all -strings, enclosed in double quote characters. +Text strings, enclosed in double quote characters, are coded in among the notes +of a stave. .index "strings" "limit on number of" There may be no more than 100 text strings before any one note; this large limit is intended to cover all possible applications. The escape character conventions using the backslash character that apply to all PMW strings are relevant (&R; &<>&). In particular, within any text string, the font can be changed by the use of the appropriate escape sequences. The -closing double-quote of the string may be followed by one or more options, +closing double-quote of the string may be followed by one or more qualifiers, separated from the quote and from each other by slash characters. The following are available: .index "text" "qualifiers" @@ -10452,17 +10467,17 @@ are available: .itable none 0 0 3 60 left 130 left 150 left .row &`/a`& "unspecific&~text&~above&~the&~stave" -.row &`/a`&<&'n'&> "ditto&~at&~fixed&~distance&~above&~the&~stave" -.row &`/ao`& "ditto&~above&~the&~stave,&~at&~the&~overlay&~level" +.row &`/a`&<&'n'&> "unspecific&~text&~at&~fixed&~distance&~above&~the&~stave" +.row &`/ao`& "unspecific&~text&~above&~the&~stave,&~at&~the&~overlay&~level" .row &`/b`& "unspecific&~text&~below&~the&~stave" -.row &`/b`&<&'n'&> "ditto&~at&~fixed&~distance&~below&~the&~stave" -.row &`/bu`& "ditto&~below&~the&~stave&~at&~the&~underlay&~level" -.row &`/m`& "ditto&~below&~the&~stave,&~midway&~to&~the&~next&~stave" +.row &`/b`&<&'n'&> "unspecific&~text&~at&~fixed&~distance&~below&~the&~stave" +.row &`/bu`& "unspecific&~text&~below&~the&~stave&~at&~the&~underlay&~level" +.row &`/m`& "unspecific&~text&~below&~the&~stave,&~midway&~to&~the&~next&~stave" .row "&~" -.row &`/ul`& "this text string is underlay" -.row &`/ol`& "this text string is overlay" -.row &`/fb`& "this&~text&~string&~is&~figured&~bass" -.row &`/fbu`& "this&~text&~string&~is&~figured&~bass&~at&~underlay&~level" +.row &`/ul`& "this text is underlay" +.row &`/ol`& "this text is overlay" +.row &`/fb`& "this&~text&~is&~figured&~bass" +.row &`/fbu`& "this&~text&~is&~figured&~bass&~at&~underlay&~level" .row "&~" .row &`/h`& "position&~halfway&~between&~notes" .row &`/lc`&<&'n'&> "position&~left&~by&~<&'n'&>&~crotchets" @@ -10545,6 +10560,7 @@ If the &`/e`& qualifier is present on the text string, it is the end of the string that is aligned with the alignment point. The &`/ne`& option can be used on text strings to cancel the effect of a previous &`/e`&. This can be useful for overriding options on strings defined as macros. + .index "text" "centred" .index "text" "centred in bar" If the &`/c`& qualifier is present, the text is centred at the alignment point. @@ -10624,16 +10640,17 @@ size, &`/s2`& specifies the second size, and so on. .code "Some text string"/s2 .endd -This example uses the second size defined by &%textsizes%&. By default, text -uses the first size, unless it is underlay, overlay, or figured bass, which -have their own default sizes (set by the &%underlaysize%&, &%overlaysize%&, and -&%fbsize%& directives). The &`/s`& option can, however, be used with underlay, -overlay, and figured bass text to specify a non-default size for an individual -string. +This example uses the second size defined by &%textsizes%&. The default size +for text that is not underlay, overlay, or figured bass is the size set by the +&%[textsize]%& directive or, if that is not present, the first settable size. +Underlay, overlay, and figured bass have their own default sizes, set by the +&%underlaysize%&, &%overlaysize%&, and &%fbsize%& directives. The &`/s`& option +can, however, be used with underlay, overlay, and figured bass text to specify +a non-default size for an individual string. -As well as the 20 settable text sizes, there are also 10 fixed sizes that -cannot be changed. The &`/S`& qualified is used to select one of these sizes. -The following are defined: +As well as the 20 settable text sizes, there are 10 fixed sizes that cannot be +changed. The &`/S`& option is used to select one of these sizes. The following +are defined: .itable none 0 0 2 20 left 50 right @@ -10664,7 +10681,7 @@ rotation is anticlockwise. The centre of rotation is on the text baseline, at the left-hand end of the string. If the string is centred or right-aligned (the &`/c`&, &`/cb`&, or -&`/e`& qualifiers), this position is computed from the length of a horizontal +&`/e`& options), this position is computed from the length of a horizontal string, before rotation. That is, rotation happens last. @@ -10702,11 +10719,11 @@ defined as 14 points): .index "fingering indications" The small caps feature of text strings is useful for selecting a smaller than normal font for fingering indications. Alternatively, a specific font size can -be defined and used with the &`/s`& text option or one of the fixed sizes can -be selected by &`/S`&. The music font contains the special characters +be defined and used with the &`/s`& text qualifier, or one of the fixed sizes +can be selected by &`/S`&. The music font contains the special characters &{a}&&~&~ and &{b}&&~&~ for indication the use of the thumb in cello parts. The use of macros is suggested when setting music with lots of -fingering, and a suitable set of macros is provided in the &%Fingering%& +fingering, and a suggested set of macros is provided in the &%Fingering%& standard macro file (&R; &<>&). Note the use of the &`/c`& option in this example, to centre the text below each note: .code @@ -10923,7 +10940,7 @@ problem does not arise. Two separate sets of fonts are provided for underlaid and overlaid text, and the size of these can be set independently of the other text fonts by the &%underlaysize%& and &%overlaysize%& directives. Individual underlay or overlay -strings can specify different sizes by means of the &`/s`& or &`/S`& option. +strings can specify different sizes by means of the &`/s`& or &`/S`& qualifier. .subsection "Underlay and overlay levels" @@ -13071,7 +13088,9 @@ described first. .subsection "Text at stave starts" SUBSECTstavetext .index "test" "at stave start" -The text-only form of &%[stave]%& has the following format: +The text-only form of &%[stave]%& has the following format, where the stave +number &'n'& can be followed the number of stave lines and/or &`omitempty`&, as +just described: .display &`[stave `&<&'n'&>&` "`&<&'string1'&>&`" "`&<&'string2'&>&`" ...]`& .endd @@ -13199,7 +13218,7 @@ drawing function associated with a stave is used to generate a special kind of .display &`[stave `&<&'n'&>&` `&<&'string'&>&` draw `&<&'arguments'&>&` `&<&'drawing name'&>&` ...]`& .endd -This feature also available for the &%[name]%& directive. If both a string +This feature is also available for the &%[name]%& directive. If both a string and a call to a drawing function are present, the string must come first. .code [stave 3 " " draw thing] @@ -13385,20 +13404,21 @@ directive. It takes a word as its argument. .row "&`[text fb]`&" "default is figured bass" .endtable -To override a default with an absolute position (for example &%[text above -15]%&), the text options &`/a`& or &`/b`& without a following number can be +To override a default with an absolute position (for example &`[text above +15]`&), the text options &`/a`& or &`/b`& without a following number can be used (as well as &`/ul`&, &`/fb`&, &`/fbu`&, or &`/m`&). Similarly, the appearance of &%[text above]%& or &%[text below]%& without a number resets to the initial state, where the default vertical position depends on the next note. Ordinary text that is positioned above or below the stave is by default output -at settable size 1 (as specified by the &%textsizes%& header directive). -Underlay, overlay, and figured bass text is output by default at the sizes -specified by the &%underlaysize%&, &%overlaysize%&, and &%fbsize%& header -directives. The default text type and size can always be overridden by explicit -qualifiers following the string. For example, if &%[text underlay]%& has been -specified, an italic dynamic mark above the stave is coded like this: +at settable size 1 (specified by the &%textsizes%& header directive), unless +the &%[textsize]%& directive has specified otherwise. Underlay, overlay, and +figured bass text is output by default at the sizes specified by the +&%underlaysize%&, &%overlaysize%&, and &%fbsize%& header directives. The +default text type and size can always be overridden by explicit qualifiers +following the string. For example, if &%[text underlay]%& has been specified, +an italic dynamic mark above the stave is coded like this: .code "\it\ff"/a .endd diff --git a/post-install b/post-install index 598a41b..21cefa7 100755 --- a/post-install +++ b/post-install @@ -6,11 +6,11 @@ MANDIR=$3 cat <systemsepwidth)); eprintf(" systemsepposx = %s\n", sff(m->systemsepposx)); eprintf(" systemsepposy = %s\n", sff(m->systemsepposy)); - + debug_stavelist("thinbracketlist", m->thinbracketlist); eprintf(" topmargin = %s\n", sff(m->topmargin)); eprintf(" transpose = "); @@ -1555,7 +1555,7 @@ if (xml_layout_list_size > 0) eprintf(" MusicXML layout size: %zd\n", xml_layout_list_size); total += xml_layout_list_size; } -#endif +#endif eprintf(" Movements vector: %zd\n", movements_size * sizeof(movtstr *)); total += movements_size * sizeof(movtstr *); diff --git a/src/draw.c b/src/draw.c index 7ebdfd9..138c3d7 100644 --- a/src/draw.c +++ b/src/draw.c @@ -26,7 +26,7 @@ enum { dr_if, dr_ifelse, dr_jump, dr_ket, - dr_le, dr_leftbarx, dr_linebottom, + dr_le, dr_leftbarx, dr_linebottom, dr_linelength, dr_lineto, dr_linetop, dr_loop, dr_lt, dr_magnification, dr_moveto, dr_mul, dr_ne, dr_neg, dr_not, dr_number, diff --git a/src/font.c b/src/font.c index d13dcbd..8e4b0f5 100644 --- a/src/font.c +++ b/src/font.c @@ -901,17 +901,17 @@ if (f != NULL) error(ERR61, lineno, filename, line); continue; } - + /* Change an underlay special character to its escaped version. */ - + switch (c) { case '#': c = ss_escapedsharp; break; case '=': c = ss_escapedequals; break; case '-': c = ss_escapedhyphen; break; - default: break; - } - + default: break; + } + fs->invalid = c | (font_unknown << 24); continue; } @@ -943,16 +943,16 @@ if (f != NULL) error(ERR61, lineno, filename, line); continue; } - + /* Change underlay special characters to escaped versions. */ - + switch (utable[ucount].pscode) { case '#': utable[ucount].pscode = ss_escapedsharp; break; case '=': utable[ucount].pscode = ss_escapedequals; break; case '-': utable[ucount].pscode = ss_escapedhyphen; break; - default: break; - } + default: break; + } ucount++; } diff --git a/src/midi.c b/src/midi.c index 2613192..ba2bcf4 100644 --- a/src/midi.c +++ b/src/midi.c @@ -613,12 +613,12 @@ for (stave = 1; stave <= midi_movt->laststave; stave++) pitchlist[pc]/2 + 12 + miditranspose; int start = moff - midi_bar_moff + pitchstart[pc] + scrubcount * (pitchlen[pc]/scrub); - + if (pitch < 0 || pitch > 127) { char buff[24]; sprintf(buff, "%s", sfb(midi_movt->barvector[midi_bar])); - error(ERR172, pitch, buff, stave); + error(ERR172, pitch, buff, stave); } /* We have to schedule a note on and a note off event. Use @@ -626,7 +626,7 @@ for (stave = 1; stave <= midi_movt->laststave; stave++) running status can be used. */ else - { + { next_event->time = start; next_event->seq = next_event_seq++; next_event->data[0] = 3; @@ -634,7 +634,7 @@ for (stave = 1; stave <= midi_movt->laststave; stave++) next_event->data[2] = pitch; next_event->data[3] = midi_stave_velocity; next_event++; - + next_event->time = start + (pitchlen[pc]/scrub); next_event->seq = next_event_seq++; next_event->data[0] = 3; @@ -642,7 +642,7 @@ for (stave = 1; stave <= midi_movt->laststave; stave++) next_event->data[2] = pitch; next_event->data[3] = 0; next_event++; - } + } } } } diff --git a/src/out.c b/src/out.c index f84bd7a..11820cf 100644 --- a/src/out.c +++ b/src/out.c @@ -1584,22 +1584,22 @@ if (xx[1] >= 0) out_ascstring((style != 3)? US"xI" : US"IxxyyyyyyI", font_mf, 10*out_stavemagn, x + (xx[2]*magn)/10 + (65*(magn - out_stavemagn))/100, out_ystave); -/* Output "wings" if requested, positioned at the thick line, if any, else at +/* Output "wings" if requested, positioned at the thick line, if any, else at the thin line if any, else at the dots. */ if (MFLAG(mf_repeatwings)) { int32_t dx = ((type == rep_left || type == rep_dleft)? 7 : -7) * magn; - int32_t dy = 4*magn; - int32_t thick = magn/2; - + int32_t dy = 4*magn; + int32_t thick = magn/2; + if (xx[0] >= 0) x += ((xx[0]+10)*magn)/10; else if (xx[1] >= 0) x += (xx[1]*magn)/10; else x += (xx[2]*magn)/10; - + if (curstave == out_topstave) { - int32_t y = 16*magn; + int32_t y = 16*magn; ps_line(x, y, x + dx, y + dy, thick, 0); } diff --git a/src/pmw_read_header.c b/src/pmw_read_header.c index 26ad984..9a578e1 100644 --- a/src/pmw_read_header.c +++ b/src/pmw_read_header.c @@ -1671,7 +1671,7 @@ if (read_c == '/') read_nextc(); if (!read_expect_integer(&size, FALSE, FALSE)) return FALSE; if ((size -= 1) >= FixedFontSizes) return error(ERR75, FixedFontSizes); - size += UserFontSizes; + size += UserFontSizes; } else { @@ -1758,9 +1758,9 @@ if (read_expect_integer(&x, FALSE, FALSE)) { if (x >= 10) { - x -= 10; + x -= 10; curmovt->flags |= mf_repeatwings; - } + } if (x <= MAX_REPEATSTYLE) curmovt->repeatstyle = x; else error(ERR174, MAX_REPEATSTYLE, MAX_REPEATSTYLE + 10); } diff --git a/src/pmw_read_note.c b/src/pmw_read_note.c index 01893d6..632637b 100644 --- a/src/pmw_read_note.c +++ b/src/pmw_read_note.c @@ -1674,7 +1674,7 @@ for (;;) /* Adjust absolute pitch for transposing clefs */ abspitch += srs.clef_octave; - + if (abspitch < 0 || abspitch > 200) error(ERR173); /* Hard */ /* Keep track of the absolute pitch range, maintain data for tessitura diff --git a/src/pmw_read_stave.c b/src/pmw_read_stave.c index 81ede16..a10f28e 100644 --- a/src/pmw_read_stave.c +++ b/src/pmw_read_stave.c @@ -957,7 +957,7 @@ read_sigc(); if (Ustrncmpic(main_readbuffer + read_i - 1, "omitempty", 9) == 0) { read_i += 8; - read_nextsigc(); + read_nextsigc(); curmovt->stavetable[srs.stavenumber]->omitempty = TRUE; } @@ -996,11 +996,11 @@ while (!endstave) bs->bartype = barline_normal; bs->barstyle = srs.barlinestyle; } - + /* Ensure bar indexes are large enough */ - - read_ensure_bar_indexes(nextbaroffset + barrepeat - 1); - + + read_ensure_bar_indexes(nextbaroffset + barrepeat - 1); + /* If we have skipped some bars, fill in the bar index vector with pointers to an empty bar. We have to make a new empty bar each time in case the barline style has changed. */ diff --git a/src/ps.c b/src/ps.c index 5cddc91..c52099a 100644 --- a/src/ps.c +++ b/src/ps.c @@ -1257,7 +1257,7 @@ ps_printf(" %s cv%s%s", sff(((flags & sflag_b) != 0)? (-co) : co), * Output a straight line * *************************************************/ -/* The origin for y coordinates is in out_ystave, typically the bottom line of +/* The origin for y coordinates is in out_ystave, typically the bottom line of a stave. Arguments: @@ -1614,7 +1614,7 @@ lines in the header are included only when we are generating an EPS file. They are flagged in the header file with %EPS. Otherwise, if a line starts with %, it is copied only if it starts with %%. Blank lines are omitted. -This function used also to be called when there were facilities for including +This function used also to be called when there were facilities for including arbitrary PostScript files, prior to release 5. This feature has never been re-instated, but could be if there is ever a demand. For this reason the following logic has not been removed: If the included file is an EPS file, the diff --git a/src/read.c b/src/read.c index 76401b5..69241e9 100644 --- a/src/read.c +++ b/src/read.c @@ -54,13 +54,13 @@ if (ispmw) { /* The transpose parameters are in globals because they are also used during header reading for transposing note and key names. */ - + active_transpose = curmovt->transpose; active_transposedaccforce = main_transposedaccforce; - + /* Copy a default set of values for reading a stave, then adjust a few from the current movement's parameters. */ - + srs = init_sreadstr; srs.stavenumber = stave; srs.hairpinwidth = curmovt->hairpinwidth; @@ -72,7 +72,7 @@ if (ispmw) srs.noteden = curmovt->noteden; srs.required_barlength = read_compute_barlength(curmovt->time); srs.suspended = (curmovt->suspend_staves & (1 << stave)) != 0; - } + } return curmovt->stavetable[stave]; } @@ -83,7 +83,7 @@ return curmovt->stavetable[stave]; * Tidy omitted staves and bars * *************************************************/ -/* Called after reading to fill in any gaps. +/* Called after reading to fill in any gaps. Argument: TRUE if reading a PMW file, FALSE for MusicXML Returns: nothing @@ -155,7 +155,7 @@ over. Arguments: new pointer to new movtstr, uninitialized - unsetflags flags to unset + unsetflags flags to unset setflags flags to set (movement type) Returns: nothing @@ -290,8 +290,8 @@ main_readbuffer_threshold = main_readbuffer_size - 2; * Manage bar indexes * *************************************************/ -/* The bar indexes for movements and staves are expandable as necessary. This -function handles that. The current movement is in curmovt and the current stave +/* The bar indexes for movements and staves are expandable as necessary. This +function handles that. The current movement is in curmovt and the current stave in st. Argument: size needed @@ -321,7 +321,7 @@ while (needed >= st->barindex_size) st->barindex = realloc(st->barindex, size); if (st->barindex == NULL) error(ERR0, "re-", "bar index", size); /* Hard */ } -} +} @@ -410,7 +410,7 @@ if (Ustrncmp(main_readbuffer, "\xef\xbb\xbf", 3) == 0) p += 3; if (Ustrncmp(p, "%abc-", 5) == 0) { TRACE("ABC file detected\n"); - read_i = Ustrlen(main_readbuffer); + read_i = Ustrlen(main_readbuffer); error(ERR3, "ABC"); /* Hard - in future will be tested */ if (ft != FT_AUTO || ft != FT_ABC) error(ERR4, "ABC"); /* Hard */ @@ -419,14 +419,14 @@ if (Ustrncmp(p, "%abc-", 5) == 0) else if (Ustrncmp(p, "= 0; curstave--) { if (mac_notbit(notsuspend, curstave)) continue; if (curstave == 0) - { + { stavestr *ss = curmovt->stavetable[curstave]; bstr *p = (bstr *)(ss->barindex[curbarnumber]); if (p->next->type == b_barline) continue; } - if (out_botstave < 0) out_botstave = curstave; + if (out_botstave < 0) out_botstave = curstave; mac_setbit(livestaves, curstave); - out_topstave = curstave; + out_topstave = curstave; } /* Now process the selected staves */ @@ -625,7 +625,7 @@ for (curstave = out_laststave; curstave >= 0; curstave--) (barlinetype == barline_ending || (finalbar && !MFLAG(mf_unfinished)))? bar_thick : (barlinestyle == 1 || barlinestyle == 3)? bar_dotted : bar_single; - + /* If the bar finished with a right-hand repeat mark, in certain cases we can omit overprinting with a normal bar line. */ diff --git a/src/string.c b/src/string.c index 97a6dce..fbb2741 100644 --- a/src/string.c +++ b/src/string.c @@ -1086,13 +1086,13 @@ for (uint32_t *s = str; *s != 0; s++) { uint32_t pc = font_utranslate(c, fs); *s &= 0xff000000u; /* Keep the current font */ - - /* A valid translated codepoint is either < 256 or an escaped sharp, + + /* A valid translated codepoint is either < 256 or an escaped sharp, equals, or hyphen, whose code points are outside the Unicode range. */ - - if (pc < 256 || pc > MAX_UNICODE) + + if (pc < 256 || pc > MAX_UNICODE) { - *s |= pc; + *s |= pc; } else { @@ -1256,7 +1256,17 @@ return n + 1; which means we have just filled up the on-stack buffer (apart from one element at the end which was left for the terminator). Start a malloc() buffer at twice the size and copy the on-stack data into it. Otherwise, increase the malloc() -buffer. */ +buffer. At the start of the memory block we leave space for a pointer so that +it can be passed to mem_register() and thus rememvered for freeing. + +Arguments: + block where to put the pointer to a new memory block + yield pointer to pointer to the usable area, updated + mem_size pointer to size of memory block. updated + string_max pointer to maximum string size, updated + +Returns: nothing +*/ static void expand_string_buffer(void **block, uint32_t **yield, size_t *mem_size, @@ -1861,7 +1871,7 @@ while (read_c == '/' && main_readbuffer[read_i] != '/') } else if (read_c == 'a' && main_readbuffer[read_i] == 'r') { - b->flags &= ~text_barcentre; + b->flags &= ~text_barcentre; b->flags |= text_baralign; read_i++; read_nextc(); @@ -1924,7 +1934,7 @@ while (read_c == '/' && main_readbuffer[read_i] != '/') { b->flags |= text_atulevel; read_i++; - } + } } else error(ERR8, "/fb"); read_nextc(); @@ -2018,10 +2028,10 @@ while (read_c == '/' && main_readbuffer[read_i] != '/') case 't': read_nextc(); - if (read_c == 's') + if (read_c == 's') { - b->flags &= ~text_barcentre; - b->flags |= text_timealign; + b->flags &= ~text_barcentre; + b->flags |= text_timealign; } else error(ERR8, "/ts"); read_nextc(); diff --git a/src/structs.h b/src/structs.h index fba7b38..dd9eac4 100644 --- a/src/structs.h +++ b/src/structs.h @@ -695,7 +695,7 @@ typedef struct snamestr { tree_node *drawing; drawitem *drawargs; int32_t adjustx; - int32_t adjusty; + int32_t adjusty; uint8_t flags; uint8_t size; uint8_t linecount; @@ -860,8 +860,8 @@ typedef struct movtstr { int32_t systemsepangle; uint32_t systemseplength; uint32_t systemsepwidth; - int32_t systemsepposx; - int32_t systemsepposy; + int32_t systemsepposx; + int32_t systemsepposy; uint32_t time; uint32_t time_unscaled; uint32_t topmargin; diff --git a/src/tables.c b/src/tables.c index 407aa6f..38d2585 100644 --- a/src/tables.c +++ b/src/tables.c @@ -245,7 +245,7 @@ static fontsizestr init_fontsizes = { { NULL, 10000, 0 }, /* vertacc */ /* It doesn't seem possible in ANSI C to parameterize this initialization - using UserFontSizes and FixedFontSizes, so we must keep this in step when + using UserFontSizes and FixedFontSizes, so we must keep this in step when either of those are changed. */ { { NULL, 10000, 0 }, /* user font size 1 */ @@ -279,7 +279,7 @@ static fontsizestr init_fontsizes = { { NULL, 10000, 0 }, /* fixed font size 8 */ { NULL, 10000, 0 }, /* fixed font size 9 */ { NULL, 10000, 0 }, /* fixed font size 10 */ - + { NULL, 11800, 0 }, /* tsfont */ { NULL, 10000, 0 }, /* ulay */ { NULL, 10000, 0 }, /* olay */ @@ -502,7 +502,7 @@ snamestr init_snamestr = { NULL, /* drawing */ NULL, /* drawargs */ 0, /* adjustx */ - 0, /* adjusty */ + 0, /* adjusty */ 0, /* flags */ ff_offset_init, /* size */ 0 /* linecount */ @@ -650,11 +650,11 @@ movtstr default_movtstr = { { 0, 0, 0, 0, 0, 0, 2000, 4000 }, /* stemadjusts */ 44000, /* systemgap */ - 20000, /* systemsepangle */ - 0, /* systemseplength */ + 20000, /* systemsepangle */ + 0, /* systemseplength */ 2000, /* systemsepwidth */ - 0, /* systemsepposx */ - 0, /* systemsepposy */ + 0, /* systemsepposx */ + 0, /* systemsepposy */ time_default, /* time default = 1*4/4 */ time_default, /* time_unscaled */ 10000, /* topmargin */ diff --git a/src/xml.c b/src/xml.c index 438edf1..6f32ff9 100644 --- a/src/xml.c +++ b/src/xml.c @@ -143,7 +143,7 @@ p = tree_search(*tree, buff); if (p == NULL) { p = mem_get(sizeof(tree_node) + Ustrlen(buff)); - p->name = mem_copystring(buff); + p->name = mem_copystring(buff); (void)tree_insert(tree, p); } } @@ -445,16 +445,16 @@ return yield; * Set a new value for a number * *************************************************/ -/* Call xml_get_string(), then replace the string with the string value of the -given number. This is used to change staff numbers for coupled staves, so we -know that the number is either 1 or 2. FIXME: perhaps this needs better +/* Call xml_get_string(), then replace the string with the string value of the +given number. This is used to change staff numbers for coupled staves, so we +know that the number is either 1 or 2. FIXME: perhaps this needs better checking and an error if name not found. Arguments: i the outer item name inner item name n the new number - + Returns: nothing */ @@ -463,7 +463,7 @@ xml_set_number(xml_item *i, uschar *name, int n) { uschar *s = xml_get_string(i, name, NULL, TRUE); if (s != NULL) *s = n + '0'; -} +} @@ -575,7 +575,7 @@ Returns: legal value or bad */ int32_t -xml_get_attr_mils(xml_item *i, uschar *name, int min, int max, int bad, +xml_get_attr_mils(xml_item *i, uschar *name, int min, int max, int bad, BOOL moan) { int32_t yield; diff --git a/src/xml.h b/src/xml.h index 7a10913..e4ad9ed 100644 --- a/src/xml.h +++ b/src/xml.h @@ -32,9 +32,9 @@ headers, but they might as well be together with those above. */ #define ISATTR(a,b,c,d,e) \ (Ustrcmp(xml_get_attr_string(a,US b,US c,d),e) == 0) -/* Stave coupling settings */ - -enum { COUPLE_NOT, COUPLE_UP, COUPLE_DOWN }; +/* Stave coupling settings */ + +enum { COUPLE_NOT, COUPLE_UP, COUPLE_DOWN }; /* Include the other XML header files */ diff --git a/src/xml_debug.c b/src/xml_debug.c index 198a10a..ce14874 100644 --- a/src/xml_debug.c +++ b/src/xml_debug.c @@ -77,7 +77,7 @@ for (i = item_list; i != NULL; i = i->next) else if (Ustrcmp(i->name, "#TEXT") == 0) { - xml_textblock *tb = i->p.txtblk; + xml_textblock *tb = i->p.txtblk; if (tb == NULL) eprintf("Dummy text block\n"); else debug_print_string(tb->string, tb->length, "\n"); } @@ -121,7 +121,7 @@ for (i = item_list; i != NULL; i = i->next) eprintf(">\n"); } } -eprintf("----- End of item list -----\n"); +eprintf("----- End of item list -----\n"); } diff --git a/src/xml_error.c b/src/xml_error.c index 13cab7d..75cf443 100644 --- a/src/xml_error.c +++ b/src/xml_error.c @@ -59,38 +59,38 @@ static error_struct error_data[] = { { ec_major, "'>' expected after '' before any other elements" }, { ec_failed, "elements too deeply nested" }, -/* 5-9 */ +/* 5-9 */ { ec_major, "nesting error: found '', expected '" }, { ec_major, "expected '=' after '%s'" }, { ec_major, "expected \" or ' after '%s='" }, { ec_major, "missing terminating %c after %s=%c..." }, { ec_major, "expected '>' after '/' or '?' in element '%s'" }, -/* 10 - 14 */ +/* 10 - 14 */ { ec_major, "missing '>' for element '%s'" }, { ec_major, "unsupported beat-unit \"%s\" for metronome mark" }, { ec_failed, "unexpected EOF while skipping processing instruction " "starting on line %d" }, { ec_failed, "unexpected EOF inside comment (started on line %d)" }, { ec_failed, "unexpected EOF inside element (started on input line %d)" }, -/* 15-19 */ +/* 15-19 */ { ec_major, "unclosed element%s at end of file" }, { ec_failed, " not found and not supported" }, { ec_failed, "missing %s" }, { ec_failed, "unrecognized or unsupported note type '%s'" }, { ec_major, "part has no %s" }, -/* 20 - 24 */ +/* 20 - 24 */ { ec_failed, "part \"%s\", listed in , not found" }, { ec_failed, "too many staves (%d) - PMW maximum is 64" }, { ec_major, "unsupported mode \"%s\"" }, { ec_major, "missing, malformed, or invalid number \"%s\"" }, { ec_major, "missing <%s> element" }, -/* 25 - 29 */ +/* 25 - 29 */ { ec_major, "unsupported clef sign \"%s\"" }, { ec_warning, "unrecognized element in measure %d in part \"%s\"" }, { ec_major, "note contains but matching previous note not found" }, { ec_major, "internal error: %s" }, { ec_failed, "too many staves (%d) for a part" }, -/* 30 - 34 */ +/* 30 - 34 */ { ec_major, "unrecognized accidental \"%s\"" }, { ec_major, "unrecognized measure number type \"%s\"" }, { ec_major, "missing attribute \"%s\"" }, @@ -102,19 +102,19 @@ static error_struct error_data[] = { { ec_major, " ignored owing to missing data" }, { ec_warning, "only equal margins for both odd and even are supported in " }, { ec_major, "internal error: missing start of slur or line" }, -/* 40 - 44 */ +/* 40 - 44 */ { ec_failed, "internal error: insert past end of text (%ld, %ld)" }, { ec_warning, "for a %c clef, only line %s is supported (%d ignored)" }, { ec_warning, "%d ignored for a percussion clef" }, { ec_warning, "%s \"%s\" is not supported" }, { ec_major, "\"%s\" line end on %s staff is not supported" }, -/* 45 - 49 */ +/* 45 - 49 */ { ec_warning, "PMW does not support \"%s\" notehead within a chord" }, { ec_warning, "PMW does not support different %s for rehearsal marks" }, { ec_warning, "PMW does not support different sizes for the same staff" }, { ec_major, "wedge type \"stop\" without matching start" }, { ec_warning, "PMW does not support nested wedges (hairpins)" }, -/* 50 - 54 */ +/* 50 - 54 */ { ec_warning, "PMW does not support for pages other than 1 or 2" }, { ec_warning, "Different parts set different number of measures in a system, " "or systems on a page" }, @@ -122,7 +122,7 @@ static error_struct error_data[] = { { ec_warning, "PMW does not support between tied notes: tie " "discarded" }, { ec_warning, "XML entity \"%.*s;\" %s" }, -/* 55 - 59 */ +/* 55 - 59 */ { ec_warning, "SPARE" }, { ec_warning, "Unknown accidental \"%s\" in key signature" }, { ec_failed, "Too many non-standard custom keys required" }, diff --git a/src/xml_heading.c b/src/xml_heading.c index 5e6218e..2c034a9 100644 --- a/src/xml_heading.c +++ b/src/xml_heading.c @@ -200,9 +200,9 @@ int32_t heading_base = -1; int32_t top_system_distance = -1; int32_t page_height = -1; -int32_t page_width = -1; -int32_t left_margin = -1; -int32_t right_margin = -1; +int32_t page_width = -1; +int32_t left_margin = -1; +int32_t right_margin = -1; int32_t top_margin = -1; int32_t bottom_margin = -1; @@ -573,7 +573,7 @@ curmovt->flags |= mf_unfinished; /* MXL has explicit bar lines */ curmovt->flags &= ~mf_keydoublebar; /* Headings and footings. Some are directly under the score-* item. Keep track -of the depth of headings (in millipoints). Any existing footings are put after +of the depth of headings (in millipoints). Any existing footings are put after XML footings. */ existing_footing = curmovt->footing; @@ -667,7 +667,7 @@ for (xml_item *credit = xml_find_item(xml_partwise_item_list, US"credit"); valign = xml_get_attr_string(cr_words, US"valign", valign, FALSE); top_align = Ustrcmp(valign, "top") == 0; use_head = page_height < 0 || dy < 0 || dy > page_height/2; - + /* Ignore totally empty strings, except take note of newlines. Have to cope with UTF-8 encodings of space characters. Pro tem just check for U+00A0. */ @@ -886,10 +886,10 @@ if (!done_rights && id_rights != NULL) if (existing_footing != NULL) { - headstr **ftptr; + headstr **ftptr; for (ftptr = &(curmovt->footing); *ftptr != NULL; ftptr = &((*ftptr)->next)) {} *ftptr = existing_footing; - } + } /* MusicXML's top system distance is defined as being from the top margin to the top of the first system. See if this is different to the distance implied diff --git a/src/xml_staves.c b/src/xml_staves.c index a0f448b..d63d5e0 100644 --- a/src/xml_staves.c +++ b/src/xml_staves.c @@ -1566,7 +1566,7 @@ for (xml_item *mi = measure->next; uschar *line_end = xml_get_attr_string(dt, US"line-end", NULL, FALSE); uschar *line_type = xml_get_attr_string(dt, US"line-type", NULL, FALSE); - BOOL isdashes = dt->name[0] == 'd'; + BOOL isdashes = dt->name[0] == 'd'; BOOL nojog = isdashes || (line_end != NULL && Ustrcmp(line_end, "none") == 0); int jogsize = nojog? 0:7; @@ -1587,7 +1587,7 @@ for (xml_item *mi = measure->next; sl->id = linechars[sn]; sl->mods = NULL; sl->flags = sflag_l | sflag_cx | sflag_abs; - if (isdashes) sl->flags |= sflag_h | sflag_i | sflag_ol | sflag_or; + if (isdashes) sl->flags |= sflag_h | sflag_i | sflag_ol | sflag_or; if (py < 0) { diff --git a/src/xml_tables.c b/src/xml_tables.c index 7118ab1..b0ae6b4 100644 --- a/src/xml_tables.c +++ b/src/xml_tables.c @@ -111,7 +111,7 @@ xml_elliststr xml_supported_elements[] = { { US"credit-type", NULL }, { US"credit-words", credit_words_attrs }, { US"cue", NULL }, - { US"dashes", dashes_attrs }, + { US"dashes", dashes_attrs }, { US"defaults", NULL }, { US"delayed-turn", turn_attrs }, { US"detached-legato", articulation_attrs },