abcm2ps-7.8.9/Changes0000644000175000017500000010421512417252216012460 0ustar jefjef---- Version 7.8.9 - 14/10/14 ---- Fix crash when %%combinevoices on beamed notes since 7.8.7 (reported by David Lacroix). Fix bad start/stop of ties since 7.8.4. Fix possible crash with %%alignbars. Fix crash when tune starting with grace note in the middle voice of a 3-voices staff. ---- Version 7.8.8 - 14/08/29 ---- Fix loss of indentation since 7.8.4 (reported by David Lacroix). Fix bad stem direction in lowest voice when invisible and visible rests at a same time in a measure since 7.8.4 (reported by Eric Reinbold). Fix crash when multi-rest at start of a second voice of a staff. ---- Version 7.8.7 - 14/08/09 ---- Fix crash when %%combinevoices and different beaming. Always remove the invisible rests at start of tune when L:auto. Fix some compilation warnings (reported by Daniel Branning). Fix bad split of tune into music lines (imported from 8.1.5) (reported by Stephen West). Fix bad horizontal offset of rests alone in a measure (reported by Stephen West). ---- Version 7.8.6 - 14/07/17 ---- Fix lack of source last character in syntax errors. Fix double information about the titles/subtitles in the PostScript output for (external) index generation since 7.8.5 (reported by Tim Macdonald). Fix double interpretation of '.' in "!p!.(c" (reported by David Lacroix). Fix the size of font of the page header/footer, broken in 7.8.5 (reported by Francis Stevens). ---- Version 7.8.5 - 14/07/01 ---- Add more information about the titles/subtitles in the PostScript output for (external) index generation (asked by Tim Macdonald). Add Δ (delta) in the known glyphs (asked by Chuck Boody). Fix some bad 'Line overfull' messages when automatic line break. Fix bad interval between staff systems according to %%staffsep (reported by Eric Reinbold and David Lacroix). Fix bad %%header/%%footer vertical offsets. Don't put the last music line on a new page when page overflow on W:. ---- Version 7.8.4 - 14/06/18 ---- Fix clash of voice name with staff when new voice after %%staves. Fix bad indentation when more staves further in the tune. Set the ties closer to the notes. Fix bad handling of '|' when first character in w: (reported by Alex Scheutzow). Check the floating voices in %%score/%%staves. Fix bad stem direction when %%combinevoices. Fix crash when measure bar numbering and less notes in the upper staff (reported by : J.Joao Almeida). Fix too big syntax error messages (reported by David Lacroix). Fix bad horizontal offset of full rests in voice overlay (reported by J.C.L.). ---- Version 7.8.3 - 14/05/23 ---- Fix too wide space between text paragraphs when not fill or justify. Fix crash when utf-8 and latin characters in a same file (reported by Henry Bley-Vroman). Change internal fonts to 'serif' on SVG output. Forbid rests in grace note sequences. Fix crash when rest in grace note sequence. Fix direction of ties in chords with odd number of notes. Fix bad direction of beam stub when last note with !beambr1! / !beambr2! (reported by David Lacroix). Fix crash when only P: or Q: in a generation sequence (reported by Henry Bley-Vroman). ---- Version 7.8.2 - 14/05/05 ---- Fix non-function of %%voice inside %%tune since some 7.5.x (reported by Gerhard Schacherl). Fix small internal problem with decorations. Fix position of accent marks (!>!) (reported by Paul Rosen). Fix bad margins when tune inside %%multicol (reported by A.B. Steen). Don't draw repeat brackets when bar between 2 staves. Fix lack of EOS in some internal strings (fixed by Olivier Levon). Fix bad guitar chord / annotation when '\' inside. Fix double transposition of 2 octaves when both %%abc2pscompat and octave= in K:/V:. Fix compilation warnings on MAC (reported by Chuck Boody). ---- Version 7.8.1 - 14/04/02 ---- Fix bad text justication with PostScript output (reported by Gerhard Schacherl). Fix loss of positions (decorations, lyrics..) when described in format file (reported by John Taylor). Fix loss of tie at end of line (reported by David Lacroix). Fix loss of vertical space above the staves (%%staffsep) since 7.6.10 (reported by David Lacroix). ---- Version 7.8.0 - 14/03/26 ---- Fix bad buffer size when blank after '-k'. Fix time shift when L:auto and multi-rests in 2nd voices. Fix bad %%abcm2ps and %%abc-charset when redefined inside previous tune. Fix loss of time signature when empty staff system at start of tune. Add 'forall', 'search' and string comparison to the mini PS interpreter (asked by Chuck Boody for easynotes.fmt). Fix bad handling of %%abcm2ps. Fix bad tie when %%combinevoices and chord behind measure bar and other symbol. ---- Version 7.7.2 - 14/03/07 ---- Fix loss of parameters after '--abcm2ps x' in command line. Fix loss of lyric word when note as last music line symbol. Fix bad handling of multi-rests when L:auto. Fix bad vertical of rests when no notes in voice and clef != treble. Fix lack of time signature at start of line when %%timewarn. Fix %%stretchstaff which did not work. Fix %%parskipfac for non fill/justified texts. Fix %%infoline in some cases. Fix %%combinevoices 0 and the rests. Fix %%break which could not be put in the tune header. Fix bad generation when SVG output of justified text. Fix bad %%voice filtering. Remove option '-u' (abs2pscompat in command line). Fix bad 'M' decoration when abc2pscompat. Fix bad duration of notes when grace notes and L:auto. Fix bad behaviour of '%%gstemdir 3' when at start of n-plet (reported by David Lacroix). ---- Version 7.7.1 - 14/02/18 ---- Fix crash when decoration at start of tune (reported by Jean-Luc Zins). ---- Version 7.7.0 - 14/02/17 ---- Fix bad indentation when new name of a voice appearing later in the music line. Fix bad rest offset when in 2nd voice and longer than notes of 1st voice. Fix bad tie when combinevoices and chord behind measure bar. Change again the behaviour of %%staffnonote. Set correct vertical space for elements of invisible staves. Don't output errors when w: found in ignored voice (not in %%staves). Add option 'opposite' in %%gstemdir (requested by David Lacroix). Fix documentation about the default value of %%staffnonote. Add line number in more 'Too many words..' error messages. Fix compilation warning. ---- Version 7.6.10 - 14/01/23 ---- Fix crash with rests in previous release (reported by David Lacroix). ---- Version 7.6.9 - 14/01/23 ---- Change the function name to 'fraction of tone' instead of 'fraction of semitone' when no 'microscale=', but '%%micronewps 1' !!compatibility!!. Add line number when 'Too many words in lyric line' error (reported by Seymour Shlien). Fix bad PS functions when K: with explicit list of microtone accidentals. Include glyphs for microscale=4. Set %%micronewps when 'microscale=' in K: or V:. Fix erroneous 'bad tie' when tie at end of line and clef change in the upper voice. Do %%tablature work again. Fix clash of rest with notes when rest between notes since 7.6.8 (reported by David Lacroix). Change the behaviour of %%staffnonote (asked by Atte André Jensen and Steve West). Fix crash when last music line contains only invisible rests and %%cfmt.measurenb >= 0. ---- Version 7.6.8 - 13/11/21 ---- Don't display the staves which contain only invisible rests. Keep the brace staff systems when '%%staffnonote 0' and at least one staff has some notes. Have better ties when clef or staff change. Have better vertical offset of rests in multi-voice tunes (reported by Eric Reinbold). Fix bad slur endpoint when above/below a tuplet. Have better display of mixed slurs and tuplets (asked by David Lacroix). Accept %%bgcolor for .xhtml output. Adjust the offset of elements in empty staves when '%%staffnonote 0'. Fix bad handling of tuplets with %%combinevoices, sometimes giving a program crash. Permit output to stdout with option '-v'. ---- Version 7.6.7 - 13/11/03 ---- Fix again bad tag in XHTML output (reported by David Lacroix). ---- Version 7.6.6 - 13/11/03 ---- Add page/sequence information in the SVG headers. Fix bad tag in XHTML output (reported by David Lacroix). ---- Version 7.6.5 - 13/11/02 ---- Fix bad SVG/XHTML output when '--' in the command line. Put program information in XHTML header only. ---- Version 7.6.4 - 13/11/01 ---- Add more information in svg images (program, command line, title for building index). Set no margin for XHTML printing. Adjust the scale of the SVG images. ---- Version 7.6.3 - 13/10/25 ---- Fix loss of line break when %%postscript at start of line. Fix bad SVG output when 'show' before 'stroke' or 'fill' (reported by David Lacroix). Fix bad position of elements built from PostScript code with 'ltr' in SVG rendering. (reported by David Lacroix). Update config.guess and config.sub from http://git.savannah.gnu.org/ (asked by Deepak C Shetty and Snehal). Add 'color="black"' in tag. Fix bad font of string starting with non-ascii character (PS output) (reported by David Lacroix). ---- Version 7.6.2 - 13/10/18 ---- Fix bad tie when ending note is combined with previous voice (reported by Brian J. Dumont). Fix loss of gchord/annotation when combine voices and both notes have guitar chord/annotation (reported by Atte André Jensen). Fix bad dash lines with SVG output (reported by David Lacroix). Accept XML character references in texts. Fix bad glyph names of characters greater than latin2 (reported by David Lacroix). ---- Version 7.6.1 - 13/10/16 ---- Fix bad staff system when %%staves with floating voices. Permit unlimited PS elements in SVG rendering. Fix memory overflow with PS 'getinterval' in SVG rendering. Fix loss of tempo when tune starts with invisible symbol (n-plet, P:..). Don't raise errors when "%%writefields w 0" and "+:xxx" lines of w:. Accept a string in 'cvx' for SVG output. Fix tuplet number vertical offset when slur starting/ending on a same note (reported by David Lacroix). Set a correct approximate width of the unicode characters of which the ending bits are ASCII control characters (reported by Mike Scott). Adjust the SVG output closer to PS: - greater font sizes, - smaller note heads, - thiner staff lines and stems. Update documentation about %%continueall. ---- Version 7.6.0 - 13/08/20 ---- Add build with ninja-build and clang. Fix %%staves parsing problem which could give bad PS output. %%glyph added. Change PS utf-8 handling !!compatibility!!. ---- Version 7.5.8 - 13/08/07 ---- Fix bad offset of rests when under the duration of an upper voice (reported by David Lacroix). Check '!' as linebreak only when does a linebreak. Accept latin names of guitar chords on %%transpose. Fix loss of lyrics under staff when %%alignbars. Do %%clip without start work again. Fix bad PS output when many lines in program command line. Apply L:auto to all voices when declared in the tune header. Fix L:auto when duration of auto measure > M: duration. Add more explanations in the file format.txt (thanks to Seymour Shlien). ---- Version 7.5.7 - 13/07/16 ---- Fix bad horizontal offset of EPS images (reported by Gerhard Schacherl). Fix bad clef change when 2 voices on the staff and invisible rests. Add 'L:auto'. Better vertical offset of rests when many voices per staff (reported by David Lacroix). Fix bad staff on multi-rest expansion when the voice goes later to an other staff. Fix bad line break when asked before a bar. Do %%clip work again. Fix bad music line breaks with %%break after generation restart. Fix bad music line breaks with %%barperline and generation restart (reported by David Lacroix). Add the command line option '-k'. Fix bad horizontal offset of stems in SVG output. ---- Version 7.5.6 - 13/06/17 ---- Have better horizontal spacing when music line is too much shrunk. Fix bad horizontal spacing when high long notes before measure bars (reported by Mike Scott). Handle more than 2 unison notes in chords (asked by Hudson Flávio Meneses Lacerda). Remove the shift of volume decorations which does not work well (reported by Jean-Luc Zins). Fix crash when beam to a repeated sequence (reported by Søren Bak Vestergaard). Fix abnormal slur when tuplet or slur over a repeated sequence (reported by Søren Bak Vestergaard). ---- Version 7.5.5 - 13/06/06 ---- Fix bad position of shifted volume decorations (reported by David Lacroix). Fix bad %%transpose of more than one octave down. Extend %%shiftunison (asked by David Lacroix). Keep the natural accidentals when transposing K:none (reported by David Lacroix). Fix bad handling of %%splittune (reported by Gerhard Schacherl). Allow back text insertion commands in tune header. Put the measure number a bit higher when at start of line with a key signature with sharps. Look to the next note for B stem direction when at start of bar (requested by Mike Scott). ---- Version 7.5.4 - 13/05/27 ---- Fix abnormal note shift when inverted voices in the staff since previous release. Accept %%ps the same as %%postscript (asked by David Lacroix). Fix crash with grace notes since previous release (reported by David Lacroix). Fix again bad accidentals of 2nd notes in a measure when transposing K:none (reported by David Lacroix). ---- Version 7.5.3 - 13/05/24 ---- Fix clash of stem and note when bigger stem due to beam (reported by Hudson Flávio Meneses Lacerda). Permit %%break in tune header (i.e. out of %%tune). Fix abnormal error when %%tune folowed by %%break. Have less width of explicit key signature with same accidentals at octave. Better handling of %%staffbreak. Fix lack of staves after %%staves and new staves. Fix bad line splitting with measure repeat (reported by Gerhard Schacherl). Fix bad vertical offset of tune on auto newpage (reported by Gerhard Schacherl). Fix the behaviour of "\n" in guitar chord since version 7.x.x (reported by Gerhard Schacherl). Don't raise error when %%textfont in tune header. Have smaller stems in some cases when the voices are inverted on a staff. Fix loss of deco/stem position/direction when declared in V: after T: / %%vskip / ... (reported by Colin Hume). Don't set natural accidentals when transposing K:none. Fix bad accidentals of 2nd notes in a measure when transposing K:none (reported by David Lacroix). Have half ties when clef or staff change (reported by David Webber). Don't shift a voice when no overlap with the previous one. Don't have one head when unison and different dots (reported by Hudson Flávio Meneses Lacerda). Center the repeat measure signs. Don't have any slur starting from measure repeat signs (reported by Søren Bak Vestergaard). Have a longer tie when the ending note is shifted. Vertically center the rests when alone in a staff (reported by Hudson Flávio Meneses Lacerda). Shift on the left the volume decorations (ff, pp..) when under a note with a stem down (asked by Hudson Flávio Meneses Lacerda). Fix loss of rest when %%combinevoices >= 0 and invisible 1st rest. Extend %%combinevoices and remove %%comball. Put the dot decorations on the stems (asked by Hudson Flávio Meneses Lacerda). Have a better tie vertical offset (asked by Hudson Flávio Meneses Lacerda). Fix loss of position/direction commands when after K: or T: inside tune (reported by Hudson Flávio Meneses Lacerda). Fix loss of tempo when 'y' at start of tune in secondary voice (reported by Hudson Flávio Meneses Lacerda). Don't allow text insertion commands in tune header. Fix bad horizontal offset of stem when unison and shifted note head (reported by Hudson Flávio Meneses Lacerda). Fix nested tuplets vertical offset when slurs (reported by Hudson Flávio Meneses Lacerda). Fix a crash when tune with only repeat bars (reported by Colin Hume). Fix a crash when K:none and %%transpose (reported by David Lacroix). ---- Version 7.5.2 - 13/03/22 ---- Fix bad display when %%combinevoice + %%comball and imbricated chords. Have wider horizontal space at end of music line when no bar. Fix a crash on explicit music break without a bar since previous version (reported by Hudson Flávio Meneses Lacerda). Define the page format in the PS output. This fixes page size problems when converting PS to PDF (asked by Martin Tarenskeen). Fix a loop when a tune ends with Z, a bar and a chord (reported by Hudson Flávio Meneses Lacerda). Check the number of measures of X/Z (multi-rests). ---- Version 7.5.1 - 13/03/17 ---- Fix some clashes of accidentals when same notes in 2 voices on the same staff (reported by Hudson Flávio Meneses Lacerda). Fix loss of line at end of %%tune/%%voice (reported by Hudson Flávio Meneses Lacerda). Fix bad handling of many %%voice's in %%tune (reported by Hudson Flávio Meneses Lacerda). Fix bad horizontal space when note with stem up followed by note with stem down (reported by Hudson Flávio Meneses Lacerda). Fix bad accidentals of tied notes when transpose with K:none (reported by David Lacroix). Have smaller vertical space for !emphasis! (accent) (asked by Hudson Flávio Meneses Lacerda). Have thicker slurs (asked by Hudson Flávio Meneses Lacerda). Have one more beam in feathered beams (asked by Hudson Flávio Meneses Lacerda). Fix bad note head when !beam-rall! on quavers (reported by Hudson Flávio Meneses Lacerda). Replace the clef of V: in case of voice filter with %%clef (reported by Hudson Flávio Meneses Lacerda). Fix bad handling of %%score/%%staves when found after %%voice (reported by Hudson Flávio Meneses Lacerda). Fix bad handling of %%beginxx/%%endxx with different abcm2ps pseudo-comment prefixes. (reported by Hudson Flávio Meneses Lacerda). Fix bad music line cut when less notes in the master voice and no bar at end of line (reported by Hudson Flávio Meneses Lacerda). Add 'true' and 'false' in the PS to SVG interpreter (asked by Hudson Flávio Meneses Lacerda). Fix bad PS output when 2 empty lines at end of a justified text sequence (reported by Hudson Flávio Meneses Lacerda). Fix crash when %%clef in %%voice (reported by Hudson Flávio Meneses Lacerda). Fix overlay voice inheritance (%%transpose and glyph placements). Apply %%transpose in tune header or after first K: to all voices. ---- Version 7.5.0 - 13/03/01 ---- Fix loss of multi-rest when alone in a music line. Fix clash of rests when 3 voices per staff (reported by David Lacroix). Fix loss of %%clef after first K:. Implement "^8" and "_8" in clef= and %%clef. Fix abnormal subtitle output when T: found outside of tune (reported by Henry Bley-Vroman). Fix bad transposition of chords (reported by Jean-Luc Zins). Don't scale the measure numbers when the first staff is scaled (asked by Hudson Flávio Meneses Lacerda). !! Accept 'clef=F' as 'clef=F,' !! (needed for ABC 2.1.1). Handle many times 'repeat 2 measures' (asked by Atte André Jensen). Permit a measure repeat to be at start of music line (asked by Atte André Jensen). Fix crash when measure repeat at start of music line (reported by Atte André Jensen). Don't output error when info-like 'x:' found outside of tune. ---- Version 7.4.2 - 13/02/13 ---- Fix bad vertical offset of Q: when %%text after first K:. Extend %%abcm2ps with up to 3 characters. Don't output the words after tune on %%leftmargin/rightmargin/scale. Fix bad horizontal place of the tune title when %%leftmargin after K: (reported by Tim Goetze). !! Don't start anymore a tune on T: !! (asked by Henry Bley-Vroman). Handle %%stafflines after %%score. Add missing definitions for Microsoft Visual Basic (reported by Jean-Luc Zins). Fix bad test of buffer overflow on command options (reported by Jean-Luc Zins). Remove extra invisible staff when %%score before %%vskip (reported by Tim Goetze). Fix bad warning message when "P: K: Q:" at end of line (reported by Jean-Luc Zins). Fix bad tune selection when many files in the command line (reported by Larry). Fix lack of slurs when beam on 2 staves (reported by David Lacroix). Fix abnormal natural signs after some %%transpose (reported by Jean-Luc Zins). ---- Version 7.4.1 - 13/02/11 ---- Better error messages when error found at end of ABC line. Warn on deprecated syntaxes of Q: (asked by Chuck Boody). Fix double slurs when beam on 2 staves (reported by David Lacroix). Extend %%repeat for working with many voices (reported by Atte André Jensen). ---- Version 7.4.0 - 13/01/29 ---- Do better transposition of microtonal tunes (asked by David Lacroix). Fix bad vertical offset of some decorations (dot, tenuto) when inverted stems and multi-voice (reported by David Lacroix). Use the glyphs of the simple accidentals of PS fonts instead of internal ones when they exist. !! Always use UTF-8 characters for simple accidentals (sharp, flat, natural) in PS output !! (see the new insertion of ellipsis in sample.abc) Fix double tie when beam continued on next line (reported by David Lacroix). Extend the %%voicescale possible values to [0.6 .. 1.5]. ---- Version 7.3.5 - 13/01/15 ---- Fix crash when "%%gchord hidden". ---- Version 7.3.4 - 13/01/08 ---- %%abcm2ps added. Bad octave in overlay voices when "octave=" in main voice (reported by Colin Hume). Let more slurs under the tuplets (asked by David Lacroix). Don't keep the K:'s with same key signature when %%keywarn is set (reported by Henry Bley-Vroman). ---- Version 7.3.3 - 12/12/14 ---- Remove some example files from the distribution. Draw the staves with spaces ('y') only and "%%staffnonote 1". Fix %%alignbars which was broken in 7.2.1. Set as tune global some info fields (K:, M: and Q:) and pseudo-comments after the first K: and middle-tune T:. Better note shifts of 3rd voice of a same staff. Change %%shiftunisson to %%shiftunison. In unison, shift the note with a down stem (reported by Paolo Minazzi). Fix bad output file when note head decoration since 7.3.2. %%voicescale added. Fix loss of %%indent since 7.2.2 (reported by David Lacroix). Remove the horizontal space of empty key signatures (reported by David Lacroix). Fix bad beam at end of voice overlay since 7.3.0 (reported by David Lacroix). ---- Version 7.3.2 - 12/12/07 ---- Don't do a page break after the tune title when %%scale after 1st K:. Fix clash of beams with grace notes when down stems. Display better slurs on grace notes with down stems. Fix abnormal error on w: ending with '\' (continuation). Fix loss of tempo (Q: in tune header) when %%scale/%%rightmargin/... after first K:. Fix again clash of slurs with decorations/tuplets/... Fix bad slurs when inside the staff since 7.3.0 (reported by David Lacroix). Fix %%select when tunes have blank lines (%%begintext..) (reported by Henry Bley-Vroman). ---- Version 7.3.1 - 12/11/28 ---- Fix left width of heads in flute.fmt. Fix the documentation about flute.fmt. Do %%ornament work. Add "hidden" in %%dynamic, %%gchord, %%ornament, %%vocal and %%volume. Don't do an error on the information field "r:". Fix no output when lack of "%%multicol end" (reported by Henry Bley-Vroman). Fix crash on "%%multicol end" with -E or -g. Handle "%% endxx" (space after %%) (reported by Henry Bley-Vroman). Check again if not enough words in lyrics (w:) (asked by Steve West). Handle ties from notes to grace notes (asked by David Lacroix). Fix bad width of hole on %%staffbreak multi-voice. Fix bad offset of the slurs since previous version (reported by David Lacroix). Don't display a key signature on %%transpose from K:none (reported by David Lacroix). ---- Version 7.3.0 - 12/11/17 ---- Don't let annotations move the next key or time signature to the right. Fix lack of key/time warnings at end of line (reported by Jean-Luc Zins). Don't continue beaming in voice overlay (reported by Jean-Luc Zins). Don't shift notes with guitar chord after repeat bracket with long text (reported by Norman Bearon). Fix bad ties from grace notes (reported by David Lacroix). !! Change %%stretchlast to a floating point value. !! Fix clash of slurs with decorations/tuplets/... (reported by John Walsh). ---- Version 7.2.2 - 12/11/07 ---- Fix bad bars between staves with %%score. Fix bad explicit line breaks after notes. Don't try to stretch the last music line when %%stretchlast 0 (reported by Chuck Boody). Fix too much space above the staff when scaled staff and P: or Q:. Fix left indentation when empty staves and %%staffnonote. Fix bad offset of measure numbers when 1st staff empty and %%staffnonote. Fix bad offset of measure numbers when 1st staff is scaled (reported by Hudson Flávio Meneses Lacerda). Change default value of %%hyphencont to 1 (asked by David Webber). Don't draw repeat brackets when bar between 2 staves (reported by David Webber). ---- Version 7.2.1 - 12/10/30 ---- Fix crash when centered decoration under staff at start of new staff system. Add %%breaklimit. Change the internal algorithm of automatic line breaking. (reported by Steve West). Fix loss of gchord/annot or bad font when scaled staves (reported by Hudson Flávio Meneses Lacerda). Fix bad vertical offset of lyrics when scaled staves and slurs in lower voice. Fix bad horizontal offset of lyrics on scaled staves. Handle the line breaks of the top voice only. Add %%staffscale and %%stafflines. Fix bad handling of '=' in M:none. Fix bad handling of %%barsperline when M:none (reported by David Lacroix). ---- Version 7.2.0 - 12/10/25 ---- Fix crash when mid-staff decoration in new voice at start of line (reported by David Lacroix). Add "ignore" as special U: value. Extend %%linebreak to * ; ? and @. !! Put the output annotations (-A) after the symbols. !! Add more symbols in output annotations (-A). Adjust the width scale of all fonts when set in %%font. Fix "error w: without music" in secondary voices when ABC version >= 2.1 (reported by Frédéric Aupépin). ---- Version 7.1.3 - 12/10/18 ---- Fix bad slur vertical offsets on scaled staves. Fix loss of key/time warning when preceeded by %%stave (reported by Mike Scott). Fix bad left side of staff systems when some %%score in the line. Handle the line breaks of all primary voices. Fix internal linkage errors. Fix error "w: without music" when Q: in tune header (reported by Frédéric Aupépin). Fix bad line width after some decorations in SVG output. Bad measure number after time signature change (reported by Jean-Luc Zins). Bad clef when P: or Q: between first K: and %%staves followed by K: or V: with a clef != treble (reported by Jean-Luc Zins). ---- Version 7.1.2 - 12/10/09 ---- Treat "%%writefield M 0". Add %%dblrepbar and draw :|: and :||: as :: (asked by Nils Liberg). Fix bad parsing of the "%abc-" at start of file. Do more control of ties between two different notes. Add %%keywarn (asked by John Chambers). Fix clash of subtitle and guitar chord since 7.1.1. Fix bad staff key signature when "| $ [P:] [K:] |" (reported by John Chambers). Fix bad staff key/time signatures when P: or Q: before K:/M: in tune (reported by John Chambers). Fix crash when %%continueall and music line cut on a bar with !beamon! (also when %%breakoneoln 0) and handle beams on two music lines (reported by Guido Gonzato). ---- Version 7.1.1 - 12/09/29 ---- Convert multi-rests of one measure to rests (reported by David Webber). Move the decorations to the last rest on multi-rest expand (reported by David Webber). Remove the test messages 'y_set i:-xx'. May change the guitar chord position (%%gchord) inside the tunes (and internal change of guitar chord / annotation handling). Add %%user. Add !beam-accel! and !beam-rall! (asked by Hudson Flávio Meneses Lacerda). Reduce a bit the space before the measure bars. ---- Version 7.1.0 - 12/09/13 ---- Fix bad accidentals when clef one octave higher or lower than normal. Add a letter to select a repeated measure in tune selection (asked by Hudson Flávio Meneses Lacerda). Fix bad music position in tune selection (%%break / %%clip) (reported by Hudson Flávio Meneses Lacerda). Fix lack of tune selection (%%break / %%clip) of the first measures (0 and 1) (reported by Hudson Flávio Meneses Lacerda). Remove extra vertical space between staves after a staff with no note (reported by Chuck Boody). Add "%%tune end" and authorize blank lines in %%tune sequences !! compatibility !! (asked by Hudson Flávio Meneses Lacerda). Change %%acccancel to %%cancelkey !! compatibility !!. Accept time signatures as "M:5 ((2+3)/4)" and "M:5 (2/4+3/4)". Display the parenthesis of "M:7/8 (3+2+2)" (reported by Guido Gonzato). ---- Version 7.0.16 - 12/09/06 ---- Fix bad measure numbering when contbarnb and "y" between "|" and "[number" (reported by Hudson Flávio Meneses Lacerda). Fix clash of measure numbering with key signature. Add 'microscale= in K: and V:. Fix bad handling of '/symbol' for "cvx" in the mini PS interpreter. Add %%micronewps. Fix abnormal new music line when Q: or P: followed by [V:x] and grace notes. Fix loss of tempo when second voice starting with grace notes (reported by Wim Rotty). ---- Version 7.0.15 - 12/08/27 ---- Fix %%transpose ignored in file or tune header (reported by David Webber). Fix octave= ignored when no clef= in K: and V: (reported by Alex Scheutzow). Add %%acccancel. ---- Version 7.0.14 - 12/07/22 ---- Fix crash with floating point sensitive machines as ARM. Remove the 'title only' selection in %%select. Extend the %%tune filter to the whole tune header. Fix bad file date in header/footer ('$d') when %%format in the ABC file (reported by D. Glenn Arthur Jr.). ---- Version 7.0.13 - 12/06/17 ---- Fix array overflow on %%writefields Q. Fix bad note heads when both normal and percussion voices in a same staff (reported by Frédéric Boulanger). Don't transpose the percussion voices. Fix bad expansion of 'Xn' when multi-staves (reported by Jose Joao Dias de Almeida). ---- Version 7.0.12 - 12/06/10 ---- Fix bad tie when at end of repeat and start of new repeat ("c- :|2 c") (reported by Nils Liberg). Fix crash when PS code at end of line since 7.0.11 (reported by David Lacroix). Fix loss of next lyric lines when error found in a w: line (reported by Nils Liberg). ---- Version 7.0.11 - 12/06/02 ---- Better hyphen in lyrics lines when big space between notes (reported by Nils Liberg). Fix presence of tempo when "%%writefields Q 0" before first K: (reported by Nils Liberg). Fix abnormal line with one note when line cut should be on a clef change (reported by Alex Scheutzow). Fix presence of meter at start of line when empty voice. Don't remove '%%' in %%beginps/%%endps sequences. Fix array overflow and possible crash with empty %%beginxxx/%endxxx (reported by Nils Liberg). ---- Version 7.0.10 - 12/05/28 ---- Extend %%voice to any options. Fix crash when K: without more symbol at end of tune (reported by Nils Liberg). Add %%stemdir, %%gstemdir and %%clef. Fix clash of '8' in clef with octave +/-8 (reported by David Lacroix). ---- Version 7.0.9 - 12/05/23 ---- Fix program loop when width of measure bigger than staff width. Fix bad last measure bar position again (reported by many people). Fix loss of music line break when line ending with grace note(s), note and no bar (reported by John Chambers). ---- Version 7.0.8 - 12/05/21 ---- Fix loss of paragraph break on empty lines. Fix crash in %%begintext with fill/justify and pango on an empty line. Fix bad offset of lyrics after tune when new page (reported by Christian Schnarr). Fix bad last measure bar position since 7.0.6. Handle 'X' (invisible multi-rest). Don't do "titletrim" when the length of last word of the title is greater than 4. Fix lack of tempo at start of tune when "%%writefields Q 0" is declared further in the tune. ---- Version 7.0.7 - 12/05/16 ---- Fix bad line numbers in errors and svg annotations (reported by Nils Liberg). ---- Version 7.0.6 - 12/05/13 ---- Fix lack of key signature when K: + clef inside music line. Fix lack of accidentals when spaces in the accidental list of K:. Fix placement errors when scaled voice or staff (reported by D. Glenn Arthur Jr.). Don't put a measure bar at end of line when the measure is incomplete (reported by Christian Schnarr). Fix ps2pdf error when unknown UTF-8 characters (reported by Nils Liberg). ---- Version 7.0.5 - 12/04/30 ---- Update the documentation: there is no %%ignore (reported-by D. Glenn Arthur Jr.). Bad offset of %%EPS since version 5.x.x (reported-by D. Glenn Arthur Jr.). Handle more lowercase to uppercase letters when %%titlecaps (reported by Christian Schnarr). ---- Version 7.0.4 - 12/03/31 ---- Fix loss of music after abc 2.0 continuation ('\'). Fix a loss of voices when appearing in a new %%staves/%%score. Handle the ABC 2.1 "w:" behaviour (with "+:"). Fix misplaced part (P:) when followed by K:, or M: (reported by Richard Walker). Accept 'K' in %%titleformat and (text) notes after tune. Crash when misplaced dble repeat bar in second voice at end of tune (reported by Simon Wascher). Fix X: value in title when ', The' at end of T: (reported by Paul Hardy). ---- Version 7.0.3 - 12/03/03 ---- Don't print the tempo in tune when '%%writefields Q 0' (reported by Martin Tarenskeen). Let less space at end of line when key signature change. Fix a scanning problem with the command line parameter '--header'. Update the %%staves/%%score in tune(s) when defined in %%tune. ---- Version 7.0.2 - 12/02/21 ---- Don't add the %%transpose values (reported by Alex Scheutzow). Accept empty K: as K:none. Fix lack of key signature change when exp accidental list of the same size. Fix bad slur on grace notes when staffscale != 1 (reported by Pete Showman). Treat 'I:' as '%%' (accept I:abc-include and I:abc-charset). Ignore %%sep and %%vskip when global and -E or -g. Accept any format parameter in %%tune sequences. Fix crash when some output needed in format files by ignoring %%text... Stop %%tune/%%voice options on empty lines. Fix %%abc2pscompat again. Fix some errors "??? buffer not empty:". Fix vertical offset problems on page breaks with %%multicol. Fix bad page header when %%multicol outside and inside tunes. Don't use pango when only accidentals in string (reported by John Collins). Ignore %%writefields when outputting %%titleformat (reported by Pete S). Reset the default standard title format when %%titleformat is empty. ---- Version 7.0.1 - 12/02/06 ---- Fix loss of music when voices disappear and reappear by %%score (reported by John Collins). Fix some warnings in slre.c compilation (reported by Chuck Boody). Add %%custos. Fix some cases of error "Line too much shrunk". Bad computation of the page height letting to much space in (portrait) or going out of (landscape) the bottom of the page when using %%multicol. ---- Version 7.0.0 - 12/02/02 ---- Permit more pseudo-comments to be defined at command-line level. Add %%tune, %%voice, %%break, %%clip and %%select. Add tune selection with '-e' by regular expression. Permit the clefs to go under or above the notes/rests. Creation from abcm2ps version 6.6.4. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/INSTALL�������������������������������������������������������������������������������0000644�0001750�0001750�00000003312�11336716162�012216� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� --- abcm2ps installation --- Unix(-like) systems =================== This version uses the GNU 'autoconf' package, so, after untarring the sources, run: ./configure make and then, as root, do: make install The 'abcm2ps' command should work if '/usr/local/bin' is in your path (try 'abcm2ps -h' for a list of the command line options). You may change some compile options at configure level. To know which, run: configure --help Windows or MAC systems ====================== Change the file 'config.h' according to your preferences, compile all the '.c' files using an ANSI C compiler, and link them together. The resulting binary file should run immediately from where it has been generated. You may then move it at any place you want. Testing ======= To test the program, run it with one of the .abc files as the command line argument: abcm2ps sample The resulting file, 'Out.ps', may be displayed using a PostScript previewer such as ghostscript, or may be sent directly to a PostScript printer, or indirectly to a simple printer using a postscript filter. About the 'pango' library ========================= abcm2ps now uses the 'pango' library to render texts with non latin characters. If you don't have such texts, you don't need this library. In Unix(-like) systems, at configure time, the pango generation elements are searched by pkg-config in the gdk-2.0 library. If this library or pkg_config are not found, the rendering of non latin characters with pango will be disabled, but this rendering may be done by other means, especially by CMap (see the file chinese.abc). Note also that, when pango is defined, it may be disabled at command line level by '--pango 0' (you may try it with chinese.abc). ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/License�������������������������������������������������������������������������������0000644�0001750�0001750�00000043076�07005373333�012502� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/Makefile������������������������������������������������������������������������������0000644�0001750�0001750�00000007422�12417252344�012631� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile source for abcm2ps VERSION = 7.8.9 CC = gcc INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} CPPFLAGS = -DHAVE_CONFIG_H -I. CPPPANGO = CFLAGS = -g -O2 -Wall -pipe LDFLAGS = -lm prefix = /usr/local exec_prefix = ${prefix} srcdir = . bindir = ${exec_prefix}/bin libdir = ${exec_prefix}/lib datadir = ${prefix}/share docdir = /usr/local/doc # unix OBJECTS=abc2ps.o \ abcparse.o buffer.o deco.o draw.o format.o front.o glyph.o music.o parse.o \ slre.o subs.o svg.o syms.o abcm2ps: $(OBJECTS) $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) $(OBJECTS): abcparse.h config.h Makefile abc2ps.o buffer.o deco.o draw.o format.o front.o glyph.o music.o parse.o \ subs.o svg.o syms.o: abc2ps.h abc2ps.o front.o: front.h front.o parse.o slre.o: slre.h subs.o: subs.c $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPPANGO) -c -o $@ $< abcmfe: front.c front.h slre.h $(CC) $(CFLAGS) -DMAIN -o $@ $< slre.o DOCFILES=$(addprefix $(srcdir)/,Changes License README *.abc *.eps *.txt) install: abcm2ps mkdir -p $(bindir); \ mkdir -p $(datadir)/abcm2ps; \ mkdir -p $(docdir)/abcm2ps; \ $(INSTALL_PROGRAM) abcm2ps $(bindir) for f in $(srcdir)/*.fmt; do \ $(INSTALL_DATA) $$f $(datadir)/abcm2ps; \ done for f in $(DOCFILES); do \ $(INSTALL_DATA) $$f $(docdir)/abcm2ps; \ done uninstall: echo "uninstalling..."; \ rm -f $(bindir)/abcm2ps; \ rm -rf $(datadir)/abcm2ps; \ rm -rf $(docdir)/abcm2ps DIST_FILES = \ abcm2ps-$(VERSION)/Changes \ abcm2ps-$(VERSION)/INSTALL \ abcm2ps-$(VERSION)/License \ abcm2ps-$(VERSION)/Makefile \ abcm2ps-$(VERSION)/Makefile.in \ abcm2ps-$(VERSION)/README \ abcm2ps-$(VERSION)/abc2ps.c \ abcm2ps-$(VERSION)/abc2ps.h \ abcm2ps-$(VERSION)/abcparse.c \ abcm2ps-$(VERSION)/abcparse.h \ abcm2ps-$(VERSION)/accordion.abc \ abcm2ps-$(VERSION)/build.ninja \ abcm2ps-$(VERSION)/buffer.c \ abcm2ps-$(VERSION)/chinese.abc \ abcm2ps-$(VERSION)/configure \ abcm2ps-$(VERSION)/configure.in \ abcm2ps-$(VERSION)/config.h \ abcm2ps-$(VERSION)/config.h.in \ abcm2ps-$(VERSION)/config.guess \ abcm2ps-$(VERSION)/config.sub \ abcm2ps-$(VERSION)/deco.c \ abcm2ps-$(VERSION)/deco.abc \ abcm2ps-$(VERSION)/draw.c \ abcm2ps-$(VERSION)/features.txt \ abcm2ps-$(VERSION)/flute.fmt \ abcm2ps-$(VERSION)/format.c \ abcm2ps-$(VERSION)/format.txt \ abcm2ps-$(VERSION)/front.c \ abcm2ps-$(VERSION)/front.h \ abcm2ps-$(VERSION)/glyph.c \ abcm2ps-$(VERSION)/install.sh \ abcm2ps-$(VERSION)/landscape.fmt \ abcm2ps-$(VERSION)/music.c \ abcm2ps-$(VERSION)/musicfont.fmt \ abcm2ps-$(VERSION)/newfeatures.abc \ abcm2ps-$(VERSION)/options.txt \ abcm2ps-$(VERSION)/parse.c \ abcm2ps-$(VERSION)/sample.abc \ abcm2ps-$(VERSION)/sample2.abc \ abcm2ps-$(VERSION)/sample3.abc \ abcm2ps-$(VERSION)/sample3.eps \ abcm2ps-$(VERSION)/sample4.abc \ abcm2ps-$(VERSION)/sample5.abc \ abcm2ps-$(VERSION)/slre.c \ abcm2ps-$(VERSION)/slre.h \ abcm2ps-$(VERSION)/subs.c \ abcm2ps-$(VERSION)/svg.c \ abcm2ps-$(VERSION)/syms.c \ abcm2ps-$(VERSION)/tight.fmt \ abcm2ps-$(VERSION)/voices.abc dist: ln -s . abcm2ps-$(VERSION); \ tar -zcvf abcm2ps-$(VERSION).tar.gz $(DIST_FILES); \ rm abcm2ps-$(VERSION) zip-dist: ln -s . abcm2ps-$(VERSION); \ zip -r abcm2ps-$(VERSION).zip $(DIST_FILES); \ rm abcm2ps-$(VERSION) zip: abcm2ps.exe strip abcm2ps.exe; \ cd ..; zip -r abcm2ps-$(VERSION).zip \ abcm2ps-$(VERSION)/abcm2ps.exe \ abcm2ps-$(VERSION)/License \ abcm2ps-$(VERSION)/Changes \ abcm2ps-$(VERSION)/INSTALL \ abcm2ps-$(VERSION)/sample3.eps \ abcm2ps-$(VERSION)/*.abc \ abcm2ps-$(VERSION)/*.fmt \ abcm2ps-$(VERSION)/*.txt ; cd - EXAMPLES = accordion.ps \ chinese.ps \ deco.ps \ newfeatures.ps \ sample.ps \ sample2.ps \ sample3.ps \ sample4.ps \ sample5.ps \ voices.ps test: $(EXAMPLES) %.ps: %.abc ./abcm2ps -O $@ $< clean: rm -f *.o $(EXAMPLES) # *.obj ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/Makefile.in���������������������������������������������������������������������������0000644�0001750�0001750�00000007434�12243365635�013246� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile source for abcm2ps VERSION = @VERSION@ CC = @CC@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ CPPFLAGS = @DEFS@ @CPPFLAGS@ -I. CPPPANGO = @CPPPANGO@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ -lm prefix = @prefix@ exec_prefix = @exec_prefix@ srcdir = @srcdir@ VPATH = @srcdir@ bindir = @bindir@ libdir = @libdir@ datadir = @datarootdir@ docdir = @prefix@/doc # unix OBJECTS=abc2ps.o \ abcparse.o buffer.o deco.o draw.o format.o front.o glyph.o music.o parse.o \ slre.o subs.o svg.o syms.o abcm2ps: $(OBJECTS) $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) $(OBJECTS): abcparse.h config.h Makefile abc2ps.o buffer.o deco.o draw.o format.o front.o glyph.o music.o parse.o \ subs.o svg.o syms.o: abc2ps.h abc2ps.o front.o: front.h front.o parse.o slre.o: slre.h subs.o: subs.c $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPPANGO) -c -o $@ $< abcmfe: front.c front.h slre.h $(CC) $(CFLAGS) -DMAIN -o $@ $< slre.o DOCFILES=$(addprefix $(srcdir)/,Changes License README *.abc *.eps *.txt) install: abcm2ps mkdir -p $(bindir); \ mkdir -p $(datadir)/abcm2ps; \ mkdir -p $(docdir)/abcm2ps; \ $(INSTALL_PROGRAM) abcm2ps $(bindir) for f in $(srcdir)/*.fmt; do \ $(INSTALL_DATA) $$f $(datadir)/abcm2ps; \ done for f in $(DOCFILES); do \ $(INSTALL_DATA) $$f $(docdir)/abcm2ps; \ done uninstall: echo "uninstalling..."; \ rm -f $(bindir)/abcm2ps; \ rm -rf $(datadir)/abcm2ps; \ rm -rf $(docdir)/abcm2ps DIST_FILES = \ abcm2ps-$(VERSION)/Changes \ abcm2ps-$(VERSION)/INSTALL \ abcm2ps-$(VERSION)/License \ abcm2ps-$(VERSION)/Makefile \ abcm2ps-$(VERSION)/Makefile.in \ abcm2ps-$(VERSION)/README \ abcm2ps-$(VERSION)/abc2ps.c \ abcm2ps-$(VERSION)/abc2ps.h \ abcm2ps-$(VERSION)/abcparse.c \ abcm2ps-$(VERSION)/abcparse.h \ abcm2ps-$(VERSION)/accordion.abc \ abcm2ps-$(VERSION)/build.ninja \ abcm2ps-$(VERSION)/buffer.c \ abcm2ps-$(VERSION)/chinese.abc \ abcm2ps-$(VERSION)/configure \ abcm2ps-$(VERSION)/configure.in \ abcm2ps-$(VERSION)/config.h \ abcm2ps-$(VERSION)/config.h.in \ abcm2ps-$(VERSION)/config.guess \ abcm2ps-$(VERSION)/config.sub \ abcm2ps-$(VERSION)/deco.c \ abcm2ps-$(VERSION)/deco.abc \ abcm2ps-$(VERSION)/draw.c \ abcm2ps-$(VERSION)/features.txt \ abcm2ps-$(VERSION)/flute.fmt \ abcm2ps-$(VERSION)/format.c \ abcm2ps-$(VERSION)/format.txt \ abcm2ps-$(VERSION)/front.c \ abcm2ps-$(VERSION)/front.h \ abcm2ps-$(VERSION)/glyph.c \ abcm2ps-$(VERSION)/install.sh \ abcm2ps-$(VERSION)/landscape.fmt \ abcm2ps-$(VERSION)/music.c \ abcm2ps-$(VERSION)/musicfont.fmt \ abcm2ps-$(VERSION)/newfeatures.abc \ abcm2ps-$(VERSION)/options.txt \ abcm2ps-$(VERSION)/parse.c \ abcm2ps-$(VERSION)/sample.abc \ abcm2ps-$(VERSION)/sample2.abc \ abcm2ps-$(VERSION)/sample3.abc \ abcm2ps-$(VERSION)/sample3.eps \ abcm2ps-$(VERSION)/sample4.abc \ abcm2ps-$(VERSION)/sample5.abc \ abcm2ps-$(VERSION)/slre.c \ abcm2ps-$(VERSION)/slre.h \ abcm2ps-$(VERSION)/subs.c \ abcm2ps-$(VERSION)/svg.c \ abcm2ps-$(VERSION)/syms.c \ abcm2ps-$(VERSION)/tight.fmt \ abcm2ps-$(VERSION)/voices.abc dist: ln -s . abcm2ps-$(VERSION); \ tar -zcvf abcm2ps-$(VERSION).tar.gz $(DIST_FILES); \ rm abcm2ps-$(VERSION) zip-dist: ln -s . abcm2ps-$(VERSION); \ zip -r abcm2ps-$(VERSION).zip $(DIST_FILES); \ rm abcm2ps-$(VERSION) zip: abcm2ps.exe strip abcm2ps.exe; \ cd ..; zip -r abcm2ps-$(VERSION).zip \ abcm2ps-$(VERSION)/abcm2ps.exe \ abcm2ps-$(VERSION)/License \ abcm2ps-$(VERSION)/Changes \ abcm2ps-$(VERSION)/INSTALL \ abcm2ps-$(VERSION)/sample3.eps \ abcm2ps-$(VERSION)/*.abc \ abcm2ps-$(VERSION)/*.fmt \ abcm2ps-$(VERSION)/*.txt ; cd - EXAMPLES = accordion.ps \ chinese.ps \ deco.ps \ newfeatures.ps \ sample.ps \ sample2.ps \ sample3.ps \ sample4.ps \ sample5.ps \ voices.ps test: $(EXAMPLES) %.ps: %.abc ./abcm2ps -O $@ $< clean: rm -f *.o $(EXAMPLES) # *.obj ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/README��������������������������������������������������������������������������������0000644�0001750�0001750�00000005121�12024034430�012027� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� --- abcm2ps version 7.x.x --- Overview ======== abcm2ps is a program which converts music tunes from ABC format to PostScript or SVG. Based on abc2ps version 1.2.5 (see Contacts below), it was developped mainly to print barock organ scores which have independant voices played on one or many keyboards and a pedal-board (the 'm' of abcm2ps stands for many or multi staves/voices). Features ======== The main features of abcm2ps are quite the same as the abc2ps ones, but they are closer to the ABC standard 2.0 (draft IV - 14/8/2003): http://abc.sourceforge.net/standard/abc2-draft.html Installation and usage ====================== The installation procedure is described in the file INSTALL. Basically, the program usage is: abcm2ps [options] file1 [file1_options] file2 [file2_options] ... where file1, file2, .. are the ABC input files. This will generate a Postscript file (default name: 'Out.ps' - run 'abcm2ps -h' to know the list of the command line options). Documentation ============= - options.txt contains the list of the command line options. - format.txt contains the list of the format parameters. - features.txt lists the differences from the current ABC standard. Differences with abc2ps ======================= - the algorithms relative to voice and staff handling are different and may give better or worse results depending on the tunes. - abcm2ps does not print the list of tunes and has different filtering functions. On the command line: - '-o' is implicit - '-e' accepts only one parameter. - '-C', '-R', '-S', '-T' don't exist anymore. If you want such filtering, you should to use some external script or program instead. - There is no interactive mode ('-i'). - The scale is global (it was restricted to the music part in abc2ps). - The characters '\\' don't do a line break. - In landscape format, the values of 'pagewidth' and 'pageheight' are internally exchanged, so there is no need to set them explicitely. - The format 'staffwidth' is obsolete. Use 'pagewidth' instead. - Look also in the file 'sample.abc' for other incompatibilities. Limits ====== Many limits may be changed at compilation time (number of voices, staves, ..). Contacts ======== The primary abcm2ps site is: http://moinejf.free.fr/ Guido Gonzatto maintains Win32 and RedHat binaries and some more documentation at: http://abcplus.sourceforge.net/ abc2ps was developped by Michael Methfessel: http://www.ihp-ffo.de/~msm/ mailto:msm@ihp-ffo.de To know more about the ABC notation, have a look at: http://abcnotation.com/ For any comment: mailto:moinejf (at) free (dot) fr �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/abc2ps.c������������������������������������������������������������������������������0000644�0001750�0001750�00000053644�12314505364�012515� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * abcm2ps: a program to typeset tunes written in ABC format using PostScript * * Copyright (C) 1998-2014 Jean-François Moine (http://moinejf.free.fr) * * Adapted from abc2ps-1.2.5: * Copyright (C) 1996,1997 Michael Methfessel (msm@ihp-ffo.de) * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ #include #include #include #include #include #include #include #ifdef linux #include #endif #include "abc2ps.h" #include "front.h" /* -- global variables -- */ INFO info; unsigned char deco[256]; struct SYMBOL *sym; /* (points to the symbols of the current voice) */ int tunenum; /* number of current tune */ int pagenum = 1; /* current page in output file */ /* switches modified by command line flags: */ int quiet; /* quiet mode */ int secure; /* secure mode */ int annotate; /* output source references */ int pagenumbers; /* write page numbers */ int epsf; /* for EPSF (1) or SVG (2) output */ int svg; /* SVG (1) or XML (2 - HTML + SVG) output */ int showerror; /* show the errors */ char outfn[FILENAME_MAX]; /* output file name */ int file_initialized; /* for output file */ FILE *fout; /* output file */ char *in_fname; /* current input file name */ time_t mtime; /* last modification time of the input file */ static time_t fmtime; /* " " of all files */ int s_argc; /* command line arguments */ char **s_argv; struct tblt_s *tblts[MAXTBLT]; struct cmdtblt_s cmdtblts[MAXCMDTBLT]; int ncmdtblt; /* -- local variables -- */ static char abc_fn[FILENAME_MAX]; /* buffer for ABC file name */ static char *styd = DEFAULT_FDIR; /* format search directory */ static int def_fmt_done = 0; /* default format read */ static struct SYMBOL notitle; /* memory arena (for clrarena, lvlarena & getarena) */ #define MAXAREAL 3 /* max area levels: * 0; global, 1: tune, 2: generation */ #define AREANASZ 8192 /* standard allocation size */ #define MAXAREANASZ 0x20000 /* biggest allocation size */ static int str_level; /* current arena level */ static struct str_a { struct str_a *n; /* next area */ char *p; /* pointer in area */ int r; /* remaining space in area */ int sz; /* size of str[] */ char str[2]; /* start of memory area */ } *str_r[MAXAREAL], *str_c[MAXAREAL]; /* root and current area pointers */ /* -- local functions -- */ static void read_def_format(void); static void treat_file(char *fn, char *ext); static FILE *open_ext(char *fn, char *ext) { FILE *fp; char *p; if ((fp = fopen(fn, "rb")) != NULL) return fp; if ((p = strrchr(fn, DIRSEP)) == NULL) p = fn; if (strrchr(p, '.') != NULL) return NULL; strcat(p, "."); strcat(p, ext); if ((fp = fopen(fn, "rb")) != NULL) return fp; return NULL; } /* -- open a file for reading -- */ FILE *open_file(char *fn, /* file name */ char *ext, /* file type */ char *rfn) /* returned real file name */ { FILE *fp; char *p; int l; /* if there was some ABC file, try its directory */ if (in_fname && in_fname != fn && (p = strrchr(in_fname, DIRSEP)) != NULL) { l = p - in_fname + 1; strncpy(rfn, in_fname, l); strcpy(&rfn[l], fn); if ((fp = open_ext(rfn, ext)) != NULL) return fp; } /* try locally */ strcpy(rfn, fn); if ((fp = open_ext(rfn, ext)) != NULL) return fp; /* try a format in the format directory */ if (*ext != 'f' || *styd == '\0') return NULL; l = strlen(styd) - 1; if (styd[l] == DIRSEP) sprintf(rfn, "%s%s", styd, fn); else sprintf(rfn, "%s%c%s", styd, DIRSEP, fn); return open_ext(rfn, ext); } /* -- read a whole input file -- */ /* the real/full file name is put in tex_buf[] */ static char *read_file(char *fn, char *ext) { size_t fsize; FILE *fin; char *file; if (*fn == '\0') { strcpy(tex_buf, "stdin"); fsize = 0; file = malloc(8192); for (;;) { int l; l = fread(&file[fsize], 1, 8192, stdin); fsize += l; if (l != 8192) break; file = realloc(file, fsize + 8192); } if (ferror(stdin) != 0) { free(file); return 0; } if (fsize % 8192 == 0) file = realloc(file, fsize + 2); time(&fmtime); } else { struct stat sbuf; fin = open_file(fn, ext, tex_buf); if (!fin) return NULL; if (fseek(fin, 0L, SEEK_END) < 0) { fclose(fin); return NULL; } fsize = ftell(fin); rewind(fin); if ((file = malloc(fsize + 2)) == NULL) { fclose(fin); return NULL; } if (fread(file, 1, fsize, fin) != fsize) { fclose(fin); free(file); return NULL; } fstat(fileno(fin), &sbuf); memcpy(&fmtime, &sbuf.st_mtime, sizeof fmtime); fclose(fin); } file[fsize] = '\0'; return file; } /* call back to handle %%format/%%abc-include - see front.c */ static void include_cb(unsigned char *fn) { char abc_fn_sav[FILENAME_MAX]; strcpy(abc_fn_sav, abc_fn); treat_file((char *) fn, "fmt"); strcpy(abc_fn, abc_fn_sav); } /* -- treat an input file and generate the ABC file -- */ static void treat_file(char *fn, char *ext) { struct abctune *t; char *file, *file2; int file_type, l; static int nbfiles; if (nbfiles > 2) { error(1, 0, "Too many included files"); return; } /* initialize if not already done */ if (!fout) read_def_format(); /* read the file into memory */ /* the real/full file name is in tex_buf[] */ if ((file = read_file(fn, ext)) == NULL) { if (strcmp(fn, "default.fmt") != 0) { error(1, NULL, "Cannot read the input file '%s'", fn); #if defined(unix) || defined(__unix__) perror(" read_file"); #endif } return; } if (!quiet) fprintf(stderr, "File %s\n", tex_buf); /* convert the strings */ l = strlen(tex_buf); if (strcmp(&tex_buf[l - 3], ".ps") == 0) { file_type = FE_PS; frontend((unsigned char *) "%%beginps\n", 0); } else if (strcmp(&tex_buf[l - 4], ".fmt") == 0) { file_type = FE_FMT; } else { file_type = FE_ABC; strcpy(abc_fn, tex_buf); in_fname = abc_fn; mtime = fmtime; } nbfiles++; file2 = (char *) frontend((unsigned char *) file, file_type); nbfiles--; free(file); if (file_type == FE_PS) /* PostScript file */ file2 = (char *) frontend((unsigned char *) "%%endps", 0); if (nbfiles > 0) /* if %%format */ return; /* don't free the preprocessed buffer */ // memcpy(&deco_tune, &deco_glob, sizeof deco_tune); if (file_type == FE_ABC) { /* if ABC file */ // if (!epsf) // open_output_file(); clrarena(1); /* clear previous tunes */ } t = abc_parse(file2); free(file2); front_init(0, 0, include_cb); /* reinit the front-end */ if (!t) { if (file_type == FE_ABC) error(1, NULL, "File '%s' is empty!", tex_buf); return; } while (t) { if (t->first_sym) /*fixme:last tune*/ do_tune(t); /* generate */ t = t->next; } /* abc_free(t); (useless) */ } /* -- read the default format -- */ static void read_def_format(void) { if (def_fmt_done) return; def_fmt_done = 1; treat_file("default.fmt", "fmt"); } /* -- set extension on a file name -- */ void strext(char *fn, char *ext) { char *p, *q; if ((p = strrchr(fn, DIRSEP)) == NULL) p = fn; if ((q = strrchr(p, '.')) == NULL) strcat(p, "."); else q[1] = '\0'; strcat(p, ext); } /* -- write the program version -- */ static void display_version(int full) { fputs("abcm2ps-" VERSION " (" VDATE ")\n", stderr); if (!full) return; fputs("Compiled: " __DATE__ "\n" "Options:" #ifdef A4_FORMAT " A4_FORMAT" #endif #ifdef DECO_IS_ROLL " DECO_IS_ROLL" #endif #ifdef HAVE_PANGO " PANGO" #endif #if !defined(A4_FORMAT) && !defined(DECO_IS_ROLL) && !defined(HAVE_PANGO) " NONE" #endif "\n", stderr); if (styd[0] != '\0') fprintf(stderr, "Default format directory: %s\n", styd); } /* -- display usage and exit -- */ static void usage(void) { display_version(0); printf( "ABC to Postscript translator.\n" "Usage: abcm2ps [options] file [file_options] ..\n" "where:\n" " file input ABC file, or '-'\n" " options and file_options:\n" " .output file options:\n" " -E produce EPSF output, one tune per file\n" " -g produce SVG output, one tune per file\n" " -v produce SVG output, one page per file\n" " -X produce SVG output in one XHTML file\n" " -O fff set outfile name to fff\n" " -O = make outfile name from infile/title\n" " -i indicate where are the errors\n" " -k kk size of the PS output buffer in Kibytes\n" " .output formatting:\n" " -s xx set scale factor to xx\n" " -w xx set staff width (cm/in/pt)\n" " -m xx set left margin (cm/in/pt)\n" " -d xx set staff separation (cm/in/pt)\n" " -a xx set max shrinkage to xx (between 0 and 1)\n" " -F foo read format file \"foo.fmt\"\n" " -D bar look for format files in directory \"bar\"\n" " .output options:\n" " -l landscape mode\n" " -I xx indent 1st line (cm/in/pt)\n" " -x add xref numbers in titles\n" " -M don't output the lyrics\n" " -N n set page numbering mode to n=\n" " 0=off 1=left 2=right 3=even left,odd right 4=even right,odd left\n" " -1 write one tune per page\n" " -G no slur in grace notes\n" " -j n[b] number the measures every n bars (or on the left if n=0)\n" " if 'b', display in a box\n" " -b n set the first measure number to n\n" " -f have flat beams\n" " -T n[v] output the tablature 'n' for voice 'v' / all voices\n" " .line breaks:\n" " -c auto line break\n" " -B n break every n bars\n" " .input file selection/options:\n" " -e pattern\n" " tune selection\n" " .help/configuration:\n" " -V show program version\n" " -h show this command summary\n" " -H show the format parameters\n" " -S secure mode\n" " -q quiet mode\n"); exit(EXIT_SUCCESS); } #ifdef linux /* -- where is the default format directory -- */ static void wherefmtdir(void) { char exe[512], *p; FILE *f; int l; if ((l = readlink("/proc/self/exe", exe, sizeof exe)) <= 0) return; if ((p = strrchr(exe, '/')) == NULL) return; p++; if (p > &exe[5] && strncmp(p - 5, "/bin", 4) == 0) { strcpy(p - 4, "share/abcm2ps/"); p += -4 + 14; } /* else, assume this is the source directory */ /* check if a format file is present */ strcpy(p, "tight.fmt"); if ((f = fopen(exe, "r")) == NULL) return; fclose(f); /* change the format directory */ p[-1] = '\0'; styd = strdup(exe); } #endif /* -- parse the tablature command ('-T n[v]') -- */ static struct cmdtblt_s *cmdtblt_parse(char *p) { struct cmdtblt_s *cmdtblt; short val; if (ncmdtblt >= MAXCMDTBLT) { error(1, NULL, "++++ Too many '-T'"); return NULL; } if (*p == '\0') val = -1; else { val = *p++ - '0' - 1; if ((unsigned) val > MAXTBLT) { error(1, NULL, "++++ Bad tablature number in '-T'\n"); return 0; } } cmdtblt = &cmdtblts[ncmdtblt++]; cmdtblt->index = val; cmdtblt->vn = p; return cmdtblt; } /* set a command line option */ static void set_opt(char *w, char *v) { static char prefix = '%'; /* pseudo-comment prefix */ if (!v) v = ""; if (strlen(w) + strlen(v) >= TEX_BUF_SZ - 10) { error(1, NULL, "Command line '%s' option too long", w); return; } sprintf(tex_buf, /* this buffer is available */ "%%%c%s %s lock\n", prefix, w, v); if (strcmp(w, "abcm2ps") == 0) prefix = *v; frontend((unsigned char *) tex_buf, 0); } /* -- main program -- */ int main(int argc, char **argv) { unsigned j; char *p, c, *aaa; if (argc <= 1) usage(); /* set the global flags */ s_argc = argc; s_argv = argv; aaa = NULL; while (--argc > 0) { argv++; p = *argv; if (*p != '-' || p[1] == '-') { if (*p == '+' && p[1] == 'F') /* +F : no default format */ def_fmt_done = 1; continue; } while ((c = *++p) != '\0') { /* '-xxx' */ switch (c) { case 'E': svg = 0; /* EPS */ epsf = 1; break; case 'g': svg = 0; /* SVG one file per tune */ epsf = 2; break; case 'h': usage(); /* no return */ case 'q': quiet = 1; break; case 'S': secure = 1; break; case 'V': display_version(1); return EXIT_SUCCESS; case 'v': svg = 1; /* SVG one file per pagee */ epsf = 0; break; case 'X': svg = 2; /* SVG/XHTML */ epsf = 0; break; case 'k': if (p[1] == '\0') { if (--argc <= 0) { error(1, NULL, "No value for '-k' - aborting"); return EXIT_FAILURE; } aaa = *++argv; } else { aaa = p + 1; p += strlen(p) - 1; } break; default: if (strchr("aBbDdeFfIjmNOsTw", c)) /* if with arg */ p += strlen(p) - 1; /* skip */ break; } } } if (!quiet) display_version(0); /* initialize */ outfn[0] = '\0'; clrarena(0); /* global */ clrarena(1); /* tunes */ clrarena(2); /* generation */ if (aaa) { /* '-k' output buffer size */ int kbsz; sscanf(aaa, "%d", &kbsz); init_outbuf(kbsz); } else { init_outbuf(0); } abc_init(getarena, /* alloc */ 0, /* free */ (void (*)(int level)) lvlarena, /* new level */ sizeof(struct SYMBOL) - sizeof(struct abcsym), 0); /* don't keep comments */ // memset(&info, 0, sizeof info); info['T' - 'A'] = ¬itle; notitle.as.text = "T:"; set_format(); reset_deco(); front_init(0, 0, include_cb); #ifdef linux /* if not set, try to find where is the default format directory */ if (styd[0] == '\0') wherefmtdir(); #endif #ifdef HAVE_PANGO pg_init(); #endif /* parse the arguments - finding a new file, treat the previous one */ argc = s_argc; argv = s_argv; while (--argc > 0) { argv++; p = *argv; if ((c = *p) == '\0') continue; if (c == '-') { int i; if (p[1] == '\0') { /* '-' alone */ if (in_fname) { treat_file(in_fname, "abc"); frontend((unsigned char *) "select\n", 0); } in_fname = ""; /* read from stdin */ continue; } i = strlen(p) - 1; if (p[i] == '-' && p[1] != '-' //fixme: 'e' may be preceded by other options && p[1] != 'e' && p[i -1] != 'O') c = '+'; /* switch off flags with '-x-' */ } if (c == '+') { /* switch off flags with '+' */ while (*++p != '\0') { switch (*p) { case '-': break; case 'B': cfmt.barsperstaff = 0; lock_fmt(&cfmt.barsperstaff); break; case 'c': cfmt.continueall = 0; lock_fmt(&cfmt.continueall); break; case 'F': // def_fmt_done = 1; break; case 'G': cfmt.graceslurs = 1; lock_fmt(&cfmt.graceslurs); break; case 'i': showerror = 0; break; case 'j': cfmt.measurenb = -1; lock_fmt(&cfmt.measurenb); break; case 'l': cfmt.landscape = 0; lock_fmt(&cfmt.landscape); break; case 'M': cfmt.fields[1] = 1 << ('w' - 'a'); lock_fmt(&cfmt.fields); break; case 'N': pagenumbers = 0; break; case 'O': outfn[0] = '\0'; break; case 'T': { struct cmdtblt_s *cmdtblt; aaa = p + 1; if (*aaa == '\0') { if (argc > 1 && argv[1][0] != '-') { aaa = *++argv; argc--; } } else { while (p[1] != '\0') /* stop */ p++; if (*p == '-') *p-- = '\0'; /* (not clean) */ } cmdtblt = cmdtblt_parse(aaa); if (cmdtblt != 0) cmdtblt->active = 0; break; } case 'x': cfmt.fields[0] &= ~(1 << ('X' - 'A')); lock_fmt(&cfmt.fields); break; case '0': cfmt.splittune = 0; lock_fmt(&cfmt.splittune); break; case '1': cfmt.oneperpage = 0; lock_fmt(&cfmt.oneperpage); break; default: error(1, NULL, "++++ Cannot switch off flag: +%c", *p); break; } } continue; } if (c == '-') { /* interpret a flag with '-' */ if (p[1] == '-') { /* long argument */ p += 2; if (--argc <= 0) { error(1, NULL, "No argument for '--'"); return EXIT_FAILURE; } argv++; set_opt(p, *argv); continue; } while ((c = *++p) != '\0') { switch (c) { /* simple flags */ case 'A': annotate = 1; break; case 'c': cfmt.continueall = 1; lock_fmt(&cfmt.continueall); break; case 'E': break; case 'f': cfmt.flatbeams = 1; lock_fmt(&cfmt.flatbeams); break; case 'G': cfmt.graceslurs = 0; lock_fmt(&cfmt.graceslurs); break; case 'g': break; case 'H': if (!fout) { read_def_format(); make_font_list(); } print_format(); return EXIT_SUCCESS; case 'i': showerror = 1; break; case 'l': cfmt.landscape = 1; lock_fmt(&cfmt.landscape); break; case 'M': cfmt.fields[1] &= ~(1 << ('w' - 'a')); lock_fmt(&cfmt.fields); break; case 'q': case 'S': break; case 'v': case 'X': break; case 'x': cfmt.fields[0] |= 1 << ('X' - 'A'); lock_fmt(&cfmt.fields); break; case '0': cfmt.splittune = 1; lock_fmt(&cfmt.splittune); break; case '1': cfmt.oneperpage = 1; lock_fmt(&cfmt.oneperpage); break; /* flag with optional parameter */ case 'N': if (p[1] == '\0' && (argc <= 1 || !isdigit((unsigned) argv[1][0]))) { pagenumbers = 2; /* old behaviour */ break; } /* fall thru */ /* flags with parameter.. */ case 'a': case 'B': case 'b': case 'D': case 'd': case 'e': case 'F': case 'I': case 'j': case 'k': case 'L': case 'm': case 'O': case 's': case 'T': case 'w': aaa = p + 1; if (*aaa == '\0') { aaa = *++argv; if (--argc <= 0 || (*aaa == '-' && c != 'O')) { error(1, NULL, "Missing parameter after '-%c' - aborting", c); return EXIT_FAILURE; } } else { p += strlen(p) - 1; /* stop */ } if (strchr("BbfjkNs", c)) { /* check num args */ for (j = 0; j < strlen(aaa); j++) { if (!strchr("0123456789.", aaa[j])) { if (aaa[j] == 'b' && aaa[j + 1] == '\0' && c == 'j') break; error(1, NULL, "Invalid parameter <%s> for flag -%c", aaa, c); return EXIT_FAILURE; } } } switch (c) { case 'a': set_opt("maxshrink", aaa); break; case 'B': set_opt("barsperstaff", aaa); break; case 'b': set_opt("measurefirst", aaa); break; case 'D': styd = aaa; break; case 'd': set_opt("staffsep", aaa); break; case 'e': set_opt("select", aaa); break; case 'F': treat_file(aaa, "fmt"); break; case 'I': set_opt("indent", aaa); break; case 'j': sscanf(aaa, "%d", &cfmt.measurenb); lock_fmt(&cfmt.measurenb); if (aaa[strlen(aaa) - 1] == 'b') cfmt.measurebox = 1; else cfmt.measurebox = 0; lock_fmt(&cfmt.measurebox); break; case 'k': break; case 'm': set_opt("leftmargin", aaa); break; case 'N': sscanf(aaa, "%d", &pagenumbers); if ((unsigned) pagenumbers > 4) { error(1, NULL, "'-N' value %s - changed to 2", aaa); pagenumbers = 2; } break; case 'O': if (strlen(aaa) >= sizeof outfn) { error(1, NULL, "'-O' too large - aborting"); exit(EXIT_FAILURE); } strcpy(outfn, aaa); break; case 's': set_opt("scale", aaa); break; case 'T': { struct cmdtblt_s *cmdtblt; cmdtblt = cmdtblt_parse(aaa); if (cmdtblt) cmdtblt->active = 1; break; } case 'w': set_opt("staffwidth", aaa); break; } break; default: error(1, NULL, "Unknown flag: -%c ignored", c); break; } } continue; } if (in_fname) { treat_file(in_fname, "abc"); frontend((unsigned char *) "select\n", 0); } in_fname = p; } if (in_fname) treat_file(in_fname, "abc"); if (multicol_start != 0) { /* lack of %%multicol end */ error(1, NULL, "Lack of %%%%multicol end"); multicol_start = 0; buffer_eob(); if (!info['X' - 'A'] && !epsf) write_buffer(); } if (!epsf && !fout) { error(1, NULL, "No input file specified"); return EXIT_FAILURE; } close_output_file(); return severity == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } /* -- arena routines -- */ void clrarena(int level) { struct str_a *a_p; if ((a_p = str_r[level]) == NULL) { str_r[level] = a_p = malloc(sizeof *str_r[0] + AREANASZ - 2); a_p->sz = AREANASZ; a_p->n = 0; } str_c[level] = a_p; a_p->p = a_p->str; a_p->r = sizeof a_p->str; } int lvlarena(int level) { int old_level; old_level = str_level; str_level = level; return old_level; } /* The area is 8 bytes aligned to handle correctly int and pointers access * on some machines as Sun Sparc. */ void *getarena(int len) { char *p; struct str_a *a_p; a_p = str_c[str_level]; len = (len + 7) & ~7; /* align at 64 bits boundary */ if (len > a_p->r) { if (len > MAXAREANASZ) { error(1, NULL, "getarena - data too wide %d - aborting", len); exit(EXIT_FAILURE); } if (len > AREANASZ) { /* big allocation */ struct str_a *a_n; a_n = a_p->n; a_p->n = malloc(sizeof *str_r[0] + len - 2); a_p->n->n = a_n; a_p->n->sz = len; } else if (a_p->n == 0) { /* standard allocation */ a_p->n = malloc(sizeof *str_r[0] + AREANASZ - 2); a_p->n->n = 0; a_p->n->sz = AREANASZ; } str_c[str_level] = a_p = a_p->n; a_p->p = a_p->str; a_p->r = a_p->sz; } p = a_p->p; a_p->p += len; a_p->r -= len; return p; } ��������������������������������������������������������������������������������������������abcm2ps-7.8.9/abc2ps.h������������������������������������������������������������������������������0000644�0001750�0001750�00000050673�12316602053�012514� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -- general macros -- */ #include #include #include "config.h" #include "abcparse.h" #define OUTPUTFILE "Out.ps" /* standard output file */ #ifndef WIN32 #define DIRSEP '/' #else #define DIRSEP '\\' #endif #define CM * 28.35 /* factor to transform cm to pt */ #define PT /* factor to transform pt to pt */ #define IN * 72.0 /* factor to transform inch to pt */ /* basic page dimensions */ #ifdef A4_FORMAT #define PAGEHEIGHT (29.7 CM) #define PAGEWIDTH (21.0 CM) #define MARGIN (1.8 CM) #else #define PAGEHEIGHT (11.0 IN) #define PAGEWIDTH (8.5 IN) #define MARGIN (0.7 IN) #endif /* -- macros controlling music typesetting -- */ #define STEM_YOFF 1.0 /* offset stem from note center */ #define STEM_XOFF 3.5 #define STEM 20 /* default stem height */ #define STEM_MIN 16 /* min stem height under beams */ #define STEM_MIN2 14 /* ... for notes with two beams */ #define STEM_MIN3 12 /* ... for notes with three beams */ #define STEM_MIN4 10 /* ... for notes with four beams */ #define STEM_CH_MIN 14 /* min stem height for chords under beams */ #define STEM_CH_MIN2 10 /* ... for notes with two beams */ #define STEM_CH_MIN3 9 /* ... for notes with three beams */ #define STEM_CH_MIN4 9 /* ... for notes with four beams */ #define BEAM_DEPTH 3.2 /* width of a beam stroke */ #define BEAM_OFFSET 0.25 /* pos of flat beam relative to staff line */ #define BEAM_SHIFT 5.0 /* shift of second and third beams */ /* To align the 4th beam as the 1st: shift=6-(depth-2*offset)/3 */ #define BEAM_FLATFAC 0.6 /* factor to decrease slope of long beams */ #define BEAM_THRESH 0.06 /* flat beam if slope below this threshold */ #define BEAM_SLOPE 0.5 /* max slope of a beam */ #define BEAM_STUB 6.0 /* length of stub for flag under beam */ #define SLUR_SLOPE 1.0 /* max slope of a slur */ #define DOTSHIFT 5 /* dot shift when up flag on note */ #define GSTEM 14 /* grace note stem length */ #define GSTEM_XOFF 1.6 /* x offset for grace note stem */ #define BETA_C 0.1 /* max expansion for flag -c */ #define BETA_X 1.0 /* max expansion before complaining */ #define VOCPRE 0.4 /* portion of vocals word before note */ #define GCHPRE 0.4 /* portion of guitar chord before note */ /* -- Parameters for note spacing -- */ /* fnn multiplies the spacing under a beam, to compress the notes a bit */ #define fnnp 0.9 /* -- macros for program internals -- */ #define STRL1 256 /* string length for file names */ #define MAXSTAFF 16 /* max staves */ #define BSIZE 512 /* buffer size for one input string */ #define BREVE (BASE_LEN * 2) /* double note (square note) */ #define SEMIBREVE BASE_LEN /* whole note */ #define MINIM (BASE_LEN / 2) /* half note (white note) */ #define CROTCHET (BASE_LEN / 4) /* quarter note (black note) */ #define QUAVER (BASE_LEN / 8) /* 1/8 note */ #define SEMIQUAVER (BASE_LEN / 16) /* 1/16 note */ #define MAXFONTS 30 /* max number of fonts */ #define T_LEFT 0 #define T_JUSTIFY 1 #define T_FILL 2 #define T_CENTER 3 #define T_SKIP 4 #define T_RIGHT 5 #define YSTEP 128 /* number of steps for y offsets */ extern unsigned char deco[256]; struct FONTSPEC { int fnum; /* index to font tables in format.c */ float size; float swfac; }; extern char *fontnames[MAXFONTS]; /* list of font names */ /* lyrics */ #define LY_HYPH 0x10 /* replacement character for hyphen */ #define LY_UNDER 0x11 /* replacement character for underscore */ #define MAXLY 16 /* max number of lyrics */ struct lyl { struct FONTSPEC *f; /* font */ float w; /* width */ float s; /* shift / note */ char t[1]; /* word */ }; struct lyrics { struct lyl *lyl[MAXLY]; /* ptr to lyric lines */ }; /* guitar chord / annotations */ #define MAXGCH 8 /* max number of guitar chords / annotations */ struct gch { char type; /* ann. char, 'g' gchord, 'r' repeat, '\0' end */ unsigned char idx; /* index in as.text */ unsigned char font; /* font */ char box; /* 1 if in box */ float x, y; /* x y offset / note + (top or bottom) of staff */ float w; /* width */ }; /* positions / directions */ /* 0: auto, 1: above/up (SL_ABOVE), 2: below/down (SL_BELOW) * 3: hidden (SL_AUTO) or opposite for gstemdir */ #define SL_HIDDEN SL_AUTO struct posit_s { unsigned short dyn:2; /* %%dynamic */ unsigned short gch:2; /* %%gchord */ unsigned short orn:2; /* %%ornament */ unsigned short voc:2; /* %%vocal */ unsigned short vol:2; /* %%volume */ unsigned short std:2; /* %%stemdir */ unsigned short gsd:2; /* %%gstemdir */ }; /* music element */ struct SYMBOL { /* struct for a drawable symbol */ struct abcsym as; /* abc symbol !!must be the first field!! */ struct SYMBOL *next, *prev; /* voice linkage */ struct SYMBOL *ts_next, *ts_prev; /* time linkage */ struct SYMBOL *extra; /* extra symbols (grace notes, tempo... */ unsigned char type; /* symbol type */ #define NO_TYPE 0 /* invalid type */ #define NOTEREST 1 /* valid symbol types */ #define SPACE 2 #define BAR 3 #define CLEF 4 #define TIMESIG 5 #define KEYSIG 6 #define TEMPO 7 #define STAVES 8 #define MREST 9 #define PART 10 #define GRACE 11 #define FMTCHG 12 #define TUPLET 13 #define STBRK 14 #define CUSTOS 15 #define NSYMTYPES 16 unsigned char voice; /* voice (0..nvoice) */ unsigned char staff; /* staff (0..nstaff) */ unsigned char nhd; /* number of notes in chord - 1 */ int dur; /* main note duration */ signed char pits[MAXHD]; /* pitches for notes */ int time; /* starting time */ unsigned int sflags; /* symbol flags */ #define S_EOLN 0x0001 /* end of line */ #define S_BEAM_ST 0x0002 /* beam starts here */ #define S_BEAM_BR1 0x0004 /* 2nd beam must restart here */ #define S_BEAM_BR2 0x0008 /* 3rd beam must restart here */ #define S_BEAM_END 0x0010 /* beam ends here */ #define S_OTHER_HEAD 0x0020 /* don't draw any note head */ #define S_IN_TUPLET 0x0040 /* in a tuplet */ #define S_TREM2 0x0080 /* tremolo on 2 notes */ #define S_RRBAR 0x0100 /* right repeat bar (when bar) */ #define S_XSTEM 0x0200 /* cross-staff stem (when note) */ #define S_BEAM_ON 0x0400 /* continue beaming */ #define S_SL1 0x0800 /* some chord slur start */ #define S_SL2 0x1000 /* some chord slur end */ #define S_TI1 0x2000 /* some chord tie start */ #define S_PERC 0x4000 /* percussion */ #define S_RBSTOP 0x8000 /* repeat bracket stop */ #define S_FEATHERED_BEAM 0x00010000 /* feathered beam */ #define S_REPEAT 0x00020000 /* sequence / measure repeat */ #define S_NL 0x00040000 /* start of new music line */ #define S_SEQST 0x00080000 /* start of vertical sequence */ #define S_SECOND 0x00100000 /* symbol on a secondary voice */ #define S_FLOATING 0x00200000 /* symbol on a floating voice */ #define S_NOREPBRA 0x00400000 /* don't print the repeat bracket */ #define S_TREM1 0x00800000 /* tremolo on 1 note */ #define S_TEMP 0x01000000 /* temporary symbol */ #define S_SHIFTUNISON_1 0x02000000 /* %%shiftunison 1 */ #define S_SHIFTUNISON_2 0x04000000 /* %%shiftunison 2 */ struct posit_s posit; /* positions / directions */ signed char stem; /* 1 / -1 for stem up / down */ signed char nflags; /* number of note flags when > 0 */ char dots; /* number of dots */ unsigned char head; /* head type */ #define H_FULL 0 #define H_EMPTY 1 #define H_OVAL 2 #define H_SQUARE 3 signed char multi; /* multi voice in the staff (+1, 0, -1) */ signed char nohdix; /* no head index (for unison) */ short u; /* auxillary information: * - CLEF: small clef * - KEYSIG: old key signature * - BAR: new bar number * - TUPLET: tuplet format * - NOTE: tremolo number / feathered beam * - FMTCHG (format change): subtype */ #define PSSEQ 0 /* postscript sequence */ #define SVGSEQ 1 /* SVG sequence */ #define REPEAT 2 /* repeat sequence or measure * doty: # measures if > 0 * # notes/rests if < 0 * nohdix: # repeat */ float x; /* x offset */ signed char y; /* y offset of note head */ signed char ymn, ymx, yav; /* min, max, avg note head y offset */ float xmx; /* max h-pos of a head rel to top * width when STBRK */ float xs, ys; /* coord of stem end / bar height */ float wl, wr; /* left, right min width */ float space; /* natural space before symbol */ float shrink; /* minimum space before symbol */ float xmax; /* max x offset */ float shhd[MAXHD]; /* horizontal shift for heads */ float shac[MAXHD]; /* horizontal shift for accidentals */ struct gch *gch; /* guitar chords / annotations */ struct lyrics *ly; /* lyrics */ signed char doty; /* NOTEREST: y pos of dot when voices overlap * STBRK: forced * FMTCHG REPEAT: infos */ }; /* bar types !tied to abcparse.h! */ #define B_SINGLE B_BAR /* | single bar */ #define B_DOUBLE 0x11 /* || thin double bar */ #define B_THIN_THICK 0x13 /* |] thick at section end */ #define B_THICK_THIN 0x21 /* [| thick at section start */ #define B_LREP 0x14 /* |: left repeat bar */ #define B_RREP 0x41 /* :| right repeat bar */ #define B_DREP 0x44 /* :: double repeat bar */ #define B_DASH 0x04 /* : dashed bar */ extern unsigned short *micro_tb; /* ptr to the microtone table of the tune */ struct FORMAT { /* struct for page layout */ float pageheight, pagewidth; float topmargin, botmargin, leftmargin, rightmargin; float topspace, wordsspace, titlespace, subtitlespace, partsspace; float composerspace, musicspace, vocalspace, textspace; float breaklimit, maxshrink, lineskipfac, parskipfac, stemheight; float indent, infospace, slurheight, notespacingfactor, scale; float staffsep, sysstaffsep, maxstaffsep, maxsysstaffsep, stretchlast; int abc2pscompat, alignbars, aligncomposer, autoclef; int barsperstaff, breakoneoln, bstemdown, cancelkey; int combinevoices, contbarnb, continueall, custos; int dblrepbar, dynalign, flatbeams; int infoline, gchordbox, graceslurs, gracespace, hyphencont; int keywarn, landscape, linewarn; int measurebox, measurefirst, measurenb, micronewps, microscale; int oneperpage; #ifdef HAVE_PANGO int pango; #endif int partsbox, pdfmark; int setdefl, shiftunison, splittune, squarebreve; int staffnonote, straightflags, stretchstaff; int textoption, titlecaps, titleleft, titletrim; int timewarn, transpose, tuplets; char *bgcolor, *dateformat, *header, *footer, *titleformat; #define FONT_UMAX 5 /* max number of user fonts */ #define ANNOTATIONFONT 5 #define COMPOSERFONT 6 #define FOOTERFONT 7 #define GCHORDFONT 8 #define HEADERFONT 9 #define HISTORYFONT 10 #define INFOFONT 11 #define MEASUREFONT 12 #define PARTSFONT 13 #define REPEATFONT 14 #define SUBTITLEFONT 15 #define TEMPOFONT 16 #define TEXTFONT 17 #define TITLEFONT 18 #define VOCALFONT 19 #define VOICEFONT 20 #define WORDSFONT 21 #define FONT_DYN 22 /* index of dynamic fonts (gch, an, ly) */ #define FONT_DYNX 12 /* number of dynamic fonts */ #define FONT_MAX (FONT_DYN+FONT_DYNX) /* whole number of fonts */ struct FONTSPEC font_tb[FONT_MAX]; char ndfont; /* current index of dynamic fonts */ unsigned char gcf, anf, vof; /* fonts for guitar chords, * annotations and lyrics */ unsigned int fields[2]; /* info fields to print *[0] is 'A'..'Z', [1] is 'a'..'z' */ struct posit_s posit; }; extern struct FORMAT cfmt; /* current format */ extern struct FORMAT dfmt; /* global format */ typedef struct SYMBOL *INFO[26]; /* information fields ('A' .. 'Z') */ extern INFO info; extern char *outbuf; /* output buffer.. should hold one tune */ extern char *mbf; /* where to PUTx() */ extern int use_buffer; /* 1 if lines are being accumulated */ extern int outft; /* last font in the output file */ extern int tunenum; /* number of current tune */ extern int pagenum; /* current page number */ extern int nbar; /* current measure number */ extern int in_page; extern int defl; /* decoration flags */ #define DEF_NOST 0x01 /* long deco with no start */ #define DEF_NOEN 0x02 /* long deco with no end */ #define DEF_STEMUP 0x04 /* stem up (1) or down (0) */ /* switches modified by flags: */ extern int quiet; /* quiet mode */ extern int secure; /* secure mode */ extern int annotate; /* output source references */ extern int pagenumbers; /* write page numbers */ extern int epsf; /* EPSF (1) / SVG (2) output */ extern int svg; /* SVG (1) or XML (2 - HTML + SVG) output */ extern int showerror; /* show the errors */ extern char outfn[FILENAME_MAX]; /* output file name */ extern char *in_fname; /* current input file name */ extern time_t mtime; /* last modification time of the input file */ extern int file_initialized; /* for output file */ extern FILE *fout; /* output file */ #define MAXTBLT 8 struct tblt_s { char *head; /* PS head function */ char *note; /* PS note function */ char *bar; /* PS bar function */ float wh; /* width of head */ float ha; /* height above the staff */ float hu; /* height under the staff */ short pitch; /* pitch when no associated 'w:' / 0 */ char instr[2]; /* instrument pitch */ }; extern struct tblt_s *tblts[MAXTBLT]; #define MAXCMDTBLT 4 /* max number of -T in command line */ struct cmdtblt_s { short index; /* tablature number */ short active; /* activate or not */ char *vn; /* voice name */ }; extern struct cmdtblt_s cmdtblts[MAXCMDTBLT]; extern int ncmdtblt; extern int s_argc; /* command line arguments */ extern char **s_argv; struct STAFF_S { struct clef_s clef; /* base clef */ char forced_clef; /* explicit clef */ char empty; /* no symbol on this staff */ short botbar, topbar; /* bottom and top of bar */ float y; /* y position */ float top[YSTEP], bot[YSTEP]; /* top/bottom y offsets */ }; extern struct STAFF_S staff_tb[MAXSTAFF]; extern int nstaff; /* (0..MAXSTAFF-1) */ struct VOICE_S { struct VOICE_S *next; /* link */ struct SYMBOL *sym; /* associated symbols */ struct SYMBOL *last_sym; /* last symbol while scanning */ struct SYMBOL *lyric_start; /* start of lyrics while scanning */ char id[VOICE_ID_SZ]; /* voice id */ char *nm; /* voice name */ char *snm; /* voice subname */ char *bar_text; /* bar text at start of staff when bar_start */ struct gch *bar_gch; /* bar text */ struct SYMBOL *tie; /* note with ties of previous line */ struct SYMBOL *rtie; /* note with ties before 1st repeat bar */ struct tblt_s *tblts[2]; /* tablatures */ float scale; /* scale */ int time; /* current time (parsing) */ struct clef_s clef; /* current clef */ struct key_s key; /* current key signature */ struct meter_s meter; /* current time signature */ struct key_s ckey; /* key signature while parsing */ struct key_s okey; /* original key signature (parsing) */ unsigned hy_st; /* lyrics hyphens at start of line (bit array) */ unsigned ignore:1; /* ignore this voice (%%staves) */ unsigned forced_clef:1; /* explicit clef */ unsigned second:1; /* secondary voice in a brace/parenthesis */ unsigned floating:1; /* floating voice in a brace system */ unsigned bar_repeat:1; /* bar at start of staff is a repeat bar */ unsigned norepbra:1; /* don't display the repeat brackets */ unsigned have_ly:1; /* some lyrics in this voice */ unsigned new_name:1; /* redisplay the voice name */ unsigned space:1; /* have a space before the next note (parsing) */ unsigned perc:1; /* percussion */ unsigned auto_len:1; /* auto L: (parsing) */ short wmeasure; /* measure duration (parsing) */ short transpose; /* transposition (parsing) */ short bar_start; /* bar type at start of staff / 0 */ struct posit_s posit; /* positions / directions */ signed char octave; /* octave (parsing) */ signed char clone; /* duplicate from this voice number */ signed char over; /* overlay of this voice number */ unsigned char staff; /* staff (0..n-1) */ unsigned char cstaff; /* staff (parsing) */ unsigned char slur_st; /* slurs at start of staff */ }; extern struct VOICE_S voice_tb[MAXVOICE]; /* voice table */ extern struct VOICE_S *first_voice; /* first_voice */ extern struct SYMBOL *tsfirst; /* first symbol in the time linked list */ extern struct SYMBOL *tsnext; /* next line when cut */ extern float realwidth; /* real staff width while generating */ #define NFLAGS_SZ 10 /* size of note flags tables */ #define C_XFLAGS 5 /* index of crotchet in flags tables */ extern float space_tb[NFLAGS_SZ]; /* note spacing */ struct SYSTEM { /* staff system */ struct SYSTEM *next; short top_voice; /* first voice in the staff system */ short nstaff; struct { short flags; #define OPEN_BRACE 0x01 #define CLOSE_BRACE 0x02 #define OPEN_BRACKET 0x04 #define CLOSE_BRACKET 0x08 #define OPEN_PARENTH 0x10 #define CLOSE_PARENTH 0x20 #define STOP_BAR 0x40 #define FL_VOICE 0x80 #define OPEN_BRACE2 0x0100 #define CLOSE_BRACE2 0x0200 #define OPEN_BRACKET2 0x0400 #define CLOSE_BRACKET2 0x0800 char empty; char dum; struct clef_s clef; float sep, maxsep; } staff[MAXSTAFF]; struct { signed char range; unsigned char staff; char second; char dum; float sep, maxsep; struct clef_s clef; } voice[MAXVOICE]; }; struct SYSTEM *cursys; /* current staff system */ /* -- external routines -- */ /* abc2ps.c */ void clrarena(int level); int lvlarena(int level); void *getarena(int len); void strext(char *fid, char *ext); /* buffer.c */ void a2b(char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif ; void block_put(void); void buffer_eob(void); void marg_init(void); void bskip(float h); void check_buffer(void); void init_outbuf(int kbsz); void close_output_file(void); void close_page(void); float get_bposy(void); void write_buffer(void); int (*output)(FILE *out, const char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void write_eps(void); /* deco.c */ void deco_add(char *text); void deco_cnv(struct deco *dc, struct SYMBOL *s, struct SYMBOL *prev); unsigned char deco_intern(unsigned char deco); unsigned char deco_define(char *name); void deco_update(struct SYMBOL *s, float dx); float deco_width(struct SYMBOL *s); void draw_all_deco(void); int draw_deco_head(int deco, float x, float y, int stem); void draw_all_deco_head(struct SYMBOL *s, float x, float y); void draw_deco_near(void); void draw_deco_note(void); void draw_deco_staff(void); float draw_partempo(int staff, float top); void draw_measnb(void); void reset_deco(void); void set_defl(int new_defl); float tempo_width(struct SYMBOL *s); void write_tempo(struct SYMBOL *s, int beat, float sc); float y_get(int staff, int up, float x, float w); void y_set(int staff, int up, float x, float w, float y); /* draw.c */ void draw_sym_near(void); void draw_all_symb(void); float draw_systems(float indent); void output_ps(struct SYMBOL *s, int state); void putf(float f); void putx(float x); void puty(float y); void putxy(float x, float y); void set_scale(struct SYMBOL *s); void set_sscale(int staff); /* format.c */ void define_fonts(void); int get_textopt(char *p); int get_font_encoding(int ft); void interpret_fmt_line(char *w, char *p, int lock); void lock_fmt(void *fmt); void make_font_list(void); FILE *open_file(char *fn, char *ext, char *rfn); void print_format(void); void set_font(int ft); void set_format(void); void set_voice_param(struct VOICE_S *p_voice, int state, char *w, char *p); struct tblt_s *tblt_parse(char *p); /* glyph.c */ char *glyph_out(char *p); void glyph_add(char *p); /* music.c */ void output_music(void); void reset_gen(void); void unlksym(struct SYMBOL *s); /* parse.c */ extern float multicol_start; void do_tune(struct abctune *t); void identify_note(struct SYMBOL *s, int len, int *p_head, int *p_dots, int *p_flags); void sort_pitch(struct SYMBOL *s, int combine); struct SYMBOL *sym_add(struct VOICE_S *p_voice, int type); /* subs.c */ void bug(char *msg, int fatal); void error(int sev, struct SYMBOL *s, char *fmt, ...); float scan_u(char *str); float cwid(unsigned short c); void get_str_font(int *cft, int *dft); void set_str_font(int cft, int dft); #ifdef HAVE_PANGO void pg_init(void); void pg_reset_font(void); #endif void put_history(void); void put_words(struct SYMBOL *words); void str_font(int ft); #define A_LEFT 0 #define A_CENTER 1 #define A_RIGHT 2 #define A_LYRIC 3 #define A_GCHORD 4 #define A_ANNOT 5 #define A_GCHEXP 6 void str_out(char *p, int action); void put_str(char *str, int action); float tex_str(char *s); extern char tex_buf[]; /* result of tex_str() */ #define TEX_BUF_SZ 512 char *trim_title(char *p, struct SYMBOL *title); void user_ps_add(char *s, char use); void user_ps_write(void); void write_title(struct SYMBOL *s); void write_heading(struct abctune *t); void write_user_ps(void); void write_text(char *cmd, char *s, int job); /* svg.c */ void define_svg_symbols(char *title, int num, float w, float h); int svg_output(FILE *out, const char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void svg_write(char *buf, int len); void svg_close(); /* syms.c */ void define_font(char *name, int num, int enc); void define_symbols(void); ���������������������������������������������������������������������abcm2ps-7.8.9/abcparse.c����������������������������������������������������������������������������0000644�0001750�0001750�00000167101�12360265111�013107� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Generic ABC parser. * * Copyright (C) 1998-2014 Jean-François Moine * Adapted from abc2ps, Copyright (C) 1996, 1997 Michael Methfessel * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include "config.h" #include #include #include #include #include "abcparse.h" /* interface */ static void *(*alloc_f)(int size); static void (*free_f)(void *); static void (*level_f)(int level); static int client_sz; static int keep_comment; /* global values */ char *deco_tb[128]; /* decoration names */ int severity; /* error severity */ static int abc_vers; /* abc version */ static short abc_state; /* parse state */ static short ulen; /* unit note length set by M: or L: */ static short meter; /* upper value of time sig for n-plets */ static unsigned char microscale; /* current microtone scale */ static signed char vover; /* voice overlay (1: single bar, -1: multi-bar */ static char lyric_started; /* lyric started */ static char *gchord; /* guitar chord */ static struct deco dc; /* decorations */ static struct abcsym *deco_start; /* 1st note of the line for d: / s: */ static struct abcsym *deco_cont; /* current symbol when d: / s: continuation */ static unsigned short *p_micro; /* ptr to the microtone table of the tune */ #define VOICE_NAME_SZ 64 /* max size of a voice name */ static char *file; /* remaining abc file */ static int linenum; /* current source line number */ static int colnum; /* current source column number */ static char *abc_line; /* line being parsed */ static struct abcsym *last_sym; /* last symbol for errors */ static short nvoice; /* number of voices (0..n-1) */ static struct { /* voice table and current pointer */ char id[VOICE_ID_SZ]; /* voice ID */ struct abcsym *last_note; /* last note or rest */ short ulen; /* unit note length */ unsigned char microscale; /* microtone scale */ unsigned char mvoice; /* main voice when voice overlay */ } voice_tb[MAXVOICE], *curvoice; /* char table for note line parsing */ #define CHAR_BAD 0 #define CHAR_IGN 1 #define CHAR_NOTE 2 #define CHAR_REST 3 #define CHAR_ACC 4 #define CHAR_GR_ST 5 #define CHAR_DECO 6 #define CHAR_GCHORD 7 #define CHAR_BSLASH 8 #define CHAR_OBRA 9 #define CHAR_BAR 10 #define CHAR_OPAR 11 #define CHAR_VOV 12 #define CHAR_SPAC 13 #define CHAR_MINUS 14 #define CHAR_CPAR 15 #define CHAR_BRHY 16 #define CHAR_DECOS 17 #define CHAR_SLASH 18 #define CHAR_GR_EN 19 #define CHAR_LINEBREAK 20 static char char_tb[256] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 00 - 07 */ 0, CHAR_SPAC, CHAR_LINEBREAK, 0, 0, 0, 0, 0, /* 08 - 0f */ 0, 0, 0, 0, 0, 0, 0, 0, /* 10 - 17 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 18 - 1f */ CHAR_SPAC, CHAR_DECOS, CHAR_GCHORD, CHAR_BAD, /* (sp) ! " # */ CHAR_BAD, CHAR_BAD, CHAR_VOV, CHAR_BAD, /* $ % & ' */ CHAR_OPAR, CHAR_CPAR, CHAR_BAD, CHAR_DECOS, /* ( ) * + */ CHAR_BAD, CHAR_MINUS, CHAR_DECO, CHAR_SLASH, /* , - . / */ CHAR_BAD, CHAR_BAD, CHAR_BAD, CHAR_BAD, /* 0 1 2 3 */ CHAR_BAD, CHAR_BAD, CHAR_BAD, CHAR_BAD, /* 4 5 6 7 */ CHAR_BAD, CHAR_BAD, CHAR_BAR, CHAR_BAD, /* 8 9 : ; */ CHAR_BRHY, CHAR_ACC, CHAR_BRHY, CHAR_BAD, /* < = > ? */ CHAR_BAD, CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, /* @ A B C */ CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, /* D E F G */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* H I J K */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* L M N O */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* P Q R S */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* T U V W */ CHAR_REST, CHAR_DECO, CHAR_REST, CHAR_OBRA, /* X Y Z [ */ CHAR_BSLASH, CHAR_BAR, CHAR_ACC, CHAR_ACC, /* \ ] ^ _ */ CHAR_IGN, CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, /* ` a b c */ CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, CHAR_NOTE, /* d e f g */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* h i j k */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* l m n o */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* p q r s */ CHAR_DECO, CHAR_DECO, CHAR_DECO, CHAR_DECO, /* t u v w */ CHAR_REST, CHAR_REST, CHAR_REST, CHAR_GR_ST, /* x y z { */ CHAR_BAR, CHAR_GR_EN, CHAR_DECO, CHAR_BAD, /* | } ~ (del) */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0 - af */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0 - bf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0 - cf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0 - df */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0 - ef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f0 - ff */ }; static const char all_notes[] = "CDEFGABcdefgab"; static char *get_line(void); static char *parse_len(char *p, int *p_len); static char *parse_basic_note(char *p, int *pitch, int *length, int *accidental, int *stemless); static int parse_info(struct abctune *t, char *p, char *comment); static char *parse_gchord(char *p); static int parse_line(struct abctune *t, char *p); static char *parse_note(struct abctune *t, char *p, int flags); static void syntax(char *msg, char *q); static void vover_new(void); /* -- abcMIDI like errors -- */ static void print_error(char *s, int col) { if (col >= 0) fprintf(stderr, "Error in line %d.%d: %s\n", linenum, col, s); else fprintf(stderr, "Error in line %d: %s\n", linenum, s); } /* -- delete an ABC symbol -- */ void abc_delete(struct abcsym *as) { switch (as->type) { case ABC_T_INFO: switch (as->text[0]) { case 'Q': if (as->u.tempo.str1) free_f(as->u.tempo.str1); if (as->u.tempo.value) free_f(as->u.tempo.value); if (as->u.tempo.str2) free_f(as->u.tempo.str2); break; case 'V': if (as->u.voice.fname) free_f(as->u.voice.fname); if (as->u.voice.nname) free_f(as->u.voice.nname); break; } break; } if (as->text) free_f(as->text); if (as->comment) free_f(as->comment); if (as->prev) as->prev->next = as->next; if (as->next) as->next->prev = as->prev; if (as->tune->first_sym == as) as->tune->first_sym = as->next; if (as->tune->last_sym == as) as->tune->last_sym = as->prev; free_f(as); } /* -- free the memory areas of all tunes -- */ void abc_free(struct abctune *t) { struct abctune *tn; struct abcsym *s, *sn; if (!free_f) return; for (;;) { if (!t) break; s = t->first_sym; /* free the associated symbols */ for (;;) { sn = s->next; abc_delete(s); if ((s = sn) == NULL) break; } /* free the tune */ tn = t->next; free_f(t); t = tn; } } /* -- initialize the parser -- */ void abc_init(void *alloc_f_api(int size), void free_f_api(void *ptr), void level_f_api(int level), int client_sz_api, int keep_comment_api) { if (alloc_f) { fprintf(stderr, "abc_init already initialized\n"); return; } alloc_f = alloc_f_api; free_f = free_f_api; level_f = level_f_api; client_sz = client_sz_api; keep_comment = keep_comment_api; } /* -- insert an ABC description -- */ void abc_insert(char *file_api, struct abcsym *s) { struct abctune *t; char *p; /* initialize */ file = file_api; if (level_f) level_f(abc_state != ABC_S_GLOBAL); abc_state = ABC_S_TUNE; linenum = 0; t = s->tune; t->last_sym = s; /* scan till end of description */ for (;;) { if ((p = get_line()) == NULL) break; /* done */ if (*p == '\0') break; /* blank line --> done */ /*fixme-insert: don't accept X:*/ /* parse the music line */ if (parse_line(t, p)) break; } } /* -- new symbol -- */ struct abcsym *abc_new(struct abctune *t, char *text, char *comment) { struct abcsym *s; s = alloc_f(sizeof *s + client_sz); memset(s, 0, sizeof *s + client_sz); s->tune = t; if (text) { s->text = alloc_f(strlen(text) + 1); strcpy(s->text, text); } if (comment) { s->comment = alloc_f(strlen(comment) + 1); strcpy(s->comment, comment); } if (!t->last_sym) { t->first_sym = s; } else { if ((s->next = t->last_sym->next) != NULL) s->next->prev = s; t->last_sym->next = s; s->prev = t->last_sym; } last_sym = t->last_sym = s; s->state = abc_state; s->linenum = linenum; s->colnum = colnum; return s; } /* get the ABC version */ static void get_vers(char *p) { int i, j,k; i = j = k = 0; if (sscanf(p, "%d.%d.%d", &i, &j, &k) != 3) if (sscanf(p, "%d.%d", &i, &j) != 2) sscanf(p, "%d", &i); abc_vers = (i << 16) + (j << 8) + k; } /* -- parse an ABC file -- */ struct abctune *abc_parse(char *file_api) { struct abctune *first_tune = NULL; struct abctune *t, *last_tune; /* saved global variables */ int g_abc_vers, g_ulen, g_microscale; char *p; char g_char_tb[128]; /* initialize */ file = file_api; t = NULL; abc_state = ABC_S_GLOBAL; if (level_f) level_f(0); linenum = 0; last_tune = NULL; g_abc_vers = g_ulen = g_microscale = 0; /* (have gcc happy) */ /* scan till end of file */ for (;;) { if ((p = get_line()) == NULL) { if (abc_state == ABC_S_HEAD) { syntax("Unexpected EOF in header definition", p); severity = 1; } if (t) t->abc_vers = abc_vers; if (abc_state != ABC_S_GLOBAL) { abc_vers = g_abc_vers; ulen = g_ulen; microscale = g_microscale; memcpy(char_tb, g_char_tb, sizeof g_char_tb); } break; /* done */ } /* start a new tune if not done */ if (!t) { if (*p == '\0') continue; t = alloc_f(sizeof *t); memset(t, 0 , sizeof *t); if (!last_tune) first_tune = t; else last_tune->next = t; last_tune = t; p_micro = t->micro_tb; meter = 0; } /* parse the music line */ switch (parse_line(t, p)) { case 2: /* start of tune */ g_abc_vers = abc_vers; g_ulen = ulen; g_microscale = microscale; memcpy(g_char_tb, char_tb, sizeof g_char_tb); break; case 1: /* end of tune */ t->abc_vers = abc_vers; abc_state = ABC_S_GLOBAL; t = NULL; abc_vers = g_abc_vers; ulen = g_ulen; microscale = g_microscale; memcpy(char_tb, g_char_tb, sizeof g_char_tb); if (level_f) level_f(0); if (dc.n > 0) syntax("Decoration without symbol", 0); dc.n = dc.h = dc.s = 0; break; } } return first_tune; } /* -- cut off after % and remove trailing blanks -- */ static char *decomment_line(char *p) { char *q, c, *comment = NULL; q = p; for (;;) { c = *p; if (c == '\0') break; if (c == '\\') { p++; if (*p == '\0') return 0; p++; continue; } if (c == '%') { if (keep_comment) { comment = p + 1; break; } break; } if (c == '"') { for (;;) { p++; if (*p == '\0') break; if (*p == '"' && p[-1] != '\\') { p++; break; } } } else { p++; } } /* remove the trailing blanks */ while (p > q) { c = *--p; if (!isspace((unsigned char) c)) { p[1] = '\0'; break; } } return comment; } /* -- treat the broken rhythm '>' and '<' -- */ static void broken_rhythm(struct note *note, int num) /* >0: do dot, <0: do half */ { int l, m, n; num *= 2; if (num > 0) { if (num == 6) num = 8; n = num * 2 - 1; for (m = 0; m <= note->nhd; m++) note->lens[m] = (note->lens[m] * n) / num; } else { n = -num; if (n == 6) n = 8; for (m = 0; m <= note->nhd; m++) note->lens[m] /= n; } l = note->lens[0]; for (m = 1; m <= note->nhd; m++) if (note->lens[m] < l) l = note->lens[m]; } /* -- check for the '!' as end of line (ABC2Win) -- */ static int check_nl(char *p) { while (*p != '\0') { switch (*p++) { case '!': return 0; case '|': case '[': case ':': case ']': case ' ': case '\t': return 1; } } return 1; } /* -- parse extra K: or V: definitions (clef, octave and microscale -- */ static char *parse_extra(char *p, char **p_name, char **p_middle, char **p_lines, char **p_scale, char **p_octave) { for (;;) { if (strncmp(p, "clef=", 5) == 0 || strncmp(p, "bass", 4) == 0 || strncmp(p, "treble", 6) == 0 || strncmp(p, "alto", 4) == 0 || strncmp(p, "tenor", 5) == 0 || strncmp(p, "perc", 4) == 0) { if (*p_name) syntax("Double clef name", p); *p_name = p; } else if (strncmp(p, "microscale=", 11) == 0) { int i; i = atoi(p + 11); if (i < 4 || i > 256) syntax("Invalid value in microscale=", p); else microscale = i; } else if (strncmp(p, "middle=", 7) == 0 || strncmp(p, "m=", 2) == 0) { if (*p_middle) syntax("Double clef middle", p); *p_middle = p + (p[1] == '=' ? 2 : 7); } else if (strncmp(p, "octave=", 7) == 0) { if (*p_octave) syntax("Double octave=", p); *p_octave = p + 7; } else if (strncmp(p, "stafflines=", 11) == 0) { if (*p_lines) syntax("Double stafflines", p); *p_lines = p + 11; } else if (strncmp(p, "staffscale=", 11) == 0) { if (*p_scale) syntax("Double staffscale", p); *p_scale = p + 11; } else if (strncmp(p, "transpose=", 10) == 0 || strncmp(p, "t=", 2) == 0) { ; /* ignored */ } else { break; } while (!isspace((unsigned char) *p) && *p != '\0') p++; while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; } return p; } /* -- parse a decoration 'xxx' -- */ static char *get_deco(char *p, unsigned char *p_deco) { char *q, sep, **t; unsigned i, l; *p_deco = 0; q = p; sep = q[-1]; if (char_tb[(unsigned char) sep] == CHAR_DECOS) { if (sep == '+') { if (*p == '+' && p[1] == '+') p++; /* special case "+++" */ } } else { sep = '\0'; /* Barfly U: */ } while (*p != sep) { if (*p == '\0') { syntax("Decoration not terminated", q); return p; } p++; } l = p - q; if (*p == sep) p++; for (i = 1, t = &deco_tb[1]; *t && i < 128; i++, t++) { if (strlen(*t) == l && strncmp(*t, q, l) == 0) { *p_deco = i + 128; return p; } } /* new decoration */ if (i < 128) { if (level_f && abc_state != ABC_S_GLOBAL) level_f(0); *t = alloc_f(l + 1); if (level_f && abc_state != ABC_S_GLOBAL) level_f(1); memcpy(*t, q, l); (*t)[l] = '\0'; *p_deco = i + 128; } else { syntax("Too many decoration types", q); } return p; } /* -- parse a list of accidentals (K:) -- */ static char *parse_acc(char *p, struct abcsym *s) { int pit, len, acc, nostem; unsigned nacc; if (s->u.key.empty == 2) syntax("cannot have 'none' and a list of accidentals", p); nacc = 0; for (;;) { if (nacc >= sizeof s->u.key.pits) { syntax("Too many accidentals", p); break; } p = parse_basic_note(p, &pit, &len, &acc, &nostem); s->u.key.pits[nacc] = pit; s->u.key.accs[nacc++] = acc; while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; if (*p != '^' && *p != '_' && *p != '=') break; } s->u.key.microscale = microscale; if (s->u.key.empty != 2) s->u.key.nacc = nacc; return p; } /* -- parse a clef (K: or V:) -- */ static void parse_clef(struct abcsym *s, char *name, char *middle, char *lines, char *scale) { int clef = -1; int transpose = 0; int clef_line = 2; char *warn = NULL; char str[80]; str[0] = '\0'; if (name && strncmp(name, "clef=", 5) == 0) { name += 5; switch (*name) { case '\"': name = get_str(str, name, sizeof str); s->u.clef.name = alloc_f(strlen(str) + 1); strcpy(s->u.clef.name, str); clef = TREBLE; break; case 'g': warn = name; transpose = -7; case 'G': clef = TREBLE; break; case 'f': warn = name; transpose = -14; clef = BASS; clef_line = 4; break; case 'F': if (name[1] == ',') /* abc2.1.1 clef=F == clef=F, */ transpose = -7; clef = BASS; clef_line = 4; break; case 'c': warn = name; transpose = -7; case 'C': clef = ALTO; clef_line = 3; break; case 'P': clef = PERC; break; } if (clef >= 0) { name++; if (*name == ',' || *name== '\'') warn = name; while (*name == ',') { transpose += 7; name++; } while (*name == '\'') { transpose -= 7; name++; } } } if (name && clef < 0) { if (!strncmp(name, "bass", 4)) { clef = BASS; clef_line = 4; s->u.clef.check_pitch = 1; name += 4; } else if (!strncmp(name, "treble", 6)) { clef = TREBLE; name += 6; } else if (!strncmp(name, "alto", 4) || !strncmp(name, "tenor", 5)) { clef = ALTO; clef_line = *name == 'a' ? 3 : 4; s->u.clef.check_pitch = 1; if (*name == 'a') name += 4; else name += 5; } else if (!strncmp(name, "perc", 4)) { clef = PERC; name += 4; } else if (strncmp(name, "none", 4) == 0) { clef = TREBLE; s->u.clef.invis = 1; s->flags |= ABC_F_INVIS; name += 4; } else { syntax("Unknown clef", name); } } if (clef >= 0) { switch (*name) { case '1': case '2': case '3': case '4': case '5': clef_line = *name++ - '0'; break; } if (name[1] == '8') { switch (*name) { case '^': transpose -= 7; case '+': s->u.clef.octave = 1; break; case '_': transpose += 7; case '-': s->u.clef.octave = -1; break; } } } if (middle) { int pit, len, acc, nostem, l; static const char line_tb[7] = {ALTO, TREBLE, ALTO, BASS, ALTO, BASS, ALTO}; warn = middle; /* 'middle=' */ parse_basic_note(middle, &pit, &len, &acc, &nostem); if (clef < 0) clef = line_tb[(pit + 7) % 7]; switch (clef) { default: l = 20 + 4; break; case ALTO: l = 16 + 4; break; case BASS: l = 12 + 4; break; } clef_line = (l - pit + 28) % 7; if (clef_line & 1) { syntax("Bad 'middle' value for the clef", middle); pit++; } clef_line = clef_line / 2 + 1; transpose = l - (clef_line - 1) * 2 - pit; s->u.clef.check_pitch = 0; } s->u.clef.type = clef; s->u.clef.line = clef_line; s->u.clef.transpose = transpose; s->u.clef.stafflines = -1; s->u.clef.staffscale = 0; if (lines) { int l; l = atoi(lines); if ((unsigned) l < 10) s->u.clef.stafflines = l; else syntax("Bad value of stafflines", lines); } if (scale) { float sc; sc = atof(scale); if (sc >= 0.5 && sc <= 3) s->u.clef.staffscale = sc; else syntax("Bad value of staffscale", scale); } if (warn) { int sev_sav; sev_sav = severity; syntax("Warning: Deprecated or non-standard item", warn); severity = sev_sav; } } /* get the octave= value */ static int parse_octave(char *p) { int oct; if (p) { oct = 1; if (*p == '-') { oct = -1; p++; } if (*p >= '0' && *p <= '4') return oct * (*p - '0'); syntax("Bad octave value", p); } return NO_OCTAVE; } /* -- parse a 'K:' -- */ static void parse_key(char *p, struct abcsym *s) { int sf, mode; char *clef_name, *clef_middle, *clef_lines, *clef_scale; char *p_octave; if (*p == '\0') { s->u.key.empty = 2; return; } if (strncasecmp(p, "none", 4) == 0) { s->u.key.empty = 2; p += 4; while (isspace((unsigned char) *p)) p++; if (*p == '\0') return; } clef_name = clef_middle = clef_lines = clef_scale = NULL; p_octave = NULL; p = parse_extra(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, &p_octave); sf = 0; mode = MAJOR; switch (*p++) { case 'F': sf = -1; break; case 'B': sf++; case 'E': sf++; case 'A': sf++; case 'D': sf++; case 'G': sf++; case 'C': break; case 'H': if (*p == 'P') { mode = BAGPIPE; p++; } else if (*p == 'p') { mode = BAGPIPE + 1; sf = 2; p++; } else { syntax("Unknown bagpipe-like key", p); } break; case '^': case '_': case '=': p--; /* explicit accidentals */ break; case '\0': if (s->u.key.empty == 0) s->u.key.empty = 1; p--; break; default: p--; if (s->u.key.empty != 2) syntax("Key not recognized", p); break; } if (*p == '#') { sf += 7; p++; } else if (*p == 'b') { sf -= 7; p++; } while (*p != '\0') { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; p = parse_extra(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, &p_octave); if (*p == '\0') break; switch (*p) { case 'a': case 'A': if (strncasecmp(p, "aeo", 3) == 0) { sf -= 3; mode = 5; break; } goto unk; case 'd': case 'D': if (strncasecmp(p, "dor", 3) == 0) { sf -= 2; mode = 1; break; } goto unk; case 'e': case 'E': if (strncasecmp(p, "exp", 3) == 0) { s->u.key.exp = 1; break; } goto unk; case 'i': case 'I': if (strncasecmp(p, "ion", 3) == 0) { mode = 0; break; } goto unk; case 'l': case 'L': if (strncasecmp(p, "loc", 3) == 0) { sf -= 5; mode = 6; break; } if (strncasecmp(p, "lyd", 3) == 0) { sf += 1; mode = 3; break; } goto unk; case 'm': case 'M': if (strncasecmp(p, "maj", 3) == 0) break; if (strncasecmp(p, "mix", 3) == 0) { sf -= 1; mode = 4; break; } if (strncasecmp(p, "min", 3) == 0 || !isalpha((unsigned char) p[1])) { /* 'm' alone */ sf -= 3; mode = MINOR; break; } goto unk; case 'p': case 'P': if (strncasecmp(p, "phr", 3) == 0) { sf -= 4; mode = 2; break; } goto unk; case '^': case '_': case '=': p = parse_acc(p, s); /* explicit accidentals */ continue; default: unk: syntax("Unknown token in key specifier", p); while (!isspace((unsigned char) *p) && *p != '\0') p++; continue; } while (isalpha((unsigned char) *p)) p++; } if (sf > 7 || sf < -7) { syntax("Too many sharps/flats", p); if (sf > 0) sf -= 12; else sf += 12; } s->u.key.sf = sf; s->u.key.mode = mode; s->u.key.octave = parse_octave(p_octave); if (clef_name || clef_middle || clef_lines || clef_scale) { s = abc_new(s->tune, NULL, NULL); s->type = ABC_T_CLEF; parse_clef(s, clef_name, clef_middle, clef_lines, clef_scale); } } /* -- set default length from 'L:' -- */ static char *get_len(char *p, struct abcsym *s) { int l1, l2, d; char *error_txt = NULL; if (strcmp(p, "auto") == 0) { /* L:auto */ s->u.length.base_length = -1; return error_txt; } l1 = 0; l2 = 1; if (sscanf(p, "%d /%d ", &l1, &l2) != 2 || l1 == 0) { s->u.length.base_length = ulen ? ulen : BASE_LEN / 8; return "Bad unit note length: unchanged"; } if (l2 == 0) { error_txt = "Bad length divisor, set to 4"; l2 = 4; } d = BASE_LEN / l2; if (d * l2 != BASE_LEN) { error_txt = "Length incompatible with BASE, using 1/8"; d = BASE_LEN / 8; } else { d *= l1; if (l1 != 1 || (l2 & (l2 - 1))) { error_txt = "Incorrect unit note length, using 1/8"; d = BASE_LEN / 8; } } s->u.length.base_length = d; return error_txt; } /* -- get a new line from the current file in memory -- */ static char *get_line(void) { int l; char *p, *q; p = file; if (*p == '\0') return 0; abc_line = p; linenum++; /* handle %%begin .. %%end */ if (strncmp(p, "%%begin", 7) == 0) { for (;;) { while (*p != '\0' && *p != '\n') p++; if (*p == '\0') { syntax("No %%end after %%begin", 0); break; } linenum++; p++; if (strncmp(p, "%%end", 5) == 0) { p[-1] = '\0'; while (*p != '\0' && *p != '\n') p++; if (*p != '\0') *p++ = '\0'; break; } } file = p; return abc_line; } /* set the end of line and * memorize the beginning of the next line */ while (*p != '\0' && *p != '\n') p++; if (*p != '\0') *p++ = '\0'; file = p; /* special case for continuation lines in ABC version 2.0 */ if (abc_vers == (2 << 16)) { p = abc_line; for (;;) { while (*p != '\0') { if (*p == '"') { for (;;) { p++; if (*p == '\0') break; if (*p == '"' && p[-1] != '\\') { p++; break; } } continue; } if (*p == '\\' && p[1] != '\\' && p[1] != '%') { q = p + 1; while (isspace((unsigned char) *q)) q++; if (*q == '\0' || *q == '%') break; p = q; continue; } p++; } if (*p == '\0') break; /* continuation found */ q = file; if (*q == '\0') break; linenum++; while (*q != '\0' && *q != '\n') q++; l = q - file; memmove(p, file, l); /* concatenate */ p[l] = '\0'; if (*q == '\0') break; file = q + 1; } } return abc_line; } /* -- parse a 'M:' -- */ static char *parse_meter(char *p, struct abcsym *s) { int m1, m2, d, wmeasure, nm, in_parenth; unsigned i; char *q; static char *top_err = "Cannot identify meter top"; if (*p == '\0') return "Empty meter string"; nm = 0; in_parenth = 0; wmeasure = 0; m1 = 0; if (strncmp(p, "none", 4) == 0) { p += 4; /* no meter */ } else while (*p != '\0') { if (*p == '=') break; if (nm >= MAX_MEASURE) return "Too many values in M:"; switch (*p) { case 'C': s->u.meter.meter[nm].top[0] = *p++; if (*p == '|') s->u.meter.meter[nm].top[1] = *p++; m1 = 4; m2 = 4; break; case 'c': case 'o': if (*p == 'c') m1 = 4; else m1 = 3; m2 = 4; s->u.meter.meter[nm].top[0] = *p++; if (*p == '.') s->u.meter.meter[nm].top[1] = *p++; break; case '(': if (p[1] == '(') { /* "M:5/4 ((2+3)/4)" */ in_parenth = 1; s->u.meter.meter[nm++].top[0] = *p++; } q = p + 1; while (*q != '\0') { if (*q == ')' || *q == '/') break; q++; } if (*q == ')' && q[1] == '/') { /* "M:5/4 (2+3)/4" */ p++; /* remove the parenthesis */ continue; } /* "M:5 (2+3)" */ /* fall thru */ case ')': in_parenth = *p == '('; s->u.meter.meter[nm++].top[0] = *p++; continue; default: if (sscanf(p, "%d", &m1) != 1 || m1 <= 0) return top_err; i = 0; m2 = 2; /* default when no bottom value */ for (;;) { while (isdigit((unsigned char) *p) && i < sizeof s->u.meter.meter[0].top) s->u.meter.meter[nm].top[i++] = *p++; if (*p == ')') { if (p[1] != '/') break; p++; } if (*p == '/') { p++; if (sscanf(p, "%d", &m2) != 1 || m2 <= 0) return "Cannot identify meter bottom"; i = 0; while (isdigit((unsigned char) *p) && i < sizeof s->u.meter.meter[0].bot) s->u.meter.meter[nm].bot[i++] = *p++; break; } if (*p != ' ' && *p != '+') break; if (*p == '\0' || p[1] == '(') /* "M:5 (2/4+3/4)" */ break; if (i < sizeof s->u.meter.meter[0].top) s->u.meter.meter[nm].top[i++] = *p++; if (sscanf(p, "%d", &d) != 1 || d <= 0) return top_err; if (p[-1] == ' ') { if (d > m1) m1 = d; } else { m1 += d; } } break; } if (!in_parenth) wmeasure += m1 * BASE_LEN / m2; nm++; if (*p == ' ') p++; else if (*p == '+') s->u.meter.meter[nm++].top[0] = *p++; } meter = m1; if (*p == '=') { if (sscanf(++p, "%d/%d", &m1, &m2) != 2 || m1 <= 0 || m2 <= 0) return "Cannot identify meter explicit duration"; wmeasure = m1 * BASE_LEN / m2; s->u.meter.expdur = 1; } s->u.meter.wmeasure = wmeasure; s->u.meter.nmeter = nm; /* if in the header, change the unit note length */ if (abc_state == ABC_S_HEAD && ulen == 0) { if (wmeasure >= BASE_LEN * 3 / 4 || wmeasure == 0) ulen = BASE_LEN / 8; else ulen = BASE_LEN / 16; } return 0; } /* -- get a possibly quoted string -- */ char *get_str(char *d, /* destination */ char *s, /* source */ int maxlen) /* max length */ { char c; maxlen--; /* have place for the EOS */ while (isspace((unsigned char) *s)) s++; if (*s == '"') { s++; while ((c = *s) != '\0') { if (c == '"') { s++; break; } if (c == '\\') { if (--maxlen > 0) *d++ = c; c = *++s; } if (--maxlen > 0) *d++ = c; s++; } } else { while ((c = *s) != '\0') { if (isspace((unsigned char) c)) break; if (--maxlen > 0) *d++ = c; s++; } } *d = '\0'; while (isspace((unsigned char) *s)) s++; return s; } /* -- parse a tempo (Q:) -- */ static char *parse_tempo(char *p, struct abcsym *s) { int l; char *q, str[80]; /* string before */ if (*p == '"') { p = get_str(str, p, sizeof str); s->u.tempo.str1 = alloc_f(strlen(str) + 1); strcpy(s->u.tempo.str1, str); } /* beat */ if (*p == 'C' || *p == 'c' || *p == 'L' || *p == 'l') { int len; p++; if (*p != '=') goto inval; p = parse_len(p + 1, &len); if (len <= 0) goto inval; s->u.tempo.length[0] = len * ulen / BASE_LEN; while (isspace((unsigned char) *p)) p++; if (abc_vers >= (2 << 16)) syntax("Deprecated Q: value", p); } else if (isdigit((unsigned char) *p) && strchr(p, '/') != 0) { unsigned i; i = 0; while (isdigit((unsigned char) *p)) { int top, bot, n; if (sscanf(p, "%d /%d%n", &top, &bot, &n) != 2 || bot <= 0) goto inval; l = (BASE_LEN * top) / bot; if (l <= 0 || i >= sizeof s->u.tempo.length / sizeof s->u.tempo.length[0]) goto inval; s->u.tempo.length[i++] = l; p += n; while (isspace((unsigned char) *p)) p++; } } /* tempo value ('Q:beat=value' or 'Q:value') */ if (*p == '=') { p++; while (isspace((unsigned char) *p)) p++; } if (*p != '\0' && *p != '"') { q = p; while (*p != '"' && *p != '\0') p++; while (isspace((unsigned char) p[-1])) p--; l = p - q; s->u.tempo.value = alloc_f(l + 1); strncpy(s->u.tempo.value, q, l); s->u.tempo.value[l] = '\0'; while (isspace((unsigned char) *p)) p++; } /* string after */ if (*p == '"') { p = get_str(str, p, sizeof str); s->u.tempo.str2 = alloc_f(strlen(str) + 1); strcpy(s->u.tempo.str2, str); } if (!s->u.tempo.str1 && !s->u.tempo.str2 && s->u.tempo.length[0] == 0) { if (s->u.tempo.value == 0) return "Empty tempo"; if (abc_vers >= (2 << 16)) syntax("Deprecated Q: value", p); } return 0; inval: return "Invalid tempo"; } /* -- get a user defined symbol (U:) -- */ static char *get_user(char *p, struct abcsym *s) { unsigned char c; char *value; c = (unsigned char) *p++; if (c == '\\') { c = (unsigned char) *p++; switch (c) { case 'n': c = '\n'; break; case 't': c = '\t'; break; } } switch (char_tb[c]) { default: return "Bad decoration character"; case CHAR_DECO: break; case CHAR_BAD: case CHAR_IGN: case CHAR_SPAC: case CHAR_DECOS: case CHAR_LINEBREAK: char_tb[c] = CHAR_DECO; break; } s->u.user.symbol = c; /* skip '=' */ while (isspace((unsigned char) *p) || *p == '=') p++; if (char_tb[(unsigned char) *p] == CHAR_DECOS) p++; /*fixme: 'U: = "text"' is not treated */ get_deco(p, &s->u.user.value); /* treat special pseudo decorations */ value = deco_tb[s->u.user.value - 128]; if (strcmp(value, "beambreak") == 0) char_tb[c] = CHAR_SPAC; else if (strcmp(value, "ignore") == 0) char_tb[c] = CHAR_IGN; else if (strcmp(value, "nil") == 0 || strcmp(value, "none") == 0) char_tb[c] = CHAR_BAD; else return 0; s->u.user.value = 0; /* not a decoration */ return 0; } /* -- parse the voice parameters (V:) -- */ static char *parse_voice(char *p, struct abcsym *s) { int voice; char *error_txt = NULL; char name[VOICE_NAME_SZ]; char *clef_name, *clef_middle, *clef_lines, *clef_scale; char *p_octave; signed char *p_stem; static struct kw_s { char *name; short len; short index; } kw_tb[] = { {"name=", 5, 0}, {"nm=", 3, 0}, {"subname=", 8, 1}, {"sname=", 6, 1}, {"snm=", 4, 1}, {"merge", 5, 2}, {"up", 2, 3}, {"down", 4, 4}, {"stem=", 5, 5}, {"gstem=", 6, 6}, {"auto", 4, 7}, {"dyn=", 4, 8}, {"lyrics=", 7, 9}, {"scale=", 6, 10}, {"gchord=", 7, 11}, {0} }; struct kw_s *kw; /* save the parameters of the previous voice */ curvoice->ulen = ulen; curvoice->microscale = microscale; if (voice_tb[0].id[0] == '\0') { switch (s->prev->type) { case ABC_T_EOLN: case ABC_T_NOTE: case ABC_T_REST: case ABC_T_BAR: /* the previous voice was implicit (after K:) */ voice_tb[0].id[0] = '1'; break; } } { char *id, sep; id = p; while (isalnum((unsigned char) *p) || *p == '_') p++; sep = *p; *p = '\0'; if (voice_tb[0].id[0] == '\0') { voice = 0; /* first voice */ } else { for (voice = 0; voice <= nvoice; voice++) { if (strcmp(id, voice_tb[voice].id) == 0) goto found; } if (voice >= MAXVOICE) { syntax("Too many voices", id); voice--; } } nvoice = voice; strncpy(voice_tb[voice].id, id, sizeof voice_tb[voice].id - 1); voice_tb[voice].mvoice = voice; found: strcpy(s->u.voice.id, voice_tb[voice].id); *p = sep; } curvoice = &voice_tb[voice]; s->u.voice.voice = voice; /* if in tune, set the voice parameters */ if (abc_state == ABC_S_TUNE) { ulen = curvoice->ulen; microscale = curvoice->microscale; } /* parse the other parameters */ clef_name = clef_middle = clef_lines = clef_scale = NULL; p_octave = NULL; p_stem = &s->u.voice.stem; for (;;) { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; p = parse_extra(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, &p_octave); if (*p == '\0') break; for (kw = kw_tb; kw->name; kw++) { if (strncmp(p, kw->name, kw->len) == 0) break; } if (!kw->name) { while (!isspace((unsigned char) *p) && *p != '\0') p++; /* ignore unknown keywords */ continue; } p += kw->len; switch (kw->index) { case 0: /* name */ p = get_str(name, p, VOICE_NAME_SZ); s->u.voice.fname = alloc_f(strlen(name) + 1); strcpy(s->u.voice.fname, name); break; case 1: /* subname */ p = get_str(name, p, VOICE_NAME_SZ); s->u.voice.nname = alloc_f(strlen(name) + 1); strcpy(s->u.voice.nname, name); break; case 2: /* merge */ s->u.voice.merge = 1; break; case 3: /* up */ *p_stem = 1; break; case 4: /* down */ *p_stem = -1; break; case 5: /* stem= */ p_stem = &s->u.voice.stem; break; case 6: /* gstem= */ p_stem = &s->u.voice.gstem; break; case 7: /* auto */ *p_stem = 2; break; case 8: /* dyn= */ p_stem = &s->u.voice.dyn; break; case 9: /* lyrics= */ p_stem = &s->u.voice.lyrics; break; case 10: { /* scale= */ float sc; sc = atof(p); if (sc >= 0.5 && sc <= 2) s->u.voice.scale = sc; else error_txt = "Bad value for voice scale"; while (!isspace((unsigned char) *p) && *p != '\0') p++; break; } case 11: /* gchord= */ p_stem = &s->u.voice.gchord; break; } } s->u.voice.octave = parse_octave(p_octave); if (clef_name || clef_middle || clef_lines || clef_scale) { s = abc_new(s->tune, NULL, NULL); s->type = ABC_T_CLEF; parse_clef(s, clef_name, clef_middle, clef_lines, clef_scale); } return error_txt; } /* -- parse a bar -- */ static char *parse_bar(struct abctune *t, char *p) { struct abcsym *s; int bar_type; char repeat_value[32]; p--; bar_type = 0; for (;;) { switch (*p++) { case '|': bar_type <<= 4; bar_type |= B_BAR; continue; case '[': bar_type <<= 4; bar_type |= B_OBRA; continue; case ']': bar_type <<= 4; bar_type |= B_CBRA; continue; case ':': bar_type <<= 4; bar_type |= B_COL; continue; default: break; } break; } p--; /* if the last element is '[', it may start * a chord, an embedded header or an other bar */ if ((bar_type & 0x0f) == B_OBRA && bar_type != B_OBRA && *p != ' ') { bar_type >>= 4; p--; } if (bar_type == (B_OBRA << 8) + (B_BAR << 4) + B_CBRA) /* [|] */ bar_type = (B_OBRA << 4) + B_CBRA; /* [] */ /* curvoice->last_note = NULL; */ if (vover > 0) { curvoice = &voice_tb[curvoice->mvoice]; vover = 0; } s = abc_new(t, gchord, NULL); if (gchord) { if (free_f) free_f(gchord); gchord = NULL; } s->type = ABC_T_BAR; s->u.bar.type = bar_type; if (dc.n > 0) { memcpy(&s->u.bar.dc, &dc, sizeof s->u.bar.dc); dc.n = dc.h = dc.s = 0; } if (!lyric_started) { lyric_started = 1; s->flags |= ABC_F_LYRIC_START; } if (!isdigit((unsigned char) *p) /* if not a repeat bar */ && (*p != '"' || p[-1] != '[')) /* ('["' only) */ return p; if (*p == '"') { p = get_str(repeat_value, p, sizeof repeat_value); } else { char *q; q = repeat_value; while (isdigit((unsigned char) *p) || *p == ',' || *p == '-' || (*p == '.' && isdigit((unsigned char) p[1]))) { if (q < &repeat_value[sizeof repeat_value - 1]) *q++ = *p++; else p++; } *q = '\0'; } if (bar_type != B_OBRA || s->text) { s = abc_new(t, repeat_value, NULL); s->type = ABC_T_BAR; s->u.bar.type = B_OBRA; } else { s->text = alloc_f(strlen(repeat_value) + 1); strcpy(s->text, repeat_value); } s->u.bar.repeat_bar = 1; return p; } /* -- parse note or rest with pitch and length -- */ /* in case of error, 'accidental' is set to -1 */ static char *parse_basic_note(char *p, int *pitch, int *length, int *accidental, int *stemless) { int pit, len, acc, nostem; acc = pit = nostem = 0; /* look for accidental sign */ switch (*p) { case '^': p++; if (*p == '^') { p++; acc = A_DS; } else { acc = A_SH; } break; case '=': p++; acc = A_NT; break; case '_': p++; if (*p == '_') { p++; acc = A_DF; } else { acc = A_FT; } break; } /* look for microtone value */ if (acc != 0 && (isdigit((unsigned char) *p) || (*p == '/' && microscale == 0))) { int n, d; char *q; n = d = 1; if (*p != '/') { n = strtol(p, &q, 10); p = q; } if (*p == '/') { p++; if (!isdigit((unsigned char) *p)) { d = 2; } else { d = strtol(p, &q, 10); p = q; } } if (microscale == 0) { d--; d += (n - 1) << 8; /* short [ (n-1) | (d-1) ] */ for (n = 1; n < MAXMICRO; n++) { if (p_micro[n] == d) break; if (p_micro[n] == 0) { p_micro[n] = d; break; } } if (n == MAXMICRO) { syntax("Too many microtone accidentals", p); n = 0; } } acc += (n << 3); } /* get the pitch */ { char *p_n; p_n = strchr(all_notes, *p); if (!p_n) { syntax(acc ? "Missing note after accidental" : "Not a note", p); acc = -1; if (*p == '\0') p--; } else { pit = p_n - all_notes + 16; } p++; } while (*p == '\'') { /* eat up following ' chars */ pit += 7; p++; } while (*p == ',') { /* eat up following , chars */ pit -= 7; p++; } if (*p == '0') { nostem = 1; p++; } p = parse_len(p, &len); *pitch = pit; *length = len; *accidental = acc; *stemless = nostem; return p; } /* -- parse the decorations of notes and bars -- */ char *parse_deco(char *p, struct deco *deco) { int n; unsigned char c, d; n = deco->n; for (;;) { c = (unsigned char) *p++; if (char_tb[c] != CHAR_DECO && char_tb[c] != CHAR_DECOS) break; if (char_tb[c] == CHAR_DECOS) { p = get_deco(p, &d); c = d; } if (n >= MAXDC) syntax("Too many decorations for the note", p); else if (c != 0) deco->t[n++] = c; } deco->n = n; return p - 1; } /* -- parse a decoration line (d: or s:) -- */ static char *parse_decoline(char *p) { struct abcsym *is; unsigned char d; int n; if ((is = deco_cont) == NULL) is = deco_start; else deco_cont = NULL; /* scan the decoration line */ while (*p != '\0') { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; switch (*p) { case '|': while (is && (is->type != ABC_T_BAR || is->u.bar.type == B_OBRA)) is = is->next; if (!is) { syntax("Not enough bar lines for deco line", p); return NULL; } is = is->next; p++; continue; case '*': while (is && is->type != ABC_T_NOTE) is = is->next; if (!is) { syntax("Not enough notes for deco line", p); return NULL; } is = is->next; p++; continue; case '\\': if (p[1] == '\0') { if (!is) return "Not enough notes for deco line"; deco_cont = is; return NULL; } syntax("'\\' ignored", p); p++; continue; case '"': p = parse_gchord(p + 1); break; default: if (char_tb[(unsigned char) *p] == CHAR_DECOS) p = get_deco(p + 1, &d); else d = (unsigned char) *p++; break; } /* store the decoration / gchord/annotation in the next note */ while (is && (is->type != ABC_T_NOTE || (is->flags & ABC_F_GRACE))) is = is->next; if (!is) return "Not enough notes for deco line"; if (gchord) { if (is->text) { char *gch; n = strlen(is->text); gch = alloc_f(n + strlen(gchord) + 2); strcpy(gch, is->text); gch[n] = '\n'; strcpy(gch + n + 1, gchord); if (free_f) { free_f(gchord); free_f(is->text); } gchord = gch; } is->text = gchord; gchord = NULL; } else { n = is->u.note.dc.n; if (n >= MAXDC) { syntax("Too many decorations for the note", p); } else if (d != 0) { is->u.note.dc.t[n] = d; is->u.note.dc.n = n + 1; } } is = is->next; } return NULL; } /* -- parse a guitar chord / annotation -- */ static char *parse_gchord(char *p) { char *q; int l, l2; q = p; while (*p != '"') { if (*p == '\\') p++; if (*p == '\0') { syntax("No end of guitar chord", p); break; } p++; } l = p - q; if (gchord) { char *gch; /* many guitar chords: concatenate with '\n' */ l2 = strlen(gchord); gch = alloc_f(l2 + 1 + l + 1); strcpy(gch, gchord); gch[l2++] = '\n'; strncpy(&gch[l2], q, l); gch[l2 + l] = '\0'; if (free_f) free_f(gchord); gchord = gch; } else { gchord = alloc_f(l + 1); strncpy(gchord, q, l); gchord[l] = '\0'; } if (*p != '\0') p++; return p; } /* -- parse a note length -- */ static char *parse_len(char *p, int *p_len) { int len, fac; char *q; len = BASE_LEN; if (isdigit((unsigned char) *p)) { len *= strtol(p, &q, 10); if (len <= 0) { syntax("Bad length", p); len = BASE_LEN; } p = q; } fac = 1; while (*p == '/') { p++; if (isdigit((unsigned char) *p)) { fac *= strtol(p, &q, 10); if (fac == 0) { syntax("Bad length divisor", p - 1); fac = 1; } p = q; } else { fac *= 2; } } if (len % fac) syntax("Bad length divisor", p - 1); len /= fac; *p_len = len; return p; } /* -- parse a ABC line -- */ /* return 1 on end of tune, and 2 on start of new tune */ static int parse_line(struct abctune *t, char *p) { struct abcsym *s; char *comment, *q, c; struct abcsym *last_note_sav = NULL; struct deco dc_sav; int i, flags, flags_sav = 0, slur; static char qtb[10] = {0, 1, 3, 2, 3, 0, 2, 0, 3, 0}; colnum = 0; switch (*p) { case '\0': /* blank line */ switch (abc_state) { case ABC_S_GLOBAL: case ABC_S_HEAD: /*fixme: may have blank lines in headers?*/ if (keep_comment || abc_state == ABC_S_GLOBAL) { if (t->last_sym && t->last_sym->type != ABC_T_NULL) { s = abc_new(t, NULL, NULL); s->type = ABC_T_NULL; } } return 0; } return 1; case '%': if (p[1] == '@') { /* line number - see front.c */ linenum = atol(p + 2); if (linenum == 0 && strncmp(file, "%abc-", 5) == 0) get_vers(file + 5); return 0; } if (p[1] == '%') { if (strncmp(p + 2, "begin", 5) != 0) comment = decomment_line(p + 2); else comment = NULL; s = abc_new(t, p, comment); s->type = ABC_T_PSCOM; p += 2; /* skip '%%' */ if (strncasecmp(p, "abc-version ", 12) == 0) { get_vers(p + 12); return 0; } if (strncasecmp(p, "decoration ", 11) == 0) { p += 11; while (isspace((unsigned char) *p)) p++; switch (*p) { case '!': char_tb['!'] = CHAR_DECOS; char_tb['+'] = CHAR_BAD; break; case '+': char_tb['+'] = CHAR_DECOS; char_tb['!'] = CHAR_BAD; break; } return 0; } if (strncasecmp(p, "linebreak ", 10) == 0) { for (i = 0; i < sizeof char_tb; i++) { if (char_tb[i] == CHAR_LINEBREAK) char_tb[i] = i != '!' ? CHAR_BAD : CHAR_DECOS; } p += 10; for (;;) { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; switch (*p) { case '!': case '$': case '*': case ';': case '?': case '@': char_tb[(unsigned char) *p++] = CHAR_LINEBREAK; break; case '<': if (strcmp(p, "") == 0) return 0; if (strcmp(p, "") == 0) { char_tb['\n'] = CHAR_LINEBREAK; p += 5; break; } /* fall thru */ default: if (strcmp(p, "lock") != 0) syntax("Invalid character in %%%%linebreak", p); return 0; } } return 0; } if (strncasecmp(p, "user ", 5) == 0) { p += 5; while (isspace((unsigned char) *p)) p++; get_user(p, s); return 0; } return 0; } /* fall thru */ case '\\': /* abc2mtex specific lines */ if (keep_comment) { s = abc_new(t, p, NULL); s->type = ABC_T_NULL; } return 0; /* skip */ } comment = decomment_line(p); /* header fields */ if (p[1] == ':' && *p != '|' && *p != ':') { /* not '|:' nor '::' */ int new_tune; new_tune = parse_info(t, p, comment); /* handle BarFly voice definition */ /* 'V:n ' */ if (*p != 'V' || abc_state != ABC_S_TUNE) return new_tune; /* (normal return) */ c = p[strlen(p) - 1]; if (c != '|' && c != ']') return new_tune; while (!isspace((unsigned char) *p) && *p != '\0') p++; while (isspace((unsigned char) *p)) p++; } if (abc_state != ABC_S_TUNE) { if (keep_comment) { s = abc_new(t, p, comment); s->type = ABC_T_NULL; } return 0; } flags = 0; if (abc_vers <= (2 << 16)) lyric_started = 0; deco_start = deco_cont = NULL; slur = 0; while (*p != '\0') { colnum = p - abc_line; switch (char_tb[(unsigned char) *p++]) { case CHAR_GCHORD: /* " */ if (flags & ABC_F_GRACE) goto bad_char; p = parse_gchord(p); break; case CHAR_GR_ST: /* '{' */ if (flags & ABC_F_GRACE) goto bad_char; last_note_sav = curvoice->last_note; curvoice->last_note = NULL; memcpy(&dc_sav, &dc, sizeof dc); dc.n = dc.h = dc.s = 0; flags_sav = flags; flags = ABC_F_GRACE; if (*p == '/') { flags |= ABC_F_SAPPO; p++; } break; case CHAR_GR_EN: /* '}' */ if (!(flags & ABC_F_GRACE)) goto bad_char; t->last_sym->flags |= ABC_F_GR_END; curvoice->last_note = last_note_sav; memcpy(&dc, &dc_sav, sizeof dc); flags = flags_sav; break; case CHAR_DECOS: if (p[-1] == '!' && char_tb['\n'] == CHAR_LINEBREAK && check_nl(p)) { s = abc_new(t, NULL, NULL); /* abc2win EOL */ s->type = ABC_T_EOLN; s->u.eoln.type = 2; break; } /* fall thru */ case CHAR_DECO: if (p[-1] == '.') { if (*p == '(' || *p == '-' || *p == ')') break; if (*p == '|') { p = parse_bar(t, p + 1); t->last_sym->u.bar.dotted = 1; break; } } p = parse_deco(p - 1, &dc); dc.h = dc.s = dc.n; break; case CHAR_LINEBREAK: s = abc_new(t, NULL, NULL); s->type = ABC_T_EOLN; // s->u.eoln.type = 0; break; case CHAR_ACC: case CHAR_NOTE: case CHAR_REST: p = parse_note(t, p - 1, flags); flags &= ABC_F_GRACE; t->last_sym->u.note.slur_st = slur; slur = 0; if (t->last_sym->u.note.lens[0] > 0) /* if not space */ curvoice->last_note = t->last_sym; break; case CHAR_SLASH: /* '/' */ if (flags & ABC_F_GRACE) goto bad_char; q = p; while (*q == '/') q++; if (char_tb[(unsigned char) *q] != CHAR_BAR) goto bad_char; s = abc_new(t, NULL, NULL); s->type = ABC_T_MREP; s->u.bar.type = 0; s->u.bar.len = q - p + 1; syntax("Non standard measure repeat syntax", p - 1); p = q; break; case CHAR_BSLASH: /* '\\' */ if (*p == '\0') break; syntax("'\\' ignored", p - 1); break; case CHAR_OBRA: /* '[' */ if (*p == '|' || *p == ']' || *p == ':' || isdigit((unsigned char) *p) || *p == '"' || *p == ' ') { if (flags & ABC_F_GRACE) goto bad_char; p = parse_bar(t, p); break; } if (p[1] != ':') { p = parse_note(t, p - 1, flags); /* chord */ flags &= ABC_F_GRACE; t->last_sym->u.note.slur_st = slur; slur = 0; curvoice->last_note = t->last_sym; break; } /* embedded header */ #if 0 /*fixme:OK for [I:staff n], ?? for other headers*/ if (flags & ABC_F_GRACE) goto bad_char; #endif while (p[2] == ' ') { /* remove the spaces */ p[2] = ':'; p[1] = *p; p++; } c = ']'; q = p; while (*p != '\0' && *p != c) p++; if (*p == '\0') { syntax("Escape sequence [..] not closed", q); c = '\0'; } else { *p = '\0'; } parse_info(t, q, NULL); *p = c; if (c != '\0') p++; break; case CHAR_BAR: /* '|', ':' or ']' */ if (flags & ABC_F_GRACE) goto bad_char; p = parse_bar(t, p); break; case CHAR_OPAR: /* '(' */ if (isdigit((unsigned char) *p)) { int pplet, qplet, rplet; pplet = strtol(p, &q, 10); if (pplet <= 1) { syntax("Invalid 'p' in tuplet", p); pplet = 0; } p = q; if ((unsigned) pplet < sizeof qtb / sizeof qtb[0]) qplet = qtb[pplet]; else qplet = qtb[0]; rplet = pplet; if (*p == ':') { p++; if (isdigit((unsigned char) *p)) { qplet = strtol(p, &q, 10); p = q; } if (*p == ':') { p++; if (isdigit((unsigned char) *p)) { rplet = strtol(p, &q, 10); p = q; } } } if (pplet == 0) break; if (rplet < 1) { syntax("Invalid 'r' in tuplet", p); break; } if (qplet == 0) qplet = meter % 3 == 0 ? 3 : 2; s = abc_new(t, NULL, NULL); s->type = ABC_T_TUPLET; s->u.tuplet.p_plet = pplet; s->u.tuplet.q_plet = qplet; s->u.tuplet.r_plet = rplet; s->flags |= flags; break; } if (*p == '&') { if (flags & ABC_F_GRACE) goto bad_char; p++; if (vover != 0) { syntax("Nested voice overlay", p - 1); break; } s = abc_new(t, NULL, NULL); s->type = ABC_T_V_OVER; s->u.v_over.type = V_OVER_S; s->u.v_over.voice = curvoice - voice_tb; vover = -1; /* multi-bars */ break; } slur <<= 3; if (p[-2] == '.' && dc.n == 0) slur |= SL_DOTTED; switch (*p) { case '\'': slur += SL_ABOVE; p++; break; case ',': slur += SL_BELOW; p++; break; default: slur += SL_AUTO; break; } break; case CHAR_CPAR: /* ')' */ switch (t->last_sym->type) { case ABC_T_NOTE: case ABC_T_REST: break; default: goto bad_char; } t->last_sym->u.note.slur_end++; break; case CHAR_VOV: /* '&' */ if (flags & ABC_F_GRACE) goto bad_char; if (*p != ')' || vover == 0) { /*??*/ if (!curvoice->last_note) { syntax("Bad start of voice overlay", p); break; } s = abc_new(t, NULL, NULL); s->type = ABC_T_V_OVER; /*s->u.v_over.type = V_OVER_V; */ vover_new(); s->u.v_over.voice = curvoice - voice_tb; if (vover == 0) vover = 1; /* single bar */ break; } p++; vover = 0; s = abc_new(t, NULL, NULL); s->type = ABC_T_V_OVER; s->u.v_over.type = V_OVER_E; s->u.v_over.voice = curvoice->mvoice; curvoice->last_note = NULL; /* ?? */ curvoice = &voice_tb[curvoice->mvoice]; break; case CHAR_SPAC: /* ' ' and '\t' */ flags |= ABC_F_SPACE; break; case CHAR_MINUS: { /* '-' */ int tie_pos; if (!curvoice->last_note || curvoice->last_note->type != ABC_T_NOTE) goto bad_char; if (p[-2] == '.' && dc.n == 0) tie_pos = SL_DOTTED; else tie_pos = 0; switch (*p) { case '\'': tie_pos += SL_ABOVE; p++; break; case ',': tie_pos += SL_BELOW; p++; break; default: tie_pos += SL_AUTO; break; } for (i = 0; i <= curvoice->last_note->u.note.nhd; i++) { if (curvoice->last_note->u.note.ti1[i] == 0) curvoice->last_note->u.note.ti1[i] = tie_pos; else if (curvoice->last_note->u.note.nhd == 0) syntax("Too many ties", p); } break; } case CHAR_BRHY: /* '>' and '<' */ if (!curvoice->last_note) goto bad_char; i = 1; while (*p == p[-1]) { i++; p++; } if (i > 3) { syntax("Bad broken rhythm", p - 1); i = 3; } if (p[-1] == '<') i = -i; broken_rhythm(&curvoice->last_note->u.note, i); curvoice->last_note->u.note.brhythm = i; break; case CHAR_IGN: /* '*' & '`' */ break; default: bad_char: syntax((flags & ABC_F_GRACE) ? "Bad character in grace note sequence" : "Bad character", p - 1); break; } } /*fixme: may we have grace notes across lines?*/ if (flags & ABC_F_GRACE) { syntax("EOLN in grace note sequence", p - 1); if (curvoice->last_note) curvoice->last_note->flags |= ABC_F_GR_END; curvoice->last_note = last_note_sav; memcpy(&dc, &dc_sav, sizeof dc); } /* add eoln */ s = abc_new(t, NULL, NULL); s->type = ABC_T_EOLN; if (flags & ABC_F_SPACE) s->flags |= ABC_F_SPACE; if (p[-1] == '\\' || char_tb['\n'] != CHAR_LINEBREAK) s->u.eoln.type = 1; /* no break */ return 0; } /* -- parse a note or a rest -- */ static char *parse_note(struct abctune *t, char *p, int flags) { struct abcsym *s; char *q; int pit, len, acc, nostem, chord, j, m; if (flags & ABC_F_GRACE) { /* in a grace note sequence */ s = abc_new(t, NULL, NULL); } else { s = abc_new(t, gchord, NULL); if (gchord) { if (free_f) free_f(gchord); gchord = NULL; } } s->type = ABC_T_NOTE; s->flags |= flags; if (!lyric_started) { lyric_started = 1; s->flags |= ABC_F_LYRIC_START; } if (*p != 'X' && *p != 'Z' && !(flags & ABC_F_GRACE)) { if (!deco_start) deco_start = s; } /* rest */ switch (*p) { case 'X': case 'Z': /* multi-rest */ s->type = ABC_T_MREST; if (*p == 'X') s->flags |= ABC_F_INVIS; p++; len = 1; if (isdigit((unsigned char) *p)) { len = strtol(p, &q, 10); if (len == 0 && len > 100) { syntax("Bad number of measures", p); len = 1; } p = q; } s->u.bar.type = 0; s->u.bar.len = len; goto add_deco; case 'y': /* space (BarFly) */ s->type = ABC_T_REST; s->flags |= ABC_F_INVIS; p++; if (isdigit((unsigned char) *p)) { /* number of points */ s->u.note.lens[1] = strtol(p, &q, 10); p = q; } else { s->u.note.lens[1] = -1; } goto add_deco; case 'x': /* invisible rest */ s->flags |= ABC_F_INVIS; /* fall thru */ case 'z': s->type = ABC_T_REST; p = parse_len(p + 1, &len); s->u.note.lens[0] = len * ulen / BASE_LEN; goto do_brhythm; } chord = 0; q = p; if (*p == '[') { /* '[..]' = chord */ chord = 1; p++; } /* get pitch, length and possible accidental */ m = 0; nostem = 0; for (;;) { int tmp; if (chord) { if (m >= MAXHD) { syntax("Too many notes in chord", p); m--; } tmp = 0; if (*p == '.') { tmp = SL_DOTTED; p++; } if (*p == '(') { p++; switch (*p) { case '\'': tmp += SL_ABOVE; p++; break; case ',': tmp += SL_BELOW; p++; break; default: tmp += SL_AUTO; break; } s->u.note.sl1[m] = (s->u.note.sl1[m] << 3) + tmp; } } tmp = dc.n; p = parse_deco(p, &dc); /* note head decorations */ if (dc.n != tmp) { if (dc.n - tmp >= 8) { syntax("Too many decorations on this head", p); tmp = dc.n - 7; } s->u.note.decs[m] = (tmp << 3) + dc.n - tmp; dc.s = dc.n; } p = parse_basic_note(p, &pit, &len, &acc, &tmp); if (!(flags & ABC_F_GRACE)) len = len * ulen / BASE_LEN; else len /= 8; /* for grace note alone */ s->u.note.pits[m] = pit; s->u.note.lens[m] = len; s->u.note.accs[m] = acc; nostem |= tmp; if (chord) { for (;;) { if (*p == '.') { if (p[1] != '-') break; p++; } if (*p == '-') { switch (p[1]) { case '\'': s->u.note.ti1[m] = SL_ABOVE; p++; break; case ',': s->u.note.ti1[m] = SL_BELOW; p++; break; default: s->u.note.ti1[m] = SL_AUTO; break; } } else if (*p == ')') { s->u.note.sl2[m]++; } else { break; } p++; } } if (acc >= 0) /* if no error */ m++; /* normal case */ if (!chord) break; if (*p == ']') { p++; if (*p == '0') { nostem |= 1; p++; } if (*p == '/' || isdigit((unsigned char) *p)) { p = parse_len(p, &len); s->u.note.chlen = len; for (j = 0; j < m; j++) { tmp = len * s->u.note.lens[j]; s->u.note.lens[j] = tmp / BASE_LEN; } } break; } if (*p == '\0') { syntax("Chord not closed", q); break; } } if (nostem) s->flags |= ABC_F_STEMLESS; if (m == 0) /* if no note (or error) */ goto err; s->u.note.microscale = microscale; s->u.note.nhd = m - 1; do_brhythm: if (curvoice->last_note && curvoice->last_note->u.note.brhythm != 0) broken_rhythm(&s->u.note, -curvoice->last_note->u.note.brhythm); add_deco: if (dc.n > 0) { memcpy(s->type != ABC_T_MREST ? &s->u.note.dc : &s->u.bar.dc, &dc, sizeof dc); dc.n = dc.h = dc.s = 0; } /* forbid rests in grace note sequences */ if (s->type != ABC_T_NOTE && (flags & ABC_F_GRACE)) { syntax("Not a note in grace note sequence", p); goto err; } return p; err: if ((t->last_sym = s->prev) == NULL) { t->first_sym = NULL; } else { s->prev->next = NULL; s->prev->flags |= (s->flags & ABC_F_ERROR); } return p; } /* -- parse an information field -- */ /* return 2 on start of new tune */ static int parse_info(struct abctune *t, char *p, char *comment) { struct abcsym *s; char info_type = *p; char *error_txt = NULL; s = abc_new(t, p, comment); s->type = ABC_T_INFO; p += 2; switch (info_type) { case 'd': case 's': if (abc_state == ABC_S_GLOBAL) break; if (!deco_start) { error_txt = "Erroneous 'd:'/'s:'"; break; } error_txt = parse_decoline(p); break; case 'K': if (abc_state == ABC_S_GLOBAL) break; parse_key(p, s); if (abc_state == ABC_S_HEAD) { int i; abc_state = ABC_S_TUNE; if (ulen == 0) ulen = BASE_LEN / 8; for (i = MAXVOICE; --i >= 0; ) voice_tb[i].ulen = ulen; lyric_started = 0; } break; case 'L': error_txt = get_len(p, s); if (s->u.length.base_length > 0) ulen = s->u.length.base_length; break; case 'M': error_txt = parse_meter(p, s); break; case 'Q': error_txt = parse_tempo(p, s); break; case 'U': error_txt = get_user(p, s); break; case 'V': if (abc_state == ABC_S_GLOBAL) break; error_txt = parse_voice(p, s); break; case 'X': memset(voice_tb, 0, sizeof voice_tb); nvoice = 0; curvoice = &voice_tb[0]; abc_state = ABC_S_HEAD; if (level_f) level_f(1); return 2; } if (error_txt) syntax(error_txt, p); return 0; } /* -- print a syntax error message -- */ static void syntax(char *msg, char *q) { int n, len, m1, m2, pp; int maxcol = 73; severity = 1; n = q - abc_line; len = strlen(abc_line); if ((unsigned) n > (unsigned) len) n = -1; print_error(msg, n); if (n < 0) { if (q && *q != '\0') fprintf(stderr, " (near '%s')\n", q); return; } m1 = 0; m2 = len; if (m2 > maxcol) { if (n < maxcol) { m2 = maxcol; } else { m1 = n - 20; m2 = m1 + maxcol; if (m2 > len) m2 = len; } } fprintf(stderr, "%4d ", linenum); pp = 6; if (m1 > 0) { fprintf(stderr, "..."); pp += 3; } fprintf(stderr, "%.*s", m2 - m1, &abc_line[m1]); if (m2 < len) fprintf(stderr, "..."); fprintf(stderr, "\n"); if ((unsigned) n < 200) fprintf(stderr, "%*s\n", n + pp - m1, "^"); if (last_sym) last_sym->flags |= ABC_F_ERROR; } /* -- switch to a new voice overlay -- */ static void vover_new(void) { int voice, mvoice; mvoice = curvoice->mvoice; for (voice = curvoice - voice_tb + 1; voice <= nvoice; voice++) if (voice_tb[voice].mvoice == mvoice) break; if (voice > nvoice) { if (nvoice >= MAXVOICE) { syntax("Too many voices", 0); return; } nvoice = voice; voice_tb[voice].id[0] = '&'; voice_tb[voice].mvoice = mvoice; } voice_tb[voice].ulen = curvoice->ulen; voice_tb[voice].microscale = curvoice->microscale; curvoice = &voice_tb[voice]; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/abcparse.h����������������������������������������������������������������������������0000644�0001750�0001750�00000016571�12314503216�013120� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*++ * Declarations for abcparse.c. * *-*/ #define MAXVOICE 32 /* max number of voices */ #define MAXHD 8 /* max heads in a chord */ #define MAXDC 45 /* max decorations per note/chord/bar */ #define MAXMICRO 32 /* max microtone values (5 bits in accs[]) */ #define BASE_LEN 1536 /* basic note length (semibreve or whole note - same as MIDI) */ #define VOICE_ID_SZ 16 /* max size of the voice identifiers */ /* accidentals */ enum accidentals { A_NULL, /* none */ A_SH, /* sharp */ A_NT, /* natural */ A_FT, /* flat */ A_DS, /* double sharp */ A_DF /* double flat */ }; /* bar types - 4 bits per symbol */ #define B_BAR 1 /* | */ #define B_OBRA 2 /* [ */ #define B_CBRA 3 /* ] */ #define B_COL 4 /* : */ /* slur/tie types (3 bits) */ #define SL_ABOVE 0x01 #define SL_BELOW 0x02 #define SL_AUTO 0x03 #define SL_DOTTED 0x04 /* (modifier bit) */ /* note structure */ struct deco { /* decorations */ char n; /* whole number of decorations */ char h; /* start of head decorations */ char s; /* start of decorations from s: (d:) */ unsigned char t[MAXDC]; /* decoration type */ }; struct note { /* note or rest */ signed char pits[MAXHD]; /* pitches */ short lens[MAXHD]; /* note lengths (# pts in [1] if space) */ unsigned char accs[MAXHD]; /* code for accidentals & index in micro_tb */ unsigned char sl1[MAXHD]; /* slur start per head */ char sl2[MAXHD]; /* number of slur end per head */ char ti1[MAXHD]; /* flag to start tie here */ unsigned char decs[MAXHD]; /* head decorations (index: 5 bits, len: 3 bits) */ short chlen; /* chord length */ char nhd; /* number of notes in chord - 1 */ unsigned char slur_st; /* slurs starting here (2 bits array) */ char slur_end; /* number of slurs ending here */ signed char brhythm; /* broken rhythm */ unsigned char microscale; /* microtone denominator - 1 */ struct deco dc; /* decorations */ }; /* symbol definition */ struct abctune; struct abcsym { struct abctune *tune; /* tune */ struct abcsym *next, *prev; /* next / previous symbol */ char type; /* symbol type */ #define ABC_T_NULL 0 #define ABC_T_INFO 1 /* (text[0] gives the info type) */ #define ABC_T_PSCOM 2 #define ABC_T_CLEF 3 #define ABC_T_NOTE 4 #define ABC_T_REST 5 #define ABC_T_BAR 6 #define ABC_T_EOLN 7 #define ABC_T_MREST 8 /* multi-measure rest */ #define ABC_T_MREP 9 /* measure repeat */ #define ABC_T_V_OVER 10 /* voice overlay */ #define ABC_T_TUPLET 11 char state; /* symbol state in file/tune */ #define ABC_S_GLOBAL 0 /* global */ #define ABC_S_HEAD 1 /* in header (after X:) */ #define ABC_S_TUNE 2 /* in tune (after K:) */ unsigned short flags; #define ABC_F_ERROR 0x0001 /* error around this symbol */ #define ABC_F_INVIS 0x0002 /* invisible symbol */ #define ABC_F_SPACE 0x0004 /* space before a note */ #define ABC_F_STEMLESS 0x0008 /* note with no stem */ #define ABC_F_LYRIC_START 0x0010 /* may start a lyric here */ #define ABC_F_GRACE 0x0020 /* grace note */ #define ABC_F_GR_END 0x0040 /* end of grace note sequence */ #define ABC_F_SAPPO 0x0080 /* short appoggiatura */ unsigned short colnum; /* ABC source column number */ int linenum; /* ABC source line number */ char *fn; /* ABC source file name */ char *text; /* main text (INFO, PSCOM), * guitar chord (NOTE, REST, BAR) */ char *comment; /* comment part (when keep_comment) */ union { /* type dependent part */ struct key_s { /* K: info */ signed char sf; /* sharp (> 0) flats (< 0) */ char empty; /* clef alone if 1, 'none' if 2 */ char exp; /* exp (1) or mod (0) */ char mode; /* mode */ /* 0: Ionian, 1: Dorian, 2: Phrygian, 3: Lydian, 4: Mixolydian * 5: Aeolian, 6: Locrian, 7: major, 8:minor, 9: HP, 10: Hp */ #define MAJOR 7 #define MINOR 8 #define BAGPIPE 9 /* bagpipe when >= 8 */ signed char nacc; /* number of explicit accidentals */ /* (-1) if no accidental */ signed char octave; /* 'octave=' */ #define NO_OCTAVE 10 /* no 'octave=' */ unsigned char microscale; /* microtone denominator - 1 */ signed char pits[8]; unsigned char accs[8]; } key; struct { /* L: info */ int base_length; /* basic note length */ } length; struct meter_s { /* M: info */ short wmeasure; /* duration of a measure */ unsigned char nmeter; /* number of meter elements */ char expdur; /* explicit measure duration */ #define MAX_MEASURE 6 struct { char top[8]; /* top value */ char bot[2]; /* bottom value */ } meter[MAX_MEASURE]; } meter; struct { /* Q: info */ char *str1; /* string before */ short length[4]; /* up to 4 note lengths */ char *value; /* tempo value */ char *str2; /* string after */ } tempo; struct { /* V: info */ char id[VOICE_ID_SZ]; /* voice ID */ char *fname; /* full name */ char *nname; /* nick name */ float scale; /* != 0 when change */ unsigned char voice; /* voice number */ signed char octave; /* 'octave=' - same as in K: */ char merge; /* merge with previous voice */ signed char stem; /* have stems up or down (2 = auto) */ signed char gstem; /* have grace stems up or down (2 = auto) */ signed char dyn; /* have dynamic marks above or below the staff */ signed char lyrics; /* have lyrics above or below the staff */ signed char gchord; /* have gchord above or below the staff */ } voice; struct { /* bar, mrest or mrep */ int type; char repeat_bar; char len; /* len if mrest or mrep */ char dotted; struct deco dc; /* decorations */ } bar; struct clef_s { /* clef (and staff!) */ char *name; /* PS drawing function */ float staffscale; /* != 0 when change */ signed char stafflines; /* >= 0 when change */ signed char type; /* no clef if < 0 */ #define TREBLE 0 #define ALTO 1 #define BASS 2 #define PERC 3 char line; signed char octave; signed char transpose; char invis; char check_pitch; /* check if old abc2ps transposition */ } clef; struct note note; /* note, rest */ struct { /* user defined accent */ unsigned char symbol; unsigned char value; } user; struct { char type; /* 0: end of line * 1: continuation ('\') * 2: line break ('!') */ } eoln; struct { /* voice overlay */ char type; #define V_OVER_V 0 /* & */ #define V_OVER_S 1 /* (& */ #define V_OVER_E 2 /* &) */ unsigned char voice; } v_over; struct { /* tuplet */ char p_plet, q_plet, r_plet; } tuplet; } u; }; /* tune definition */ struct abctune { struct abctune *next; /* next tune */ struct abcsym *first_sym; /* first symbol */ struct abcsym *last_sym; /* last symbol */ int abc_vers; /* ABC version = (H << 16) + (M << 8) + L */ void *client_data; /* client data */ unsigned short micro_tb[MAXMICRO]; /* microtone values [ (n-1) | (d-1) ] */ }; #ifdef WIN32 #define strcasecmp stricmp #define strncasecmp strnicmp #endif #if defined(__cplusplus) extern "C" { #endif extern char *deco_tb[]; extern int severity; void abc_delete(struct abcsym *as); void abc_free(struct abctune *first_tune); void abc_init(void *alloc_f_api(int size), void free_f_api(void *ptr), void level_f_api(int level), int client_sz_api, int keep_comment_api); void abc_insert(char *file_api, struct abcsym *s); struct abcsym *abc_new(struct abctune *t, char *p, char *comment); struct abctune *abc_parse(char *file_api); char *get_str(char *d, char *s, int maxlen); char *parse_deco(char *p, struct deco *deco); #if defined(__cplusplus) } #endif ���������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/accordion.abc�������������������������������������������������������������������������0000644�0001750�0001750�00000004451�11654555736�013615� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% tablature examples % --- diatonic accordion %%beginps % length x y n accordh - accordion tablature header with 2 or 3 lines /accordh{ % /Times-Roman 14 selectfont /nlines exch def .8 SLW gsave 20 add T /w exch def 0 0 M w 0 RL 0 3 M w 0 RL 0 21 M w 0 RL 0 39 M w 0 RL nlines 2 eq{ 0 42 M w 0 RL stroke /barh 42 def 3 7 M (T:) show 3 25 M (P:) show }{ 0 57 M w 0 RL 0 60 M w 0 RL stroke /barh 60 def 3 7 M (B/a:) show 3 25 M (T:) show 3 43 M (P:) show }ifelse grestore }! % string x y n accordn - accordion tablature /accordn{ -18 mul add barh add 3 add M showc }! /accordb{ 0 eq{20 add M 0 barh RL stroke} {pop pop}ifelse pop}! %%endps X:3 T:Andro à Patrice Corbel N: validé 03/05/01 -- 04/08/02 R:Andro O:Bretagne M:4/4 K:Am %%tablature 70 accordh accordn accordb "A"A2 cA "F" aAce | "G"dGBd "C"e4 | "F"fedc "G"B2 AB |1 "F"cABc "E"B4 :|2 "F"cABc "A"A4 :|\ w: * * * * * * * 8 6 7 8 7' * * * * * * * * * * * 7 * * * * * w: 7 8 7 11 7 8 9 * * * * * 8' 9 7' 8 6' 7 6' 8 7 6' 8 * 8 7 6' 8 7 "A"A2 GF "E"E3 B | "E"c2 d2 "C"e4 | "F"fedc "G"B2 AB |1 "F"cABc "E"B4 :|2 "F"cABc "A"A4 :| w: * 6 * 4' 7 6' 8 7' * * * * * * * * * * * 7 * * * * * w: 7 * 4' * * * * * 8' 9 7' 8 6' 7 6' 8 7 6' 8 * 8 7 6' 8 7 X:51 T:Jeune fille de quinze ans (50-51-52) T:Une fille de rose N: rev. 01/06/01 R:hanter dro C:trad A:Bretagne O:France M:3/4 L:1/8 Q:100 K:Am %%tablature 90 accordh accordn accordb |: "Am" ee/f/ "Am" ed "Am" c2 | "Am" ed/c/ "G" Bd "Am" cA | "Am" ee/f/ "Am" ed "Am" c2 |1 "Am" ed/c/ "G" BG "Em" E2 :|2 "Am" ed/c/ "G" BG "Am" A2 | w: * * * * * * | * * * 7 8 * * | * * * * * * | * * * 7 6 4'| * * * 7 6 * w: 9 9 8' 9 7' 8 | 9 7' 8 * * 8 7 | 9 9 8' 9 7' 8 | 9 7' 8 * * * | 9 7' 8 * * 7 w: A a * A a A~~a | A a * G g E e | A a * A a A~~a | A a * G g E~~e | A a * G g E~~e | |: "Am" AA/B/ "Am" cd "C" e2 | "G" de/f/ "F" af "Am" e2 | "Am" cd/e/ "F" fe "G" d2 |1 "G" Bc/d/ "Em" cB "Em" cB :|2 "G" Bc/d/ "Em" cB "Am" A2 || w: * * * * * 7' | 8 7' * * * * | * * * * * 8 | 7 6' 8 6' 7 6' 7 | 7 6' 8 6' 7 * w: 7 7 6' 8 7' * | * * 8' 9' 8' 9 | 8 7' 9 8' 9 * | * * * * * * * | * * * * * 7 w: A a * A a C~c | G g * F f A~a | A a * F f G~g | G g * E e E e | G g * E e A~a | �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/build.ninja���������������������������������������������������������������������������0000644�0001750�0001750�00000005774�12417252362�013321� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# rules for ninja (ninja-build) VERSION = 7.8.9 cflags = -g -O2 -Wall -pipe -DHAVE_CONFIG_H -I. #cflags = -g -Wall -pipe -DHAVE_CONFIG_H -I. ldflags = -lm rule cc # command = gcc $cflags -c $in -o $out command = clang $cflags -c $in -o $out # -mcpu=iwmmxt # -mcpu=iwmmxt2 # -mthumb -march=armv7-a rule ld # command = cc $ldflags -o $out $in command = clang $ldflags -o $out $in build abc2ps.o: cc abc2ps.c | config.h abcparse.h abc2ps.h front.h build abcparse.o: cc abcparse.c | config.h abcparse.h build buffer.o: cc buffer.c | config.h abcparse.h abc2ps.h build deco.o: cc deco.c | config.h abcparse.h abc2ps.h build draw.o: cc draw.c | config.h abcparse.h abc2ps.h build format.o: cc format.c | config.h abcparse.h abc2ps.h build front.o: cc front.c | config.h abcparse.h abc2ps.h front.h slre.h build glyph.o: cc glyph.c | config.h abcparse.h abc2ps.h build music.o: cc music.c | config.h abcparse.h abc2ps.h build parse.o: cc parse.c | config.h abcparse.h abc2ps.h build slre.o: cc slre.c | slre.h build subs.o: cc subs.c | config.h abcparse.h abc2ps.h build svg.o: cc svg.c | config.h abcparse.h abc2ps.h build syms.o: cc syms.c | config.h abcparse.h abc2ps.h build abcm2ps: ld abc2ps.o abcparse.o buffer.o deco.o draw.o format.o front.o $ glyph.o music.o parse.o slre.o subs.o svg.o syms.o default abcm2ps rule dist_tar command = ln -s . abcm2ps-$VERSION; $ tar -zcvf $out $ abcm2ps-$VERSION/Changes $ abcm2ps-$VERSION/INSTALL $ abcm2ps-$VERSION/License $ abcm2ps-$VERSION/Makefile $ abcm2ps-$VERSION/Makefile.in $ abcm2ps-$VERSION/README $ abcm2ps-$VERSION/abc2ps.c $ abcm2ps-$VERSION/abc2ps.h $ abcm2ps-$VERSION/abcparse.c $ abcm2ps-$VERSION/abcparse.h $ abcm2ps-$VERSION/accordion.abc $ abcm2ps-$VERSION/build.ninja $ abcm2ps-$VERSION/buffer.c $ abcm2ps-$VERSION/chinese.abc $ abcm2ps-$VERSION/configure $ abcm2ps-$VERSION/configure.in $ abcm2ps-$VERSION/config.h $ abcm2ps-$VERSION/config.h.in $ abcm2ps-$VERSION/config.guess $ abcm2ps-$VERSION/config.sub $ abcm2ps-$VERSION/deco.c $ abcm2ps-$VERSION/deco.abc $ abcm2ps-$VERSION/draw.c $ abcm2ps-$VERSION/features.txt $ abcm2ps-$VERSION/flute.fmt $ abcm2ps-$VERSION/format.c $ abcm2ps-$VERSION/format.txt $ abcm2ps-$VERSION/front.c $ abcm2ps-$VERSION/front.h $ abcm2ps-$VERSION/glyph.c $ abcm2ps-$VERSION/install.sh $ abcm2ps-$VERSION/landscape.fmt $ abcm2ps-$VERSION/music.c $ abcm2ps-$VERSION/musicfont.fmt $ abcm2ps-$VERSION/newfeatures.abc $ abcm2ps-$VERSION/options.txt $ abcm2ps-$VERSION/parse.c $ abcm2ps-$VERSION/sample.abc $ abcm2ps-$VERSION/sample2.abc $ abcm2ps-$VERSION/sample3.abc $ abcm2ps-$VERSION/sample3.eps $ abcm2ps-$VERSION/sample4.abc $ abcm2ps-$VERSION/sample5.abc $ abcm2ps-$VERSION/slre.c $ abcm2ps-$VERSION/slre.h $ abcm2ps-$VERSION/subs.c $ abcm2ps-$VERSION/svg.c $ abcm2ps-$VERSION/syms.c $ abcm2ps-$VERSION/tight.fmt $ abcm2ps-$VERSION/voices.abc;$ rm abcm2ps-$VERSION build abcm2ps-$VERSION.tar.gz: dist_tar build dist: phony abcm2ps-$VERSION.tar.gz ����abcm2ps-7.8.9/buffer.c������������������������������������������������������������������������������0000644�0001750�0001750�00000052414�12355567026�012616� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Postscript buffering functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2014 Jean-François Moine * Adapted from abc2ps, Copyright (C) 1996,1997 Michael Methfessel * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include #include #include #ifdef WIN32 #define snprintf _snprintf #endif #include "abc2ps.h" #define BUFFLN 80 /* max number of lines in output buffer */ static int ln_num; /* number of lines in buffer */ static float ln_pos[BUFFLN]; /* vertical positions of buffered lines */ static char *ln_buf[BUFFLN]; /* buffer location of buffered lines */ static float ln_lmarg[BUFFLN]; /* left margin of buffered lines */ static float ln_scale[BUFFLN]; /* scale of buffered lines */ static signed char ln_font[BUFFLN]; /* font of buffered lines */ static float cur_lmarg = 0; /* current left margin */ static float min_lmarg, max_rmarg; /* margins for -E/-g */ static float cur_scale = 1.0; /* current scale */ static float maxy; /* remaining vertical space in page */ static float bposy; /* current position in buffered data */ static int nepsf; /* counter for -E/-g output files */ static int nbpages; /* number of pages in the output file */ static int outbufsz; /* size of outbuf */ static char outfnam[FILENAME_MAX]; /* internal file name for open/close */ static struct FORMAT *p_fmt; /* current format while treating a new page */ int (*output)(FILE *out, const char *fmt, ...); int in_page; /* filling a PostScript page */ char *outbuf; /* output buffer.. should hold one tune */ char *mbf; /* where to a2b() */ int use_buffer; /* 1 if lines are being accumulated */ /* -- cut off extension on a file identifier -- */ static void cutext(char *fid) { char *p; if ((p = strrchr(fid, DIRSEP)) == NULL) p = fid; if ((p = strrchr(p, '.')) != NULL) *p = '\0'; } /* -- open the output file -- */ static void open_fout(void) { int i; char fnm[FILENAME_MAX]; strcpy(fnm, outfn); i = strlen(fnm) - 1; if (i < 0) { strcpy(fnm, svg ? "Out.xhtml" : OUTPUTFILE); #if 1 } else if (i != 0 || fnm[0] != '-') { #else } else if (i == 0 && fnm[0] == '-') { if (svg == 1) { error(1, 0, "Cannot use stdout with '-v' - abort"); exit(EXIT_FAILURE); } } else { #endif if (fnm[i] == '=') { char *p; if ((p = strrchr(in_fname, DIRSEP)) == 0) p = in_fname; else p++; /*fixme: should check if there is a DIRSEP at the end of fnm*/ strcpy(&fnm[i], p); strext(fnm, svg ? "xhtml" : "ps"); } else if (fnm[i] == DIRSEP) { strcpy(&fnm[i + 1], OUTPUTFILE); } #if 0 /*fixme: fnm may be a directory*/ else ... #endif } if (svg == 1 && (i != 0 || fnm[0] != '-')) { cutext(fnm); i = strlen(fnm) - 1; if (strncmp(fnm, outfnam, i) != 0) nepsf = 0; sprintf(&fnm[i + 1], "%03d.svg", ++nepsf); } else if (strcmp(fnm, outfnam) == 0) { return; /* same output file */ } close_output_file(); strcpy(outfnam, fnm); if (i != 0 || fnm[0] != '-') { if ((fout = fopen(fnm, "w")) == NULL) { error(1, NULL, "Cannot create output file %s - abort", fnm); exit(EXIT_FAILURE); } } else { fout = stdout; } } /* -- convert a date -- */ static void cnv_date(time_t *ltime) { char buf[TEX_BUF_SZ]; tex_str(cfmt.dateformat); strcpy(buf, tex_buf); strftime(tex_buf, TEX_BUF_SZ, buf, localtime(ltime)); } /* initialize the min/max margin values */ /* (used only with eps -E and svg -g) */ void marg_init(void) { min_lmarg = cfmt.pagewidth; max_rmarg = cfmt.pagewidth; } /* -- initialize the postscript file (PS or EPS) -- */ static void init_ps(char *str) { time_t ltime; unsigned i; char version[32]; if (epsf) { cur_lmarg = min_lmarg - 10; fprintf(fout, "%%!PS-Adobe-2.0 EPSF-2.0\n" "%%%%BoundingBox: 0 0 %.0f %.0f\n", (p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth) - cur_lmarg - max_rmarg + 10, -bposy); marg_init(); } else { if (!fout) open_fout(); fprintf(fout, "%%!PS-Adobe-2.0\n"); fprintf(fout, "%%%%BoundingBox: 0 0 %.0f %.0f\n", p_fmt->pagewidth, p_fmt->pageheight); } fprintf(fout, "%%%%Title: %s\n", str); time(<ime); #ifndef WIN32 strftime(tex_buf, TEX_BUF_SZ, "%b %e, %Y %H:%M", localtime(<ime)); #else strftime(tex_buf, TEX_BUF_SZ, "%b %#d, %Y %H:%M", localtime(<ime)); #endif fprintf(fout, "%%%%Creator: abcm2ps-" VERSION "\n" "%%%%CreationDate: %s\n", tex_buf); if (!epsf) fprintf(fout, "%%%%Pages: (atend)\n"); fprintf(fout, "%%%%LanguageLevel: 3\n" "%%%%EndComments\n" "%%CommandLine:"); for (i = 1; i < (unsigned) s_argc; i++) { char *p, *q; int space; p = s_argv[i]; space = strchr(p, ' ') != NULL || strchr(p, '\n') != NULL; fputc(' ', fout); if (space) fputc('\'', fout); for (;;) { q = strchr(p, '\n'); if (!q) break; fprintf(fout, " %.*s\n%%", (int) (q - p), p); p = q + 1; } fprintf(fout, "%s", p); if (space) fputc('\'', fout); } fprintf(fout, "\n\n"); if (epsf) fprintf(fout, "save\n"); strcpy(version, "/creator [(abcm2ps) " VERSION "] def"); for (i = 0; i < strlen(version); i++) { if (version[i] == '.') version[i] = ' '; } fprintf(fout, "%%%%BeginSetup\n" "/!{bind def}bind def\n" "/bdef{bind def}!\n" /* for compatibility */ "/T/translate load def\n" "/M/moveto load def\n" "/RM/rmoveto load def\n" "/L/lineto load def\n" "/RL/rlineto load def\n" "/C/curveto load def\n" "/RC/rcurveto load def\n" "/SLW/setlinewidth load def\n" "/defl 0 def\n" /* decoration flags - see deco.c for values */ "/dlw{0.7 SLW}!\n" "%s\n", version); define_symbols(); output = fprintf; user_ps_write(); define_fonts(); if (!epsf) fprintf(fout, "/setpagedevice where{pop\n" " <>setpagedevice}if\n", p_fmt->pagewidth, p_fmt->pageheight); fprintf(fout, "%%%%EndSetup\n"); file_initialized = 1; } /* -- initialize the svg file (option '-g') -- */ static void init_svg(char *str) { cur_lmarg = min_lmarg - 10; output = svg_output; #if 1 //fixme:test if (file_initialized) fprintf(stderr, "??? init_svg: file_initialized"); #endif define_svg_symbols(str, nepsf, (p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth) - cur_lmarg - max_rmarg + 10, -bposy); file_initialized = 1; user_ps_write(); } static void close_fout(void) { long m; if (fout == stdout) goto out2; if (quiet) goto out1; m = ftell(fout); if (epsf || svg == 1) fprintf(stderr, "Output written on %s (%ld bytes)\n", outfnam, m); else fprintf(stderr, "Output written on %s (%d page%s, %d title%s, %ld bytes)\n", outfnam, nbpages, nbpages == 1 ? "" : "s", tunenum, tunenum == 1 ? "" : "s", m); out1: fclose(fout); out2: fout = NULL; file_initialized = 0; } /* -- close the output file -- */ /* epsf is always null */ void close_output_file(void) { if (!fout) return; if (multicol_start != 0) { /* if no '%%multicol end' */ error(1, NULL, "No \"%%%%multicol end\""); multicol_start = 0; write_buffer(); } if (tunenum == 0) error(0, NULL, "No tunes written to output file"); close_page(); if (!svg) { fprintf(fout, "%%%%Trailer\n" "%%%%Pages: %d\n" "%%EOF\n", nbpages); close_fout(); } else if (svg == 2) { fputs("\n" "\n", fout); close_fout(); } /* else (svg == 1) * 'fout' is closed in close_page */ nbpages = tunenum = 0; defl = 0; } /* -- close the PS / SVG page -- */ void close_page(void) { if (!in_page) return; in_page = 0; if (svg) { svg_close(); if (svg == 1 && fout != stdout) close_fout(); else fputs("

\n", fout); } else { #if 1 fprintf(fout, "grestore\n" "showpage\n" "%%%%EndPage: %d %d\n", nbpages, nbpages); #else fputs("%%PageTrailer\n" "grestore\n" "showpage\n", fout); #endif } cur_lmarg = 0; cur_scale = 1.0; outft = -1; } /* -- output a header/footer element -- */ static void format_hf(char *d, char *p) { char *q; time_t ltime; for (;;) { if (*p == '\0') break; if ((q = strchr(p, '$')) != NULL) *q = '\0'; d += sprintf(d, "%s", p); if (!q) break; p = q + 1; switch (*p) { case 'd': ltime = mtime; goto dput; case 'D': time(<ime); dput: cnv_date(<ime); d += sprintf(d, "%s", tex_buf); break; case 'F': /* ABC file name */ #if DIRSEP!='\\' d += sprintf(d, "%s", in_fname); #else { int i; q = in_fname; i = TEX_BUF_SZ; for (;;) { if (--i <= 0 || *q == '\0') break; if ((*d++ = *q++) == '\\') { i--; *d++ = '\\'; } } *d = '\0'; } #endif break; case 'I': /* information field */ p++; if (*p < 'A' || *p > 'Z' || !info[*p - 'A']) break; d += sprintf(d, "%s", &info[*p - 'A']->as.text[2]); break; case 'P': /* page number */ if (p[1] == '0') { p++; if (pagenum & 1) break; } else if (p[1] == '1') { p++; if ((pagenum & 1) == 0) break; } d += sprintf(d, "%d", pagenum); break; case 'T': /* tune title */ q = &info['T' - 'A']->as.text[2]; tex_str(q); d += sprintf(d, "%s", tex_buf); break; case 'V': d += sprintf(d,"abcm2ps-" VERSION); break; default: continue; } p++; } *d = '\0'; /* in case of empty string */ } /* -- output the header or footer -- */ static float headfooter(int header, float pwidth, float pheight) { char tmp[TEX_BUF_SZ], str[TEX_BUF_SZ + 1024]; char *p, *q, *r, *mbf_sav; float size, y, wsize; struct FONTSPEC *f, f_sav; int cft_sav, dft_sav; if (header) { p = cfmt.header; f = &cfmt.font_tb[HEADERFONT]; size = f->size; y = -size; } else { p = cfmt.footer; f = &cfmt.font_tb[FOOTERFONT]; size = f->size; y = - (pheight - cfmt.topmargin - cfmt.botmargin) + size; } if (*p == '-') { if (pagenum == 1) return 0; p++; } get_str_font(&cft_sav, &dft_sav); memcpy(&f_sav, &cfmt.font_tb[0], sizeof f_sav); str_font(f - cfmt.font_tb); output(fout, "%.1f F%d ", size, f->fnum); outft = f - cfmt.font_tb; /* may have 2 lines */ wsize = size; if ((r = strstr(p, "\\n")) != NULL) { if (!header) y += size; wsize += size; *r = '\0'; } mbf_sav = mbf; for (;;) { tex_str(p); strcpy(tmp, tex_buf); format_hf(str, tmp); /* left side */ p = str; if ((q = strchr(p, '\t')) != NULL) { if (q != p) { *q = '\0'; output(fout, "%.1f %.1f M ", p_fmt->leftmargin, y); str_out(p, A_LEFT); a2b("\n"); mbf = mbf_sav; if (svg) svg_write(mbf, strlen(mbf)); else fputs(mbf, fout); } p = q + 1; } if ((q = strchr(p, '\t')) != NULL) *q = '\0'; /* center */ if (q != p) { output(fout, "%.1f %.1f M ", pwidth * 0.5, y); str_out(p, A_CENTER); a2b("\n"); mbf = mbf_sav; if (svg) svg_write(mbf, strlen(mbf)); else fputs(mbf, fout); } /* right side */ if (q) { p = q + 1; if (*p != '\0') { output(fout, "%.1f %.1f M ", pwidth - p_fmt->rightmargin, y); str_out(p, A_RIGHT); a2b("\n"); mbf = mbf_sav; if (svg) svg_write(mbf, strlen(mbf)); else fputs(mbf, fout); } } if (!r) break; *r = '\\'; p = r + 2; r = NULL; y -= size; } /* restore the fonts */ *mbf_sav = '\0'; memcpy(&cfmt.font_tb[0], &f_sav, sizeof cfmt.font_tb[0]); set_str_font(cft_sav, dft_sav); return wsize; } /* -- initialize the first page or a new page for svg -- */ /* the flag 'in_page' is always false and epsf is always null */ static void init_page(void) { float pheight, pwidth; p_fmt = !info['X' - 'A'] ? &cfmt : &dfmt; /* global format */ nbpages++; if (svg) { if (!file_initialized) { if (!fout) open_fout(); define_svg_symbols(in_fname, nbpages, cfmt.landscape ? p_fmt->pageheight : p_fmt->pagewidth, cfmt.landscape ? p_fmt->pagewidth : p_fmt->pageheight); file_initialized = 1; output = svg_output; } else { define_svg_symbols(in_fname, nbpages, cfmt.landscape ? p_fmt->pageheight : p_fmt->pagewidth, cfmt.landscape ? p_fmt->pagewidth : p_fmt->pageheight); } user_ps_write(); } else if (!file_initialized) { init_ps(in_fname); } in_page = 1; outft = -1; if (!svg) fprintf(fout, "%%%%Page: %d %d\n", nbpages, nbpages); if (cfmt.landscape) { pheight = p_fmt->pagewidth; pwidth = cfmt.pageheight; if (!svg) fprintf(fout, "%%%%PageOrientation: Landscape\n" "gsave 90 rotate 0 %.1f T\n", -cfmt.topmargin); } else { pheight = cfmt.pageheight; pwidth = p_fmt->pagewidth; if (!svg) fprintf(fout, "gsave 0 %.1f T\n", pheight - cfmt.topmargin); } if (svg) output(fout, "0 %.1f T\n", -cfmt.topmargin); else output(fout, "%% --- width %.1f\n", /* for index */ ((cfmt.landscape ? cfmt.pageheight : cfmt.pagewidth) - cfmt.leftmargin - cfmt.rightmargin) / cfmt.scale); maxy = pheight - cfmt.topmargin - cfmt.botmargin; /* output the header and footer */ if (!cfmt.header) { char *p = NULL; switch (pagenumbers) { case 1: p = "$P\t"; break; case 2: p = "\t\t$P"; break; case 3: p = "$P0\t\t$P1"; break; case 4: p = "$P1\t\t$P0"; break; } if (p) cfmt.header = strdup(p); } if (cfmt.header) { float dy; dy = headfooter(1, pwidth, pheight); if (dy != 0) { output(fout, "0 %.1f T\n", -dy); maxy -= dy; } } if (cfmt.footer) maxy -= headfooter(0, pwidth, pheight); pagenum++; outft = -1; } /* -- adjust the tune title part of the output file name -- */ static void epsf_fn_adj(char *p) { char c; while ((c = *p) != '\0') { if (c == ' ') *p = '_'; else if (c == DIRSEP || (unsigned) c >= 127) *p = '.'; p++; } } /* -- build the title of the eps/svg file and check if correct utf-8 -- */ static void epsf_title(char *p, int sz) { unsigned char c; snprintf(p, sz, "%.72s (%.4s)", in_fname, &info['X' - 'A']->as.text[2]); while ((c = (unsigned char) *p) != '\0') { if (c >= 0x80) { if ((c & 0xf8) == 0xf0) { if ((p[1] & 0xc0) != 0x80 && (p[2] & 0xc0) != 0x80 && (p[3] & 0xc0) != 0x80) *p = ' '; } else if ((c & 0xf0) == 0xe0) { if ((p[1] & 0xc0) != 0x80 && (p[2] & 0xc0) != 0x80) *p = ' '; } else if ((c & 0xe0) == 0xc0) { if ((p[1] & 0xc0) != 0x80) *p = ' '; } else { *p = ' '; } } p++; } } /* -- output a EPS (-E) or SVG (-g) file -- */ void write_eps(void) { unsigned i; char *p, title[80]; if (mbf == outbuf || !info['X' - 'A']) return; p_fmt = &cfmt; /* tune format */ strcpy(outfnam, outfn); if (outfnam[0] == '\0') strcpy(outfnam, OUTPUTFILE); cutext(outfnam); i = strlen(outfnam) - 1; if (i == 0 && outfnam[0] == '-') { if (epsf == 1) { error(1, NULL, "Cannot use stdout with '-E' - abort"); exit(EXIT_FAILURE); } fout = stdout; } else { if (outfnam[i] == '=') { p = &info['T' - 'A']->as.text[2]; while (isspace((unsigned char) *p)) p++; strncpy(&outfnam[i], p, sizeof outfnam - i - 4); outfnam[sizeof outfnam - 5] = '\0'; epsf_fn_adj(&outfnam[i]); } else { if (i >= sizeof outfnam - 4 - 3) i = sizeof outfnam - 4 - 3; sprintf(&outfnam[i + 1], "%03d", ++nepsf); } strcat(outfnam, epsf == 1 ? ".eps" : ".svg"); if ((fout = fopen(outfnam, "w")) == NULL) { error(1, NULL, "Cannot open output file %s - abort", outfnam); exit(EXIT_FAILURE); } } epsf_title(title, sizeof title); if (epsf == 1) { init_ps(title); fprintf(fout, "0 %.1f T\n", -bposy); write_buffer(); fprintf(fout, "showpage\nrestore\n"); } else { init_svg(title); write_buffer(); svg_close(); } close_fout(); cur_lmarg = 0; cur_scale = 1.0; } /* -- start a new page -- */ /* epsf is always null */ static void newpage(void) { close_page(); init_page(); } /* subroutines to handle output buffer */ /* -- update the output buffer pointer -- */ void a2b(char *fmt, ...) { va_list args; if (mbf + BSIZE > outbuf + outbufsz) { if (epsf) { error(1, NULL, "Output buffer overflow - increase outbufsz"); fprintf(stderr, "*** abort\n"); exit(EXIT_FAILURE); } error(0, NULL, "Possible buffer overflow"); write_buffer(); use_buffer = 0; } va_start(args, fmt); mbf += vsnprintf(mbf, outbuf + outbufsz - mbf, fmt, args); va_end(args); } /* -- translate down by 'h' scaled points in output buffer -- */ void bskip(float h) { bposy -= h * cfmt.scale; a2b("0 %.2f T\n", -h); } /* -- initialize the output buffer -- */ void init_outbuf(int kbsz) { if (outbuf) free(outbuf); outbufsz = kbsz * 1024; if (outbufsz < 0x10000) outbufsz = 0x10000; outbuf = malloc(outbufsz); if (!outbuf) { error(1, NULL, "Out of memory for outbuf - abort"); exit(EXIT_FAILURE); } bposy = 0; ln_num = 0; mbf = outbuf; } /* -- write buffer contents, break at full pages -- */ void write_buffer(void) { char *p_buf; int l, np; float p1, dp; int outft_sav; if (mbf == outbuf || multicol_start != 0) return; if (!in_page && !epsf) init_page(); outft_sav = outft; p1 = 0; p_buf = outbuf; for (l = 0; l < ln_num; l++) { if (ln_pos[l] > 0) { /* if in multicol */ int ll; float pos; for (ll = l + 1; ll < ln_num; ll++) { if (ln_pos[ll] <= 0) { pos = ln_pos[ll]; while (--ll >= l) ln_pos[ll] = pos; break; } } } dp = ln_pos[l] - p1; np = maxy + dp < 0 && !epsf; if (np) { newpage(); if (ln_font[l] >= 0) { struct FONTSPEC *f; f = &cfmt.font_tb[ln_font[l]]; output(fout, "%.1f F%d\n", f->size, f->fnum); } } if (ln_scale[l] != cur_scale) { output(fout, "%.3f dup scale\n", ln_scale[l] / cur_scale); cur_scale = ln_scale[l]; } if (ln_lmarg[l] != cur_lmarg) { output(fout, "%.2f 0 T\n", (ln_lmarg[l] - cur_lmarg) / cur_scale); cur_lmarg = ln_lmarg[l]; } if (np) { output(fout, "0 %.2f T\n", -cfmt.topspace); maxy -= cfmt.topspace * cfmt.scale; } if (*p_buf != '\001') { if (epsf == 2 || svg) svg_write(p_buf, ln_buf[l] - p_buf); else fwrite(p_buf, 1, ln_buf[l] - p_buf, fout); } else { /* %%EPS - see parse.c */ FILE *f; char line[BSIZE], *p, *q; p = strchr(p_buf + 1, '\n'); fwrite(p_buf + 1, 1, p - p_buf, fout); p_buf = p + 1; p = strchr(p_buf, '%'); *p++ = '\0'; q = strchr(p, '\n'); *q = '\0'; if ((f = fopen(p, "r")) == NULL) { error(1, NULL, "Cannot open EPS file '%s'", p); } else { if (epsf == 2 || svg) { fprintf(fout, "\n", p); svg_output(fout, "gsave\n" "%s T\n", p_buf); while (fgets(line, sizeof line, f)) /* copy the file */ svg_write(line, strlen(line)); svg_output(fout, "grestore\n" "%s T\n", p_buf); fprintf(fout, "\n", p); } else { fprintf(fout, "save\n" "/showpage{}def/setpagedevice{pop}def\n" "%s T\n" "%%%%BeginDocument: %s\n", p_buf, p); while (fgets(line, sizeof line, f)) /* copy the file */ fwrite(line, 1, strlen(line), fout); fprintf(fout, "%%%%EndDocument\n" "restore\n"); } fclose(f); } } p_buf = ln_buf[l]; maxy += dp; p1 = ln_pos[l]; } #if 1 //fixme:test if (*p_buf != '\0') fprintf(stderr, "??? bug - buffer not empty:\n%s\n", p_buf); #endif outft = outft_sav; bposy = 0; ln_num = 0; mbf = outbuf; } /* -- add a block in the output buffer -- */ void block_put(void) { if (mbf == outbuf) return; //fixme: should be done sooner and should be adjusted when cfmt change... if (maxy == 0) maxy = (cfmt.landscape ? cfmt.pagewidth : cfmt.pageheight) - cfmt.topmargin - cfmt.botmargin; if (ln_num > 0 && mbf == ln_buf[ln_num - 1]) return; /* no data */ if (ln_num >= BUFFLN) { char c, *p; error(1, NULL, "max number of buffer lines exceeded" " -- check BUFFLN"); multicol_start = 0; p = ln_buf[ln_num - 1]; c = *p; /* (avoid "buffer not empty") */ *p = '\0'; write_buffer(); multicol_start = maxy + bposy; *p = c; strcpy(outbuf, p); use_buffer = 0; } ln_buf[ln_num] = mbf; ln_pos[ln_num] = multicol_start == 0 ? bposy : 1; ln_lmarg[ln_num] = cfmt.leftmargin; if (epsf) { if (cfmt.leftmargin < min_lmarg) min_lmarg = cfmt.leftmargin; if (cfmt.rightmargin < max_rmarg) max_rmarg = cfmt.rightmargin; } ln_scale[ln_num] = cfmt.scale; ln_font[ln_num] = outft; ln_num++; if (!use_buffer) { write_buffer(); return; } } /* -- handle completed block in buffer -- */ /* if the added stuff does not fit on current page, write it out after page break and change buffer handling mode to pass though */ void buffer_eob(void) { block_put(); if (maxy + bposy < 0 && !epsf && multicol_start == 0) { if (in_page) newpage(); write_buffer(); use_buffer = 0; } } /* -- dump buffer if not enough place for a music line -- */ void check_buffer(void) { if (mbf + 5000 > outbuf + outbufsz) { /* assume music line < 5000 bytes */ error(0, NULL, "Possibly bad page breaks, outbufsz exceeded"); write_buffer(); use_buffer = 0; } } /* -- return the current vertical offset in the page -- */ float get_bposy(void) { return maxy + bposy; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/chinese.abc���������������������������������������������������������������������������0000644�0001750�0001750�00000005146�11700610745�013254� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% abcm2ps sample file with chinese characters % define the chinese utf-8 truetype font %%font UKaiCN-UTF8-H native % add the utf8 -> CID translator %%beginps nosvg /UKaiCN-UTF8-H /UniGB-UTF8-H [ /UKaiCN ] composefont pop %%endps % define some fonts %%titlefont UKaiCN-UTF8-H native 20 %%subtitlefont UKaiCN-UTF8-H native 16 %%textfont UKaiCN-UTF8-H native 16 %%vocalfont UKaiCN-UTF8-H native 13 %%wordsfont UKaiCN-UTF8-H native 16 X: 1 T: Green Island Serenade T: 绿岛小夜曲 T: 綠島小夜曲 T: Lǜ Dǎo Xiǎoyèqǔ T: Зелёный Остров T: جزيرة اخضرة C: Chen Chang-shou D: Vienna Teng "Warm Strangers" M: 4/4 L: 1/8 K: D A,2 \ | "D"A3 B "(F#m)"A2 F2 | "A7"E2 {FE}DE "Bm"F3 E \ | "G"DD2 B, "D"A,3 B, | "D"A,4 "(A7)"z4 \ | "G"B,3 A, B,2 D2 | "A7"E2 {FE}DE "D"F3 A \ | "Em"EE2 F "A7"A3 B | "D"A4 "(A7)"z4 | | "G"BB2 A "D"F2 FE | "Bm"DE F[AD] "F#m"F4 \ | "Em"EE2 D "G"B,A, B,D | "A7"E4 z4 \ | "D"FF2 E "Bm"FA F2 | "Em"EF ED "G"B,4 \ | "D"A,A FE "A7"AB FE | "D"{E}D4 z4 |] [|"G"B>B BA "D"F F3 | "Em"EE2 D "G"B,A, B,D | "A7"E4 z4 \ | "D"A>B AE "F#m"FF2 F | "Em"EE2 D "G"B,2 D2 | "D"A4 "A7"z3A | | "D"A2 {BA}FA "G"B3 d | "D"AB AF "Em"E4 \ | "Bm"F2 ED "G"B,3 D | "A7"E2 {FE}DE "D"F3A \ | "G"B3 F "A7"E3 F/E/ | "D"D4 z2 |] % W: 这绿岛像一隻船在月夜里摇呀摇 W: 姑娘哟妳也在我的心海裡飘呀飘 W: 让我的歌声随那微风吹開了妳的窗簾 W: 让我的衷情随那流水不断的向妳倾诉 W: W: 椰子树的长影掩不住我的情意 W: 明媚的月光更照亮了我的心 W: 这绿岛的夜已经这样沉静 W: 姑娘哟妳为什么还是默默无语 W: W: zhè lǜ dǎo xiàng yī zhī chuàn, zài yué yè lǐ yáo ya yáo. W: gū niang yo, nǐ ye zài wǒde xīn hǎi lǐ piao ya piao. W: ràng wǒde ge sheng sui na wei feng, chui kai le nǐ de chuang lian. W: ràng wǒde zhong qing sui na liu shui, bu duan de xiang nǐ qing su. W: W: ye zi shu de chang ying yan bu zhu wǒde qing yi; W: mìng mèi de yuè guang geng zhao liang le wǒde xīn. W: zhe lǜ dao de ye yi jing zhe yang de chen jing W: gū niang ya, nǐ wei shen ma hai shì muò muò wú yǚ? W: W: This Green Island is like a boat, floating in the moonlight, W: My darling, you too are floating in the sea of my heart, W: Let the sound of my song follow the breeze, blowing open the curtain of your window, W: Let my love follow the flowing water, endlessly pouring out its feelings for you. W: W: The long shadows of the palm trees cannot conceal my love, W: The bright beauty of the moonlight casts its brilliance into my heart. W: This Green Island night is so calm and serene, W: My darling, why are you silent, saying nothing? ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/configure�����������������������������������������������������������������������������0000755�0001750�0001750�00000421431�12417252310�013071� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="abc2ps.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS CPPPANGO VERSION EGREP GREP CPP INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_pango enable_a4 enable_deco_is_roll with_def_fdir ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-pango Use pango if available [default: yes] --enable-a4 Handle european A4 format instead of default US letter --enable-deco-is-roll Have ~ as roll instead of twiddle Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-def-fdir=directory Default format directory Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu VERSION=7.8.9 VDATE='October 14, 2014' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in malloc.h do : ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" if test "x$ac_cv_header_malloc_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MALLOC_H 1 _ACEOF fi done if test "X$GCC" = "Xyes" ; then CFLAGS="$CFLAGS -Wall -pipe" fi test "x$prefix" = xNONE && prefix=$ac_default_prefix # Check whether --enable-pango was given. if test "${enable_pango+set}" = set; then : enableval=$enable_pango; checkpango="$enableval" else checkpango="yes" fi if test "$checkpango" = "yes"; then $as_echo_n "checking for pango... " >&6 if which pkg-config > /dev/null ; then if pkg-config --exists freetype2 ; then if pkg-config --exists pangocairo ; then $as_echo "yes" >&6 CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1" CPPPANGO="`pkg-config pango cairo freetype2 --cflags`" LDFLAGS="$LDFLAGS `pkg-config pangocairo pangoft2 freetype2 --libs`" else $as_echo "no" >&6 fi else $as_echo "pangocairo not found" >&6 fi else $as_echo "pkg-config not found" >&6 fi fi # Check whether --enable-a4 was given. if test "${enable_a4+set}" = set; then : enableval=$enable_a4; if test "$enableval" = "yes"; then $as_echo "#define A4_FORMAT 1" >>confdefs.h fi fi # Check whether --enable-deco-is-roll was given. if test "${enable_deco_is_roll+set}" = set; then : enableval=$enable_deco_is_roll; if test "$enableval" = "yes"; then $as_echo "#define DECO_IS_ROLL 1" >>confdefs.h fi fi DEFAULT_FDIR="$prefix/share/abcm2ps" # Check whether --with-def-fdir was given. if test "${with_def_fdir+set}" = set; then : withval=$with_def_fdir; DEFAULT_FDIR="$withval" fi cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define VDATE "$VDATE" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_FDIR "$DEFAULT_FDIR" _ACEOF ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/configure.in��������������������������������������������������������������������������0000644�0001750�0001750�00000003521�12417252270�013474� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������dnl Configure source for abcm2ps -*- sh -*- dnl Copyright (C) 2001-2014 JF Moine. AC_INIT(abc2ps.h) VERSION=7.8.9 VDATE='October 14, 2014' AC_CANONICAL_SYSTEM dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL dnl AC_PROG_MAKE_SET AC_CONFIG_HEADER(config.h) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(malloc.h) if test "X$GCC" = "Xyes" ; then CFLAGS="$CFLAGS -Wall -pipe" fi test "x$prefix" = xNONE && prefix=$ac_default_prefix dnl Check for options AC_ARG_ENABLE(pango, [ --enable-pango Use pango if available [[default: yes]]], [checkpango="$enableval"], [checkpango="yes"]) if test "$checkpango" = "yes"; then $as_echo_n "checking for pango... " >&6 if which pkg-config > /dev/null ; then dnl Checks freetype2 if pkg-config --exists freetype2 ; then dnl Checks pangocairo if pkg-config --exists pangocairo ; then $as_echo "yes" >&6 CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1" CPPPANGO="`pkg-config pango cairo freetype2 --cflags`" LDFLAGS="$LDFLAGS `pkg-config pangocairo pangoft2 freetype2 --libs`" else $as_echo "no" >&6 fi else $as_echo "pangocairo not found" >&6 fi else $as_echo "pkg-config not found" >&6 fi fi AC_ARG_ENABLE(a4, [ --enable-a4 Handle european A4 format instead of default US letter], [if test "$enableval" = "yes"; then AC_DEFINE(A4_FORMAT)dnl fi]) AC_ARG_ENABLE(deco-is-roll, [ --enable-deco-is-roll Have ~ as roll instead of twiddle], [if test "$enableval" = "yes"; then AC_DEFINE(DECO_IS_ROLL)dnl fi]) DEFAULT_FDIR="$prefix/share/abcm2ps" AC_ARG_WITH(def-fdir, [ --with-def-fdir=directory Default format directory], [DEFAULT_FDIR="$withval"]) dnl Build characteristics AC_SUBST(VERSION) AC_SUBST(CPPPANGO) AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_DEFINE_UNQUOTED(VDATE, "$VDATE") AC_DEFINE_UNQUOTED(DEFAULT_FDIR, "$DEFAULT_FDIR") AC_OUTPUT(Makefile) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/config.h������������������������������������������������������������������������������0000644�0001750�0001750�00000001032�12417252327�012577� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.h. Generated from config.h.in by configure. */ /* config.h.in */ /* default directory to search for format files */ #define DEFAULT_FDIR "/usr/local/share/abcm2ps" /* Define if you have the strtol function. */ /* #undef HAVE_STRTOL */ /* Define if you have the header file. */ #define HAVE_MALLOC_H 1 /* Define to handle the european A4 format. */ /* #undef A4_FORMAT */ /* Define to have ~ as roll instead of twiddle. */ /* #undef DECO_IS_ROLL */ #define VERSION "7.8.9" #define VDATE "October 14, 2014" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/config.h.in���������������������������������������������������������������������������0000644�0001750�0001750�00000000640�11334064351�013203� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.h.in */ /* default directory to search for format files */ #define DEFAULT_FDIR xxx /* Define if you have the strtol function. */ #undef HAVE_STRTOL /* Define if you have the header file. */ #undef HAVE_MALLOC_H /* Define to handle the european A4 format. */ #undef A4_FORMAT /* Define to have ~ as roll instead of twiddle. */ #undef DECO_IS_ROLL #define VERSION xxx #define VDATE xxx ������������������������������������������������������������������������������������������������abcm2ps-7.8.9/config.guess��������������������������������������������������������������������������0000644�0001750�0001750�00000130361�12232133043�013472� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file 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 Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/config.sub����������������������������������������������������������������������������0000644�0001750�0001750�00000105412�12232135067�013144� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-10-01' # This file 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 Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/deco.c��������������������������������������������������������������������������������0000644�0001750�0001750�00000144702�12343411325�012244� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Decoration handling. * * This file is part of abcm2ps. * * Copyright (C) 2000-2014, Jean-François Moine. * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include #include #include #ifdef WIN32 #define lroundf(x) ((long) ((x) + 0.5)) #endif #include "abc2ps.h" int defl; /* decoration flags */ static struct deco_elt { struct deco_elt *next, *prev; /* next/previous decoration */ struct SYMBOL *s; /* symbol */ struct deco_elt *start; /* start a long decoration ending here */ unsigned char t; /* decoration index */ unsigned char staff; /* staff */ unsigned char flags; #define DE_VAL 0x01 /* put extra value if 1 */ #define DE_UP 0x02 /* above the staff */ #define DE_BELOW 0x08 /* below the staff */ #define DE_GRACE 0x10 /* in grace note */ #define DE_INV 0x20 /* invert the glyph */ #define DE_LDST 0x40 /* start of long decoration */ #define DE_LDEN 0x80 /* end of long decoration */ unsigned char defl; /* decorations flags - see DEF_xx */ float x, y; /* x, y */ float v; /* extra value */ char *str; /* string / 0 */ } *deco_head, *deco_tail; typedef void draw_f(struct deco_elt *de); static draw_f d_arp, d_cresc, d_near, d_slide, d_upstaff, d_pf, d_trill; /* decoration table */ /* !! don't change the order of the numbered items !! */ static struct deco_def_s { char *name; unsigned char func; /* function index */ signed char ps_func; /* postscript function index */ unsigned char h; /* height */ unsigned char wl; /* width */ unsigned char wr; unsigned char strx; /* string index - 255=deco name */ unsigned char ld_end; /* index of end of long decoration */ unsigned char dum; } deco_def_tb[128]; /* c function table */ static draw_f *func_tb[] = { d_near, /* 0 - near the note */ d_slide, /* 1 */ d_arp, /* 2 */ d_upstaff, /* 3 - tied to note */ d_upstaff, /* 4 (below the staff) */ d_trill, /* 5 */ d_pf, /* 6 - tied to staff (dynamic marks) */ d_cresc, /* 7 */ }; /* postscript function table */ static char *ps_func_tb[128]; static char *str_tb[32]; /* standard decorations */ static char *std_deco_tb[] = { "dot 0 stc 5 1 1", "roll 3 cpu 7 6 6", "fermata 3 hld 12 7 7", "emphasis 3 accent 7 4 4", "lowermordent 3 lmrd 10 2 2", "coda 3 coda 24 10 10", "uppermordent 3 umrd 10 2 2", "segno 3 sgno 20 4 4", "trill 3 trl 11 4 4", "upbow 3 upb 10 5 5", "downbow 3 dnb 9 5 5", "gmark 3 grm 6 5 5", "slide 1 sld 3 7 0", "tenuto 0 emb 5 2 2", "breath 3 brth 0 1 20", "longphrase 3 lphr 0 1 1", "mediumphrase 3 mphr 0 1 1", "shortphrase 3 sphr 0 1 1", "invertedfermata 3 hld 12 7 7", "invertedturn 3 turn 10 0 5", "invertedturnx 3 turnx 10 0 5", "0 3 fng 8 3 3 0", "1 3 fng 8 3 3 1", "2 3 fng 8 3 3 2", "3 3 fng 8 3 3 3", "4 3 fng 8 3 3 4", "5 3 fng 8 3 3 5", "plus 3 dplus 7 3 3", "+ 3 dplus 7 3 3", "accent 3 accent 7 4 4", "> 3 accent 7 4 4", "D.C. 3 dacs 16 10 10 D.C.", "D.S. 3 dacs 16 10 10 D.S.", "fine 3 dacs 16 10 10 FINE", "f 6 pf 18 1 7", "ff 6 pf 18 2 10", "fff 6 pf 18 4 13", "ffff 6 pf 18 6 16", "mf 6 pf 18 6 13", "mp 6 pf 18 6 16", "mordent 3 lmrd 10 2 2", "open 3 opend 10 2 2", "p 6 pf 18 2 8", "pp 6 pf 18 5 14", "ppp 6 pf 18 8 20", "pppp 6 pf 18 10 25", "pralltriller 3 umrd 10 2 2", "sfz 6 sfz 18 4 10", "turn 3 turn 10 0 5", "wedge 3 wedge 8 1 1", "turnx 3 turnx 10 0 5", "trill( 5 - 8 0 0", "trill) 5 ltr 8 0 0", "snap 3 snap 14 3 3", "thumb 3 thumb 14 2 2", "arpeggio 2 arp 12 10 0", "crescendo( 7 - 18 0 0", "crescendo) 7 cresc 18 0 0", "<( 7 - 18 0 0", "<) 7 cresc 18 0 0", "diminuendo( 7 - 18 0 0", "diminuendo) 7 dim 18 0 0", ">( 7 - 18 0 0", ">) 7 dim 18 0 0", "invisible 32 0 0 0 0", "beamon 33 0 0 0 0", "trem1 34 0 0 0 0", "trem2 34 0 0 0 0", "trem3 34 0 0 0 0", "trem4 34 0 0 0 0", "xstem 35 0 0 0 0", "beambr1 36 0 0 0 0", "beambr2 36 0 0 0 0", "rbstop 37 0 0 0 0", "/ 38 0 0 6 6", "// 38 0 0 6 6", "/// 38 0 0 6 6", "beam-accel 39 0 0 0 0", "beam-rall 39 0 0 0 0", 0 }; /* user decorations */ static struct u_deco { struct u_deco *next; char text[2]; } *user_deco; static struct SYMBOL *first_note; /* first note/rest of the line */ static void draw_gchord(struct SYMBOL *s, float gchy_min, float gchy_max); /* -- get the max/min vertical offset -- */ float y_get(int staff, int up, float x, float w) { struct STAFF_S *p_staff; int i, j; float y; p_staff = &staff_tb[staff]; i = (int) (x / realwidth * YSTEP); if (i < 0) { // fprintf(stderr, "y_get i:%d\n", i); i = 0; } j = (int) ((x + w) / realwidth * YSTEP); if (j >= YSTEP) { j = YSTEP - 1; if (i > j) i = j; } if (up) { y = p_staff->top[i++]; while (i <= j) { if (y < p_staff->top[i]) y = p_staff->top[i]; i++; } } else { y = p_staff->bot[i++]; while (i <= j) { if (y > p_staff->bot[i]) y = p_staff->bot[i]; i++; } } return y; } /* -- adjust the vertical offsets -- */ void y_set(int staff, int up, float x, float w, float y) { struct STAFF_S *p_staff; int i, j; p_staff = &staff_tb[staff]; i = (int) (x / realwidth * YSTEP); /* (may occur when annotation on 'y' at start of an empty staff) */ if (i < 0) { // fprintf(stderr, "y_set i:%d\n", i); i = 0; } j = (int) ((x + w) / realwidth * YSTEP); if (j >= YSTEP) { j = YSTEP - 1; if (i > j) i = j; } if (up) { while (i <= j) { if (p_staff->top[i] < y) p_staff->top[i] = y; i++; } } else { while (i <= j) { if (p_staff->bot[i] > y) p_staff->bot[i] = y; i++; } } } /* -- get the staff position of the dynamic and volume marks -- */ static int up_p(struct SYMBOL *s, int pos) { switch (pos) { case SL_ABOVE: return 1; case SL_BELOW: return 0; } if (s->multi != 0) return s->multi > 0; if (!voice_tb[s->voice].have_ly) return 0; /* above if the lyrics are below the staff */ return s->posit.voc != SL_ABOVE; } /* -- drawing functions -- */ /* special case for arpeggio */ static void d_arp(struct deco_elt *de) { struct SYMBOL *s; struct deco_def_s *dd; int m, h; float xc, dx; s = de->s; dd = &deco_def_tb[de->t]; xc = 0; for (m = 0; m <= s->nhd; m++) { if (s->as.u.note.accs[m]) { dx = 5 + s->shac[m]; } else { dx = 6 - s->shhd[m]; switch (s->head) { case H_SQUARE: case H_OVAL: dx += 2.5; break; } } if (dx > xc) xc = dx; } h = 3 * (s->pits[s->nhd] - s->pits[0]) + 4; m = dd->h; /* minimum height */ if (h < m) h = m; de->flags |= DE_VAL; de->v = h; de->x = s->x - xc; de->y = (float) (3 * (s->pits[0] - 18)) - 3; } /* special case for crescendo/diminuendo */ static void d_cresc(struct deco_elt *de) { struct SYMBOL *s, *s2; struct deco_def_s *dd, *dd2; struct deco_elt *de1; int up; float x, dx, x2; if (de->flags & DE_LDST) return; s2 = de->s; de1 = de->start; /* start of the deco */ if (de1) { s = de1->s; x = s->x + 3; } else { /* end without start */ s = first_note; x = s->x - s->wl - 4; } de->staff = s2->staff; de->flags &= ~DE_LDEN; /* old behaviour */ de->flags |= DE_VAL; up = up_p(s2, s2->posit.dyn); if (up) de->flags |= DE_UP; /* shift the starting point if any dynamic mark on the left */ if (de1 && de1->prev && de1->prev->s == s && ((de->flags ^ de1->prev->flags) & DE_UP) == 0) { dd2 = &deco_def_tb[de1->prev->t]; if (dd2->func >= 6) { x2 = de1->prev->x + de1->prev->v + 4; if (x2 > x) x = x2; } } if (de->defl & DEF_NOEN) { /* if no decoration end */ dx = de->x - x; if (dx < 20) { x = de->x - 20 - 3; dx = 20; } } else { x2 = s2->x; if (de->next && de->next->s == s && ((de->flags ^ de->next->flags) & DE_UP) == 0) { dd2 = &deco_def_tb[de->next->t]; if (dd2->func >= 6) /* if dynamic mark */ x2 -= 5; } dx = x2 - x - 4; if (dx < 20) { x -= (20 - dx) * 0.5; if (de->start == 0) x -= (20 - dx) * 0.5; dx = 20; } } de->v = dx; de->x = x; dd = &deco_def_tb[de->t]; de->y = y_get(de->staff, up, x, dx); if (!up) de->y -= dd->h; /* (y_set is done later in draw_deco_staff) */ } /* near the note (dot, tenuto) */ static void d_near(struct deco_elt *de) { struct SYMBOL *s; struct deco_def_s *dd; int y, up; s = de->s; dd = &deco_def_tb[de->t]; if (s->multi) up = s->multi > 0; else up = s->stem < 0; if (up) y = s->ymx; else y = s->ymn - dd->h; if (y > -6 && y < 24) { if (up) y += 3; y = (y + 6) / 6 * 6 - 6; /* between lines */ } if (up) s->ymx = y + dd->h; else s->ymn = y; de->y = (float) y; de->x = s->x + s->shhd[s->stem >= 0 ? 0 : s->nhd]; if (dd->name[0] == 'd' /* if dot decoration */ && s->nflags >= -1) { /* on stem */ if (up) { if (s->stem > 0) de->x += STEM_XOFF; } else { if (s->stem < 0) de->x -= STEM_XOFF; } } } /* special case for piano/forte indications */ static void d_pf(struct deco_elt *de) { struct SYMBOL *s; struct deco_def_s *dd, *dd2; float x, x2; char *str; int up; s = de->s; dd = &deco_def_tb[de->t]; de->v = dd->wl + dd->wr; up = up_p(s, s->posit.vol); if (up) de->flags |= DE_UP; x = s->x - dd->wl; if (de->prev && de->prev->s == s && ((de->flags ^ de->prev->flags) & DE_UP) == 0) { dd2 = &deco_def_tb[de->prev->t]; if (dd2->func >= 6) { /* if dynamic mark */ x2 = de->prev->x + de->prev->v + 4; if (x2 > x) x = x2; } #if 0 //fixme:test volume shift // does not work with // cE!p!E !fff!Ceg| } else if (!up && s->stem < 0 && s->ymn < 10) { float y; x2 = x - (STEM_XOFF + dd->wr + 4); y = y_get(s->staff, up, x2, de->v); if (y > s->ymn) { x = x2; } else { x2 -= 3; y = y_get(s->staff, up, x2, de->v); if (y > s->ymn) x = x2; } #endif } str = dd->name; if (dd->strx != 0 && dd->strx != 255) str = str_tb[dd->strx]; de->x = x; de->y = y_get(s->staff, up, x, de->v); if (!up) de->y -= dd->h; de->str = str; /* (y_set is done later in draw_deco_staff) */ } /* special case for slide and tremolo */ static void d_slide(struct deco_elt *de) { struct SYMBOL *s; int m, yc; float xc, dx; s = de->s; yc = s->pits[0]; xc = 5; for (m = 0; m <= s->nhd; m++) { if (s->as.u.note.accs[m]) { dx = 4 + s->shac[m]; } else { dx = 5 - s->shhd[m]; switch (s->head) { case H_SQUARE: case H_OVAL: dx += 2.5; break; } } if (s->pits[m] <= yc + 3 && dx > xc) xc = dx; } de->x = s->x - xc; de->y = (float) (3 * (yc - 18)); } /* special case for long trill */ static void d_trill(struct deco_elt *de) { struct SYMBOL *s, *s2; struct deco_def_s *dd; int staff, up; float x, y, w; if (de->flags & DE_LDST) return; s2 = de->s; if (de->start) { /* deco start */ s = de->start->s; x = s->x; if (s->as.type == ABC_T_NOTE && s->as.u.note.dc.n > 1) x += 10; } else { /* end without start */ s = first_note; x = s->x - s->wl - 4; } de->staff = staff = s2->staff; up = s2->multi >= 0; if (de->defl & DEF_NOEN) { /* if no decoration end */ w = de->x - x; if (w < 20) { x = de->x - 20 - 3; w = 20; } } else { w = s2->x - x - 6; if (s2->as.type == ABC_T_NOTE) w -= 6; if (w < 20) { x -= (20 - w) * 0.5; if (de->start == 0) x -= (20 - w) * 0.5; w = 20; } } dd = &deco_def_tb[de->t]; y = y_get(staff, up, x, w); if (up) { float stafft; stafft = staff_tb[s->staff].topbar + 2; if (y < stafft) y = stafft; } else { float staffb; y -= dd->h; staffb = staff_tb[s->staff].botbar - 2; if (y > staffb) y = staffb; } de->flags &= ~DE_LDEN; de->flags |= DE_VAL; de->v = w; de->x = x; de->y = y; if (up) y += dd->h; y_set(staff, up, x, w, y); if (up) s->ymx = s2->ymx = y; else s->ymn = s2->ymn = y; } /* above (or below) the staff */ static void d_upstaff(struct deco_elt *de) { struct SYMBOL *s; struct deco_def_s *dd; float x, yc, stafft, staffb, w; int inv; s = de->s; dd = &deco_def_tb[de->t]; inv = 0; x = s->x + s->shhd[s->stem >= 0 ? 0 : s->nhd]; w = dd->wl + dd->wr; stafft = staff_tb[s->staff].topbar + 2; staffb = staff_tb[s->staff].botbar - 2; if (dd->strx != 0) de->str = dd->strx == 255 ? dd->name : str_tb[dd->strx]; switch (s->posit.orn) { case SL_ABOVE: de->flags &= ~DE_BELOW; break; case SL_BELOW: de->flags |= DE_BELOW; break; } if (strcmp(dd->name, ">") == 0 || strcmp(dd->name, "accent") == 0 || strcmp(dd->name, "emphasis") == 0 || strcmp(dd->name, "roll") == 0) { if (s->multi < 0 || (s->multi == 0 && s->stem > 0)) { yc = y_get(s->staff, 0, s->x - dd->wl, w); if (yc > staffb) yc = staffb; yc -= dd->h; y_set(s->staff, 0, s->x, 0, yc); inv = 1; s->ymn = yc; } else { yc = y_get(s->staff, 1, s->x, 0); if (yc < stafft) yc = stafft; // if (s->stem <= 0 // && (s->dots == 0 || ((int) s->y % 6))) // yc -= 2; y_set(s->staff, 1, s->x - dd->wl, w, yc + dd->h); s->ymx = yc + dd->h; } } else if (strcmp(dd->name, "breath") == 0 || strcmp(dd->name, "longphrase") == 0 || strcmp(dd->name, "mediumphrase") == 0 || strcmp(dd->name, "shortphrase") == 0) { yc = stafft + 1; for (s = s->ts_next; s; s = s->ts_next) if (s->shrink != 0) break; if (s) x += (s->x - x) * 0.4; else x += (realwidth - x) * 0.4; } else { if (strcmp(dd->name, "invertedturn") == 0 || strcmp(dd->name, "invertedturnx") == 0) inv = 1; if (s->multi >= 0 && strcmp(dd->name, "invertedfermata") != 0 && !(de->flags & DE_BELOW)) { yc = y_get(s->staff, 1, s->x - dd->wl, w); if (yc < stafft) yc = stafft; y_set(s->staff, 1, s->x - dd->wl, w, yc + dd->h); s->ymx = yc + dd->h; } else { yc = y_get(s->staff, 0, s->x - dd->wl, w); if (yc > staffb) yc = staffb; yc -= dd->h; y_set(s->staff, 0, s->x - dd->wl, w, yc); if (strcmp(dd->name, "fermata") == 0 || strcmp(dd->name, "invertedfermata") == 0) inv = 1; s->ymn = yc; } } if (inv) { yc += dd->h; de->flags |= DE_INV; } de->x = x; de->y = yc; } /* -- add a decoration - from %%deco -- */ /* syntax: * %%deco [] */ void deco_add(char *s) { struct u_deco *d; int l; l = strlen(s); d = malloc(sizeof *user_deco - sizeof user_deco->text + l + 1); strcpy(d->text, s); d->next = user_deco; user_deco = d; } static unsigned char deco_build(char *text) { struct deco_def_s *dd; int c_func, ideco, h, o, wl, wr, n; unsigned l, ps_x, strx; char name[32]; char ps_func[16]; /* extract the arguments */ if (sscanf(text, "%15s %d %15s %d %d %d%n", name, &c_func, ps_func, &h, &wl, &wr, &n) != 6) { error(1, 0, "Invalid deco %s", text); return 128; } if ((unsigned) c_func >= sizeof func_tb / sizeof func_tb[0] && (c_func < 32 || c_func > 39)) { error(1, 0, "%%%%deco: bad C function index (%s)", text); return 128; } if (h < 0 || wl < 0 || wr < 0) { error(1, 0, "%%%%deco: cannot have a negative value (%s)", text); return 128; } if (h > 50 || wl > 80 || wr > 80) { error(1, 0, "%%%%deco: abnormal h/wl/wr value (%s)", text); return 128; } text += n; while (isspace((unsigned char) *text)) text++; /* search the decoration */ for (ideco = 1, dd = &deco_def_tb[1]; ideco < 128; ideco++, dd++) { if (!dd->name || strcmp(dd->name, name) == 0) break; } if (ideco == 128) { error(1, 0, "Too many decorations"); return 128; } /* search the postscript function */ for (ps_x = 0; ps_x < sizeof ps_func_tb / sizeof ps_func_tb[0]; ps_x++) { if (ps_func_tb[ps_x] == 0 || strcmp(ps_func_tb[ps_x], ps_func) == 0) break; } if (ps_x == sizeof ps_func_tb / sizeof ps_func_tb[0]) { error(1, 0, "Too many postscript functions"); return 128; } /* have an index for the string */ if (*text == '\0') { strx = 0; } else if (strcmp(text, name) == 0) { strx = 255; } else { for (strx = 1; strx < sizeof str_tb / sizeof str_tb[0]; strx++) { if (str_tb[strx] == 0) { if (*text == '"') { text++; l = strlen(text); str_tb[strx] = malloc(l); memcpy(str_tb[strx], text, l - 1); str_tb[strx][l - 1] = '\0'; } else { str_tb[strx] = strdup(text); } break; } if (strcmp(str_tb[strx], text) == 0) break; } if (strx == sizeof str_tb / sizeof str_tb[0]) { error(1, 0, "Too many decoration strings"); return 128; } } /* set the values */ if (!dd->name) dd->name = strdup(name); /* new decoration */ dd->func = c_func; if (!ps_func_tb[ps_x]) { if (ps_func[0] == '-' && ps_func[1] == '\0') ps_x = -1; else ps_func_tb[ps_x] = strdup(ps_func); } dd->ps_func = ps_x; dd->h = h; dd->wl = wl; dd->wr = wr; dd->strx = strx; /* link the start and end of long decorations */ l = strlen(name); if (l == 0) return ideco; l--; if (name[l] == '(' || name[l] == ')') { struct deco_def_s *ddo; for (o = 1, ddo = &deco_def_tb[1]; o < 128; o++, ddo++) { if (!ddo->name) break; if (strlen(ddo->name) == l + 1 && strncmp(ddo->name, name, l) == 0) { if (name[l] == '(' && ddo->name[l] == ')') { dd->ld_end = o; break; } if (name[l] == ')' && ddo->name[l] == '(') { ddo->ld_end = ideco; break; } } } } return ideco; } /* -- set the duration of the notes under a feathered beam -- */ static void set_feathered_beam(struct SYMBOL *s1, int accel) { struct SYMBOL *s, *s2; int n, t, tt, d, b, i; float a; /* search the end of the beam */ d = s1->dur; s2 = NULL; n = 1; for (s = (struct SYMBOL *) s1->as.next; s; s = (struct SYMBOL *) s->as.next) { if (s->dur != d || (s->as.flags & ABC_F_SPACE)) break; s2 = s; n++; } if (!s2) return; b = d / 2; /* smallest note duration */ a = (float) d / (n - 1); /* delta duration */ tt = d * n; t = 0; if (accel) { /* !beam-accel! */ for (s = s1, i = n - 1; s != s2; s = (struct SYMBOL *) s->as.next, i--) { d = (int) lroundf(a * i) + b; s->dur = d; t += d; } } else { /* !beam-rall! */ for (s = s1, i = 0; s != s2; s = (struct SYMBOL *) s->as.next, i++) { d = (int) lroundf(a * i) + b; s->dur = d; t += d; } } s2->dur = tt - t; } /* -- convert the decorations -- */ void deco_cnv(struct deco *dc, struct SYMBOL *s, struct SYMBOL *prev) { int i, j; struct deco_def_s *dd; unsigned char ideco; static char must_note_fmt[] = "Deco !%s! must be on a note"; for (i = dc->n; --i >= 0; ) { if ((ideco = dc->t[i]) == 0) continue; if (ideco < 128) { ideco = deco[ideco]; if (ideco == 0) error(1, s, "Notation '%c' not treated", dc->t[i]); } else { ideco = deco_intern(ideco); } dc->t[i] = ideco; if (ideco == 0) continue; /* special decorations */ dd = &deco_def_tb[ideco]; switch (dd->func) { default: continue; case 32: /* 32 = invisible */ s->as.flags |= ABC_F_INVIS; break; case 33: /* 33 = beamon */ s->sflags |= S_BEAM_ON; break; case 34: /* 34 = trem1..trem4 */ if (s->as.type != ABC_T_NOTE || !prev || prev->as.type != ABC_T_NOTE) { error(1, s, "!%s! must be on the last of a couple of notes", dd->name); break; } s->sflags |= (S_TREM2 | S_BEAM_END); s->sflags &= ~S_BEAM_ST; prev->sflags |= (S_TREM2 | S_BEAM_ST); prev->sflags &= ~S_BEAM_END; s->u = prev->u = dd->name[4] - '0'; for (j = 0; j <= s->nhd; j++) s->as.u.note.lens[j] *= 2; for (j = 0; j <= prev->nhd; j++) prev->as.u.note.lens[j] *= 2; break; case 35: /* 35 = xstem */ if (s->as.type != ABC_T_NOTE) { error(1, s, must_note_fmt, dd->name); break; } s->sflags |= S_XSTEM; break; case 36: /* 36 = beambr1 / beambr2 */ if (s->as.type != ABC_T_NOTE) { error(1, s, must_note_fmt, dd->name); break; } s->sflags |= dd->name[6] == '1' ? S_BEAM_BR1 : S_BEAM_BR2; break; case 37: /* 37 = rbstop */ s->sflags |= S_RBSTOP; break; case 38: /* 38 = /, // and /// = tremolo */ if (s->as.type != ABC_T_NOTE) { error(1, s, must_note_fmt, dd->name); break; } s->sflags |= S_TREM1; s->u = strlen(dd->name); /* 1, 2 or 3 */ break; case 39: /* 39 = beam-accel/beam-rall */ if (s->as.type != ABC_T_NOTE) { error(1, s, must_note_fmt, dd->name); break; } s->sflags |= S_FEATHERED_BEAM; set_feathered_beam(s, dd->name[5] == 'a'); break; } dc->t[i] = 0; /* already treated */ } } /* -- define a user decoration -- */ static unsigned char user_deco_define(char *name) { struct u_deco *d; int l; l = strlen(name); for (d = user_deco; d; d = d->next) { if (strncmp(d->text, name, l) == 0 && d->text[l] == ' ') return deco_build(d->text); } return 128; } /* -- define a standard decoration -- */ unsigned char deco_define(char *name) { unsigned char ideco; int l; l = strlen(name); for (ideco = 0; ; ideco++) { if (!std_deco_tb[ideco]) return 128; if (strncmp(std_deco_tb[ideco], name, l) == 0 && std_deco_tb[ideco][l] == ' ') break; } return deco_build(std_deco_tb[ideco]); } /* -- convert the external deco number to the internal one -- */ unsigned char deco_intern(unsigned char ideco) { char *name; if (ideco == 0) return ideco; name = deco_tb[ideco - 128]; for (ideco = 1; ideco < 128; ideco++) { if (!deco_def_tb[ideco].name) { ideco = user_deco_define(name); /* try a user decoration */ if (ideco == 128) /* try a standard decoration */ ideco = deco_define(name); break; } if (strcmp(deco_def_tb[ideco].name, name) == 0) break; } if (ideco == 128) { error(1, 0, "Decoration !%s! not treated", name); ideco = 0; } return ideco; } /* -- update the x position of a decoration -- */ void deco_update(struct SYMBOL *s, float dx) { struct deco_elt *de; for (de = deco_head; de; de = de->next) { if (de->s == s) { while (de && de->s == s) { de->x += dx; de = de->next; } break; } } } /* -- adjust the symbol width -- */ float deco_width(struct SYMBOL *s) { struct deco *dc; int i; float wl; wl = 0; if (s->type == BAR) dc = &s->as.u.bar.dc; else dc = &s->as.u.note.dc; for (i = dc->n; --i >= 0; ) { struct deco_def_s *dd; dd = &deco_def_tb[dc->t[i]]; switch (dd->func) { case 1: /* slide */ if (wl < 7) wl = 7; break; case 2: /* arpeggio */ if (wl < 14) wl = 14; break; } } if (wl != 0 && s->prev && s->prev->type == BAR) wl -= 3; return wl; } /* -- draw the decorations -- */ /* (the staves are defined) */ void draw_all_deco(void) { struct deco_elt *de; struct deco_def_s *dd; int f, staff; float x, y, y2, ym; float ymid[MAXSTAFF]; if (!cfmt.dynalign) { staff = nstaff; y = staff_tb[staff].y; while (--staff >= 0) { y2 = staff_tb[staff].y; ymid[staff] = (y + 24 + y2) * 0.5; y = y2; } } for (de = deco_head; de; de = de->next) { dd = &deco_def_tb[de->t]; if ((f = dd->ps_func) < 0) continue; staff = de->staff; y = de->y + staff_tb[staff].y; /* center the dynamic marks between two staves */ /*fixme: KO when deco on other voice and same direction*/ if (dd->func >= 6 && !cfmt.dynalign && (((de->flags & DE_UP) && staff > 0) || (!(de->flags & DE_UP) && staff < nstaff))) { if (de->flags & DE_UP) ym = ymid[--staff]; else ym = ymid[staff++]; ym -= dd->h * 0.5; if (((de->flags & DE_UP) && y < ym) || (!(de->flags & DE_UP) && y > ym)) { struct SYMBOL *s; s = de->s; if (s->staff > staff) { while (s->staff != staff) s = s->ts_prev; } else if (s->staff < staff) { while (s->staff != staff) s = s->ts_next; } y2 = y_get(staff, !(de->flags & DE_UP), de->x, de->v) + staff_tb[staff].y; if (de->flags & DE_UP) y2 -= dd->h; if (((de->flags & DE_UP) && y2 > ym) || (!(de->flags & DE_UP) && y2 < ym)) { y = ym; y_set(staff, de->flags & DE_UP, de->x, de->v, ((de->flags & DE_UP) ? y + dd->h : y) - staff_tb[staff].y); } } } set_scale(de->s); set_defl(de->defl); /*fixme: scaled or not?*/ if (de->flags & DE_VAL) putf(de->v); if (de->str) { char *p, *q; a2b("("); q = p = de->str; while (*p != '\0') { if (*p == '(' || *p == ')') { if (p != q) a2b("%.*s", (int) (p - q), q); a2b("\\"); q = p; } p++; } if (p != q) a2b("%.*s", (int) (p - q), q); a2b(")"); } putxy(de->x, y); if (de->flags & DE_LDEN) { if (de->start) { x = de->start->x; y = de->start->y + staff_tb[de->start->staff].y; } else { x = first_note->x - first_note->wl - 4; } if (x > de->x - 20) x = de->x - 20; putxy(x, y); } if (de->flags & DE_GRACE) { if (de->flags & DE_INV) a2b("gsave T 0.7 -0.7 scale 0 0 %s grestore\n", ps_func_tb[f]); else a2b("gsave T 0.7 dup scale 0 0 %s grestore\n", ps_func_tb[f]); } else { if (de->flags & DE_INV) a2b("gsave 1 -1 scale neg %s grestore\n", ps_func_tb[f]); else a2b("%s\n", ps_func_tb[f]); } } set_sscale(-1); /* restore the scale */ } /* -- draw a decoration relative to a note head -- */ /* return 1 if the decoration is a head */ int draw_deco_head(int ideco, float x, float y, int stem) { struct deco_def_s *dd; char *str; if (ideco == 0) return 0; dd = &deco_def_tb[ideco]; if (dd->ps_func < 0) return 0; if (cfmt.setdefl) set_defl(stem >= 0 ? DEF_STEMUP : 0); switch (dd->func) { case 2: case 5: case 7: a2b("0 "); break; case 3: case 4: if (dd->strx == 0) break; /* fall thru */ case 6: str = dd->name; if (dd->strx != 0 && dd->strx != 255) str = str_tb[dd->strx]; a2b("(%s)", str); break; } putxy(x, y); a2b("%s ", ps_func_tb[dd->ps_func]); return strncmp(dd->name, "head-", 5) == 0; } /* -- draw the chord decorations relative to the heads -- */ void draw_all_deco_head(struct SYMBOL *s, float x, float y) { int k; unsigned char ideco; struct deco *dc; struct deco_def_s *dd; dc = &s->as.u.note.dc; for (k = dc->n; --k >= 0; ) { if (k >= dc->h && k < dc->s) /* skip the head decorations */ continue; if ((ideco = dc->t[k]) == 0) continue; dd = &deco_def_tb[ideco]; if (strncmp(dd->name, "head-", 5) != 0) continue; draw_deco_head(ideco, x, y, s->stem); } } /* -- create the deco elements, and treat the near ones -- */ static void deco_create(struct SYMBOL *s, struct deco *dc) { int k, l, posit; unsigned char ideco; struct deco_def_s *dd; struct deco_elt *de; #if 1 /*fixme:pb with decorations above the staff*/ for (k = 0; k < dc->n; k++) { if (k >= dc->h && k < dc->s) /* skip the head decorations */ continue; if ((ideco = dc->t[k]) == 0) continue; dd = &deco_def_tb[ideco]; #else int i, j; struct deco_def_s *d_tb[MAXDC]; /* the decorations above the staff must be treated in reverse order */ memset(&d_tb, 0, sizeof d_tb); i = 0; j = dc->n; for (k = 0; k < dc->n; k++) { if (k >= dc->h && k < dc->s) /* skip the head decorations */ continue; if ((ideco = dc->t[k]) == 0) continue; dd = &deco_def_tb[ideco]; if (dd->func < 3) { /* if near the note */ if (s->multi > 0 || (s->multi == 0 && s->stem < 0)) { d_tb[--j] = dd; continue; } } else if (dd->func == 3 /* if tied to note (not below) */ || dd->func == 5) { if (s->multi >= 0) { d_tb[--j] = dd; continue; } } d_tb[i++] = dd; } for (k = 0; k < dc->n; k++) { if ((dd = d_tb[k]) == 0) continue; #endif /* check if hidden */ switch (dd->func) { default: posit = 0; break; case 3: /* d_upstaff */ case 4: //fixme:trill does not work yet case 5: /* trill */ posit = s->posit.orn; break; case 6: /* d_pf */ posit = s->posit.vol; break; case 7: /* d_cresc */ posit = s->posit.dyn; break; } if (posit == SL_HIDDEN) { dc->t[k] = 0; continue; } /* memorize the decorations, but not the head ones */ if (strncmp(dd->name, "head-", 5) == 0) { switch (s->type) { case NOTEREST: s->sflags |= S_OTHER_HEAD; break; default: error(1, s, "Cannot have !%s! on a bar", dd->name); break; } continue; } de = (struct deco_elt *) getarena(sizeof *de); memset(de, 0, sizeof *de); de->prev = deco_tail; if (!deco_tail) deco_head = de; else deco_tail->next = de; deco_tail = de; de->s = s; de->t = dd - deco_def_tb; de->staff = s->staff; if (s->as.type == ABC_T_NOTE && (s->as.flags & ABC_F_GRACE)) de->flags = DE_GRACE; if (dd->ld_end != 0) { de->flags |= DE_LDST; } else { l = strlen(dd->name) - 1; if (l > 0 && dd->name[l] == ')') { if (strchr(dd->name, '(') == 0) { de->flags |= DE_LDEN; de->defl = DEF_NOST; } } } if (cfmt.setdefl && s->stem >= 0) de->defl |= DEF_STEMUP; if (dd->func >= 3) /* if not near the note */ continue; if (s->as.type != ABC_T_NOTE) { error(1, s, "Cannot have !%s! on a rest or a bar", dd->name); continue; } func_tb[dd->func](de); } } /* -- create the decorations and treat the ones near the notes -- */ /* (the staves are not yet defined) */ /* this function must be called first as it builds the deco element table */ void draw_deco_near(void) { struct SYMBOL *s, *g; struct deco *dc; struct SYMBOL *first; deco_head = deco_tail = NULL; first = NULL; for (s = tsfirst; s; s = s->ts_next) { switch (s->type) { case BAR: case MREST: if (s->as.u.bar.dc.n == 0) continue; dc = &s->as.u.bar.dc; break; case NOTEREST: case SPACE: if (!first) first = s; if (s->as.u.note.dc.n == 0) continue; dc = &s->as.u.note.dc; break; case GRACE: for (g = s->extra; g; g = g->next) { if (g->as.type != ABC_T_NOTE || g->as.u.note.dc.n == 0) continue; dc = &g->as.u.note.dc; deco_create(g, dc); } /* fall thru */ default: continue; } deco_create(s, dc); } first_note = first; } /* -- draw the decorations tied to a note -- */ /* (the staves are not yet defined) */ void draw_deco_note(void) { struct deco_elt *de, *de2; struct deco_def_s *dd; int f, t, staff, voice; for (de = deco_head; de; de = de->next) { t = de->t; dd = &deco_def_tb[t]; if (de->flags & DE_LDST) { /* start of long decoration */ t = dd->ld_end; voice = de->s->voice; /* search in the voice */ for (de2 = de->next; de2; de2 = de2->next) if (de2->t == t && de2->s->voice == voice) break; if (!de2) { /* search in the staff */ staff = de->s->staff; for (de2 = de->next; de2; de2 = de2->next) if (de2->t == t && de2->s->staff == staff) break; } if (!de2) { /* no end, insert one */ de2 = (struct deco_elt *) getarena(sizeof *de2); memset(de2, 0, sizeof *de2); de2->prev = deco_tail; deco_tail->next = de2; deco_tail = de2; de2->s = de->s; de2->t = t; de2->defl = DEF_NOEN; de2->flags = DE_LDEN; de2->x = realwidth - 6; de2->y = de->s->y; } de2->start = de; de2->defl &= ~DEF_NOST; } f = dd->func; if (f < 3 || f >= 6) continue; /* not tied to the note */ if (f == 4) de->flags |= DE_BELOW; func_tb[f](de); } } /* -- draw the music elements tied to the staff -- */ /* (the staves are not yet defined) */ void draw_deco_staff(void) { struct SYMBOL *s, *first_gchord; struct VOICE_S *p_voice; float x, y, w; struct deco_elt *de; struct { float ymin, ymax; } minmax[MAXSTAFF]; // outft = -1; /* force font output */ /* search the vertical offset for the guitar chords */ memset(minmax, 0, sizeof minmax); first_gchord = 0; for (s = tsfirst; s; s = s->ts_next) { struct gch *gch; int ix, ig; gch = s->gch; if (!gch) continue; if (!first_gchord) first_gchord = s; ig = -1; for (ix = 0; ix < MAXGCH; ix++, gch++) { if (gch->type == '\0') break; if (gch->type != 'g') continue; ig = ix; /* guitar chord closest to the staff */ if (gch->y < 0) break; } if (ig >= 0) { gch = s->gch + ig; w = gch->w; if (gch->y >= 0) { y = y_get(s->staff, 1, s->x, w); if (y > minmax[s->staff].ymax) minmax[s->staff].ymax = y; } else { y = y_get(s->staff, 0, s->x, w); if (y < minmax[s->staff].ymin) minmax[s->staff].ymin = y; } } } /* draw the guitar chords if any */ if (first_gchord) { int i; for (i = 0; i <= nstaff; i++) { int top, bot; bot = staff_tb[i].botbar; minmax[i].ymin -= 3; if (minmax[i].ymin > bot - 10) minmax[i].ymin = bot -10; top = staff_tb[i].topbar; minmax[i].ymax += 3; if (minmax[i].ymax < top + 10) minmax[i].ymax = top + 10; } set_sscale(-1); /* restore the scale parameters */ for (s = first_gchord; s; s = s->ts_next) { if (!s->gch) continue; switch (s->type) { case NOTEREST: case SPACE: case MREST: break; case BAR: if (!s->as.u.bar.repeat_bar) break; default: continue; } draw_gchord(s, minmax[s->staff].ymin, minmax[s->staff].ymax); } } /* draw the repeat brackets */ for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { struct SYMBOL *s1, *s2, *first_repeat; float y2; int i, repnl; if (p_voice->second || !p_voice->sym) continue; /* search the max y offset and set the end of bracket */ y = staff_tb[p_voice->staff].topbar + 6 + 20; first_repeat = 0; for (s = p_voice->sym->next; s; s = s->next) { if (s->type != BAR || !s->as.u.bar.repeat_bar || (s->sflags & S_NOREPBRA)) continue; /*fixme: line cut on repeat!*/ if (!s->next) break; if (!first_repeat) { set_font(REPEATFONT); first_repeat = s; } s1 = s; /* a bracket may be 4 measures * but only 2 measures when it has no start */ i = s1->as.text ? 4 : 2; for (;;) { if (!s->next) break; s = s->next; if (s->sflags & S_RBSTOP) break; if (s->type != BAR) continue; if (((s->as.u.bar.type & 0xf0) /* if complex bar */ && s->as.u.bar.type != (B_OBRA << 4) + B_CBRA) || s->as.u.bar.type == B_CBRA || s->as.u.bar.repeat_bar) break; if (--i <= 0) { /* have a shorter repeat bracket */ s = s1; i = 2; for (;;) { s = s->next; if (s->type != BAR) continue; if (--i <= 0) break; } s->sflags |= S_RBSTOP; break; } } y2 = y_get(p_voice->staff, 1, s1->x, s->x - s1->x); if (y < y2) y = y2; /* have room for the repeat numbers */ if (s1->gch) { w = s1->gch->w; y2 = y_get(p_voice->staff, 1, s1->x + 4, w); y2 += cfmt.font_tb[REPEATFONT].size + 2; if (y < y2) y = y2; } if (s->as.u.bar.repeat_bar) s = s->prev; } /* draw the repeat indications */ s = first_repeat; if (!s) continue; set_sscale(p_voice->staff); repnl = 0; for ( ; s; s = s->next) { char *p; if (s->type != BAR || !s->as.u.bar.repeat_bar || (s->sflags & S_NOREPBRA)) continue; s1 = s; for (;;) { if (!s->next) break; s = s->next; if (s->sflags & S_RBSTOP) break; if (s->type != BAR) continue; if (((s->as.u.bar.type & 0xf0) /* if complex bar */ && s->as.u.bar.type != (B_OBRA << 4) + B_CBRA) || s->as.u.bar.type == B_CBRA || s->as.u.bar.repeat_bar) break; } s2 = s; if (s1 == s2) break; x = s1->x; if ((s1->as.u.bar.type & 0x07) == B_COL) x -= 4; i = 0; /* no bracket end */ if (s2->sflags & S_RBSTOP) { w = 8; /* (w = left shift) */ } else if (s2->type != BAR) { w = s2->x - realwidth + 4; } else if (((s2->as.u.bar.type & 0xf0) /* if complex bar */ && s2->as.u.bar.type != (B_OBRA << 4) + B_CBRA) || s2->as.u.bar.type == B_CBRA) { i = 2; /* bracket start and stop */ /*fixme:%%staves: cursys moved?*/ if (s->staff > 0 && !(cursys->staff[s->staff - 1].flags & STOP_BAR)) { w = s2->wl; } else if ((s2->as.u.bar.type & 0x0f) == B_COL) { w = 12; } else if (!(s2->sflags & S_RRBAR) || s2->as.u.bar.type == B_CBRA) { w = 0; /* explicit repeat end */ /* if ']', don't display as thick bar */ if (s2->as.u.bar.type == B_CBRA) s2->as.flags |= ABC_F_INVIS; } else { w = 8; } } else { w = 8; } w = s2->x - x - w; p = s1->as.text; if (!p) { i--; /* no bracket start (1) or not drawn */ p = ""; } if (i == 0 && !s2->next /* 2nd ending at end of line */ && !(s2->sflags & S_RBSTOP)) { if (p_voice->bar_start == 0) repnl = 1; /* continue on next line */ } if (i >= 0) { a2b("(%s)-%.1f %d ", p, cfmt.font_tb[REPEATFONT].size * 0.8 + 1, i); putx(w); putxy(x, y); a2b("y%d repbra\n", s1->staff); y_set(s1->staff, 1, x, w, y + 2); } if (s->as.u.bar.repeat_bar) s = s->prev; } if (repnl) { p_voice->bar_start = B_OBRA; p_voice->bar_repeat = 1; } } /* create the decorations tied to the staves */ memset(minmax, 0, sizeof minmax); for (de = deco_head; de; de = de->next) { struct deco_def_s *dd; dd = &deco_def_tb[de->t]; if (dd->func < 6) /* if not tied to the staff */ continue; func_tb[dd->func](de); if (dd->ps_func < 0) continue; if (cfmt.dynalign) { if (de->flags & DE_UP) { if (de->y > minmax[de->staff].ymax) minmax[de->staff].ymax = de->y; } else { if (de->y < minmax[de->staff].ymin) minmax[de->staff].ymin = de->y; } } } /* and, if wanted, set them at a same vertical offset */ for (de = deco_head; de; de = de->next) { struct deco_def_s *dd; dd = &deco_def_tb[de->t]; if (dd->ps_func < 0 || dd->func < 6) continue; if (cfmt.dynalign) { if (de->flags & DE_UP) y = minmax[de->staff].ymax; else y = minmax[de->staff].ymin; de->y = y; } else { y = de->y; } if (de->flags & DE_UP) y += dd->h; y_set(de->staff, de->flags & DE_UP, de->x, de->v, y); } } /* -- draw the guitar chords and annotations -- */ /* (the staves are not yet defined) */ static void draw_gchord(struct SYMBOL *s, float gchy_min, float gchy_max) { struct gch *gch; int action, ix, ig, box; float x, y, w, h, y_above, y_below; float hbox, xboxh, xboxl, yboxh, yboxl, expdx; /* adjust the vertical offset according to the guitar chords */ //fixme: w may be too small w = s->gch->w; #if 1 y_above = y_get(s->staff, 1, s->x - 2, w); y_below = y_get(s->staff, 0, s->x - 2, w); #else y_above = y_get(s->staff, 1, s->x - 2, w) + 2; y_below = y_get(s->staff, 0, s->x - 2, w) - 2; #endif ig = -1; for (ix = 0, gch = s->gch; ix < MAXGCH; ix++, gch++) { if (gch->type == '\0') break; if (gch->type != 'g') continue; ig = ix; /* index of guitar chord closest to the staff */ if (gch->y < 0) break; } if (ig >= 0) { gch = s->gch + ig; if (gch->y >= 0) { if (y_above < gchy_max) y_above = gchy_max; } else { if (y_below > gchy_min) y_below = gchy_min; } } str_font(s->gch->font); set_font(s->gch->font); /* needed if scaled staff */ set_sscale(s->staff); action = A_GCHORD; xboxh = xboxl = s->x; yboxh = -100; yboxl = 100; box = 0; expdx = 0; for (ix = 0, gch = s->gch; ix < MAXGCH; ix++, gch++) { if (gch->type == '\0') break; h = cfmt.font_tb[gch->font].size; str_font(gch->font); w = tex_str(s->as.text + gch->idx); if (gch->type == 'g') { /* guitar chord */ if (!strchr(tex_buf, '\t')) { action = A_GCHORD; } else { struct SYMBOL *next; char *r; int n; /* some TAB: expand the guitar chord */ x = realwidth; next = s->next; while (next) { switch (next->type) { default: next = next->next; continue; case NOTEREST: case BAR: x = next->x; break; } break; } n = 0; r = tex_buf; for (;;) { n++; r = strchr(r, '\t'); if (!r) break; r++; } expdx = (x - s->x - w) / n; action = A_GCHEXP; } } else { action = A_ANNOT; } x = s->x + gch->x; switch (gch->type) { case '_': /* below */ y = gch->y + y_below; y_set(s->staff, 0, x, w, y - h * 0.2 - 2); break; case '^': /* above */ y = gch->y + y_above; y_set(s->staff, 1, x, w, y + h * 0.8 + 2); break; default: /* guitar chord */ hbox = gch->box ? 3 : 2; if (gch->y >= 0) { y = gch->y + y_above; y_set(s->staff, 1, x, w, y + h + hbox); } else { y = gch->y + y_below; y_set(s->staff, 0, x, w, y - hbox); } if (gch->box) { if (xboxl > x) xboxl = x; w += x; if (xboxh < w) xboxh = w; if (yboxl > y) yboxl = y; if (yboxh < y + h) yboxh = y + h; box++; } break; case '<': /* left */ /*fixme: what symbol space?*/ if (s->as.u.note.accs[0]) x -= s->shac[0]; y = s->yav + gch->y; break; case '>': /* right */ x += s->xmx; if (s->dots > 0) x += 1.5 + 3.5 * s->dots; y = s->yav + gch->y; break; case '@': /* absolute */ y = s->yav + gch->y; break; } putxy(x, y + h * 0.2); /* (descent) */ a2b("y%d M ", s->staff); if (action == A_GCHEXP) a2b("%.2f ", expdx); str_out(tex_buf, action); if (gch->type == 'g' && box > 0) a2b(" boxstart"); a2b("\n"); } /* draw the box of the guitar chords */ if (xboxh != xboxl) { /* if any normal guitar chord */ xboxl -= 2; w = xboxh - xboxl + 2; putxy(xboxl, yboxl - 2); #if 1 a2b("y%d %.1f boxdraw\n", s->staff, yboxh - yboxl + 3); #else a2b("y%d %.1f %.1f box\n", s->staff, w, yboxh - yboxl + 3); #endif } } /* -- draw the measure bar numbers -- */ void draw_measnb(void) { struct SYMBOL *s; struct SYSTEM *sy; char *showm; int any_nb, staff, bar_num; float x, y, w, font_size; showm = cfmt.measurebox ? "showb" : "show"; any_nb = 0; /* search the first staff */ sy = cursys; for (staff = 0; staff <= nstaff; staff++) { if (!sy->staff[staff].empty) break; } if (staff > nstaff) return; /* no visible staff */ //fixme: must use the scale, otherwise bad y offset (y0 empty) set_sscale(staff); /* leave the measure numbers as unscaled */ font_size = cfmt.font_tb[MEASUREFONT].size; cfmt.font_tb[MEASUREFONT].size /= staff_tb[staff].clef.staffscale; s = tsfirst; /* clef */ bar_num = nbar; if (bar_num > 1) { if (cfmt.measurenb == 0) { set_font(MEASUREFONT); any_nb = 1; x = 0; w = 20; // while (s->staff != staff) // s = s->ts_next; y = y_get(staff, 1, x, w); if (y < staff_tb[staff].topbar + 14) y = staff_tb[staff].topbar + 14; a2b("0 "); puty(y); a2b("y%d M(%d)%s", staff, bar_num, showm); y_set(staff, 1, x, w, y + cfmt.font_tb[MEASUREFONT].size + 2); } else if (bar_num % cfmt.measurenb == 0) { for ( ; ; s = s->ts_next) { switch (s->type) { case TIMESIG: case CLEF: case KEYSIG: case FMTCHG: case STBRK: continue; } break; } // while (s->staff != staff) // s = s->ts_next; if (s->prev->type != CLEF) s = s->prev; x = s->x - s->wl; set_font(MEASUREFONT); any_nb = 1; w = cwid('0') * cfmt.font_tb[MEASUREFONT].size; if (bar_num >= 10) { if (bar_num >= 100) w *= 3; else w *= 2; } if (cfmt.measurebox) w += 4; y = y_get(staff, 1, x, w); if (y < staff_tb[staff].topbar + 6) y = staff_tb[staff].topbar + 6; y += 2; putxy(x, y); a2b("y%d M(%d)%s", staff, bar_num, showm); y += cfmt.font_tb[MEASUREFONT].size; y_set(staff, 1, x, w, y); s->ymx = y; } } for ( ; s; s = s->ts_next) { switch (s->type) { case STAVES: sy = sy->next; for (staff = 0; staff < nstaff; staff++) { if (!sy->staff[staff].empty) break; } set_sscale(staff); continue; default: continue; case BAR: break; } if (s->u <= 0) continue; bar_num = s->u; if (cfmt.measurenb == 0 || (bar_num % cfmt.measurenb) != 0 || !s->next) continue; // while (s->staff != staff) // s = s->ts_next; if (!any_nb) { any_nb = 1; set_font(MEASUREFONT); } w = cwid('0') * cfmt.font_tb[MEASUREFONT].size; if (bar_num >= 10) { if (bar_num >= 100) w *= 3; else w *= 2; } if (cfmt.measurebox) w += 4; x = s->x - w * 0.4; y = y_get(staff, 1, x, w); if (y < staff_tb[staff].topbar + 6) y = staff_tb[staff].topbar + 6; if (s->next->as.type == ABC_T_NOTE) { if (s->next->stem > 0) { if (y < s->next->ys - cfmt.font_tb[MEASUREFONT].size) y = s->next->ys - cfmt.font_tb[MEASUREFONT].size; } else { if (y < s->next->y) y = s->next->y; } } y += 2; a2b(" "); putxy(x, y); a2b("y%d M(%d)%s", staff, bar_num, showm); y += cfmt.font_tb[MEASUREFONT].size; y_set(staff, 1, x, w, y); s->ymx = y; } if (any_nb) a2b("\n"); nbar = bar_num; cfmt.font_tb[MEASUREFONT].size = font_size; } /* -- get the beat from a time signature -- */ static int get_beat(struct meter_s *m) { int top, bot; if (m->meter[0].top[0] == 'C') { if (m->meter[0].top[0] == '|') return BASE_LEN / 2; return BASE_LEN / 4; } if (m->meter[0].bot[0] == '\0') return BASE_LEN / 4; sscanf(m->meter[0].top, "%d", &top); sscanf(m->meter[0].bot, "%d", &bot); if (bot >= 8 && top >= 6 && top % 3 == 0) return BASE_LEN * 3 / 8; return BASE_LEN / bot; } /* -- draw the note of the tempo -- */ static void draw_notempo(struct SYMBOL *s, int len, float sc) { int head, dots, flags; float dx; a2b("gsave %.2f dup scale 8 3 RM currentpoint ", sc); identify_note(s, len, &head, &dots, &flags); switch (head) { case H_OVAL: a2b("HD"); break; case H_EMPTY: a2b("Hd"); break; default: a2b("hd"); break; } dx = 4; if (dots) { float dotx; dotx = 8; if (flags > 0) dotx += 4; switch (head) { case H_SQUARE: case H_OVAL: dotx += 2; break; case H_EMPTY: dotx += 1; break; } while (--dots >= 0) { a2b(" %.1f 0 dt", dotx); dx = dotx; dotx += 3.5; } } if (len < SEMIBREVE) { if (flags <= 0) { a2b(" %d su", STEM); } else { a2b(" %d %d sfu", flags, STEM); if (dx < 6) dx = 6; } } a2b(" grestore %.1f 0 RM\n", (dx + 15) * sc); } /* -- return the tempo width -- */ float tempo_width(struct SYMBOL *s) { unsigned i; float w; w = 0; if (s->as.u.tempo.str1) w += tex_str(s->as.u.tempo.str1); if (s->as.u.tempo.value != 0) { i = 1; while (i < sizeof s->as.u.tempo.length / sizeof s->as.u.tempo.length[0] && s->as.u.tempo.length[i] > 0) { w += 10; i++; } w += 6 + cwid(' ') * cfmt.font_tb[TEMPOFONT].size * 6 + 10 + 10; } if (s->as.u.tempo.str2) w += tex_str(s->as.u.tempo.str2); return w; } /* - output a tempo --*/ void write_tempo(struct SYMBOL *s, int beat, float sc) { int top, bot; unsigned j; if (s->as.u.tempo.str1) put_str(s->as.u.tempo.str1, A_LEFT); if (s->as.u.tempo.value != 0) { sc *= 0.7 * cfmt.font_tb[TEMPOFONT].size / 15.0; /*fixme: 15.0 = initial tempofont*/ if (s->as.u.tempo.length[0] == 0) { if (beat == 0) beat = get_beat(&voice_tb[cursys->top_voice].meter); s->as.u.tempo.length[0] = beat; } for (j = 0; j < sizeof s->as.u.tempo.length / sizeof s->as.u.tempo.length[0] && s->as.u.tempo.length[j] > 0; j++) { draw_notempo(s, s->as.u.tempo.length[j], sc); } put_str("= ", A_LEFT); if (sscanf(s->as.u.tempo.value, "%d/%d", &top, &bot) == 2 && bot > 0) draw_notempo(s, top * BASE_LEN / bot, sc); else put_str(s->as.u.tempo.value, A_LEFT); } if (s->as.u.tempo.str2) put_str(s->as.u.tempo.str2, A_LEFT); } /* -- draw the parts and the tempo information -- */ /* (the staves are being defined) */ float draw_partempo(int staff, float top) { struct SYMBOL *s, *g; int beat, dosh, shift; int some_part, some_tempo; float h, ht, w, x, y, ymin, dy; /* put the tempo indication at top */ dy = 0; ht = 0; some_part = some_tempo = 0; /* get the minimal y offset */ ymin = staff_tb[staff].topbar + 12; dosh = 0; shift = 1; x = 0; for (s = tsfirst; s; s = s->ts_next) { g = s->extra; if (!g) continue; for ( ; g; g = g->next) if (g->type == TEMPO) break; if (!g) continue; if (!some_tempo) { some_tempo = 1; str_font(TEMPOFONT); } w = tempo_width(g); y = y_get(staff, 1, s->x - 5, w) + 2; if (y > ymin) ymin = y; if (x >= s->x - 5 && !(dosh & (shift >> 1))) dosh |= shift; shift <<= 1; x = s->x - 5 + w; } if (some_tempo) { ht = cfmt.font_tb[TEMPOFONT].size + 2 + 2; y = 2 - ht; h = y - ht; if (dosh != 0) ht *= 2; if (top < ymin + ht) dy = ymin + ht - top; /* draw the tempo indications */ str_font(TEMPOFONT); beat = 0; for (s = tsfirst; s; s = s->ts_next) { if (!(s->sflags & S_SEQST)) continue; if (s->type == TIMESIG) beat = get_beat(&s->as.u.meter); g = s->extra; if (!g) continue; for ( ; g; g = g->next) if (g->type == TEMPO) break; if (!g) continue; /*fixme: cf left shift (-5)*/ a2b("%.1f %.1f M ", s->x - 5, (dosh & 1) ? h : y); dosh >>= 1; write_tempo(g, beat, 1); } } /* then, put the parts */ /*fixme: should reduce if parts don't overlap tempo...*/ ymin = staff_tb[staff].topbar + 14; for (s = tsfirst; s; s = s->ts_next) { g = s->extra; if (!g) continue; for (; g; g = g->next) if (g->type == PART) break; if (!g) continue; if (!some_part) { some_part = 1; h = cfmt.font_tb[PARTSFONT].size + 2 + 2; /* + cfmt.partsspace; ?? */ str_font(PARTSFONT); } w = tex_str(&g->as.text[2]); y = y_get(staff, 1, s->x - 10, w + 15) + 5; if (ymin < y) ymin = y; } if (!some_part) goto out; if (top < ymin + h + ht) dy = ymin + h + ht - top; set_font(PARTSFONT); for (s = tsfirst; s; s = s->ts_next) { g = s->extra; if (!g) continue; for (; g; g = g->next) if (g->type == PART) break; if (!g) continue; w = tex_str(&g->as.text[2]); a2b("%.1f %.1f M", s->x - 10, 2 - ht - h); str_out(tex_buf, A_LEFT); if (cfmt.partsbox) a2b(" %.1f %.1f %.1f %.1f box", s->x - 10 - 2, 2 - ht - h - 4, w + 4, h); a2b("\n"); } out: return dy * staff_tb[staff].clef.staffscale; } /* -- initialize the default decorations -- */ void reset_deco(void) { memset(&deco, 0, sizeof deco); /* standard */ deco['.'] = deco_define("dot"); #ifdef DECO_IS_ROLL deco['~'] = deco_define("roll"); #endif deco['H'] = deco_define("fermata"); deco['L'] = deco_define("emphasis"); deco['M'] = deco_define("lowermordent"); deco['O'] = deco_define("coda"); deco['P'] = deco_define("uppermordent"); deco['S'] = deco_define("segno"); deco['T'] = deco_define("trill"); deco['u'] = deco_define("upbow"); deco['v'] = deco_define("downbow"); /* non-standard */ #ifndef DECO_IS_ROLL deco['~'] = deco_define("gmark"); #endif deco['J'] = deco_define("slide"); deco['R'] = deco_define("roll"); } /* -- set the decoration flags -- */ void set_defl(int new_defl) { if (defl == new_defl) return; defl = new_defl; a2b("/defl %d def ", new_defl); } ��������������������������������������������������������������abcm2ps-7.8.9/deco.abc������������������������������������������������������������������������������0000644�0001750�0001750�00000030130�12254372702�012542� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������%!! here is an experimental decoration extension !! %!! syntax may change in next releases !! % % this option is required for !trem! % %setdefl 1 % % == postscript definitions - must be before any tune == % %%beginps % -- cresc / decresc / dimin /crdc{ % usage: str x y crdc - cresc, decresc, .. /Times-Italic 14 selectfont M -6 4 RM show}! % % -- alternate piano/forte indication between parenthesis /apf{ % usage: str x y apf M -6 5 RM /Times-Italic 16 selectfont(\()show /Times-BoldItalic 16 selectfont show /Times-Italic 16 selectfont(\))show}! % % -- draw parenthesis around a note /opnot{ % usage: x y opnot M -5.5 -3 RM /Times-Roman 15 selectfont(\( \))show}! % -- same, but inside a chord (x is not the same) /opchnot{ % usage: x y opchnot M -10.5 -3 RM /Times-Roman 15 selectfont(\( \))show}! % % -- sforzando accent /sfa{ % usage: x y sfa 1.2 SLW M -2.4 4.8 RM 2.4 8.0 RL 2.4 -7.4 RL -1.0 0.0 RL -1.8 6.4 RL stroke}! % % -- draw octava indication /octava{ % usage: w x y octava exch -10 add exch 2 copy M 0 10 RM /Times-Roman 16 selectfont(8)show /Times-Roman 12 selectfont(va)show M 0 6 RL currentpoint stroke M [6] 0 setdash 30 add 0 RL currentpoint stroke M [] 0 setdash 0 -6 RL stroke}! /octavab{ % usage: w x y octavab exch -14 add exch 2 copy M 0 2 RM /Times-Roman 16 selectfont(8)show /Times-Roman 12 selectfont(va basso)show 22 add M 0 -6 RL currentpoint stroke M [6] 0 setdash 30 add 0 RL stroke [] 0 setdash}! % % -- write big letters (position marks) above the staff % (from Guido Gonzato) /bigl{ % usage: str x y bigl /Times-Bold 26 selectfont 4 add M showc 1 SLW 1 -2 RM 0 22 RL -22 0 RL 0 -22 RL 22 0 RL stroke}! % (from Jonas Petersson) /biglc{ % usage: str x y biglc 2 copy 5 2 roll /Times-Bold 22 selectfont 6 add M showc 1 SLW 13 add newpath 12 0 360 arc stroke}! % % -- pedal glyph % (from CMN http://ccrma-www.stanford.edu/software/cmn/cmn/cmn.html) /ped{ % usage: str x y ped gsave 4 add exch -10 add exch T 26 dup scale 0.368 0.074 moveto 0.341 0.121 0.335 0.147 0.371 0.203 curveto 0.435 0.289 0.531 0.243 0.488 0.155 curveto 0.472 0.117 0.434 0.096 0.414 0.080 curveto 0.429 0.038 0.494 -0.006 0.541 0.075 curveto 0.559 0.123 0.558 0.224 0.663 0.252 curveto 0.603 0.354 0.449 0.393 0.461 0.405 curveto 0.902 0.262 0.705 -0.124 0.555 0.046 curveto 0.488 -0.032 0.417 0.021 0.389 0.055 curveto 0.303 -0.018 0.303 -0.020 0.248 0.040 curveto 0.218 0.108 0.191 0.062 0.164 0.047 curveto 0.010 -0.056 0.032 0.019 0.124 0.062 curveto 0.229 0.117 0.200 0.091 0.228 0.195 curveto 0.240 0.241 0.149 0.250 0.166 0.311 curveto 0.207 0.493 lineto -0.041 0.441 0.049 0.261 0.126 0.387 curveto 0.138 0.381 lineto -0.020 0.119 -0.100 0.472 0.220 0.507 curveto 0.548 0.486 0.399 0.171 0.254 0.374 curveto 0.264 0.384 lineto 0.338 0.259 0.521 0.449 0.228 0.488 curveto 0.198 0.356 lineto 0.181 0.304 0.273 0.294 0.262 0.241 curveto 0.229 0.101 lineto 0.273 0.070 0.282 -0.038 0.368 0.074 curveto 0.391 0.094 moveto 0.456 0.130 0.476 0.171 0.468 0.213 curveto 0.452 0.276 0.333 0.171 0.391 0.094 curveto 0.627 0.019 moveto 0.533 0.041 0.586 0.228 0.678 0.229 curveto 0.729 0.170 0.712 0.025 0.627 0.019 curveto eofill 0.8 0.04 0.04 0 360 newpath arc fill pop grestore}! % % -- pedal off glyph % (from CMN http://ccrma-www.stanford.edu/software/cmn/cmn/cmn.html) /pedoff{ % usage: str x y ped gsave 4 add exch -5 add exch T 26 dup scale 0.219 0.198 moveto 0.231 0.172 0.195 0.138 0.162 0.173 curveto 0.149 0.219 0.206 0.231 0.219 0.198 curveto 0.144 0.242 moveto 0.166 0.223 0.193 0.230 0.181 0.267 curveto 0.178 0.306 0.144 0.302 0.151 0.335 curveto 0.160 0.381 0.225 0.377 0.224 0.330 curveto 0.228 0.302 0.198 0.306 0.197 0.267 curveto 0.194 0.237 0.213 0.222 0.237 0.247 curveto 0.263 0.276 0.234 0.297 0.268 0.322 curveto 0.314 0.347 0.354 0.297 0.316 0.259 curveto 0.296 0.237 0.273 0.266 0.246 0.237 curveto 0.223 0.217 0.232 0.194 0.266 0.197 curveto 0.303 0.202 0.302 0.232 0.332 0.228 curveto 0.381 0.232 0.388 0.156 0.332 0.152 curveto 0.302 0.148 0.302 0.185 0.266 0.183 curveto 0.231 0.186 0.228 0.169 0.245 0.143 curveto 0.273 0.116 0.297 0.141 0.316 0.117 curveto 0.350 0.075 0.303 0.029 0.258 0.062 curveto 0.237 0.082 0.261 0.102 0.233 0.133 curveto 0.212 0.151 0.194 0.147 0.197 0.113 curveto 0.203 0.075 0.232 0.075 0.230 0.043 curveto 0.223 -0.004 0.159 -0.002 0.152 0.042 curveto 0.148 0.075 0.185 0.076 0.183 0.113 curveto 0.183 0.147 0.163 0.150 0.141 0.133 curveto 0.113 0.104 0.140 0.079 0.113 0.059 curveto 0.069 0.037 0.033 0.077 0.063 0.117 curveto 0.082 0.141 0.104 0.117 0.132 0.142 curveto 0.153 0.163 0.144 0.188 0.113 0.182 curveto 0.073 0.182 0.075 0.147 0.046 0.152 curveto -0.003 0.152 -0.003 0.227 0.048 0.227 curveto 0.075 0.231 0.075 0.198 0.113 0.196 curveto 0.141 0.197 0.147 0.207 0.133 0.237 curveto 0.102 0.264 0.082 0.237 0.062 0.261 curveto 0.028 0.302 0.077 0.347 0.118 0.318 curveto 0.138 0.297 0.116 0.275 0.144 0.242 curveto fill pop grestore}! % % -- glissendo /gliss{ % usage: x2 y2 x1 y1 gliss gsave exch 13 add exch 2 copy T 0 0 M exch 4 -1 roll exch sub 3 1 roll sub % dx dy 2 copy exch atan dup rotate % dx dy alpha exch pop cos div % len % 9 sub 0 RL % simple line 9 sub 0 8 3 -1 roll{ % squiggly line 2 -1.15 2.30 150 30 arcn 4 0 T 2 1.15 2.30 -150 -30 arc 4 0 T pop }for 1 SLW stroke grestore}! % % -- upper glissendo /glissup{ % usage: x y glissup gsave T 5 0 T 25 rotate 10 0 T 0 0 M 0 8 8{ 2 -1.15 2.30 150 30 arcn 4 0 T 2 1.15 2.30 -150 -30 arc 4 0 T pop }for 1 SLW stroke grestore}! % % -- note decorations % (sorry for I don't know the name of these: there so many ones) % The convention I use here is: % - t2 or t3: mordent with 2 or 3 peeks % - ta or tb: turn from above or from below % - b, ub or db: middle, upper or lower bar /tr3{ % usage: x y tr3 - mordent with 3 peeks M 2.2 2.2 RL 2.1 -2.9 RL 0.7 0.7 RL 2.2 2.2 RL 2.1 -2.9 RL 0.7 0.7 RL 2.2 2.2 RL 2.1 -2.9 RL 0.7 0.7 RL -2.2 -2.2 RL -2.1 2.9 RL -0.7 -0.7 RL -2.2 -2.2 RL -2.1 2.9 RL -0.7 -0.7 RL -2.2 -2.2 RL -2.1 2.9 RL -0.7 -0.7 RL fill}! /t2ub{ % usage: x y t2ub - mordent ending with an upper bar 2 copy umrd 0.6 SLW M 5 4 RM 0 6 RL stroke}! /t3tab{ % usage: x y t3tab - mordent + upper turn and bar 4 add 2 copy exch 7.5 sub exch tr3 exch 7.5 add exch 2 copy 0.6 SLW M 2 6 14 6 16 0 RC M 8 1 RM 0 6 RL stroke}! /ubt3ta{ % usage: x y ubt3ta - up bar + mordent + upper turn 4 add 2 copy 0.6 SLW M -7.5 0 RM 0 6 RL stroke 2 copy exch 7.5 sub exch tr3 M 7.5 0 RM 2 6 14 6 16 0 RC stroke}! /tbt3{ % usage: x y tbt3 - low turn + long mordent exch 10 sub exch 6 add 2 copy 0.6 SLW M -8 0 RM 2 -6 14 -6 16 0 RC stroke exch 8 add exch tr3}! /t2ta{ % usage: x y t2ta - mordent + upper turn 2 copy umrd M 5 4 RM 1 5 9 5 10 0 RC stroke}! /t3b{ % usage: x y t3b - upper + lower mordent 2 copy exch -7.5 add exch 4 add tr3 0.6 SLW M 2.5 0 RM 0 8 RL stroke}! /sharp{ % usage: x y sharp - sharp above note 4 add gsave T 0.6 dup scale 0 0 sh0 grestore}! /flat{ % usage: x y flat - flat above note 4 add gsave T 0.6 dup scale 0 0 ft0 grestore}! /natural{ % usage: x y natural - natural sign above note 4 add gsave T 0.6 dup scale 0 0 nt0 grestore}! % % -- 'treble-8' customization /octl{ /Times-BoldItalic 16 selectfont M 5.5 -14 RM(8vb)show}! % % -- latin guitar chords % note: 'Ré' cannot be used /gcshow{ dup 0 get dup dup 65 ge exch 71 le and{ 65 sub[(La)(Si)(Do)(Re)(Mi)(Fa)(Sol )]exch get show dup length 1 sub 1 exch getinterval }if show}! % % -- 'tr' + long trill /trtrill{ % usage: w x y trtrill 2 copy trl 3 1 roll 9 add 3 1 roll 9 sub 3 1 roll 2 add ltr}! % % -- guitar diagrams /guitar{ % usage: x y guitar gsave exch 10 sub exch 8 add T 1.5 SLW -0.3 24.6 M 20.6 0 RL stroke 0.6 SLW 0 0 M 20 0 RL 0 6 M 20 0 RL 0 12 M 20 0 RL 0 18 M 20 0 RL 0 0 M 0 24 RL 4 0 M 0 24 RL 8 0 M 0 24 RL 12 0 M 0 24 RL 16 0 M 0 24 RL 20 0 M 0 24 RL stroke 0.5 SLW}! /gdot{newpath 1.4 0 360 arc fill}! /gx{28 M -1.3 -1.3 RM 2.6 2.6 RL 0 -2.6 RM -2.6 2.6 RL stroke}! /go{28 newpath 1.5 0 360 arc stroke}! /Dm{ % usage: x y Dm guitar 0 gx 4 gx 8 go 20 21 gdot 12 15 gdot 16 9 gdot grestore}! /Bb{ guitar 0 gx 20 gx 4 21 gdot 8 9 gdot 12 9 gdot 16 9 gdot grestore}! /C7{ guitar 0 gx 20 go 16 21 gdot 8 15 gdot 4 9 gdot 12 9 gdot grestore}! % % -- arpeggio variations % arpeggio with arrow 1st version /arpu{ 2 copy 4 index add M -6.5 0 RM 2.5 5 RL 2.5 -5 RL fill arp}! /arpd{ 2 copy M -6.5 0 RM 2.5 -5 RL 2.5 5 RL fill arp}! % arpeggio with arrow other version % /arpu{ 2 copy 4 index add M -7 0 RM 3 5 RL 3 -5 RL % 0.7 SLW stroke arp}! % /arpd{ 2 copy M -7 0 RM 3 -5 RL 3 5 RL % 0.7 SLW stroke arp}! % arpeggio crossing the staves % (! this works because the decoration are drawn sorted by time !) /arps{ % arpeggio start - stack: h x ylow exch /x exch def % memorize 'x' add /y exch def}! % memorize the upper vert offset /arpe{ % arpeggio end - stack: h x ylow 3 -1 roll pop % discard 'h' exch dup x gt {pop x} if exch % have room for accidentals y 1 index sub 3 1 roll % new height arp}! % % -- optional breath /brth{6 add /xbr 2 index def /ybr 1 index def /Times-BoldItalic 30 selectfont M (,) show}! /opbrth{pop pop xbr 10 sub ybr 5 sub /Times-Roman 20 selectfont M (\( \)) show}! % % -- head decorations / replacement % lower mordent /hlmrd{ % usage: x y hlmrd exch 12 sub exch 4 sub lmrd}! % small note head /shd{ % usage: x y shd M 3 1.3 RM -1 2.5 -6.5 0 -5.5 -2.5 RC 1 -2.5 6.5 0 5.5 2.5 RC fill}! % -- measure bar between two staves (1 and 2) /hbar{ % usage: x y hbar dlw pop dup 0 y0 M 24 y1 lineto stroke}! %%endps % % == decoration definitions == % % actual syntax (see format.txt): % %%deco [] % % -- accent near the note / sforzando %%deco accn 0 accent 8 4 4 %%deco sfa 3 sfa 12 5 5 % % -- dynamic indication below the staff %%deco fp 6 pf 18 5 11 fp %%deco cresc 6 crdc 20 4 28 Cresc. %%deco decresc 6 crdc 20 4 32 Decresc. %%deco dimin 6 crdc 20 4 28 Dimin. %%deco riten 6 crdc 20 8 40 Poco riten. % % -- dynamic indication below the staff between parenthesis %%deco (p) 6 apf 20 8 16 p %%deco (pp) 6 apf 20 8 24 pp %%deco (f) 6 apf 20 8 16 f %%deco (ff) 6 apf 20 8 24 ff % % -- repeat indication above the staff %%deco alcoda 3 dacs 20 0 0 al Coda % % -- who asked for a Pedal indication ? %%deco ped 6 ped 20 0 0 %%deco ped-end 6 pedoff 20 0 0 % % -- optional note %%deco () 1 opnot 0 0 0 % % -- start / stop of octava indication %%deco 8( 5 - 24 0 0 %%deco 8) 5 octava 24 0 0 %%deco 8b( 7 - 24 0 0 %%deco 8b) 7 octavab 24 0 0 % % -- big letters %%deco biga 3 bigl 20 0 0 A %%deco bigb 3 biglc 20 0 0 B % ... % % -- glissendo %%deco -( 1 - 0 0 0 %%deco -) 1 gliss 0 0 0 %%deco - 1 glissup 0 2 10 % % -- note decorations %%deco t2ub 3 t2ub 12 5 5 %%deco t3tab 3 t3tab 12 8 24 %%deco ubt3ta 3 ubt3ta 12 8 24 %%deco tbt3 3 tbt3 14 14 18 %%deco t2ta 3 t2ta 12 5 15 %%deco t3b 3 t3b 12 5 15 %%deco # 3 sharp 8 0 0 %%deco b 3 flat 8 0 0 %%deco = 3 natural 8 0 0 % % -- 'tr' + long trill %%deco tr( 5 - 11 0 0 %%deco tr) 5 trtrill 11 0 0 % % -- guitar chords %%deco Dm 3 Dm 36 0 0 %%deco Bb 3 Bb 36 0 0 %%deco C7 3 C7 36 0 0 % % -- arpeggios %%deco arpu 2 arpu 0 0 0 %%deco arpd 2 arpd 0 0 0 %%deco arps 2 arps 0 0 0 %%deco arpe 2 arpe 0 0 0 % % -- optional breath %%deco opbrth 3 opbrth 0 0 0 % % -- head decorations %%deco op 1 opchnot 0 0 0 % optional head %%deco m 0 hlmrd 0 0 0 % lower mordent on the left %%deco head-x 0 dsh0 0 0 0 % X head %%deco head-shd 0 shd 0 0 0 % small head % % -- measure bar between two staves %%deco hbar 3 hbar 0 0 0 X:1 T:Customized decorations M:C L:1/8 K:C treble-8 !biga!y!fp!"C"C!t2ub!C !cresc!"D"D!t3tab!D !decresc!"E"E!ubt3ta!E !dimin!"F"F!tbt3!F|\ !mp!"G"G!t2ta!G !(p)!A!t3b!c T!b!!(pp)!A2 P!#!!(f)!B2|M!=!!(ff)!c8| % K: clef=treble !8(!!riten!EF !-!G2 !ped!GA!ped-end!B!8)!c|!8b(!!bigb!C2!()!E2 !tr(!G3!tr)!!8b)!c!alcoda!|\ CE!-(!G2!-)!C2c2| % "Dm"!Dm!e3/d/ d6 | "Bb"!Bb!z2 d/d3/ "C7"!C7!cB/A/- AG |\ F!accent!G!accn!AB !sfa!c4|| X:3 T:Decorations with abcm2ps 4.x.x M:C L:1/4 %%staves {1 2} K:C V:1 !arpu![!op!C!op!Gc]4 !hbar![] !breath!!opbrth!!arpd![CGc]4 |\ !arps![CGc]4 | z3/[!head-x!B]/ [c!m!eg]2 | c4 || V:2 !arpeggio![C,,G,,C,]4 [] [C,,G,,C,]4 |\ !arpe![C,,G,,C,]4 | [C,,!head-shd!C,][G,,!head-shd!G,]C,2 | C,4 || ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/draw.c��������������������������������������������������������������������������������0000644�0001750�0001750�00000330033�12416422200�012254� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Drawing functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2014 Jean-François Moine * Adapted from abc2ps, Copyright (C) 1996,1997 Michael Methfessel * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include #include #include "abc2ps.h" struct BEAM { /* packages info on one beam */ struct SYMBOL *s1, *s2; float a, b; short nflags; }; static char *acc_tb[] = { "", "sh", "nt", "ft", "dsh", "dft" }; /* scaling stuff */ static int scale_voice; /* staff (0) or voice(1) scaling */ static float cur_scale = 1; /* voice or staff scale */ static float cur_trans = 0; /* != 0 when scaled staff */ static float cur_staff = 1; /* current scaled staff */ static void draw_note(float x, struct SYMBOL *s, int fl); static void set_tie_room(void); /* output debug annotations */ static void anno_out(struct SYMBOL *s, char type) { if (s->as.linenum == 0) return; if (mbf[-1] != '\n') *mbf++ = '\n'; a2b("%%A %c %d %d ", type, s->as.linenum, s->as.colnum); putxy(s->x - s->wl - 2, staff_tb[s->staff].y + s->ymn - 2); if (type != 'b' && type != 'e') /* if not beam */ a2b("%.1f %d", s->wl + s->wr + 4, s->ymx - s->ymn + 4); a2b("\n"); } /* -- up/down shift needed to get k*6 -- */ static float rnd6(float y) { int iy; iy = ((int) (y + 2.999) + 12) / 6 * 6 - 12; return iy - y; } /* -- compute the best vertical offset for the beams -- */ static float b_pos(int grace, int stem, int flags, float b) { float d1, d2, shift, depth; float top, bot; shift = !grace ? BEAM_SHIFT : 3; depth = !grace ? BEAM_DEPTH : 1.7; if (stem > 0) { bot = b - (flags - 1) * shift - depth; if (bot > 26) return 0; top = b; } else { top = b + (flags - 1) * shift + depth; if (top < -2) return 0; bot = b; } d1 = rnd6(top - BEAM_OFFSET); d2 = rnd6(bot + BEAM_OFFSET); if (d1 * d1 > d2 * d2) return d2; return d1; } /* duplicate a note for beaming continuation */ static struct SYMBOL *sym_dup(struct SYMBOL *s_orig) { struct SYMBOL *s; s = (struct SYMBOL *) getarena(sizeof *s); memcpy(s, s_orig, sizeof *s); s->as.flags |= ABC_F_INVIS; s->as.text = NULL; memset(s->as.u.note.sl1, 0, sizeof s->as.u.note.sl1); memset(s->as.u.note.decs, 0, sizeof s->as.u.note.decs); memset(&s->as.u.note.dc, 0, sizeof s->as.u.note.dc); s->gch = NULL; s->ly = NULL; return s; } /* -- calculate a beam -- */ /* (the staves may be defined or not) */ static int calculate_beam(struct BEAM *bm, struct SYMBOL *s1) { struct SYMBOL *s, *s2; int notes, nflags, staff, voice, two_staves, two_dir; float x, y, ys, a, b, max_stem_err; float sx, sy, sxx, sxy, syy, a0, stem_xoff, scale; static float min_tb[2][6] = { {STEM_MIN, STEM_MIN, STEM_MIN2, STEM_MIN3, STEM_MIN4, STEM_MIN4}, {STEM_CH_MIN, STEM_CH_MIN, STEM_CH_MIN2, STEM_CH_MIN3, STEM_CH_MIN4, STEM_CH_MIN4} }; /* must have one printed note head */ if (s1->as.flags & ABC_F_INVIS) { if (!s1->next || (s1->next->as.flags & ABC_F_INVIS)) return 0; } if (!(s1->sflags & S_BEAM_ST)) { /* beam from previous music line */ s = sym_dup(s1); s1->prev->next = s; s->prev = s1->prev; s1->prev = s; s->next = s1; s1->ts_prev->ts_next = s; s->ts_prev = s1->ts_prev; s1->ts_prev = s; s->ts_next = s1; s->x -= 12; if (s->x > s1->prev->x + 12) s->x = s1->prev->x + 12; s->sflags &= S_SEQST; s->sflags |= S_BEAM_ST | S_TEMP; s->as.u.note.slur_st = 0; s->as.u.note.slur_end = 0; s1 = s; } /* search last note in beam */ notes = nflags = 0; /* set x positions, count notes and flags */ two_staves = two_dir = 0; staff = s1->staff; voice = s1->voice; stem_xoff = (s1->as.flags & ABC_F_GRACE) ? GSTEM_XOFF : STEM_XOFF; for (s2 = s1; ; s2 = s2->next) { if (s2->as.type == ABC_T_NOTE) { if (s2->nflags > nflags) nflags = s2->nflags; notes++; if (s2->staff != staff) two_staves = 1; if (s2->stem != s1->stem) two_dir = 1; if (s2->sflags & S_BEAM_END) break; } if (!s2->next) { /* beam towards next music line */ for (; ; s2 = s2->prev) { if (s2->as.type == ABC_T_NOTE) break; } s = sym_dup(s2); s->next = s2->next; if (s->next) s->next->prev = s; s2->next = s; s->prev = s2; s->ts_next = s2->ts_next; if (s->ts_next) s->ts_next->ts_prev = s; s2->ts_next = s; s->ts_prev = s2; s->sflags &= S_SEQST; s->sflags |= S_BEAM_END | S_TEMP; s->as.u.note.slur_st = 0; s->as.u.note.slur_end = 0; s->x += 12; if (s->x < realwidth - 12) s->x = realwidth - 12; s2 = s; notes++; break; } } bm->s2 = s2; /* (don't display the flags) */ if (staff_tb[staff].y == 0) { /* staves not defined */ if (two_staves) return 0; } else { /* staves defined */ if (!two_staves && !(s1->as.flags & ABC_F_GRACE)) { bm->s1 = s1; /* beam already calculated */ bm->a = (s1->ys- s2->ys) / (s1->xs - s2->xs); bm->b = s1->ys - s1->xs * bm->a + staff_tb[staff].y; bm->nflags = nflags; return 1; } } sx = sy = sxx = sxy = syy = 0; /* linear fit through stem ends */ for (s = s1; ; s = s->next) { if (s->as.type != ABC_T_NOTE) continue; if ((scale = voice_tb[s->voice].scale) == 1) scale = staff_tb[s->staff].clef.staffscale; if (s->stem >= 0) x = stem_xoff + s->shhd[0]; else x = -stem_xoff + s->shhd[s->nhd]; x *= scale; x += s->x; s->xs = x; y = s->ys + staff_tb[s->staff].y; sx += x; sy += y; sxx += x * x; sxy += x * y; syy += y * y; if (s == s2) break; } /* beam fct: y=ax+b */ a = (sxy * notes - sx * sy) / (sxx * notes - sx * sx); b = (sy - a * sx) / notes; /* the next few lines modify the slope of the beam */ if (!(s1->as.flags & ABC_F_GRACE)) { if (notes >= 3) { float hh; hh = syy - a * sxy - b * sy; /* flatten if notes not in line */ if (hh > 0 && hh / (notes - 2) > .5) a *= BEAM_FLATFAC; } if (a >= 0) a = BEAM_SLOPE * a / (BEAM_SLOPE + a); /* max steepness for beam */ else a = BEAM_SLOPE * a / (BEAM_SLOPE - a); } else { if (a > BEAM_SLOPE) a = BEAM_SLOPE; else if (a < -BEAM_SLOPE) a = -BEAM_SLOPE; } /* to decide if to draw flat etc. use normalized slope a0 */ a0 = a * (s2->xs - s1->xs) / (20 * (notes - 1)); if (a0 * a0 < BEAM_THRESH * BEAM_THRESH) a = 0; /* flat below threshhold */ b = (sy - a * sx) / notes; /* recalculate b for new slope */ /* if (nflags>1) b=b+2*stem;*/ /* leave a bit more room if several beams */ /* have flat beams when asked */ if (cfmt.flatbeams) { if (!(s1->as.flags & ABC_F_GRACE)) b = -11 + staff_tb[staff].y; else b = 35 + staff_tb[staff].y; a = 0; } /*fixme: have a look again*/ /* have room for the symbols in the staff */ max_stem_err = 0; /* check stem lengths */ s = s1; if (two_dir) { /* 2 directions */ /*fixme: more to do*/ if (!(s1->as.flags & ABC_F_GRACE)) ys = BEAM_SHIFT; else ys = 3; ys *= (nflags - 1); ys += BEAM_DEPTH; ys *= .5; if (s1->stem != s2->stem && s1->nflags < s2->nflags) ys *= s2->stem; else ys *= s1->stem; b += ys; } else if (!(s1->as.flags & ABC_F_GRACE)) { /* normal notes */ float stem_err, beam_h; beam_h = BEAM_DEPTH + BEAM_SHIFT * (nflags - 1); while (s->ts_prev->as.type == ABC_T_NOTE && s->ts_prev->time == s->time && s->ts_prev->x > s1->xs) s = s->ts_prev; for (; s && s->time <= s2->time; s = s->ts_next) { if (s->as.type != ABC_T_NOTE || (s->as.flags & ABC_F_INVIS) || (s->staff != staff && s->voice != voice)) { continue; } x = s->voice == voice ? s->xs : s->x; ys = a * x + b - staff_tb[s->staff].y; if (s->voice == voice) { if (s->nhd == 0) stem_err = min_tb[0][(unsigned) s->nflags]; else stem_err = min_tb[1][(unsigned) s->nflags]; if (s->stem > 0) { if (s->pits[s->nhd] > 26) { stem_err -= 2; if (s->pits[s->nhd] > 28) stem_err -= 2; } stem_err -= ys - (float) (3 * (s->pits[s->nhd] - 18)); } else { if (s->pits[0] < 18) { stem_err -= 2; if (s->pits[0] < 16) stem_err -= 2; } stem_err -= (float) (3 * (s->pits[0] - 18)) - ys; } stem_err += BEAM_DEPTH + BEAM_SHIFT * (s->nflags - 1); } else { /*fixme: KO when two_staves*/ if (s1->stem > 0) { if (s->stem > 0) { /*fixme: KO when the voice numbers are inverted*/ if (s->ymn > ys + 4 || s->ymx < ys - beam_h - 2) continue; if (s->voice > voice) stem_err = s->ymx - ys; else stem_err = s->ymn + 8 - ys; } else { stem_err = s->ymx - ys; } } else { if (s->stem < 0) { if (s->ymx < ys - 4 || s->ymn > ys - beam_h - 2) continue; if (s->voice < voice) stem_err = ys - s->ymn; else stem_err = ys - s->ymx + 8; } else { stem_err = ys - s->ymn; } } stem_err += 2 + beam_h; } if (stem_err > max_stem_err) max_stem_err = stem_err; } } else { /* grace notes */ for ( ; ; s = s->next) { float stem_err; ys = a * s->xs + b - staff_tb[s->staff].y; stem_err = GSTEM - 2; if (s->stem > 0) stem_err -= ys - (float) (3 * (s->pits[s->nhd] - 18)); else stem_err += ys - (float) (3 * (s->pits[0] - 18)); stem_err += 3 * (s->nflags - 1); if (stem_err > max_stem_err) max_stem_err = stem_err; if (s == s2) break; } } if (max_stem_err > 0) /* shift beam if stems too short */ b += s1->stem * max_stem_err; /* have room for the gracenotes, bars and clefs */ /*fixme: test*/ if (!two_staves && !two_dir) for (s = s1->next; ; s = s->next) { struct SYMBOL *g; switch (s->type) { case NOTEREST: /* cannot move rests in multi-voices */ if (s->as.type != ABC_T_REST) break; g = s->ts_next; if (!g || g->staff != staff || g->type != NOTEREST) break; //fixme:too much vertical shift if some space above the note //fixme:this does not fix rest under beam in second voice (ts_prev) /*fall thru*/ case BAR: #if 1 if (s->as.flags & ABC_F_INVIS) #else //?? if (!(s->as.flags & ABC_F_INVIS)) #endif break; /*fall thru*/ case CLEF: y = a * s->x + b; if (s1->stem > 0) { y = s->ymx - y + BEAM_DEPTH + BEAM_SHIFT * (nflags - 1) + 2; if (y > 0) b += y; } else { y = s->ymn - y - BEAM_DEPTH - BEAM_SHIFT * (nflags - 1) - 2; if (y < 0) b += y; } break; case GRACE: g = s->extra; for ( ; g; g = g->next) { if (g->type != NOTEREST) continue; y = a * g->x + b; if (s1->stem > 0) { y = g->ymx - y + BEAM_DEPTH + BEAM_SHIFT * (nflags - 1) + 2; if (y > 0) b += y; } else { y = g->ymn - y - BEAM_DEPTH - BEAM_SHIFT * (nflags - 1) - 2; if (y < 0) b += y; } } break; } if (s == s2) break; } if (a == 0) /* shift flat beams onto staff lines */ b += b_pos(s1->as.flags & ABC_F_GRACE, s1->stem, nflags, b - staff_tb[staff].y); /* adjust final stems and rests under beam */ for (s = s1; ; s = s->next) { float dy; switch (s->as.type) { case ABC_T_NOTE: s->ys = a * s->xs + b - staff_tb[s->staff].y; if (s->stem > 0) { s->ymx = s->ys + 2.5; //fixme: hack if (s->ts_prev && s->ts_prev->stem > 0 && s->ts_prev->staff == s->staff && s->ts_prev->ymn < s->ymx && s->ts_prev->x == s->x && s->shhd[0] == 0) { s->ts_prev->x -= 5; /* fix stem clash */ s->ts_prev->xs -= 5; } } else { s->ymn = s->ys - 2.5; } break; case ABC_T_REST: y = a * s->x + b - staff_tb[s->staff].y; dy = BEAM_DEPTH + BEAM_SHIFT * (nflags - 1) + (s->head != H_FULL ? 4 : 9); if (s1->stem > 0) { y -= dy; if (s1->multi == 0 && y > 12) y = 12; if (s->y <= y) break; } else { y += dy; if (s1->multi == 0 && y < 12) y = 12; if (s->y >= y) break; } if (s->head != H_FULL) { int iy; iy = ((int) y + 3 + 12) / 6 * 6 - 12; y = iy; } s->y = y; break; } if (s == s2) break; } /* save beam parameters */ if (staff_tb[staff].y == 0) /* if staves not defined */ return 0; bm->s1 = s1; bm->a = a; bm->b = b; bm->nflags = nflags; return 1; } /* -- draw a single beam -- */ /* (the staves are defined) */ static void draw_beam(float x1, float x2, float dy, float h, struct BEAM *bm, int n) /* beam number (1..n) */ { struct SYMBOL *s; float y1, dy2; s = bm->s1; if (n > s->nflags - s->u && (s->sflags & S_TREM2) && s->head != H_EMPTY) { if (s->head >= H_OVAL) { x1 = s->x + 6; x2 = bm->s2->x - 6; } else { x1 += 5; x2 -= 6; } } y1 = bm->a * x1 + bm->b - dy; x2 -= x1; dy2 = bm->a * x2; putf(h); putx(x2); putf(dy2); putxy(x1, y1); a2b("bm\n"); } /* -- draw the beams for one word -- */ /* (the staves are defined) */ static void draw_beams(struct BEAM *bm) { struct SYMBOL *s, *s1, *s2; int i, beam_dir; float shift, bshift, bstub, bh, da; s1 = bm->s1; /*fixme: KO if many staves with different scales*/ set_scale(s1); s2 = bm->s2; if (!(s1->as.flags & ABC_F_GRACE)) { bshift = BEAM_SHIFT; bstub = BEAM_STUB; shift = .34; /* (half width of the stem) */ bh = BEAM_DEPTH; } else { bshift = 3; bstub = 3.2; shift = .29; bh = 1.6; } /*fixme: quick hack for stubs at end of beam and different stem directions*/ beam_dir = s1->stem; if (s1->stem != s2->stem && s1->nflags < s2->nflags) beam_dir = s2->stem; if (beam_dir < 0) bh = -bh; if (cur_trans == 0 && cur_scale != 1) { bm->a /= cur_scale; bm->b = s1->ys - s1->xs * bm->a + staff_tb[s1->staff].y; bshift *= cur_scale; } /* make first beam over whole word and adjust the stem lengths */ draw_beam(s1->xs - shift, s2->xs + shift, 0., bh, bm, 1); da = 0; for (s = s1; ; s = s->next) { if (s->as.type == ABC_T_NOTE && s->stem != beam_dir) s->ys = bm->a * s->xs + bm->b - staff_tb[s->staff].y + bshift * (s->nflags - 1) * s->stem - bh; if (s == s2) break; } if (s1->sflags & S_FEATHERED_BEAM) { da = bshift / (s2->xs - s1->xs); if (s1->dur > s2->dur) { da = -da; bshift = da * s1->xs; } else { bshift = da * s2->xs; } da = da * beam_dir; } /* other beams with two or more flags */ shift = 0; for (i = 2; i <= bm->nflags; i++) { shift += bshift; if (da != 0) bm->a += da; for (s = s1; ; s = s->next) { struct SYMBOL *k1, *k2; float x1; if (s->as.type != ABC_T_NOTE || s->nflags < i) { if (s == s2) break; continue; } if ((s->sflags & S_TREM1) && i > s->nflags - s->u) { if (s->head >= H_OVAL) x1 = s->x; else x1 = s->xs; draw_beam(x1 - 5, x1 + 5, (shift + 2.5) * beam_dir, bh, bm, i); if (s == s2) break; continue; } k1 = s; for (;;) { if (s == s2) break; if ((s->next->type == NOTEREST && s->next->nflags < i) || (s->next->sflags & S_BEAM_BR1) || ((s->next->sflags & S_BEAM_BR2) && i > 2)) break; s = s->next; } k2 = s; while (k2->as.type != ABC_T_NOTE) k2 = k2->prev; x1 = k1->xs; if (k1 == k2) { if (k1 == s1) { x1 += bstub; } else if (k1 == s2) { x1 -= bstub; } else if ((k1->sflags & S_BEAM_BR1) || ((k1->sflags & S_BEAM_BR2) && i > 2)) { x1 += bstub; } else { struct SYMBOL *k; k = k1->next; while (k->as.type != ABC_T_NOTE) k = k->next; if ((k->sflags & S_BEAM_BR1) || ((k->sflags & S_BEAM_BR2) && i > 2)) { x1 -= bstub; } else { k1 = k1->prev; while (k1->as.type != ABC_T_NOTE) k1 = k1->prev; if (k1->nflags < k->nflags || (k1->nflags == k->nflags && k1->dots < k->dots)) x1 += bstub; else x1 -= bstub; } } } draw_beam(x1, k2->xs, #if 1 shift * beam_dir, #else shift * k1->stem, /*fixme: more complicated */ #endif bh, bm, i); if (s == s2) break; } } if (s1->sflags & S_TEMP) unlksym(s1); else if (s2->sflags & S_TEMP) unlksym(s2); } /* -- draw a system brace or bracket -- */ static void draw_sysbra(float x, int staff, int flag) { int i, end; float yt, yb; while (cursys->staff[staff].empty || staff_tb[staff].clef.stafflines == 0) { if (cursys->staff[staff].flags & flag) return; staff++; } i = end = staff; for (;;) { if (!cursys->staff[i].empty && staff_tb[i].clef.stafflines != 0) end = i; if (cursys->staff[i].flags & flag) break; i++; } yt = staff_tb[staff].y + staff_tb[staff].topbar * staff_tb[staff].clef.staffscale; yb = staff_tb[end].y + staff_tb[end].botbar * staff_tb[end].clef.staffscale; a2b("%.1f %.1f %.1f %s\n", yt - yb, x, yt, (flag & (CLOSE_BRACE | CLOSE_BRACE2)) ? "brace" : "bracket"); } /* -- draw the left side of the staves -- */ static void draw_lstaff(float x) { int i, j, l, nst; float yb; if (cfmt.alignbars) return; nst = cursys->nstaff; l = 0; for (i = 0; ; i++) { if (cursys->staff[i].flags & (OPEN_BRACE | OPEN_BRACKET)) l++; if (!cursys->staff[i].empty && staff_tb[i].clef.stafflines != 0) break; if (cursys->staff[i].flags & (CLOSE_BRACE | CLOSE_BRACKET)) l--; if (i == nst) break; } for (j = nst; j > i; j--) { if (!cursys->staff[j].empty && staff_tb[j].clef.stafflines != 0) break; } if (i == j && l == 0) return; set_sscale(-1); yb = staff_tb[j].y + staff_tb[j].botbar * staff_tb[j].clef.staffscale; a2b("%.1f %.1f %.1f bar\n", staff_tb[i].y + staff_tb[i].topbar * staff_tb[i].clef.staffscale - yb, x, yb); for (i = 0; i <= nst; i++) { if (cursys->staff[i].flags & OPEN_BRACE) draw_sysbra(x, i, CLOSE_BRACE); if (cursys->staff[i].flags & OPEN_BRACKET) draw_sysbra(x, i, CLOSE_BRACKET); if (cursys->staff[i].flags & OPEN_BRACE2) draw_sysbra(x - 6, i, CLOSE_BRACE2); if (cursys->staff[i].flags & OPEN_BRACKET2) draw_sysbra(x - 6, i, CLOSE_BRACKET2); } } /* -- draw a staff -- */ static void draw_staff(int staff, float x1, float x2) { int nlines; float y; /* draw the staff */ set_sscale(staff); y = staff_tb[staff].y; nlines = cursys->staff[staff].clef.stafflines; switch (nlines) { case 0: return; case 1: y += 12; break; case 2: case 3: y += 6; break; } putx(x2 - x1); a2b("%d ", nlines); putxy(x1, y); a2b("staff\n"); } /* -- draw the time signature -- */ static void draw_timesig(float x, struct SYMBOL *s) { unsigned i, staff, l, l2; char *f, meter[64]; float dx; if (s->as.u.meter.nmeter == 0) return; staff = s->staff; x -= s->wl; for (i = 0; i < s->as.u.meter.nmeter; i++) { l = strlen(s->as.u.meter.meter[i].top); if (l > sizeof s->as.u.meter.meter[i].top) l = sizeof s->as.u.meter.meter[i].top; if (s->as.u.meter.meter[i].bot[0] != '\0') { sprintf(meter, "(%.8s)(%.2s)", s->as.u.meter.meter[i].top, s->as.u.meter.meter[i].bot); f = "tsig"; l2 = strlen(s->as.u.meter.meter[i].bot); if (l2 > sizeof s->as.u.meter.meter[i].bot) l2 = sizeof s->as.u.meter.meter[i].bot; if (l2 > l) l = l2; } else switch (s->as.u.meter.meter[i].top[0]) { case 'C': if (s->as.u.meter.meter[i].top[1] != '|') { f = "csig"; } else { f = "ctsig"; l--; } meter[0] = '\0'; break; case 'c': if (s->as.u.meter.meter[i].top[1] != '.') { f = "imsig"; } else { f = "iMsig"; l--; } meter[0] = '\0'; break; case 'o': if (s->as.u.meter.meter[i].top[1] != '.') { f = "pmsig"; } else { f = "pMsig"; l--; } meter[0] = '\0'; break; case '(': case ')': sprintf(meter, "(\\%s)", s->as.u.meter.meter[i].top); f = "stsig"; break; default: sprintf(meter, "(%.8s)", s->as.u.meter.meter[i].top); f = "stsig"; break; } if (meter[0] != '\0') a2b("%s ", meter); dx = (float) (13 * l); putxy(x + dx * .5, staff_tb[staff].y); a2b("%s\n", f); x += dx; } } /* -- draw an accidental -- */ static void draw_acc(int acc, int microscale) { int n, d; n = micro_tb[acc >> 3]; if (acc >> 3 != 0 && (cfmt.micronewps || microscale)) { if (microscale) { d = microscale; n = acc >> 3; } else { d = ((n & 0xff) + 1) * 2; n = (n >> 8) + 1; } a2b("%d %s%d ", n, acc_tb[acc & 0x07], d); } else { a2b("%s%d ", acc_tb[acc & 0x07], n); } } /* -- draw a key signature -- */ static void draw_keysig(struct VOICE_S *p_voice, float x, struct SYMBOL *s) { int old_sf = s->u; int staff = p_voice->staff; float staffb = staff_tb[staff].y; int i, clef_ix, shift; const signed char *p_seq; static const char sharp_cl[7] = {24, 9, 15, 21, 6, 12, 18}; static const char flat_cl[7] = {12, 18, 24, 9, 15, 21, 6}; static const signed char sharp1[6] = {-9, 12, -9, -9, 12, -9}; static const signed char sharp2[6] = {12, -9, 12, -9, 12, -9}; static const signed char flat1[6] = {9, -12, 9, -12, 9, -12}; static const signed char flat2[6] = {-12, 9, -12, 9, -12, 9}; clef_ix = s->pits[0]; if (clef_ix & 1) clef_ix += 7; clef_ix /= 2; while (clef_ix < 0) clef_ix += 7; clef_ix %= 7; /* normal accidentals */ if (s->as.u.key.nacc == 0 && !s->as.u.key.empty) { /* put neutrals if not 'accidental cancel' */ if (cfmt.cancelkey || s->as.u.key.sf == 0) { /* when flats to sharps, or sharps to flats, */ if (s->as.u.key.sf == 0 || old_sf * s->as.u.key.sf < 0) { /* old sharps */ shift = sharp_cl[clef_ix]; p_seq = shift > 9 ? sharp1 : sharp2; for (i = 0; i < old_sf; i++) { putxy(x, staffb + shift); a2b("nt0 "); shift += *p_seq++; x += 5.5; } /* old flats */ shift = flat_cl[clef_ix]; p_seq = shift < 18 ? flat1 : flat2; for (i = 0; i > old_sf; i--) { putxy(x, staffb + shift); a2b("nt0 "); shift += *p_seq++; x += 5.5; } if (s->as.u.key.sf != 0) x += 3; /* extra space */ /* or less sharps or flats */ } else if (s->as.u.key.sf > 0) { /* sharps */ if (s->as.u.key.sf < old_sf) { shift = sharp_cl[clef_ix]; p_seq = shift > 9 ? sharp1 : sharp2; for (i = 0; i < s->as.u.key.sf; i++) shift += *p_seq++; for (; i < old_sf; i++) { putxy(x, staffb + shift); a2b("nt0 "); shift += *p_seq++; x += 5.5; } x += 3; /* extra space */ } } else /*if (s->as.u.key.sf < 0)*/ { /* flats */ if (s->as.u.key.sf > old_sf) { shift = flat_cl[clef_ix]; p_seq = shift < 18 ? flat1 : flat2; for (i = 0; i > s->as.u.key.sf; i--) shift += *p_seq++; for (; i > old_sf; i--) { putxy(x, staffb + shift); a2b("nt0 "); shift += *p_seq++; x += 5.5; } x += 3; /* extra space */ } } } /* new sharps */ shift = sharp_cl[clef_ix]; p_seq = shift > 9 ? sharp1 : sharp2; for (i = 0; i < s->as.u.key.sf; i++) { putxy(x, staffb + shift); a2b("sh0 "); shift += *p_seq++; x += 5.5; } /* new flats */ shift = flat_cl[clef_ix]; p_seq = shift < 18 ? flat1 : flat2; for (i = 0; i > s->as.u.key.sf; i--) { putxy(x, staffb + shift); a2b("ft0 "); shift += *p_seq++; x += 5.5; } } else { int acc, last_acc, last_shift; /* explicit accidentals */ last_acc = s->as.u.key.accs[0]; last_shift = 100; for (i = 0; i < s->as.u.key.nacc; i++) { acc = s->as.u.key.accs[i]; if (acc != last_acc) { last_acc = acc; x += 3; } shift = s->pits[0] * 3 + 3 * (s->as.u.key.pits[i] - 18); while (shift < -3) shift += 21; while (shift > 24 + 3) shift -= 21; if (shift == last_shift + 21 || shift == last_shift - 21) x -= 5.5; /* octave */ last_shift = shift; putxy(x, staffb + shift); draw_acc(acc, s->as.u.key.microscale); x += 5.5; } } if (old_sf != 0 || s->as.u.key.sf != 0 || s->as.u.key.nacc >= 0) a2b("\n"); } /* -- convert the standard measure bars -- */ static int bar_cnv(int bar_type) { switch (bar_type) { case B_OBRA: /* case B_CBRA: */ case (B_OBRA << 4) + B_CBRA: return 0; /* invisible */ case B_COL: return B_BAR; /* dotted */ #if 0 case (B_CBRA << 4) + B_BAR: return B_BAR; #endif case (B_BAR << 4) + B_COL: bar_type |= (B_OBRA << 8); /* |: -> [|: */ break; case (B_BAR << 8) + (B_COL << 4) + B_COL: bar_type |= (B_OBRA << 12); /* |:: -> [|:: */ break; case (B_BAR << 12) + (B_COL << 8) + (B_COL << 4) + B_COL: bar_type |= (B_OBRA << 16); /* |::: -> [|::: */ break; case (B_COL << 4) + B_BAR: case (B_COL << 8) + (B_COL << 4) + B_BAR: case (B_COL << 12) + (B_COL << 8) + (B_COL << 4) + B_BAR: bar_type <<= 4; bar_type |= B_CBRA; /* :..| -> :..|] */ break; case (B_COL << 4) + B_COL: bar_type = cfmt.dblrepbar; /* :: -> dble repeat bar */ break; } return bar_type; } /* -- draw a measure bar -- */ static void draw_bar(struct SYMBOL *s, float bot, float h) { int staff, bar_type, dotted; float x, yb; char *psf; staff = s->staff; yb = staff_tb[staff].y; x = s->x; /* if measure repeat, draw the '%' like glyphs */ if (s->as.u.bar.len != 0) { struct SYMBOL *s2; set_scale(s); if (s->as.u.bar.len == 1) { for (s2 = s->prev; s2->as.type != ABC_T_REST; s2 = s2->prev) ; putxy(s2->x, yb); a2b("mrep\n"); } else { putxy(x, yb); a2b("mrep2\n"); if (s->voice == cursys->top_voice) { /*fixme set_font(s->gcf); */ set_font(cfmt.anf); putxy(x, yb + staff_tb[staff].topbar + 4); a2b("M(%d)showc\n", s->as.u.bar.len); } } } dotted = s->as.u.bar.dotted || s->as.u.bar.type == B_COL; bar_type = bar_cnv(s->as.u.bar.type); if (bar_type == 0) return; /* invisible */ for (;;) { psf = "bar"; switch (bar_type & 0x07) { case B_BAR: if (dotted) psf = "dotbar"; break; case B_OBRA: case B_CBRA: psf = "thbar"; x -= 3; break; case B_COL: x -= 2; break; } switch (bar_type & 0x07) { default: set_sscale(-1); a2b("%.1f %.1f %.1f %s ", h, x, bot, psf); break; case B_COL: set_sscale(staff); putxy(x + 1, staff_tb[staff].y); a2b("rdots "); break; } bar_type >>= 4; if (bar_type == 0) break; x -= 3; } a2b("\n"); } /* -- draw a rest -- */ /* (the staves are defined) */ static void draw_rest(struct SYMBOL *s) { int i, y; float x, dotx, staffb; static char *rest_tb[NFLAGS_SZ] = { "r128", "r64", "r32", "r16", "r8", "r4", "r2", "r1", "r0", "r00" }; /* if rest alone in the measure, center */ x = s->x + s->shhd[0] * cur_scale; if (s->dur == voice_tb[s->voice].meter.wmeasure) { struct SYMBOL *s2; /* don't use next/prev: there is no bar in voice averlay */ s2 = s->ts_next; while (s2 && s2->time != s->time + s->dur) s2 = s2->ts_next; if (s2) x = s2->x; else x = realwidth; s2 = s; while (!(s2->sflags & S_SEQST)) s2 = s2->ts_prev; s2 = s2->ts_prev; x = (x + s2->x) * .5; /* center the associated decorations */ if (s->as.u.note.dc.n > 0) deco_update(s, x - s->x); s->x = x; } if ((s->as.flags & ABC_F_INVIS) && !(s->sflags & S_OTHER_HEAD)) return; staffb = staff_tb[s->staff].y; /* bottom of staff */ if (s->sflags & S_REPEAT) { putxy(x, staffb); if (s->doty < 0) { a2b("srep\n"); } else { a2b("mrep\n"); if (s->doty > 2 && s->voice == cursys->top_voice) { /*fixme set_font(s->gcf); */ set_font(cfmt.anf); putxy(x, staffb + 24 + 4); a2b("M(%d)showc\n", s->doty); } } return; } y = s->y; if (s->sflags & S_OTHER_HEAD) { draw_all_deco_head(s, x, y + staffb); return; } i = C_XFLAGS - s->nflags; /* rest_tb index */ if (i == 7 && y == 12 && staff_tb[s->staff].clef.stafflines <= 2) y -= 6; /* semibreve a bit lower */ putxy(x, y + staffb); /* rest */ a2b("%s ", rest_tb[i]); /* output ledger line(s) when greater than minim */ if (i >= 6) { int yb, yt; switch (staff_tb[s->staff].clef.stafflines) { case 0: yb = 12; yt = 12; break; case 1: yb = 6; yt = 18; break; case 2: yb = 0; yt = 18; break; case 3: yb = 0; yt = 24; break; default: yb = -6; yt = staff_tb[s->staff].clef.stafflines * 6; break; } switch (i) { case 6: /* minim */ if (y <= yb || y >= yt) { putxy(x, y + staffb); a2b("hl "); } break; case 7: /* semibreve */ if (y < yb || y >= yt - 6) { putxy(x, y + 6 + staffb); a2b("hl "); } break; default: if (y < yb || y >= yt - 6) { putxy(x,y + 6 + staffb); a2b("hl "); } if (i == 9) /* longa */ y -= 6; if (y <= yb || y >= yt) { putxy(x, y + staffb); a2b("hl "); } break; } } dotx = 8; for (i = 0; i < s->dots; i++) { a2b("%.1f 3 dt ", dotx); dotx += 3.5; } a2b("\n"); } /* -- draw grace notes -- */ /* (the staves are defined) */ static void draw_gracenotes(struct SYMBOL *s) { int yy; float x0, y0, x1, y1, x2, y2, x3, y3, bet1, bet2, dy1, dy2; struct SYMBOL *g, *last; struct BEAM bm; /* draw the notes */ bm.s2 = NULL; /* (draw flags) */ for (g = s->extra; g; g = g->next) { if (g->type != NOTEREST) continue; if ((g->sflags & (S_BEAM_ST | S_BEAM_END)) == S_BEAM_ST) { if (annotate) anno_out(g, 'b'); if (calculate_beam(&bm, g)) draw_beams(&bm); } draw_note(g->x, g, bm.s2 == NULL); if (annotate) anno_out(s, 'g'); if (g == bm.s2) bm.s2 = NULL; /* (draw flags again) */ if (g->as.flags & ABC_F_SAPPO) { /* (on 1st note only) */ if (!g->next) { /* if one note */ x1 = 9; y1 = g->stem > 0 ? 5 : -5; } else { /* many notes */ x1 = (g->next->x - g->x) * .5 + 4; y1 = (g->ys + g->next->ys) * .5 - g->y; if (g->stem > 0) y1 -= 1; else y1 += 1; } putxy(x1, y1); a2b("g%ca\n", g->stem > 0 ? 'u' : 'd'); } if (annotate && (g->sflags & (S_BEAM_ST | S_BEAM_END)) == S_BEAM_END) anno_out(g, 'e'); if (!g->next) break; /* (keep the last note) */ } /* slur */ if (voice_tb[s->voice].key.mode >= BAGPIPE /* no slur when bagpipe */ || !cfmt.graceslurs || s->as.u.note.slur_st /* explicit slur */ || !s->next || s->next->as.type != ABC_T_NOTE) return; last = g; if (last->stem >= 0) { yy = 127; for (g = s->extra; g; g = g->next) { if (g->type != NOTEREST) continue; if (g->y < yy) { yy = g->y; last = g; } } x0 = last->x; y0 = last->y - 5; if (s->extra != last) { x0 -= 4; y0 += 1; } s = s->next; x3 = s->x - 1; if (s->stem < 0) x3 -= 4; y3 = 3 * (s->pits[0] - 18) - 5; dy1 = (x3 - x0) * .4; if (dy1 > 3) dy1 = 3; dy2 = dy1; bet1 = .2; bet2 = .8; if (y0 > y3 + 7) { x0 = last->x - 1; y0 += .5; y3 += 6.5; x3 = s->x - 5.5; dy1 = (y0 - y3) * .8; dy2 = (y0 - y3) * .2; bet1 = 0; } else if (y3 > y0 + 4) { y3 = y0 + 4; x0 = last->x + 2; y0 = last->y - 4; } } else { yy = -127; for (g = s->extra; g; g = g->next) { if (g->type != NOTEREST) continue; if (g->y > yy) { yy = g->y; last = g; } } x0 = last->x; y0 = last->y + 5; if (s->extra != last) { x0 -= 4; y0 -= 1; } s = s->next; x3 = s->x - 1; if (s->stem >= 0) x3 -= 2; y3 = 3 * (s->pits[s->nhd] - 18) + 5; dy1 = (x0 - x3) * .4; if (dy1 < -3) dy1 = -3; dy2 = dy1; bet1 = .2; bet2 = .8; if (y0 < y3 - 7) { x0 = last->x - 1; y0 -= .5; y3 -= 6.5; x3 = s->x - 5.5; dy1 = (y0 - y3) * .8; dy2 = (y0 - y3) * .2; bet1 = 0; } else if (y3 < y0 - 4) { y3 = y0 - 4; x0 = last->x + 2; y0 = last->y + 4; } } x1 = bet1 * x3 + (1 - bet1) * x0; y1 = bet1 * y3 + (1 - bet1) * y0 - dy1; x2 = bet2 * x3 + (1 - bet2) * x0; y2 = bet2 * y3 + (1 - bet2) * y0 - dy2; a2b("%.2f %.2f %.2f %.2f %.2f %.2f ", x1 - x0, y1 - y0, x2 - x0, y2 - y0, x3 - x0, y3 - y0); putxy(x0, y0 + staff_tb[s->staff].y); a2b("gsl\n"); } /* -- set the y offset of the dots -- */ static void setdoty(struct SYMBOL *s, signed char *y_tb) { int m, m1, y, doty; /* set the normal offsets */ doty = s->doty; for (m = 0; m <= s->nhd; m++) { y = 3 * (s->pits[m] - 18); /* note height on staff */ if ((y % 6) == 0) { if (doty != 0) y -= 3; else y += 3; } y_tb[m] = y; } /* dispatch and recenter the dots in the staff spaces */ for (m = 0; m < s->nhd; m++) { if (y_tb[m + 1] > y_tb[m]) continue; m1 = m; while (m1 > 0) { if (y_tb[m1] > y_tb[m1 - 1] + 6) break; m1--; } if (3 * (s->pits[m1] - 18) - y_tb[m1] < y_tb[m + 1] - 3 * (s->pits[m + 1] - 18)) { while (m1 <= m) y_tb[m1++] -= 6; } else { y_tb[m + 1] = y_tb[m] + 6; } } } /* -- draw m-th head with accidentals and dots -- */ /* (the staves are defined) */ static void draw_basic_note(float x, struct SYMBOL *s, int m, signed char *y_tb) { int i, y, no_head, head, dots, nflags; float staffb, shhd; char *p; char perc_hd[8]; staffb = staff_tb[s->staff].y; /* bottom of staff */ y = 3 * (s->pits[m] - 18); /* note height on staff */ shhd = s->shhd[m] * cur_scale; /* draw the note decorations */ no_head = (s->sflags & S_OTHER_HEAD); if (no_head) draw_all_deco_head(s, x + shhd, y + staffb); if (s->as.u.note.decs[m] != 0) { int n; i = s->as.u.note.decs[m] >> 3; /* index */ n = i + (s->as.u.note.decs[m] & 0x07); /* # deco */ for ( ; i < n; i++) no_head |= draw_deco_head(s->as.u.note.dc.t[i], x + shhd, y + staffb, s->stem); } if (s->as.flags & ABC_F_INVIS) return; /* special case when no head */ if (s->nohdix >= 0) { if ((s->stem > 0 && m <= s->nohdix) || (s->stem < 0 && m >= s->nohdix)) { a2b("/x "); /* set x y */ putx(x + shhd); a2b("def/y "); puty(y + staffb); a2b("def"); return; } } identify_note(s, s->as.u.note.lens[m], &head, &dots, &nflags); /* output a ledger line if horizontal shift / chord * and note on a line */ if (y % 6 == 0 && shhd != (s->stem > 0 ? s->shhd[0] : s->shhd[s->nhd])) { int yy; yy = 0; if (y >= 30) { yy = y; if (yy % 6) yy -= 3; } else if (y <= -6) { yy = y; if (yy % 6) yy += 3; } if (yy) { putxy(x + shhd, yy + staffb); a2b("hl "); } } /* draw the head */ putxy(x + shhd, y + staffb); if (no_head) { p = "/y exch def/x exch def"; } else if (s->as.flags & ABC_F_GRACE) { p = "ghd"; } else if (s->type == CUSTOS) { p = "custos"; } else if ((s->sflags & S_PERC) && (i = s->as.u.note.accs[m]) != 0) { i &= 0x07; sprintf(perc_hd, "p%shd", acc_tb[i]); p = perc_hd; } else { switch (head) { case H_OVAL: if (s->as.u.note.lens[m] < BREVE) { p = "HD"; break; } if (s->head != H_SQUARE) { p = "HDD"; break; } /* fall thru */ case H_SQUARE: if (s->as.u.note.lens[m] < BREVE * 2) p = "breve"; else p = "longa"; /* don't display dots on last note of the tune */ if (!tsnext && s->next && s->next->type == BAR && !s->next->next) dots = 0; break; case H_EMPTY: p = "Hd"; break; default: p = "hd"; break; } } a2b("%s", p); /* draw the dots */ /*fixme: to see for grace notes*/ if (dots) { float dotx; int doty; dotx = (int) (8. + s->xmx); doty = y_tb[m] - y; while (--dots >= 0) { a2b(" %.1f %d dt", dotx - shhd, doty); dotx += 3.5; } } /* draw the accidental */ if ((i = s->as.u.note.accs[m]) != 0 && !(s->sflags & S_PERC)) { x -= s->shac[m] * cur_scale; a2b(" "); putx(x); if (s->as.flags & ABC_F_GRACE) a2b("gsc "); else a2b("y "); draw_acc(i, s->as.u.note.microscale); if (s->as.flags & ABC_F_GRACE) a2b(" grestore"); } } /* -- draw a note or a chord -- */ /* (the staves are defined) */ static void draw_note(float x, struct SYMBOL *s, int fl) { int i, m, ma, y; float staffb, slen, shhd; char c, *hltype; signed char y_tb[MAXHD]; if (s->dots) setdoty(s, y_tb); if (s->head >= H_OVAL) x += 1; staffb = staff_tb[s->staff].y; /* output the ledger lines */ if (!(s->as.flags & ABC_F_INVIS)) { if (s->as.flags & ABC_F_GRACE) { hltype = "ghl"; } else { switch (s->head) { default: hltype = "hl"; break; case H_OVAL: hltype = "hl1"; break; case H_SQUARE: hltype = "hl2"; break; } } shhd = (s->stem > 0 ? s->shhd[0] : s->shhd[s->nhd]) * cur_scale; y = 3 * (s->pits[0] - 18); /* lower ledger lines */ switch (staff_tb[s->staff].clef.stafflines) { case 0: case 1: i = 6; break; case 2: case 3: i = 0; break; default: i = -6; break; } for ( ; i >= y; i -= 6) { putxy(x + shhd, i + staffb); a2b("%s ", hltype); } y = 3 * (s->pits[s->nhd] - 18); /* upper ledger lines */ switch (staff_tb[s->staff].clef.stafflines) { case 0: case 1: case 2: i = 18; break; case 3: i = 24; break; default: i = staff_tb[s->staff].clef.stafflines * 6; break; } for ( ; i <= y; i += 6) { putxy(x + shhd, i + staffb); a2b("%s ", hltype); } } /* draw the master note, first or last one */ if (cfmt.setdefl) set_defl(s->stem >= 0 ? DEF_STEMUP : 0); ma = s->stem >= 0 ? 0 : s->nhd; draw_basic_note(x, s, ma, y_tb); /* add stem and flags */ if (!(s->as.flags & (ABC_F_INVIS | ABC_F_STEMLESS))) { char c2; c = s->stem >= 0 ? 'u' : 'd'; slen = (s->ys - s->y) / voice_tb[s->voice].scale; if (!fl || s->nflags - s->u <= 0) { /* stem only */ c2 = (s->as.flags & ABC_F_GRACE) ? 'g' : 's'; if (s->nflags > 0) { /* (fix for PS low resolution) */ if (s->stem >= 0) slen -= 1; else slen += 1; } a2b(" %.1f %c%c", slen, c2, c); } else { /* stem and flags */ if (cfmt.straightflags) c = 's'; /* straight flag */ c2 = (s->as.flags & ABC_F_GRACE) ? 'g' : 'f'; a2b(" %d %.1f s%c%c", s->nflags - s->u, slen, c2, c); } } else if (s->sflags & S_XSTEM) { /* cross-staff stem */ struct SYMBOL *s2; s2 = s->ts_prev; if (s2->stem > 0) slen = s2->y - s->y; else slen = s2->ys - s->y; slen += staff_tb[s2->staff].y - staffb; /*fixme:KO when different scales*/ slen /= voice_tb[s->voice].scale; a2b(" %.1f su", slen); } /* draw the tremolo bars */ if (!(s->as.flags & ABC_F_INVIS) && fl && (s->sflags & S_TREM1)) { float x1; x1 = x; if (s->stem > 0) slen = 3 * (s->pits[s->nhd] - 18); else slen = 3 * (s->pits[0] - 18); if (s->head >= H_OVAL) { if (s->stem > 0) slen = slen + 5 + 5.4 * s->u; else slen = slen - 5 - 5.4; } else { x1 += ((s->as.flags & ABC_F_GRACE) ? GSTEM_XOFF : STEM_XOFF) * s->stem; if (s->stem > 0) slen = slen + 6 + 5.4 * s->u; else slen = slen - 6 - 5.4; } slen /= voice_tb[s->voice].scale; a2b(" %d ", s->u); putxy(x1, staffb + slen); a2b("trem"); } /* draw the other note heads */ for (m = 0; m <= s->nhd; m++) { if (m == ma) continue; a2b(" "); draw_basic_note(x, s, m, y_tb); } a2b("\n"); } /* -- find where to terminate/start a slur -- */ static struct SYMBOL *next_scut(struct SYMBOL *s) { struct SYMBOL *prev; prev = s; for (s = s->next; s; s = s->next) { if (s->type == BAR && ((s->sflags & S_RRBAR) || s->as.u.bar.type == B_THIN_THICK || s->as.u.bar.type == B_THICK_THIN || (s->as.u.bar.repeat_bar && s->as.text && s->as.text[0] != '1'))) return s; prev = s; } /*fixme: KO when no note for this voice at end of staff */ return prev; } static struct SYMBOL *prev_scut(struct SYMBOL *s) { struct SYMBOL *sym; int voice; float x; voice = s->voice; for (s = s->prev ; s; s = s->prev) { if (s->type == BAR && ((s->sflags & S_RRBAR) || s->as.u.bar.type == B_THIN_THICK || s->as.u.bar.type == B_THICK_THIN || (s->as.u.bar.repeat_bar && s->as.text && s->as.text[0] != '1'))) return s; } /* return sym before first note/rest/bar */ sym = voice_tb[voice].sym; for (s = sym->next; s; s = s->next) { switch (s->as.type) { case ABC_T_NOTE: case ABC_T_REST: case ABC_T_BAR: x = s->x; do { s = s->prev; } while (s->x == x); return s; } } return sym; } /* -- decide whether a slur goes up or down -- */ static int slur_direction(struct SYMBOL *k1, struct SYMBOL *k2) { struct SYMBOL *s; int some_upstem, low; some_upstem = low = 0; for (s = k1; ; s = s->next) { if (s->as.type == ABC_T_NOTE) { if (!(s->as.flags & ABC_F_STEMLESS)) { if (s->stem < 0) return 1; some_upstem = 1; } if (s->pits[0] < 22) /* if under middle staff */ low = 1; } if (s == k2) break; } if (!some_upstem && !low) return 1; return -1; } /* -- output a slur / tie -- */ static void slur_out(float x1, float y1, float x2, float y2, int s, float height, int dotted, int staff) /* if < 0, the staves are defined */ { float alfa, beta, mx, my, xx1, yy1, xx2, yy2, dx, dy, dz; float scale_y; alfa = .3; beta = .45; /* for wide flat slurs, make shape more square */ dy = y2 - y1; if (dy < 0) dy = -dy; dx = x2 - x1; if (dx > 40. && dy / dx < .7) { alfa = .3 + .002 * (dx - 40.); if (alfa > .7) alfa = .7; } /* alfa, beta, and height determine Bezier control points pp1,pp2 * * X====alfa===|===alfa=====X * / | \ * pp1 | pp2 * / height \ * beta | beta * / | \ * p1 m p2 * */ mx = .5 * (x1 + x2); my = .5 * (y1 + y2); xx1 = mx + alfa * (x1 - mx); yy1 = my + alfa * (y1 - my) + height; xx1 = x1 + beta * (xx1 - x1); yy1 = y1 + beta * (yy1 - y1); xx2 = mx + alfa * (x2 - mx); yy2 = my + alfa * (y2 - my) + height; xx2 = x2 + beta * (xx2 - x2); yy2 = y2 + beta * (yy2 - y2); dx = .03 * (x2 - x1); // if (dx > 10.) // dx = 10.; // dy = 1.6 * s; dy = 2 * s; dz = .2 + .001 * (x2 - x1); if (dz > .6) dz = .6; dz *= s; scale_y = scale_voice ? cur_scale : 1; if (!dotted) a2b("%.2f %.2f %.2f %.2f %.2f %.2f 0 %.2f ", (xx2 - dx - x2) / cur_scale, (yy2 + dy - y2 - dz) / scale_y, (xx1 + dx - x2) / cur_scale, (yy1 + dy - y2 - dz) / scale_y, (x1 - x2) / cur_scale, (y1 - y2 - dz) / scale_y, dz); a2b("%.2f %.2f %.2f %.2f %.2f %.2f ", (xx1 - x1) / cur_scale, (yy1 - y1) / scale_y, (xx2 - x1) / cur_scale, (yy2 - y1) / scale_y, (x2 - x1) / cur_scale, (y2 - y1) / scale_y); putxy(x1, y1); if (staff >= 0) a2b("y%d ", staff); a2b(dotted ? "dSL\n" : "SL\n"); } /* -- check if slur sequence in a multi-voice staff -- */ static int slur_multi(struct SYMBOL *k1, struct SYMBOL *k2) { for (;;) { if (k1->multi != 0) /* if multi voice */ /*fixme: may change*/ return k1->multi; if (k1 == k2) break; k1 = k1->next; } return 0; } /* -- draw a phrasing slur between two symbols -- */ /* (the staves are not yet defined) */ /* (not a pretty routine, this) */ static int draw_slur(struct SYMBOL *k1, struct SYMBOL *k2, int m1, int m2, int slur_type) { struct SYMBOL *k; float x1, y1, x2, y2, height, addy; float a, y, z, h, dx, dy; int s, nn, upstaff, two_staves; /*fixme: if two staves, may have upper or lower slur*/ switch (slur_type & 0x03) { /* (ignore dot bit) */ case SL_ABOVE: s = 1; break; case SL_BELOW: s = -1; break; default: if ((s = slur_multi(k1, k2)) == 0) s = slur_direction(k1, k2); break; } nn = 1; upstaff = k1->staff; two_staves = 0; if (k1 != k2) for (k = k1->next; k; k = k->next) { if (k->type == NOTEREST) { nn++; if (k->staff != upstaff) { two_staves = 1; if (k->staff < upstaff) upstaff = k->staff; } } if (k == k2) break; } /*fixme: KO when two staves*/ if (two_staves) error(0, k1, "*** multi-staves slurs not treated yet"); /* fix endpoints */ x1 = k1->x + k1->xmx; /* take the max right side */ if (k1 != k2) { x2 = k2->x; } else { /* (the slur starts on last note of the line) */ for (k = k2->ts_next; k; k = k->ts_next) if (k->type == STAVES) break; if (!k) x2 = realwidth; else x2 = k->x; } y1 = (float) (s > 0 ? k1->ymx + 2 : k1->ymn - 2); y2 = (float) (s > 0 ? k2->ymx + 2 : k2->ymn - 2); if (k1->as.type == ABC_T_NOTE) { if (s > 0) { if (k1->stem > 0) { x1 += 5; if ((k1->sflags & S_BEAM_END) && k1->nflags >= -1 /* if with a stem */ //fixme: check if at end of tuplet && (!(k1->sflags & S_IN_TUPLET))) { // || k1->ys > y1 - 3)) { if (k1->nflags > 0) { x1 += 2; y1 = k1->ys - 3; } else { y1 = k1->ys - 6; } } else { y1 = k1->ys + 3; } } else { y1 = k1->y + 8; } } else { if (k1->stem < 0) { x1 -= 1; if ((k1->sflags & S_BEAM_END) && k1->nflags >= -1 && (!(k1->sflags & S_IN_TUPLET) || k1->ys < y1 + 3)) { if (k1->nflags > 0) { x1 += 2; y1 = k1->ys + 3; } else { y1 = k1->ys + 6; } } else { y1 = k1->ys - 3; } } else { y1 = k1->y - 8; } } } if (k2->as.type == ABC_T_NOTE) { if (s > 0) { if (k2->stem > 0) { x2 += 1; if ((k2->sflags & S_BEAM_ST) && k2->nflags >= -1 && (!(k2->sflags & S_IN_TUPLET))) // || k2->ys > y2 - 3)) y2 = k2->ys - 6; else y2 = k2->ys + 3; } else { y2 = k2->y + 8; } } else { if (k2->stem < 0) { x2 -= 5; if ((k2->sflags & S_BEAM_ST) && k2->nflags >= -1 && (!(k2->sflags & S_IN_TUPLET))) // || k2->ys < y2 + 3)) y2 = k2->ys + 6; else y2 = k2->ys - 3; } else { y2 = k2->y - 8; } } } if (k1->as.type != ABC_T_NOTE) { y1 = y2 + 1.2 * s; x1 = k1->x + k1->wr * .5; if (x1 > x2 - 12) x1 = x2 - 12; } if (k2->as.type != ABC_T_NOTE) { if (k1->as.type == ABC_T_NOTE) y2 = y1 + 1.2 * s; else y2 = y1; if (k1 != k2) x2 = k2->x - k2->wl * .3; } if (nn >= 3) { if (k1->next->type != BAR && k1->next->x < x1 + 48) { if (s > 0) { y = k1->next->ymx - 2; if (y1 < y) y1 = y; } else { y = k1->next->ymn + 2; if (y1 > y) y1 = y; } } if (k2->prev->type != BAR && k2->prev->x > x2 - 48) { if (s > 0) { y = k2->prev->ymx - 2; if (y2 < y) y2 = y; } else { y = k2->prev->ymn + 2; if (y2 > y) y2 = y; } } } #if 0 /* shift endpoints */ addx = .04 * (x2 - x1); if (addx > 3.0) addx = 3.0; addy = .01 * (x2 - x1); if (addy > 3.0) addy = 3.0; x1 += addx; x2 -= addx; /*fixme: to simplify*/ if (k1->staff == upstaff) y1 += s * addy; else y1 = -6; if (k2->staff == upstaff) y2 += s * addy; else y2 = -6; #endif a = (y2 - y1) / (x2 - x1); /* slur steepness */ if (a > SLUR_SLOPE || a < -SLUR_SLOPE) { if (a > SLUR_SLOPE) a = SLUR_SLOPE; else a = -SLUR_SLOPE; if (a * s > 0) y1 = y2 - a * (x2 - x1); else y2 = y1 + a * (x2 - x1); } /* for big vertical jump, shift endpoints */ y = y2 - y1; if (y > 8) y = 8; else if (y < -8) y = -8; z = y; if (z < 0) z = -z; dx = .5 * z; dy = .3 * y; if (y * s > 0) { x2 -= dx; y2 -= dy; } else { x1 += dx; y1 += dy; } /* special case for grace notes */ if (k1->as.flags & ABC_F_GRACE) x1 = k1->x - GSTEM_XOFF * .5; if (k2->as.flags & ABC_F_GRACE) x2 = k2->x + GSTEM_XOFF * 1.5; h = 0; a = (y2 - y1) / (x2 - x1); if (k1 != k2) { addy = y1 - a * x1; for (k = k1->next; k != k2 ; k = k->next) { if (k->staff != upstaff) continue; switch (k->type) { case NOTEREST: if (s > 0) { y = 3 * (k->pits[k->nhd] - 18) + 6; if (y < k->ymx) y = k->ymx; y -= a * k->x + addy; if (y > h) h = y; } else { y = 3 * (k->pits[0] - 18) - 6; if (y > k->ymn) y = k->ymn; y -= a * k->x + addy; if (y < h) h = y; } break; case GRACE: { struct SYMBOL *g; for (g = k->extra; g; g = g->next) { #if 1 if (s > 0) { y = 3 * (g->pits[g->nhd] - 18) + 6; if (y < g->ymx) y = g->ymx; y -= a * g->x + addy; if (y > h) h = y; } else { y = 3 * (g->pits[0] - 18) - 6; if (y > g->ymn) y = g->ymn; y -= a * g->x + addy; if (y < h) h = y; } #else y = g->y - a * k->x - addy; if (s > 0) { y += GSTEM + 2; if (y > h) h = y; } else { y -= 2; if (y < h) h = y; } #endif } break; } } } y1 += .45 * h; y2 += .45 * h; h *= .65; } if (nn > 3) height = (.08 * (x2 - x1) + 12) * s; else height = (.03 * (x2 - x1) + 8) * s; if (s > 0) { if (height < 3 * h) height = 3 * h; if (height > 40) height = 40; } else { if (height > 3 * h) height = 3 * h; if (height < -40) height = -40; } y = y2 - y1; if (y < 0) y = -y; if (s > 0) { if (height < .8 * y) height = .8 * y; } else { if (height > -.8 * y) height = -.8 * y; } height *= cfmt.slurheight; /*fixme: ugly!*/ if (m1 >= 0) y1 = (float) (3 * (k1->pits[m1] - 18) + 5 * s); if (m2 >= 0) y2 = (float) (3 * (k2->pits[m2] - 18) + 5 * s); slur_out(x1, y1, x2, y2, s, height, slur_type & SL_DOTTED, upstaff); /* have room for other symbols */ dx = x2 - x1; a = (y2 - y1) / dx; /*fixme: it seems to work with .4, but why?*/ addy = y1 - a * x1 + .4 * height; for (k = k1; k != k2; k = k->next) { if (k->staff != upstaff) continue; y = a * k->x + addy; if (k->ymx < y) k->ymx = y; else if (k->ymn > y) k->ymn = y; if (k->next == k2) { dx = x2; if (k2->sflags & S_SL1) dx -= 5; } else { dx = k->next->x; } if (k != k1) x1 = k->x; dx -= x1; y_set(upstaff, s > 0, x1, dx, y); } return (s > 0 ? SL_ABOVE : SL_BELOW) | (slur_type & SL_DOTTED); } /* -- draw the slurs between 2 symbols --*/ static void draw_slurs(struct SYMBOL *first, struct SYMBOL *last) { struct SYMBOL *s, *s1, *k, *gr1, *gr2; int i, m1, m2, gr1_out, slur_type, cont; gr1 = gr2 = NULL; s = first; for (;;) { if (!s || s == last) { if (!gr1 || !(s = gr1->next) || s == last) break; gr1 = NULL; } if (s->type == GRACE) { gr1 = s; s = s->extra; continue; } if ((s->type != NOTEREST && s->type != SPACE) || (s->as.u.note.slur_st == 0 && !(s->sflags & S_SL1))) { s = s->next; continue; } k = NULL; /* find matching slur end */ s1 = s->next; gr1_out = 0; for (;;) { if (!s1) { if (gr2) { s1 = gr2->next; gr2 = NULL; continue; } if (!gr1 || gr1_out) break; s1 = gr1->next; gr1_out = 1; continue; } if (s1->type == GRACE) { gr2 = s1; s1 = s1->extra; continue; } if (s1->type == BAR && ((s1->sflags & S_RRBAR) || s1->as.u.bar.type == B_THIN_THICK || s1->as.u.bar.type == B_THICK_THIN || (s1->as.u.bar.repeat_bar && s1->as.text && s1->as.text[0] != '1'))) { k = s1; break; } if (s1->type != NOTEREST && s1->type != SPACE) { s1 = s1->next; continue; } if (s1->as.u.note.slur_end || (s1->sflags & S_SL2)) { k = s1; break; } if (s1->as.u.note.slur_st || (s1->sflags & S_SL1)) { if (gr2) { /* if in grace note sequence */ for (k = s1; k->next; k = k->next) ; k->next = gr2->next; if (gr2->next) gr2->next->prev = k; // gr2->as.u.note.slur_st = SL_AUTO; k = NULL; } draw_slurs(s1, last); if (gr2 && gr2->next) { gr2->next->prev->next = NULL; gr2->next->prev = gr2; } } if (s1 == last) break; s1 = s1->next; } if (!s1) { k = next_scut(s); } else if (!k) { s = s1; if (s == last) break; continue; } /* if slur in grace note sequence, change the linkages */ if (gr1) { for (s1 = s; s1->next; s1 = s1->next) ; s1->next = gr1->next; if (gr1->next) gr1->next->prev = s1; gr1->as.u.note.slur_st = SL_AUTO; } if (gr2) { gr2->prev->next = gr2->extra; gr2->extra->prev = gr2->prev; gr2->as.u.note.slur_st = SL_AUTO; } if (s->as.u.note.slur_st) { slur_type = s->as.u.note.slur_st & 0x07; s->as.u.note.slur_st >>= 3; m1 = -1; } else { for (m1 = 0; m1 <= s->nhd; m1++) if (s->as.u.note.sl1[m1]) break; slur_type = s->as.u.note.sl1[m1] & 0x07; s->as.u.note.sl1[m1] >>= 3; if (s->as.u.note.sl1[m1] == 0) { for (i = m1 + 1; i <= s->nhd; i++) if (s->as.u.note.sl1[i]) break; if (i > s->nhd) s->sflags &= ~S_SL1; } } m2 = -1; cont = 0; if ((k->type == NOTEREST || k->type == SPACE) && (k->as.u.note.slur_end || (k->sflags & S_SL2))) { if (k->as.u.note.slur_end) { k->as.u.note.slur_end--; } else { for (m2 = 0; m2 <= k->nhd; m2++) if (k->as.u.note.sl2[m2]) break; k->as.u.note.sl2[m2]--; if (k->as.u.note.sl2[m2] == 0) { for (i = m2 + 1; i <= k->nhd; i++) if (k->as.u.note.sl2[i]) break; if (i > k->nhd) k->sflags &= ~S_SL2; } } } else { if (k->type != BAR || (!(k->sflags & S_RRBAR) && k->as.u.bar.type != B_THIN_THICK && k->as.u.bar.type != B_THICK_THIN && (!k->as.u.bar.repeat_bar || !k->as.text || k->as.text[0] == '1'))) cont = 1; } slur_type = draw_slur(s, k, m1, m2, slur_type); if (cont) { /*fixme: the slur types are inverted*/ voice_tb[k->voice].slur_st <<= 3; voice_tb[k->voice].slur_st += slur_type; } /* if slur in grace note sequence, restore the linkages */ if (gr1 && gr1->next) { gr1->next->prev->next = NULL; gr1->next->prev = gr1; } if (gr2) { gr2->prev->next = gr2; gr2->extra->prev = NULL; } if (s->as.u.note.slur_st || (s->sflags & S_SL1)) continue; if (s == last) break; s = s->next; } } /* -- draw a tuplet -- */ /* (the staves are not yet defined) */ /* See 'tuplets' in format.txt about the value of 'u' */ static struct SYMBOL *draw_tuplet(struct SYMBOL *t, /* tuplet in extra */ struct SYMBOL *s) /* main note */ { struct SYMBOL *s1, *s2, *sy, *next, *g; int r, upstaff, nb_only, some_slur; float x1, x2, y1, y2, xm, ym, a, s0, yy, yx, dy; next = s; if ((t->u & 0x0f00) == 0x100) /* if 'when' == never */ return next; /* treat the nested tuplets starting on this symbol */ for (g = t->next; g; g = g->next) { if (g->type == TUPLET) { sy = draw_tuplet(g, s); if (sy->time > next->time) next = sy; } } /* search the first and last notes/rests of the tuplet */ r = t->as.u.tuplet.r_plet; s1 = NULL; some_slur = 0; upstaff = s->staff; for (s2 = s; s2; s2 = s2->next) { if (s2 != s) { for (g = s2->extra; g; g = g->next) { if (g->type == TUPLET) { sy = draw_tuplet(g, s2); if (sy->time > next->time) next = sy; } } } if (s2->type != NOTEREST) { if (s2->type == GRACE) { for (g = s2->extra; g; g = g->next) { if (g->type != NOTEREST) continue; if (g->as.u.note.slur_st || (g->sflags & S_SL1)) some_slur = 1; } } continue; } if (s2->as.u.note.slur_st /* if slur start/end */ || s2->as.u.note.slur_end || (s2->sflags & (S_SL1 | S_SL2))) some_slur = 1; if (s2->staff < upstaff) upstaff = s2->staff; if (!s1) s1 = s2; if (--r <= 0) break; } if (!s2) return next; /* no solution... */ if (s2->time > next->time) next = s2; #if 0 /* draw the slurs when inside the tuplet */ if (some_slur) { draw_slurs(s1, s2); if (s1->as.u.note.slur_st || (s1->sflags & S_SL1)) return next; for (sy = s1->next; sy != s2; sy = sy->next) { if (sy->as.u.note.slur_st /* if slur start/end */ || sy->as.u.note.slur_end || (sy->sflags & (S_SL1 | S_SL2))) return next; /* don't draw now */ } if (s2->as.u.note.slur_end || (s2->sflags & S_SL2)) return next; } #endif if (s1 == s2) { /* tuplet with 1 note (!) */ nb_only = 1; } else if ((t->u & 0x0f0) == 0x10) { /* 'what' == slur */ nb_only = 1; draw_slur(s1, s2, -1, -1, s1->stem > 0 ? SL_ABOVE : SL_BELOW); } else { /* search if a bracket is needed */ if ((t->u & 0x0f00) == 0x200 /* if 'when' == always */ || s1->as.type != ABC_T_NOTE || s2->as.type != ABC_T_NOTE) { nb_only = 0; } else { nb_only = 1; for (sy = s1; ; sy = sy->next) { if (sy->type != NOTEREST) { if (sy->type == GRACE || sy->type == SPACE) continue; nb_only = 0; break; } if (sy == s2) break; if (sy->sflags & S_BEAM_END) { nb_only = 0; break; } } if (nb_only && !(s1->sflags & (S_BEAM_ST | S_BEAM_BR1 | S_BEAM_BR2))) { for (sy = s1->prev; sy; sy = sy->prev) { if (sy->type == NOTEREST) { if (sy->nflags >= s1->nflags) nb_only = 0; break; } } } if (nb_only && !(s2->sflags & S_BEAM_END)) { for (sy = s2->next; sy; sy = sy->next) { if (sy->type == NOTEREST) { if (!(sy->sflags & (S_BEAM_BR1 | S_BEAM_BR2)) && sy->nflags >= s2->nflags) nb_only = 0; break; } } } } } /* if number only, draw it */ if (nb_only) { float a, b; if ((t->u & 0x0f) == 1) /* if 'value' == none */ return next; xm = (s2->x + s1->x) * .5; if (s1 == s2) /* tuplet with 1 note */ a = 0; else a = (s2->ys - s1->ys) / (s2->x - s1->x); b = s1->ys - a * s1->x; yy = a * xm + b; if (s1->stem > 0) { ym = y_get(s1->staff, 1, xm - 3, 6); if (ym > yy) b += ym - yy; b += 4; } else { ym = y_get(s1->staff, 0, xm - 3, 6); if (ym < yy) b += ym - yy; b -= 12; } for (sy = s1; ; sy = sy->next) { if (sy->x >= xm) break; } if (s1->stem * s2->stem > 0) { if (s1->stem > 0) xm += GSTEM_XOFF; else xm -= GSTEM_XOFF; } ym = a * xm + b; if ((t->u & 0x0f) == 0) /* if 'value' == number */ a2b("(%d)", t->as.u.tuplet.p_plet); else a2b("(%d:%d)", t->as.u.tuplet.p_plet, t->as.u.tuplet.q_plet); putxy(xm, ym); a2b("y%d bnum\n", s1->staff); if (s1->stem > 0) { ym += 8; if (sy->ymx < ym) sy->ymx = (short) ym; y_set(s1->staff, 1, xm - 3, 6, ym); } else { if (sy->ymn > ym) sy->ymn = (short) ym; y_set(s1->staff, 0, xm - 3, 6, ym); } s->sflags &= ~S_IN_TUPLET; /* the tuplet is drawn */ return next; } #if 1 /* draw the slurs when inside the tuplet */ if (some_slur) { draw_slurs(s1, s2); if (s1->as.u.note.slur_st || (s1->sflags & S_SL1)) return next; for (sy = s1->next; sy != s2; sy = sy->next) { if (sy->as.u.note.slur_st /* if slur start/end */ || sy->as.u.note.slur_end || (sy->sflags & (S_SL1 | S_SL2))) return next; /* don't draw now */ } /* don't draw the tuplet when a slur ends on the last note */ if (s2->as.u.note.slur_end || (s2->sflags & S_SL2)) return next; } #endif if ((t->u & 0x0f0) != 0) /* if 'what' != square */ fprintf(stderr, "'what' value of %%%%tuplets not yet coded\n"); /*fixme: two staves not treated*/ /*fixme: to optimize*/ if (s1->multi >= 0) { /* sole or upper voice: the bracket is above the staff */ x1 = s1->x - 4; y1 = 24; if (s1->staff == upstaff) { sy = s1; if (sy->as.type != ABC_T_NOTE) { for (sy = sy->next; sy != s2; sy = sy->next) if (sy->as.type == ABC_T_NOTE) break; } ym = y_get(upstaff, 1, sy->x, 0); if (ym > y1) y1 = ym; if (s1->stem > 0) x1 += 3; } y2 = 24; if (s2->staff == upstaff) { sy = s2; if (sy->as.type != ABC_T_NOTE) { for (sy = sy->prev; sy != s1; sy = sy->prev) if (sy->as.type == ABC_T_NOTE) break; } ym = y_get(upstaff, 1, sy->x, 0); if (ym > y2) y2 = ym; } /* end the backet according to the last note duration */ #if 1 if (s2->dur > s2->prev->dur) { if (s2->next) x2 = s2->next->x - s2->next->wl - 5; else x2 = realwidth - 6; } else { x2 = s2->x + 4; r = s2->stem >= 0 ? 0 : s2->nhd; if (s2->shhd[r] > 0) x2 += s2->shhd[r]; if (s2->staff == upstaff && s2->stem > 0) x2 += 3.5; } #else if (s2->next) x2 += (s2->next->x - s2->next->wl - s2->x - s2->wr) * 0.5; else x2 += (realwidth - s2->x) * 0.5; #endif xm = .5 * (x1 + x2); ym = .5 * (y1 + y2); a = (y2 - y1) / (x2 - x1); s0 = 3 * (s2->pits[s2->nhd] - s1->pits[s1->nhd]) / (x2 - x1); if (s0 > 0) { if (a < 0) a = 0; else if (a > s0) a = s0; } else { if (a > 0) a = 0; else if (a < s0) a = s0; } if (a * a < .1 * .1) a = 0; /* shift up bracket if needed */ dy = 0; for (sy = s1; ; sy = sy->next) { if (sy->dur == 0 /* not a note or a rest */ || sy->staff != upstaff) { if (sy == s2) break; continue; } yy = ym + (sy->x - xm) * a; yx = y_get(upstaff, 1, sy->x, 0); if (yx - yy > dy) dy = yx - yy; if (sy == s2) break; } ym += dy + 4; y1 = ym + a * (x1 - xm); y2 = ym + a * (x2 - xm); putxy(x2 - x1, y2 - y1); putxy(x1, y1 + 4); a2b("y%d tubr", upstaff); /* shift the slurs / decorations */ ym += 8; for (sy = s1; ; sy = sy->next) { if (sy->staff == upstaff) { yy = ym + (sy->x - xm) * a; if (sy->ymx < yy) sy->ymx = yy; if (sy == s2) break; y_set(upstaff, 1, sy->x, sy->next->x - sy->x, yy); } else if (sy == s2) { break; } } } else { /* lower voice of the staff: the bracket is below the staff */ /*fixme: think to all that again..*/ x1 = s1->x - 7; #if 1 if (s2->dur > s2->prev->dur) { if (s2->next) x2 = s2->next->x - s2->next->wl - 8; else x2 = realwidth - 6; } else { x2 = s2->x + 2; if (s2->shhd[s2->nhd] > 0) x2 += s2->shhd[s2->nhd]; } #else if (s2->next) x2 += (s2->next->x - s2->next->wl - s2->x - s2->wr) * 0.5; else x2 += (realwidth - s2->x) * 0.5; #endif if (s1->staff == upstaff) { sy = s1; if (sy->as.type != ABC_T_NOTE) { for (sy = sy->next; sy != s2; sy = sy->next) if (sy->as.type == ABC_T_NOTE) break; } y1 = y_get(upstaff, 0, sy->x, 0); } else { y1 = 0; } if (s2->staff == upstaff) { sy = s2; if (sy->as.type != ABC_T_NOTE) { for (sy = sy->prev; sy != s1; sy = sy->prev) if (sy->as.type == ABC_T_NOTE) break; } y2 = y_get(upstaff, 0, sy->x, 0); } else { y2 = 0; } xm = .5 * (x1 + x2); ym = .5 * (y1 + y2); a = (y2 - y1) / (x2 - x1); s0 = 3 * (s2->pits[0] - s1->pits[0]) / (x2 - x1); if (s0 > 0) { if (a < 0) a = 0; else if (a > s0) a = s0; } else { if (a > 0) a = 0; else if (a < s0) a = s0; } if (a * a < .1 * .1) a = 0; /* shift down bracket if needed */ dy = 0; for (sy = s1; ; sy = sy->next) { if (sy->dur == 0 /* not a note nor a rest */ || sy->staff != upstaff) { if (sy == s2) break; continue; } yy = ym + (sy->x - xm) * a; yx = y_get(upstaff, 0, sy->x, 0); if (yx - yy < dy) dy = yx - yy; if (sy == s2) break; } ym += dy - 12; y1 = ym + a * (x1 - xm); y2 = ym + a * (x2 - xm); putxy(x2 - x1, y2 - y1); putxy(x1, y1 + 4); a2b("y%d tubrl",upstaff); /* shift the slurs / decorations */ ym -= 8; for (sy = s1; ; sy = sy->next) { if (sy->staff == upstaff) { if (sy == s2) break; yy = ym + (sy->x - xm) * a; if (sy->ymn > yy) sy->ymn = (short) yy; y_set(upstaff, 0, sy->x, sy->next->x - sy->x, yy); } if (sy == s2) break; } } /* lower voice */ if ((t->u & 0x0f) == 1) { /* if 'value' == none */ s->sflags &= ~S_IN_TUPLET; return next; } yy = .5 * (y1 + y2); if ((t->u & 0x0f) == 0) /* if 'value' == number */ a2b("(%d)", t->as.u.tuplet.p_plet); else a2b("(%d:%d)", t->as.u.tuplet.p_plet, t->as.u.tuplet.q_plet); putxy(xm, yy); a2b("y%d bnumb\n", upstaff); s->sflags &= ~S_IN_TUPLET; return next; } /* -- draw the ties between two notes/chords -- */ static void draw_note_ties(struct SYMBOL *k1, struct SYMBOL *k2, int ntie, int *mhead1, int *mhead2, int job) { int i, s, m1, m2, p, p1, p2, y, staff; float x1, x2, h, sh; for (i = 0; i < ntie; i++) { m1 = mhead1[i]; p1 = k1->pits[m1]; m2 = mhead2[i]; p2 = k2->pits[m2]; s = (k1->as.u.note.ti1[m1] & 0x03) == SL_ABOVE ? 1 : -1; x1 = k1->x; sh = k1->shhd[m1]; /* head shift */ if (s > 0) { if (m1 < k1->nhd && p1 + 1 == k1->pits[m1 + 1]) if (k1->shhd[m1 + 1] > sh) sh = k1->shhd[m1 + 1]; } else { if (m1 > 0 && p1 == k1->pits[m1 - 1] + 1) if (k1->shhd[m1 - 1] > sh) sh = k1->shhd[m1 - 1]; } // x1 += sh; x1 += sh * 0.6; x2 = k2->x; sh = k2->shhd[m2]; if (s > 0) { if (m2 < k2->nhd && p2 + 1 == k2->pits[m2 + 1]) if (k2->shhd[m2 + 1] < sh) sh = k2->shhd[m2 + 1]; } else { if (m2 > 0 && p2 == k2->pits[m2 - 1] + 1) if (k2->shhd[m2 - 1] < sh) sh = k2->shhd[m2 - 1]; } // x2 += sh; x2 += sh * 0.6; staff = k1->staff; switch (job) { case 0: if (p1 == p2 || (p1 & 1)) p = p1; else p = p2; break; case 1: /* no starting note */ case 3: /* clef or staff change */ x1 = k1->x; if (x1 > x2 - 20) x1 = x2 - 20; p = p2; staff = k2->staff; if (job == 3) s = -s; break; /* case 2: * no ending note */ default: if (k1 != k2) { x2 -= k2->wl; } else { struct SYMBOL *k; for (k = k2->ts_next; k; k = k->ts_next) if (k->type == STAVES) break; if (!k) x2 = realwidth; else x2 = k->x; } if (x2 < x1 + 16) x2 = x1 + 16; p = p1; break; } if (x2 - x1 > 20) { x1 += 3.5; x2 -= 3.5; } y = 3 * (p - 18); if (job != 1 && job != 3) { if (p & 1) y += 2 * s; if (s > 0) { // if (k1->nflags > -2 && k1->stem > 0 // && k1->nhd == 0) // x1 += 4.5; if (!(p & 1) && k1->dots > 0) y = 3 * (p - 18) + 6; } } // if (job != 2) { else { if (p & 1) y += 2 * s; // if (s < 0) { // if (k2->nflags > -2 && k2->stem < 0 // && k2->nhd == 0) // x2 -= 4.5; // } // if (job != 0) // y1 = y2; // } else { // if (k1 == k2) { /* if continuation on next line */ // k1->as.u.note.ti1[m1] &= SL_DOTTED; // k1->as.u.note.ti1[m1] += // s > 0 ? SL_ABOVE : SL_BELOW; // } } h = (.04 * (x2 - x1) + 10) * s; slur_out(x1, staff_tb[staff].y + y, x2, staff_tb[staff].y + y, s, h, k1->as.u.note.ti1[m1] & SL_DOTTED, -1); } } /* -- draw ties between neighboring notes/chords -- */ static void draw_ties(struct SYMBOL *k1, struct SYMBOL *k2, int job) /* 0: normal * 1: no starting note * 2: no ending note * 3: no start for clef or staff change */ { struct SYMBOL *k3; int i, m1, nh1, pit, ntie, tie2, ntie3, time; int mhead1[MAXHD], mhead2[MAXHD], mhead3[MAXHD]; /* special cases for ties to/from a grace note */ if (k1->type == GRACE) { k3 = k1->extra; while (k3) { if (k3->type == NOTEREST) k1 = k3; /* last grace note */ k3 = k3->next; } } if (k2->type == GRACE) { k3 = k2->extra; while (k3) { if (k3->type == NOTEREST) { k2 = k3; /* first grace note */ break; } k3 = k3->next; } } ntie = ntie3 = 0; nh1 = k1->nhd; time = k1->time + k1->dur; /* half ties from last note in line or before new repeat */ if (job == 2) { for (i = 0; i <= nh1; i++) { if (k1->as.u.note.ti1[i]) mhead3[ntie3++] = i; } draw_note_ties(k1, k2, ntie3, mhead3, mhead3, job); return; } /* set up list of ties to draw */ for (i = 0; i <= nh1; i++) { if (k1->as.u.note.ti1[i] == 0) continue; tie2 = -1; pit = k1->as.u.note.pits[i]; for (m1 = k2->nhd; m1 >= 0; m1--) { switch (k2->as.u.note.pits[m1] - pit) { case 1: /* maybe ^c - _d */ case -1: /* _d - ^c */ if (k1->as.u.note.accs[i] != k2->as.u.note.accs[m1]) tie2 = m1; break; case 0: mhead1[ntie] = i; mhead2[ntie++] = m1; goto found; } } if (tie2 >= 0) { /* second choice */ mhead1[ntie] = i; mhead2[ntie++] = tie2; } else { mhead3[ntie3++] = i; /* no match */ } found: ; } /* draw the ties */ draw_note_ties(k1, k2, ntie, mhead1, mhead2, job); /* if any bad tie, try an other voice of the same staff */ if (ntie3 == 0) return; /* no bad tie */ k3 = k1->ts_next; while (k3 && k3->time < time) k3 = k3->ts_next; while (k3 && k3->time == time) { if (k3->as.type != ABC_T_NOTE || k3->staff != k1->staff) { k3 = k3->ts_next; continue; } ntie = 0; for (i = ntie3; --i >= 0; ) { pit = k1->as.u.note.pits[mhead3[i]]; for (m1 = k3->nhd; m1 >= 0; m1--) { if (k3->as.u.note.pits[m1] == pit) { mhead1[ntie] = mhead3[i]; mhead2[ntie++] = m1; ntie3--; mhead3[i] = mhead3[ntie3]; break; } } } if (ntie > 0) { draw_note_ties(k1, k3, ntie, mhead1, mhead2, job == 1 ? 1 : 0); if (ntie3 == 0) return; } k3 = k3->ts_next; } if (ntie3 != 0) error(1, k1, "Bad tie"); } /* -- draw all ties between neighboring notes -- */ static void draw_all_ties(struct VOICE_S *p_voice) { struct SYMBOL *s1, *s2, *rtie; struct SYMBOL tie; int clef_chg; for (s1 = p_voice->sym->next; s1; s1 = s1->next) if (s1->type != KEYSIG && s1->type != TIMESIG) break; rtie = p_voice->rtie; /* tie from 1st repeat bar */ for (s2 = s1; s2; s2 = s2->next) { if (s2->as.type == ABC_T_NOTE || s2->type == GRACE) break; if (s2->type != BAR || !s2->as.u.bar.repeat_bar || !s2->as.text) continue; if (s2->as.text[0] == '1') /* 1st repeat bar */ rtie = p_voice->tie; else p_voice->tie = rtie; } if (!s2) return; if (p_voice->tie) { /* tie from previous line */ p_voice->tie->x = s1->x + s1->wr; s1 = p_voice->tie; p_voice->tie = NULL; s1->staff = s2->staff; s1->ts_next = tsfirst->next; /* (for tie to other voice) */ s1->time = s2->time - s1->dur; /* (if after repeat sequence) */ draw_ties(s1, s2, 1); /* tie to 1st note */ } /* search the start of ties */ clef_chg = 0; for (;;) { for (s1 = s2; s1; s1 = s1->next) { if (s1->sflags & S_TI1) break; if (!rtie) continue; if (s1->type != BAR || !s1->as.u.bar.repeat_bar || !s1->as.text) continue; if (s1->as.text[0] == '1') { /* 1st repeat bar */ rtie = NULL; continue; } for (s2 = s1->next; s2; s2 = s2->next) if (s2->as.type == ABC_T_NOTE) break; if (!s2) { s1 = NULL; break; } memcpy(&tie, rtie, sizeof tie); tie.x = s1->x + s1->wr; tie.next = s2; tie.staff = s2->staff; tie.time = s2->time - tie.dur; draw_ties(&tie, s2, 1); } if (!s1) break; /* search the end of the tie * and notice the clef changes (may occur in an other voice) */ for (s2 = s1->ts_next; s2; s2 = s2->ts_next) { if (s2->staff != s1->staff && s2->voice != s1->voice) continue; if (s2->type == CLEF) { clef_chg = 1; continue; } if (s2->voice != s1->voice) continue; if (s2->as.type == ABC_T_NOTE) { if (s2->time != s1->time + s1->dur) s2 = NULL; /* %%combinevoices */ break; } if (s2->type == GRACE) break; if (s2->type == BAR) { if ((s2->sflags & S_RRBAR) || s2->as.u.bar.type == B_THIN_THICK || s2->as.u.bar.type == B_THICK_THIN) break; if (!s2->as.u.bar.repeat_bar || !s2->as.text) continue; if (s2->as.text[0] != '1') break; rtie = s1; /* 1st repeat bar */ } } if (!s2) { struct SYMBOL *s3; /* special case: tie to a combined chord */ if (s1->ts_prev && s1->ts_prev->next) { int time; s3 = s1->ts_prev->next; /* previous voice */ time = s1->time + s1->dur; if (s3->time == time) { while (s3 && s3->time == time && s3->as.type != ABC_T_NOTE) s3 = s3->next; if (s3 && s3->time == time && s3->as.type == ABC_T_NOTE) { draw_ties(s1, s3, 1); break; } } } draw_ties(s1, s1, 2); p_voice->tie = s1; break; } /* ties with clef or staff change */ if (clef_chg || s1->staff != s2->staff) { float x, dx; clef_chg = 0; dx = (s2->x - s1->x) * 0.4; x = s2->x; s2->x -= dx; if (s2->x > s1->x + 32.) s2->x = s1->x + 32.; draw_ties(s1, s2, 2); s2->x = x; x = s1->x; s1->x += dx; if (s1->x < s2->x - 24.) s1->x = s2->x - 24.; draw_ties(s1, s2, 3); s1->x = x; continue; } draw_ties(s1, s2, s2->as.type == ABC_T_NOTE ? 0 : 2); } p_voice->rtie = rtie; } /* -- draw all phrasing slurs for one staff -- */ /* (the staves are not yet defined) */ static void draw_all_slurs(struct VOICE_S *p_voice) { struct SYMBOL *s, *k; int i, m2, slur_type; unsigned char slur_st; s = p_voice->sym->next; if (!s) return; slur_type = p_voice->slur_st; p_voice->slur_st = 0; /* the starting slur types are inverted */ slur_st = 0; while (slur_type != 0) { slur_st <<= 3; slur_st |= (slur_type & 0x07); slur_type >>= 3; } /* draw the slurs inside the music line */ draw_slurs(s, NULL); /* do unbalanced slurs still left over */ for ( ; s; s = s->next) { if (s->type != NOTEREST && s->type != SPACE) continue; while (s->as.u.note.slur_end || (s->sflags & S_SL2)) { if (s->as.u.note.slur_end) { s->as.u.note.slur_end--; m2 = -1; } else { for (m2 = 0; m2 <= s->nhd; m2++) if (s->as.u.note.sl2[m2]) break; s->as.u.note.sl2[m2]--; if (s->as.u.note.sl2[m2] == 0) { for (i = m2 + 1; i <= s->nhd; i++) if (s->as.u.note.sl2[i]) break; if (i > s->nhd) s->sflags &= ~S_SL2; } } slur_type = slur_st & 0x07; k = prev_scut(s); draw_slur(k, s, -1, m2, slur_type); if (k->type != BAR || (!(k->sflags & S_RRBAR) && k->as.u.bar.type != B_THIN_THICK && k->as.u.bar.type != B_THICK_THIN && (!k->as.u.bar.repeat_bar || !k->as.text || k->as.text[0] == '1'))) slur_st >>= 3; } } s = p_voice->sym->next; while (slur_st != 0) { slur_type = slur_st & 0x07; slur_st >>= 3; k = next_scut(s); draw_slur(s, k, -1, -1, slur_type); if (k->type != BAR || (!(k->sflags & S_RRBAR) && k->as.u.bar.type != B_THIN_THICK && k->as.u.bar.type != B_THICK_THIN && (!k->as.u.bar.repeat_bar || !k->as.text || k->as.text[0] == '1'))) { /*fixme: the slur types are inverted again*/ p_voice->slur_st <<= 3; p_voice->slur_st += slur_type; } } } /* -- work out accidentals to be applied to each note -- */ static void setmap(int sf, /* number of sharps/flats in key sig (-7 to +7) */ unsigned char *map) /* for 7 notes only */ { int j; for (j = 7; --j >= 0; ) map[j] = A_NULL; switch (sf) { case 7: map[6] = A_SH; case 6: map[2] = A_SH; case 5: map[5] = A_SH; case 4: map[1] = A_SH; case 3: map[4] = A_SH; case 2: map[0] = A_SH; case 1: map[3] = A_SH; break; case -7: map[3] = A_FT; case -6: map[0] = A_FT; case -5: map[4] = A_FT; case -4: map[1] = A_FT; case -3: map[5] = A_FT; case -2: map[2] = A_FT; case -1: map[6] = A_FT; break; } } /* output a tablature string escaping the parenthesis */ static void tbl_out(char *s, float x, int j, char *f) { char *p; a2b("("); p = s; for (;;) { while (*p != '\0' && *p != '(' && *p != ')' ) p++; if (p != s) { a2b("%.*s", (int) (p - s), s); s = p; } if (*p == '\0') break; a2b("\\"); p++; } a2b(")%.1f y %d %s ", x, j, f); } /* -- draw the tablature with w: -- */ static void draw_tblt_w(struct VOICE_S *p_voice, int nly, float y, struct tblt_s *tblt) { struct SYMBOL *s; struct lyrics *ly; struct lyl *lyl; char *p; int j, l; a2b("/y{%.1f y%d}def ", y, p_voice->staff); set_font(VOCALFONT); a2b("%.1f 0 y %d %s\n", realwidth, nly, tblt->head); for (j = 0; j < nly ; j++) { for (s = p_voice->sym->next; s; s = s->next) { ly = s->ly; if (!ly || (lyl = ly->lyl[j]) == NULL) { if (s->type == BAR) { if (!tblt->bar) continue; p = &tex_buf[16]; *p-- = '\0'; l = bar_cnv(s->as.u.bar.type); while (l != 0) { *p-- = "?|[]:???"[l & 0x07]; l >>= 4; } p++; tbl_out(p, s->x, j, tblt->bar); } continue; } tbl_out(lyl->t, s->x, j, tblt->note); } a2b("\n"); } } /* -- draw the tablature with automatic pitch -- */ static void draw_tblt_p(struct VOICE_S *p_voice, float y, struct tblt_s *tblt) { struct SYMBOL *s; int j, pitch, octave, sf, tied, acc; unsigned char workmap[70]; /* sharps/flats - base: lowest 'C' */ unsigned char basemap[7]; static int scale[7] = {0, 2, 4, 5, 7, 9, 11}; /* index = natural note */ static int acc_pitch[6] = {0, 1, 0, -1, 2, -2}; /* index = enum accidentals */ sf = p_voice->key.sf; setmap(sf, basemap); for (j = 0; j < 10; j++) memcpy(&workmap[7 * j], basemap, 7); a2b("gsave 0 %.1f y%d T(%.2s)%s\n", y, p_voice->staff, tblt->instr, tblt->head); tied = 0; for (s = p_voice->sym; s; s = s->next) { switch (s->type) { case NOTEREST: if (s->as.type == ABC_T_REST) continue; if (tied) { tied = s->as.u.note.ti1[0]; continue; } break; case KEYSIG: sf = s->as.u.key.sf; setmap(sf, basemap); for (j = 0; j < 10; j++) memcpy(&workmap[7 * j], basemap, 7); continue; case BAR: if (s->as.flags & ABC_F_INVIS) continue; for (j = 0; j < 10; j++) memcpy(&workmap[7 * j], basemap, 7); continue; default: continue; } pitch = s->as.u.note.pits[0] + 19; acc = s->as.u.note.accs[0]; if (acc != 0) { workmap[pitch] = acc == A_NT ? A_NULL : (acc & 0x07); } pitch = scale[pitch % 7] + acc_pitch[workmap[pitch]] + 12 * (pitch / 7) - tblt->pitch; octave = 0; while (pitch < 0) { pitch += 12; octave--; } while (pitch >= 36) { pitch -= 12; octave++; } if ((acc & 0xf8) == 0) { a2b("%d %d %.2f %s\n", octave, pitch, s->x, tblt->note); } else { int n, d; float micro_p; n = micro_tb[acc >> 3]; d = (n & 0xff) + 1; n = (n >> 8) + 1; switch (acc & 0x07) { case A_FT: case A_DF: n = -n; break; } micro_p = (float) pitch + (float) n / d; a2b("%d %.3f %.2f %s\n", octave, micro_p, s->x, tblt->note); } tied = s->as.u.note.ti1[0]; } a2b("grestore\n"); } /* -- draw the lyrics under (or above) notes -- */ /* !! this routine is tied to set_width() !! */ static float draw_lyrics(struct VOICE_S *p_voice, int nly, float y, int incr) /* 1: below, -1: above */ { int hyflag, l, j, lflag; char *p; float lastx, w, lskip, desc; struct SYMBOL *s; struct FONTSPEC *f; struct lyrics *ly; struct lyl *lyl; /* check if the lyrics contain tablatures */ if (p_voice->tblts[0]) { if (p_voice->tblts[0]->pitch == 0) return y; /* yes */ if (p_voice->tblts[1] && p_voice->tblts[1]->pitch == 0) return y; /* yes */ } outft = -1; /* force font output */ lskip = 0; /* (compiler warning) */ f = NULL; /* (force new font) */ if (incr > 0) { /* under the staff */ j = 0; /*fixme: may not be the current font*/ y -= cfmt.font_tb[VOCALFONT].size; if (y > -cfmt.vocalspace) y = -cfmt.vocalspace; } else { int top; top = staff_tb[p_voice->staff].topbar; j = nly - 1; nly = -1; if (y < top + cfmt.vocalspace - cfmt.font_tb[VOCALFONT].size) y = top + cfmt.vocalspace - cfmt.font_tb[VOCALFONT].size; } /*fixme: may not be the current font*/ desc = cfmt.font_tb[VOCALFONT].size * .25; /* descent */ for (; j != nly ; j += incr) { float x0, shift; a2b("/y{%.1f y%d}! ", y + desc, p_voice->staff); hyflag = lflag = 0; if (p_voice->hy_st & (1 << j)) { hyflag = 1; p_voice->hy_st &= ~(1 << j); } for (s = p_voice->sym; /*s*/; s = s->next) if (s->type != CLEF && s->type != KEYSIG && s->type != TIMESIG) break; if (s->prev) lastx = s->prev->x; else lastx = 0; x0 = 0; if (f != 0) lskip = f->size * 1.1; for ( ; s; s = s->next) { ly = s->ly; if (!ly || (lyl = ly->lyl[j]) == NULL) { switch (s->type) { case NOTEREST: if (s->as.type == ABC_T_NOTE) break; /* fall thru */ case MREST: if (lflag) { putx(x0 - lastx); putx(lastx + 3); a2b("y wln "); lflag = 0; lastx = s->x + s->wr; } } continue; } if (lyl->f != f) { /* font change */ f = lyl->f; str_font(f - cfmt.font_tb); if (lskip < f->size * 1.1) lskip = f->size * 1.1; } p = lyl->t; w = lyl->w; shift = lyl->s; if (hyflag) { if (*p == LY_UNDER) { /* '_' */ *p = LY_HYPH; } else if (*p != LY_HYPH) { /* not '-' */ putx(s->x - shift - lastx); putx(lastx); a2b("y hyph "); hyflag = 0; lastx = s->x + s->wr; } } if (lflag && *p != LY_UNDER) { /* not '_' */ putx(x0 - lastx + 3); putx(lastx + 3); a2b("y wln "); lflag = 0; lastx = s->x + s->wr; } if (*p == LY_HYPH /* '-' */ || *p == LY_UNDER) { /* '_' */ if (x0 == 0 && lastx > s->x - 18) lastx = s->x - 18; if (*p == LY_HYPH) hyflag = 1; else lflag = 1; x0 = s->x - shift; continue; } x0 = s->x - shift; l = strlen(p) - 1; if (p[l] == LY_HYPH) { /* '-' at end */ p[l] = '\0'; hyflag = 1; } putx(x0); a2b("y M "); put_str(p, A_LYRIC); lastx = x0 + w; } if (hyflag) { x0 = realwidth - 10; if (x0 < lastx + 10) x0 = lastx + 10; putx(x0 - lastx); putx(lastx); a2b("y hyph "); if (cfmt.hyphencont) p_voice->hy_st |= (1 << j); } /* see if any underscore in the next line */ for (s = tsnext; s; s = s->ts_next) if (s->voice == p_voice - voice_tb) break; for ( ; s; s = s->next) { if (s->as.type == ABC_T_NOTE) { if (s->ly && s->ly->lyl[j] != 0 && s->ly->lyl[j]->t[0] == LY_UNDER) { lflag = 1; x0 = realwidth - 15; if (x0 < lastx + 12) x0 = lastx + 12; } break; } } if (lflag) { putx(x0 - lastx + 3); putx(lastx + 3); a2b("y wln"); } a2b("\n"); if (incr > 0) y -= lskip; else y += lskip; } if (incr > 0) y += lskip; return y; } /* -- draw all the lyrics and the tablatures -- */ /* (the staves are not yet defined) */ static void draw_all_lyrics(void) { struct VOICE_S *p_voice; struct SYMBOL *s; int staff, voice, nly, i; struct { short a, b; float top, bot; } lyst_tb[MAXSTAFF]; char nly_tb[MAXVOICE]; char above_tb[MAXVOICE]; char rv_tb[MAXVOICE]; float top, bot, y; /* check if any lyric */ for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (p_voice->have_ly || p_voice->tblts[0]) break; } if (!p_voice) return; /* compute the number of lyrics per voice - staff * and their y offset on the staff */ memset(above_tb, 0, sizeof above_tb); memset(nly_tb, 0, sizeof nly_tb); memset(lyst_tb, 0, sizeof lyst_tb); staff = -1; top = bot = 0; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (!p_voice->sym) continue; voice = p_voice - voice_tb; if (p_voice->staff != staff) { top = 0; bot = 0; staff = p_voice->staff; } nly = 0; if (p_voice->have_ly) { for (s = p_voice->sym; s; s = s->next) { struct lyrics *ly; float x, w; ly = s->ly; if (!ly) continue; /*fixme:should get the real width*/ x = s->x; if (ly->lyl[0] != 0) { x -= ly->lyl[0]->s; w = ly->lyl[0]->w; } else { w = 10; } y = y_get(p_voice->staff, 1, x, w); if (top < y) top = y; y = y_get(p_voice->staff, 0, x, w); if (bot > y) bot = y; for (i = MAXLY; --i >= 0; ) if (ly->lyl[i] != 0) break; i++; if (i > nly) nly = i; } } else { y = y_get(p_voice->staff, 1, 0, realwidth); if (top < y) top = y; y = y_get(p_voice->staff, 0, 0, realwidth); if (bot > y) bot = y; } lyst_tb[staff].top = top; lyst_tb[staff].bot = bot; if (nly == 0) continue; nly_tb[voice] = nly; if (p_voice->posit.voc != 0) above_tb[voice] = p_voice->posit.voc == SL_ABOVE; else if (p_voice->next /*fixme:%%staves:KO - find an other way..*/ && p_voice->next->staff == staff && p_voice->next->have_ly) above_tb[voice] = 1; if (above_tb[voice]) lyst_tb[staff].a = 1; else lyst_tb[staff].b = 1; } /* draw the lyrics under the staves */ i = 0; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { struct tblt_s *tblt; if (!p_voice->sym) continue; if (!p_voice->have_ly && !p_voice->tblts[0]) continue; voice = p_voice - voice_tb; if (above_tb[voice]) { rv_tb[i++] = voice; continue; } staff = p_voice->staff; set_sscale(staff); if (nly_tb[voice] > 0) lyst_tb[staff].bot = draw_lyrics(p_voice, nly_tb[voice], lyst_tb[staff].bot, 1); for (nly = 0; nly < 2; nly++) { if ((tblt = p_voice->tblts[nly]) == NULL) break; if (tblt->hu > 0) { lyst_tb[staff].bot -= tblt->hu; lyst_tb[staff].b = 1; } if (tblt->pitch == 0) draw_tblt_w(p_voice, nly_tb[voice], lyst_tb[staff].bot, tblt); else draw_tblt_p(p_voice, lyst_tb[staff].bot, tblt); if (tblt->ha != 0) { lyst_tb[staff].top += tblt->ha; lyst_tb[staff].a = 1; } } } /* draw the lyrics above the staff */ while (--i >= 0) { voice = rv_tb[i]; p_voice = &voice_tb[voice]; staff = p_voice->staff; set_sscale(staff); lyst_tb[staff].top = draw_lyrics(p_voice, nly_tb[voice], lyst_tb[staff].top, -1); } /* set the max y offsets of all symbols */ for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (!p_voice->sym) continue; staff = p_voice->staff; set_sscale(staff); if (lyst_tb[staff].a) { top = lyst_tb[staff].top + 2; for (s = p_voice->sym->next; s; s = s->next) { /*fixme: may have lyrics crossing a next symbol*/ if (s->ly) { /*fixme:should set the real width*/ y_set(staff, 1, s->x - 2, 10, top); } } } if (lyst_tb[staff].b) { bot = lyst_tb[staff].bot - 2; if (nly_tb[p_voice - voice_tb] > 0) { for (s = p_voice->sym->next; s; s = s->next) { if (s->ly) { /*fixme:should set the real width*/ y_set(staff, 0, s->x - 2, 10, bot); } } } else { y_set(staff, 0, 0, realwidth, bot); } } } } /* -- draw the symbols near the notes -- */ /* (the staves are not yet defined) */ /* order: * - beams * - decorations near the notes * - measure bar numbers * - n-plets * - decorations tied to the notes * - slurs * - guitar chords * - then remaining decorations * The buffer output is delayed until the definition of the staff system, * so, global variables must be saved (see music.c delayed_output()). */ void draw_sym_near(void) { struct VOICE_S *p_voice; struct SYMBOL *s; /* calculate the beams but don't draw them (the staves are not yet defined) */ for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { struct BEAM bm; int first_note = 1; for (s = p_voice->sym; s; s = s->next) { if (s->as.type != ABC_T_NOTE) continue; if (((s->sflags & S_BEAM_ST) && !(s->sflags & S_BEAM_END)) || (first_note && !(s->sflags & S_BEAM_ST))) { first_note = 0; calculate_beam(&bm, s); } } } /* initialize the y offsets */ { int i, staff; for (staff = 0; staff <= nstaff; staff++) { for (i = 0; i < YSTEP; i++) { staff_tb[staff].top[i] = 0; staff_tb[staff].bot[i] = 24; } } } set_tie_room(); draw_deco_near(); /* set the min/max vertical offsets */ for (s = tsfirst; s; s = s->ts_next) { int y; struct SYMBOL *g; // if (!s->prev) // continue; /* skip the clefs */ if (s->as.flags & ABC_F_INVIS) continue; if (s->type == GRACE) { g = s->extra; for ( ; g; g = g->next) { y_set(s->staff, 1, g->x - g->wl, g->wl + g->wr, g->ymx + 1); y_set(s->staff, 0, g->x - g->wl, g->wl + g->wr, g->ymn - 1); } continue; } if (s->type != MREST) { y_set(s->staff, 1, s->x - s->wl, s->wl + s->wr, s->ymx + 2); y_set(s->staff, 0, s->x - s->wl, s->wl + s->wr, s->ymn - 2); } else { y_set(s->staff, 1, s->x - 16, 32, s->ymx + 2); } if (s->as.type != ABC_T_NOTE) continue; /* have room for the accidentals */ if (s->as.u.note.accs[s->nhd]) { y = s->y + 8; if (s->ymx < y) s->ymx = y; y_set(s->staff, 1, s->x, 0., y); } if (s->as.u.note.accs[0]) { y = s->y; if ((s->as.u.note.accs[0] & 0x07) == A_SH || s->as.u.note.accs[0] == A_NT) y -= 7; else y -= 5; if (s->ymn > y) s->ymn = y; y_set(s->staff, 0, s->x, 0., y); } } if (cfmt.measurenb >= 0) draw_measnb(); draw_deco_note(); for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { s = p_voice->sym; if (!s) continue; set_sscale(cursys->voice[p_voice - voice_tb].staff); /* draw the tuplets near the notes */ for (s = s->next; s; s = s->next) { struct SYMBOL *g; if ((s->sflags & S_IN_TUPLET) && (g = s->extra) != NULL) { for ( ; g; g = g->next) { if (g->type == TUPLET) { s = draw_tuplet(g, s); break; } } } } draw_all_slurs(p_voice); /* draw the tuplets over the slurs */ for (s = p_voice->sym->next; s; s = s->next) { struct SYMBOL *g; if ((s->sflags & S_IN_TUPLET) && (g = s->extra) != NULL) { for ( ; g; g = g->next) { if (g->type == TUPLET) { s = draw_tuplet(g, s); break; } } } } } /* set the top and bottom for all symbols to be out of the staves */ { int top, bot, i, staff; for (staff = 0; staff <= nstaff; staff++) { top = staff_tb[staff].topbar + 2; bot = staff_tb[staff].botbar - 2; /*fixme:should handle stafflines changes*/ for (i = 0; i < YSTEP; i++) { if (top > staff_tb[staff].top[i]) staff_tb[staff].top[i] = (float) top; if (bot < staff_tb[staff].bot[i]) staff_tb[staff].bot[i] = (float) bot; } } } draw_all_lyrics(); draw_deco_staff(); set_sscale(-1); /* restore the scale parameters */ } /* -- draw the name/subname of the voices -- */ static void draw_vname(float indent) { struct VOICE_S *p_voice; int n, staff; struct { int nl; char *v[8]; } staff_d[MAXSTAFF], *staff_p; char *p, *q; float y; for (staff = cursys->nstaff; staff >= 0; staff--) { if (!cursys->staff[staff].empty) break; } if (staff < 0) return; memset(staff_d, 0, sizeof staff_d); n = 0; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (!p_voice->sym) continue; staff = cursys->voice[p_voice - voice_tb].staff; if (cursys->staff[staff].empty) continue; if (p_voice->new_name) { p_voice->new_name = 0; p = p_voice->nm; } else { p = p_voice->snm; } if (!p) continue; if (cursys->staff[staff].flags & CLOSE_BRACE2) { while (!(cursys->staff[staff].flags & OPEN_BRACE2)) staff--; } else if (cursys->staff[staff].flags & CLOSE_BRACE) { while (!(cursys->staff[staff].flags & OPEN_BRACE)) staff--; } staff_p = &staff_d[staff]; for (;;) { staff_p->v[staff_p->nl++] = p; p = strstr(p, "\\n"); if (!p || staff_p->nl >= MAXSTAFF) break; p += 2; } n++; } if (n == 0) return; str_font(VOICEFONT); indent = -indent * .5; /* center */ for (staff = nstaff; staff >= 0; staff--) { staff_p = &staff_d[staff]; if (staff_p->nl == 0) continue; y = staff_tb[staff].y + staff_tb[staff].topbar * .5 * staff_tb[staff].clef.staffscale + 9 * (staff_p->nl - 1) - cfmt.font_tb[VOICEFONT].size * .3; n = staff; if (cursys->staff[staff].flags & OPEN_BRACE2) { while (!(cursys->staff[n].flags & CLOSE_BRACE2)) n++; } else if (cursys->staff[staff].flags & OPEN_BRACE) { while (!(cursys->staff[n].flags & CLOSE_BRACE)) n++; } if (n != staff) y -= (staff_tb[staff].y - staff_tb[n].y) * .5; for (n = 0; n < staff_p->nl; n++) { p = staff_p->v[n]; q = strstr(p, "\\n"); if (q) *q = '\0'; a2b("%.1f %.1f M ", indent, y); put_str(p, A_CENTER); y -= 18.; if (q) *q = '\\'; } } } /* -- adjust the empty flag in a staff system -- */ static void set_empty(struct SYSTEM *sy) { int staff; /* if a system brace has empty and non empty staves, keep all staves */ for (staff = 0; staff <= nstaff; staff++) { int i, empty_fl; if (!(sy->staff[staff].flags & (OPEN_BRACE | OPEN_BRACE2))) continue; empty_fl = 0; i = staff; while (staff <= nstaff) { if (sy->staff[staff].empty) empty_fl |= 1; else empty_fl |= 2; if (cursys->staff[staff].flags & (CLOSE_BRACE | CLOSE_BRACE2)) break; staff++; } if (empty_fl == 3) { /* if empty and not empty staves */ /*fixme: add measure bars on empty main voices*/ while (i <= staff) sy->staff[i++].empty = 0; } } } /* -- set the y offset of the staves and return the whole height -- */ static float set_staff(void) { struct SYSTEM *sy; struct SYMBOL *s; int i, staff, prev_staff; float y, staffsep, dy, maxsep, mbot, v; char empty[MAXSTAFF]; /* search the empty staves in each parts */ memset(empty, 1, sizeof empty); for (staff = 0; staff <= nstaff; staff++) staff_tb[staff].empty = 0; sy = cursys; set_empty(sy); for (staff = 0; staff <= nstaff; staff++) { if (!sy->staff[staff].empty) empty[staff] = 0; } for (s = tsfirst; s; s = s->ts_next) { if (s->type != STAVES) continue; sy = sy->next; set_empty(sy); for (staff = 0; staff <= nstaff; staff++) { if (!sy->staff[staff].empty) empty[staff] = 0; } } /* output the scale of the voices */ { struct VOICE_S *p_voice; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (p_voice->scale != 1) a2b("/scvo%d{gsave %.2f dup scale}!\n", (int) (p_voice - voice_tb), p_voice->scale); } } /* set the vertical offset of the 1st staff */ for (staff = 0; staff <= nstaff; staff++) { if (!empty[staff]) break; staff_tb[staff].empty = 1; } if (staff > nstaff) staff--; /* one staff, empty */ y = 0; for (i = 0; i < YSTEP; i++) { v = staff_tb[staff].top[i]; if (y < v) y = v; } /* draw the parts and tempo indications if any */ y += draw_partempo(staff, y); staffsep = cfmt.staffsep * 0.5 + staff_tb[staff].topbar * staff_tb[staff].clef.staffscale; if (y < staffsep) y = staffsep; staff_tb[staff].y = -y; /* set the offset of the other staves */ prev_staff = staff; for (staff++; staff <= nstaff; staff++) { if (empty[staff]) { staff_tb[staff].empty = 1; continue; } if (sy->staff[prev_staff].sep != 0) staffsep = sy->staff[prev_staff].sep; else staffsep = cfmt.sysstaffsep; if (sy->staff[prev_staff].maxsep != 0) maxsep = sy->staff[prev_staff].maxsep; else maxsep = cfmt.maxsysstaffsep; dy = 0; if (staff_tb[staff].clef.staffscale == staff_tb[prev_staff].clef.staffscale) { for (i = 0; i < YSTEP; i++) { v = staff_tb[staff].top[i] - staff_tb[prev_staff].bot[i]; if (dy < v) dy = v; } dy *= staff_tb[staff].clef.staffscale; } else { for (i = 0; i < YSTEP; i++) { v = staff_tb[staff].top[i] * staff_tb[staff].clef.staffscale - staff_tb[prev_staff].bot[i] * staff_tb[prev_staff].clef.staffscale; if (dy < v) dy = v; } } staffsep += staff_tb[staff].topbar * staff_tb[staff].clef.staffscale; if (dy < staffsep) dy = staffsep; maxsep += staff_tb[staff].topbar * staff_tb[staff].clef.staffscale; if (dy > maxsep) dy = maxsep; y += dy; staff_tb[staff].y = -y; prev_staff = staff; } mbot = 0; for (i = 0; i < YSTEP; i++) { v = staff_tb[prev_staff].bot[i]; if (mbot > v) mbot = v; } mbot *= staff_tb[prev_staff].clef.staffscale; /* output the staff offsets */ for (staff = nstaff; staff >= 0; staff--) { dy = staff_tb[staff].y; if (staff_tb[staff].clef.staffscale != 1 && staff_tb[staff].clef.staffscale != 0) { a2b("/scst%d{gsave 0 %.2f T %.2f dup scale}!\n", staff, dy, staff_tb[staff].clef.staffscale); a2b("/y%d{}!\n", staff); } else { a2b("/y%d{%.1f add}!\n", staff, dy); } } if (mbot == 0) { for (staff = nstaff; staff >= 0; staff--) { if (!empty[staff]) break; } if (staff < 0) /* no symbol in this system ! */ return y; } dy = -mbot; staffsep = cfmt.staffsep * 0.5; if (dy < staffsep) dy = staffsep; maxsep = cfmt.maxstaffsep * 0.5; if (dy > maxsep) dy = maxsep; y += dy; if (y > cfmt.maxstaffsep) y = cfmt.maxstaffsep; /* return the whole staff system height */ return y; } /* -- set the bottom and height of the measure bars -- */ static void bar_set(float *bar_bot, float *bar_height) { int staff, nlines; float dy, staffscale; /* !! max number of staff lines !! */ static const char top[10] = {18, 18, 12, 18, 18, 24, 30, 36, 42, 48}; static const char bot[10] = { 6, 6, 6, 6, 0, 0, 0, 0, 0, 0}; dy = 0; for (staff = 0; staff <= nstaff; staff++) { nlines = cursys->staff[staff].clef.stafflines; staffscale = cursys->staff[staff].clef.staffscale; if (cursys->staff[staff].empty) { bar_bot[staff] = bar_height[staff] = 0; continue; } if (dy == 0) dy = staff_tb[staff].y + top[nlines] * staffscale; bar_height[staff] = dy - staff_tb[staff].y - bot[nlines] * staffscale; bar_bot[staff] = staff_tb[staff].y + bot[nlines] * staffscale; if (cursys->staff[staff].flags & STOP_BAR) dy = 0; else dy = bar_bot[staff]; } } /* -- draw the staff systems and the measure bars -- */ float draw_systems(float indent) { struct SYSTEM *next_sy; struct SYMBOL *s, *s2; int staff; float xstaff[MAXSTAFF], bar_bot[MAXSTAFF], bar_height[MAXSTAFF]; float x, x2; float line_height; line_height = set_staff(); draw_vname(indent); /* draw the staff, skipping the staff breaks */ for (staff = 0; staff <= nstaff; staff++) xstaff[staff] = cursys->staff[staff].empty ? -1 : 0; bar_set(bar_bot, bar_height); draw_lstaff(0); for (s = tsfirst; s; s = s->ts_next) { staff = s->staff; switch (s->type) { case STAVES: next_sy = cursys->next; for (staff = 0; staff <= nstaff; staff++) { if (next_sy->staff[staff].empty == cursys->staff[staff].empty && next_sy->staff[staff].clef.stafflines == cursys->staff[staff].clef.stafflines) continue; x2 = s->x; if ((x = xstaff[staff]) >= 0) { if (s->ts_prev->type == BAR) x2 = s->ts_prev->x; draw_staff(staff, x, x2); } if (next_sy->staff[staff].empty) { xstaff[staff] = -1; } else if (xstaff[staff] < 0) { if (s->ts_next->type != BAR) xstaff[staff] = x2; else xstaff[staff] = s->ts_next->x; } else { xstaff[staff] = x2; } } cursys = next_sy; bar_set(bar_bot, bar_height); break; case BAR: if ((s->sflags & S_SECOND) || cursys->staff[staff].empty) s->as.flags |= ABC_F_INVIS; if (s->as.flags & ABC_F_INVIS) break; draw_bar(s, bar_bot[staff], bar_height[staff]); if (annotate) anno_out(s, 'B'); break; case STBRK: if (cursys->voice[s->voice].range == 0) { if (s->next && s->next->type == STAVES) s->next->x = s->x; if ( s->xmx > .5 CM) { int i, nvoice; /* draw the left system if stbrk in all voices */ nvoice = 0; for (i = 0; i < MAXVOICE; i++) { if (cursys->voice[i].range > 0) nvoice++; } for (s2 = s->ts_next; s2; s2 = s2->ts_next) { if (s2->type != STBRK) break; nvoice--; } if (nvoice == 0) draw_lstaff(s->x); } } s2 = s->prev; if (!s2) break; if (s2->type == STAVES) s2 = s2->prev; x2 = s2->x; if (s2->type != BAR) x2 += s2->wr; staff = s->staff; x = xstaff[staff]; if (x >= 0) { if (x >= x2) continue; draw_staff(staff, x, x2); } xstaff[staff] = s->x; break; default: //fixme:does not work for "%%staves K: M: $" */ if (cursys->staff[staff].empty) s->as.flags |= ABC_F_INVIS; break; } } for (staff = 0; staff <= nstaff; staff++) { if ((x = xstaff[staff]) < 0 || x >= realwidth - 8) continue; draw_staff(staff, x, realwidth); } set_sscale(-1); return line_height; } /* -- output PostScript sequences -- */ void output_ps(struct SYMBOL *s, int state) { struct SYMBOL *g, *g2; g = s->extra; g2 = NULL; for (;;) { if (g->type == FMTCHG && (g->u == PSSEQ || g->u == SVGSEQ) && g->as.state <= state) { if (g->u == SVGSEQ) a2b("%%svg %s\n", g->as.text); else a2b("%s\n", g->as.text); if (!g2) s->extra = g->next; else g2->next = g->next; } else { g2 = g; } g = g->next; if (!g) break; } } /* -- draw remaining symbols when the staves are defined -- */ static void draw_symbols(struct VOICE_S *p_voice) { struct BEAM bm; struct SYMBOL *s; float x, y; int staff, first_note; /* output the PostScript code at start of line */ for (s = p_voice->sym; s; s = s->next) { if (s->extra) output_ps(s, 127); switch (s->type) { case CLEF: case KEYSIG: case TIMESIG: case BAR: continue; /* skip the symbols added by init_music_line() */ } break; } bm.s2 = NULL; first_note = 1; for (s = p_voice->sym; s; s = s->next) { if (s->extra) output_ps(s, 127); if ((s->as.flags & ABC_F_INVIS) && s->type != NOTEREST && s->type != GRACE) continue; x = s->x; switch (s->type) { case NOTEREST: set_scale(s); if (s->as.type == ABC_T_NOTE) { if ((s->sflags & (S_BEAM_ST | S_BEAM_END)) == S_BEAM_ST || (first_note && !(s->sflags & S_BEAM_ST))) { first_note = 0; if (calculate_beam(&bm, s)) { if (annotate) anno_out(s, 'b'); draw_beams(&bm); } } draw_note(x, s, bm.s2 == NULL); if (annotate) anno_out(s, 'N'); if (s == bm.s2) bm.s2 = NULL; if (annotate && (s->sflags & (S_BEAM_ST | S_BEAM_END)) == S_BEAM_END) anno_out(s, 'e'); break; } draw_rest(s); if (annotate) anno_out(s, 'R'); break; case BAR: break; /* drawn in draw_systems */ case CLEF: staff = s->staff; if (s->sflags & S_SECOND) /* || p_voice->staff != staff) */ break; /* only one clef per staff */ if ((s->as.flags & ABC_F_INVIS) || staff_tb[staff].empty) break; set_sscale(staff); y = staff_tb[staff].y; x -= 10; /* clef shift - see set_width() */ putxy(x, y + s->y); if (s->as.u.clef.name) a2b("%s\n", s->as.u.clef.name); else a2b("%c%cclef\n", s->u ? 's' : ' ', "tcbp"[(unsigned) s->as.u.clef.type]); if (s->as.u.clef.octave != 0) { /*fixme:break the compatibility and avoid strange numbers*/ if (s->as.u.clef.octave > 0) y += s->ymx - 12; else y += s->ymn + 2; putxy(x, y); a2b("oct%c\n", s->as.u.clef.octave > 0 ? 'u' : 'l'); } if (annotate) anno_out(s, 'c'); break; case TIMESIG: memcpy(&p_voice->meter, &s->as.u.meter, sizeof p_voice->meter); if ((s->sflags & S_SECOND) || staff_tb[s->staff].empty) break; if (cfmt.alignbars && s->staff != 0) break; set_sscale(s->staff); draw_timesig(x, s); if (annotate) anno_out(s, 'M'); break; case KEYSIG: memcpy(&p_voice->key, &s->as.u.key, sizeof p_voice->key); if ((s->sflags & S_SECOND) || staff_tb[s->staff].empty) break; set_sscale(s->staff); draw_keysig(p_voice, x, s); if (annotate) anno_out(s, 'K'); break; case MREST: set_scale(s); a2b("(%d)", s->as.u.bar.len); putxy(x, staff_tb[s->staff].y); a2b("mrest\n"); break; case GRACE: set_scale(s); draw_gracenotes(s); break; case SPACE: case STAVES: case STBRK: case FMTCHG: break; /* nothing */ case CUSTOS: set_scale(s); s->sflags |= ABC_F_STEMLESS; draw_note(x, s, 0); break; default: bug("Symbol not drawn", 1); } } set_scale(p_voice->sym); draw_all_ties(p_voice); } /* -- draw all symbols -- */ void draw_all_symb(void) { struct VOICE_S *p_voice; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { #if 1 /*fixme:test*/ if (!p_voice->sym) #else if (staff_tb[p_voice->staff].empty || !p_voice->sym) #endif continue; draw_symbols(p_voice); } } /* -- output a floating value, and x and y according to the current scale -- */ void putf(float v) { a2b("%.1f ", v); } void putx(float x) { putf(x / cur_scale); } void puty(float y) { putf(scale_voice ? y / cur_scale : /* scaled voice */ y - cur_trans); /* scaled staff */ } void putxy(float x, float y) { if (scale_voice) a2b("%.1f %.1f ", x / cur_scale, y / cur_scale); /* scaled voice */ else a2b("%.1f %.1f ", x / cur_scale, y - cur_trans); /* scaled staff */ } /* -- set the voice or staff scale -- */ void set_scale(struct SYMBOL *s) { int staff; float scale, trans; staff = -1; scale = voice_tb[s->voice].scale; if (scale == 1) { staff = s->staff; scale = staff_tb[staff].clef.staffscale; } /*fixme: KO when both staff and voice are scaled */ if (staff >= 0 && scale != 1) { trans = staff_tb[staff].y; scale_voice = 0; if (staff != cur_staff && cur_scale != 1) cur_scale = 0; } else { trans = 0; scale_voice = 1; } if (scale == cur_scale && trans == cur_trans) return; if (cur_scale != 1) a2b("grestore "); cur_scale = scale; cur_trans = trans; if (scale != 1) { if (scale_voice) { a2b("scvo%d ", s->voice); } else { a2b("scst%d ", staff); cur_staff = staff; } } } /* -- set the staff scale (only) -- */ void set_sscale(int staff) { float scale, trans; scale_voice = 0; if (staff != cur_staff && cur_scale != 1) cur_scale = 0; if (staff >= 0) scale = staff_tb[staff].clef.staffscale; else scale = 1; if (staff >= 0 && scale != 1) trans = staff_tb[staff].y; else trans = 0; if (scale == cur_scale && trans == cur_trans) return; if (cur_scale != 1) a2b("grestore "); cur_scale = scale; cur_trans = trans; if (scale != 1) { a2b("scst%d ", staff); cur_staff = staff; } } /* -- set the tie directions for one voice -- */ static void set_tie_dir(struct SYMBOL *sym) { struct SYMBOL *s; int i, ntie, dir, sec, pit, ti; for (s = sym; s; s = s->next) { if (!(s->sflags & S_TI1)) continue; /* if other voice, set the ties in opposite direction */ if (s->multi != 0) { /* struct SYMBOL *s2; s2 = s->ts_next; if (s2->time == s->time && s2->staff == s->staff) { */ dir = s->multi > 0 ? SL_ABOVE : SL_BELOW; for (i = 0; i <= s->nhd; i++) { ti = s->as.u.note.ti1[i]; if (!((ti & 0x03) == SL_AUTO)) continue; s->as.u.note.ti1[i] = (ti & SL_DOTTED) | dir; } continue; /* } */ } /* if one note, set the direction according to the stem */ sec = ntie = 0; pit = 128; for (i = 0; i <= s->nhd; i++) { if (s->as.u.note.ti1[i]) { ntie++; if (pit < 128 && s->as.u.note.pits[i] <= pit + 1) sec++; pit = s->as.u.note.pits[i]; } } if (ntie <= 1) { dir = s->stem < 0 ? SL_ABOVE : SL_BELOW; for (i = 0; i <= s->nhd; i++) { ti = s->as.u.note.ti1[i]; if (ti != 0) { if ((ti & 0x03) == SL_AUTO) s->as.u.note.ti1[i] = (ti & SL_DOTTED) | dir; break; } } continue; } if (sec == 0) { if (ntie & 1) { /* in chords with an odd number of notes, the outer noteheads are paired off * center notes are tied according to their position in relation to the * center line */ ntie = ntie / 2; dir = SL_BELOW; for (i = 0; i <= s->nhd; i++) { ti = s->as.u.note.ti1[i]; if (ti == 0) continue; if (ntie == 0) { /* central tie */ if (s->pits[i] >= 22) dir = SL_ABOVE; } if ((ti & 0x03) == SL_AUTO) s->as.u.note.ti1[i] = (ti & SL_DOTTED) | dir; if (ntie-- == 0) dir = SL_ABOVE; } continue; } else { /* even number of notes, ties divided in opposite directions */ ntie /= 2; dir = SL_BELOW; for (i = 0; i <= s->nhd; i++) { ti = s->as.u.note.ti1[i]; if (ti == 0) continue; if ((ti & 0x03) == SL_AUTO) s->as.u.note.ti1[i] = (ti & SL_DOTTED) | dir; if (--ntie == 0) dir = SL_ABOVE; } continue; } } /*fixme: treat more than one second */ /* if (nsec == 1) { */ /* When a chord contains the interval of a second, tie those two notes in * opposition; then fill in the remaining notes of the chord accordingly */ pit = 128; for (i = 0; i <= s->nhd; i++) { if (s->as.u.note.ti1[i]) { if (pit < 128 && s->as.u.note.pits[i] <= pit + 1) { ntie = i; break; } pit = s->as.u.note.pits[i]; } } dir = SL_BELOW; for (i = 0; i <= s->nhd; i++) { ti = s->as.u.note.ti1[i]; if (ti == 0) continue; if (ntie == i) dir = SL_ABOVE; if ((ti & 0x03) == SL_AUTO) s->as.u.note.ti1[i] = (ti & SL_DOTTED) | dir; } /*fixme.. continue; } ..*/ /* if a chord contains more than one pair of seconds, the pair farthest * from the center line receives the ties drawn in opposition */ } } /* -- have room for the ties out of the staves -- */ static void set_tie_room(void) { struct VOICE_S *p_voice; struct SYMBOL *s, *s2; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { s = p_voice->sym; if (!s) continue; s = s->next; if (!s) continue; set_tie_dir(s); for ( ; s; s = s->next) { float dx, y, dy; if (!(s->sflags & S_TI1)) continue; if (s->pits[0] < 20 && s->as.u.note.ti1[0] == SL_BELOW) ; else if (s->pits[s->nhd] > 24 && s->as.u.note.ti1[s->nhd] == SL_ABOVE) ; else continue; s2 = s->next; while (s2 && s2->as.type != ABC_T_NOTE) s2 = s2->next; if (s2) { if (s2->staff != s->staff) continue; dx = s2->x - s->x - 10; } else { dx = realwidth - s->x - 10; } if (dx < 100) dy = 9; else if (dx < 300) dy = 12; else dy = 16; if (s->pits[s->nhd] > 24) { y = 3 * (s->pits[s->nhd] - 18) + dy; if (s->ymx < y) s->ymx = y; if (s2 && s2->ymx < y) s2->ymx = y; y_set(s->staff, 1, s->x + 5, dx, y); } if (s->pits[0] < 20) { y = 3 * (s->pits[0] - 18) - dy; if (s->ymn > y) s->ymn = y; if (s2 && s2->ymn > y) s2->ymn = y; y_set(s->staff, 0, s->x + 5, dx, y); } } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/features.txt��������������������������������������������������������������������������0000644�0001750�0001750�00000027430�12314503276�013550� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Features of abcm2ps 7.6.9 (J.F. Moine, January 2014) ==================================================== abcm2ps tries to follow the ABC standard version 2.1 (december 2011): http://abcnotation.com/wiki/abc:standard:v2.1 Here are listed only the differences from the standard. Features not implemented. ======================== Information fields. - The continuation field ('+:') is implemented for w: only. - The charsets iso-8859-5 .. iso-8859-8 are not implemented. Tune body. - The following decorations are not implemented: !dacoda!, !dacapo! - 'U:' fields cannot contain guitar chord nor annotations. - The values assigned by the 'U:' field are always global (they are not restored at end of tune). - Multiple measure overlay (as '&&') is not implemented. Use the '(& .. & .. & .. &) extension instead. Text strings. - The HTML sequences are not implemented. - The unicode '\Uxxxxxxxx' 32 bits character is not implemented. Use the UTF-16 surrogates instead. Features that work differently. =============================== File structure. - The T: header field may be omitted when 'X:' is present. - There is no notion of 'file header': any valid ABC field found outside the tunes is considered as global, and applies to the remaining tunes. Information fields. - In a tune body, the lines beginning with a letter in range A-G or a-g and immediately followed by a colon are interpreted as information fields. - When the %%abc-version is different from '2.0', the field 'A:' is 'Area', and not 'Author of lyrics'. It is displayed only when 'infoline' is set. - In 'K:' fields, the list of accidentals may be 'none' (for no accidental). - In 'U:' fields, the character may be '\ ' (back-slash - space) to redefine the character space, or '\t' (back-slash - t) to redefine the character tabulation. The default value of these characters is !beambreak! (see below). Tune body. - The decorations on notes inside chords cannot be standard ones because their offset is relative to the note they are attached to, and not to the chord. They must be explicitly defined by %%deco and %%postscript. - '@' in annotations must be followed by the and offsets of the text from the note position (in points). The and values are separated by a comma, and may be followed by a space (usefull if the text begins with a digit, a dot or the letters 'E' or 'e' - see sample3.abc for an example). - Grace notes may appear before any symbol and may contain chords. Their note lengths are handled. The unit note length is not tied to L: (or M:). Instead, for compatibility, it is: - a quaver for a single note and a semi-quaver for many notes in standard tunes, - a demi-semi-quaver in bagpipe tunes. Grace notes greater than crotchets are drawn as crotchets. - Tuplets values may be greater than 9. - Tuplets may be nested. Clefs. - When 'clef=' is present, the clef name may be one of 'G' (treble clef), 'C' (alto clef) or 'F' (bass clef). The two following definitions are equivalent: K: clef=F K: bass - The suffixes "^8" and "_8" do an octave transposition (while "+8" and "-8" don't do it). Multiple voices. - When the voices are synchronized, a 'P:' field is set in the first voice, without changing the current voice. This fixes the common error: P:A V:1 .. V:2 .. P:B % misplaced P: (in voice 2) V:1 % should be here .. V:2 % and normally repeated here .. ABC Stylesheet specification. - The star ('*' = floating voice) is not treated in '%%score'. - '%%staves' coexists with '%%score'. The differences of '%%staves' are: - measure bars are drawn between staves when there is no '|' between the voice names (this feature is inverted in %%score). - A floating voice may be only the second one in a 3 voices brace. - Some formatting directives are not implemented, and some other ones are defined. See the file 'format.txt' for details. Extensions. ========== File structure. - Lines starting with '\' (back-slash) are ignored (abc2mtex compatibility). Information fields. - The field 'L:' may contain 'auto' in which case the duration of each note is adjusted to fulfill the measures. This value works when the measures are regular (fixed duration). 'L:auto' may be used in each case the measure is regular in a compatible way. For instance, the three following lines give a same result: - standard ABC: L:1/4 cccd | e2d2 | cedd | c4 | - auto L: M:C % required L:auto cccd | ed | cedd | c | - compatible M:C % required L:auto cccd | e2d2 | cedd | c4 | - The field 'M:' may specify more complex meters with a combination of digits, parenthesis, slashes and blanks. It may also specify ancient meters as 'M:2' or 'M:3', and also 'M:o' (perfect minor), 'M:o.' (perfect major), 'M:c' (imperfect minor) and 'M:c.' (imperfect major). An explicit measure duration may be specified putting its value after an '=' sign (ex: 'M:C|=2/1'). - 'microscale=' in 'K:' or 'V:' fields defines the denominator to use in microtonal accidentals (see 'microtone' pitches below). - The field 'd:' is the same as 's:' (symbol line). - In 'U:' fields, !ignore! defines the character as ignored. This is the default value for the character '`' (back-quote). - In 'U:' fields, !beambreak! defines the character as stopping note beaming. This is the default value for the characters '\ ' (space) and '\t' (tabulation). Tune body. - Microtone pitches are indicated by a number or a fraction after an accidental (and before the note). There are two ways to define microtone pitches: - old method (default) The pitches are indicated by a fraction of semitone as "^3/4c" (3/4 of a sharp). When omitted, the numerator defaults to 1 and the denominator to 2 ("^/c" is the same as "^1/2c"). Support exists for 1/2 and 3/2 sharps and flats. For other values, PostScript functions must be defined (%%postscript or %%beginps - see below). - new method The pitches are indicated by a fraction of tone (! not semitone !) when "microscale=" is set in K: or V: information fields. With this method, only the numerator is to be set after the accidental as "^3c". For instance, the two declarations - without microscale: ^3/2c - with microscale=4: ^3c give a same result. Note: the numerator and denominator cannot be greater than 255. There are also two ways to implement the accidental drawing function: - old method When neither "microscale=" nor "%%micronewps" are set, the name of the PostScript function which draws a microtone accidental is: where: - is "sh" (sharp) or "ft" (flat) (may be also "nt", "dsh" or "dft" !) - is computed from the fraction as: ( - 1) * 256 + - 1 and it is called with and . - new method When either "microscale=" or "%%micronewps" is set, the name of the PostScript function is: and it is called with . Note that the is two times the pitch denominator when "microscale=" is not set. - A note length starting with '0' (zero') indicates a stemless note. - A space ('y') may be followed by a width in points. The default width is 20 pts. - '[]' is the same as '[|]' (invisible bar). - ':' (colon alone) is the same as '.|' (dotted bar). - ']' alone is not a bar. It stops a repeat bracket. - Repeat bars may contain a set of digits, '-' (hyphen), ',' (comma) or '.' (dot), or even a free string. Ex: |: ... [1,3 ... :|2,4-6 ... :|["last time" ... (note that a '[' is needed before the string - this one may be empty). - There may be slurs from notes to grace notes and reverse. - Opening slurs ("(") may be followed by "'" or "," to force their direction (above or below). - The tie character ("-") may be followed by "'" or "," to force the tie direction (above or below). - The following decorations are added: !beamon! do not break beaming (on a measure bar) !beambr1! and !beambr2! let only 1 or 2 beams from the previous note !gmark! grace mark ('~' like sign) !invisible! prevent a symbol to be displayed !rbstop! stop here the current repeat bracket !trem1! .. !trem4! tremolo (on the second of a couple of notes - see sample4.abc for example) !xstem! draw a stem up to the note on the previous staff !/! .. !///! tremolo on one note !beam-accel! and !beam-rall! feathered beam - There may be decorations on grace notes. - Multiple lines of guitar chord / annotation may also be indicated by '\n' or ';' in which case, the lines are of the same type (gchord or annotation). The 3 next notations are equivalent: "_ann1" "_ann2" "G3" "4" "_ann1;ann2" "G3;4" "_ann1\nann2" "G3\n4" (annotation on 2 lines and guitar chord on 2 lines) The two next notations are NOT equivalent: "_ann1" "G" "_ann1;G" (in the 1st line, 'G' is a guitar chord, in the 2nd one, it is the 2nd line of the annotation) A new annotation type may be indicated after a ';' as: "^above;_below" Clefs. - the clef definition should not be in K: or V: information fields. Better use the %%clef pseudo-comment (see format.txt) - 'clef=P' is the same as 'perc'. - When the clef name is 'perc' (or 'P'), accidentals change the note head glyph. By default, sharp notes are drawn as a 'x' and flat notes as a circled 'x'. This behaviour may be changed redefineding the PostScript functions 'pshhd' and 'pfthd', or defining 'pnthd' (natural), 'pdshhd' (double sharp) and 'pdfthd' (double flat). - When no clef is specified, clef changes are automatically inserted when needed ('bass' or 'treble'). - The clef name may be enclosed by double quotes in which case it is the name of the PostScript function which draws the clef. The arguments of this function are the x and y offsets. Multiple voices. - 'stem=auto' in a V: field re-enables the automatic computation of the direction of the stems (default). - For compatibility with previous abcm2ps versions, the V: fields may contain: - 'gchord=up' (default) and 'gchord=down' which forces the display of guitar chords above or below the staff (see 'gchord' in format.txt). - 'gstem=up' or 'gstem=down' which forces the direction of the stems of the grace notes (see 'gstemdir' in format.txt). - 'dyn=up', 'dyn=down' or 'dyn=auto' which forces the place of the dynamic marks (above or below the staff - default is 'auto' - see 'dynamic' in format.txt) - 'lyrics=up', 'lyrics=down' or 'lyrics=auto' which forces the place of the lyrics (above or below the staff - default is 'auto' - see 'vocal' in format.txt). (use pseudo comments instead - see format.txt) - 'merge' in a V: field makes the voice to go on the same staff as the previous voice (BarFly compatibility). - The BarFly voice switch in tune ('V:x ', i.e. voice + notes on the same line) may work. - The operator '(&...&...&)' permits voice overlay on many measures. See sample3.abc for an example. Text strings. - The guitar chords and annotations may contain '\#', '\b' and '\=' to display accidentals. - The strings may contain characters from '\001' to '\005' to display accidentals. For compatibility, the values '\201' to '\205' are handled the same way. - In quoted string, the '%' does not need to be escaped. - The strings may contain XML character references like "é" or "𝅘𝅥" Deprecated ABC syntax. - Most of the deprecated ABC syntax is supported. - Some incompatible syntaxes are handled according to the ABC version of the file as the ABC 2.0 line continuation mechanism. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/flute.fmt�����������������������������������������������������������������������������0000644�0001750�0001750�00000020323�12055357464�013022� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������% format file for flute tablatures - this file is part of abcm2ps % % Tin whistle by Guido Gonzato % Galoubet and Pipe-Tabor by Michel Bellon % % tw_ : tin whistle % gbl_ : galoubet (3 holes pipe from Provence) % gblc_ : galoubet (digit only ) % pt_ : pipe and tabor (3 holes pipe from England) % xi_ : txistu (3 holes pipe from Euskadi) % % you may try it running: % abcm2ps sample -e1 -F flute.fmt -T1 -T3 beginps % -- whistle drawing functions -- % % start of line % string tw_head /tw_head{/Helvetica 8 selectfont 0 15 M 90 rotate(WHISTLE)show -90 rotate /Helvetica-Bold 36 selectfont 0 15 M show .5 SLW newpath}! /tw_under{ -2.5 6.5 M 2.5 -2.5 RL 2.5 2.5 RL -2.5 -2.5 RM 0 6 RL stroke}! /tw_over{ -2.5 7.5 M 2.5 2.5 RL 2.5 -2.5 RL -2.5 2.5 RM 0 -6 RL stroke}! /tw_p{-3 0 M 6 0 RL -3 -3 RM 0 6 RL stroke}! /tw_pp{-3 0 M 6 0 RL -1.5 -1.5 RM 0 3 RL -3 0 RM 0 -3 RL stroke}! % holes /tw_0{0 0 3 0 360 arc stroke}! /tw_1{0 0 3 90 270 arc fill 0 0 3 270 90 arc stroke}! /tw_2{0 0 3 0 360 arc fill}! % hole table - from C to B /tw_holes [8#222222 8#222221 8#222220 8#222210 8#222200 8#222000 8#221000 8#220000 8#210000 8#200000 8#022000 8#000000] def % draw a note % octave pitch x tw_note /tw_note{gsave 7 T % oct pit cvi % (if microtone) dup 12 idiv % oct pit pit/12 dup 0 eq{pop} {1 eq{tw_p} {tw_pp}ifelse }ifelse dup 12 eq{ pop 8#022222 % (special case) }{ 12 mod tw_holes exch get }ifelse % oct holes 0 1 5{pop 0 7 T dup 8#3 and dup 0 eq{pop tw_0} {1 eq{tw_1} {tw_2}ifelse }ifelse -3 bitshift }for pop % oct dup 0 gt{pop tw_over} {0 lt{tw_under}if }ifelse grestore }! % -- galoubet en Do -- % % début de ligne % string gbl_head /gbl_tete{/Helvetica 7 selectfont 0 10 M 90 rotate(GALOUBET)show -90 rotate /Helvetica-Bold 24 selectfont 0 10 M show .5 SLW newpath}! /gbl_c{/Helvetica-utf8 14 selectfont -5 10 M show .5 SLW newpath}! /gbl_doux{-3.5 0 M 7 0 RL stroke}! /gbl_fort{-3.5 0 M 7 0 RL -3.5 -3.5 RM 0 7 RL stroke}! /gbl_tres_fort{-5 0 M 10 0 RL -2.5 -3 RM 0 6 RL -5 0 RM 0 -6 RL stroke}! % trous /gbl_0{0 0 3.5 0 360 arc stroke}! /gbl_1{0 0 3.5 90 270 arc fill 0 0 3.5 270 90 arc stroke}! /gbl_2{0 0 3.5 0 360 arc fill}! % table des trous - de E à d' /gbl_trous [8#22210 % F.. B 8#22200 8#22100 8#22000 8#21000 8#20000 8#10000 8#00000 % c .. e 8#22201 8#22101 8#22001 8#21001 8#20001 % f ..b 8#22202 8#00002 8#22002 8#21002 8#20002 8#10202 8#00202 % c' .. d' 8#22203 8#22103 8#22003] def % table des doigtés chiffrés /gbl_dgt [(3Þ) (3) (2Þ) (2) (1Þ) (1) (Þ) (0) (3) (2Þ) (2) (1Þ) (1) (3) (0) (2) (1Þ) (1) (ÞF) (F) (3) (2Þ) (2)] def % dessin d'une note % octave pitch x gbl_note /gbl_note{gsave 8 T % oct pit cvi % (if microtone) 4 sub % oct pit/'E' exch % pit/E oct 0 eq % (1ere octave seulement) 1 index 0 ge and % (pitch = 0 .. 22 = E .. d') 1 index 23 lt and{ dup gbl_dgt exch get 0 30 T gbl_c 0 -35 T gbl_trous exch get dup 8#3 and dup 0 eq{pop gbl_doux} {dup 1 eq{pop} {2 eq{gbl_fort} {gbl_tres_fort}ifelse }ifelse }ifelse -3 bitshift 0 9 T dup 8#3 and 1 eq{gbl_1}if -3 bitshift 0 1 2{pop 0 9 T dup 8#3 and dup 0 eq{pop gbl_0} {1 eq{gbl_1} {gbl_2}ifelse }ifelse -3 bitshift }for }if pop grestore }! % -- galoubet en Do Tablature chiffrée-- % % début de ligne % string gbl_head /gblc_tete{/Helvetica 7 selectfont 0 10 M 90 rotate(GALOUBET)show -90 rotate /Helvetica-Bold 24 selectfont 0 10 M show .5 SLW newpath}! /gblc_c{/Helvetica-utf8 18 selectfont -5 10 M show .5 SLW newpath}! /gblc_doux{-3.5 0 M 7 0 RL stroke}! /gblc_fort{-3.5 0 M 7 0 RL -3.5 -3.5 RM 0 7 RL stroke}! /gblc_tres_fort{-5 0 M 10 0 RL -2.5 -3 RM 0 6 RL -5 0 RM 0 -6 RL stroke}! % trous /gblc_0{0 0 3.5 0 360 arc stroke}! /gblc_1{0 0 3.5 90 270 arc fill 0 0 3.5 270 90 arc stroke}! /gblc_2{0 0 3.5 0 360 arc fill}! % table des trous - de E à d' /gblc_trous [8#22210 % F.. B 8#22200 8#22100 8#22000 8#21000 8#20000 8#10000 8#00000 % c .. e 8#22201 8#22101 8#22001 8#21001 8#20001 % f ..b 8#22202 8#00002 8#22002 8#21002 8#20002 8#10202 8#00202 % c' .. d' 8#22203 8#22103 8#22003] def % table des doigtés chiffrés /gblc_dgt [(3Þ) (3) (2Þ) (2) (1Þ) (1) (Þ) (0) (3) (2Þ) (2) (1Þ) (1) (3) (0) (2) (1Þ) (1) (ÞF) (F) (3) (2Þ) (2)] def % dessin d'une note % octave pitch x gblc_note /gblc_note{gsave 8 T % oct pit cvi % (if microtone) 4 sub % oct pit/'E' exch % pit/E oct 0 eq % (1ere octave seulement) 1 index 0 ge and % (pitch = 0 .. 22 = E .. d') 1 index 23 lt and{ dup gblc_dgt exch get 0 10 T gblc_c 0 0 T gblc_trous exch get dup 8#3 and dup 0 eq{pop gblc_doux} {dup 1 eq{pop} {2 eq{gblc_fort} {gblc_tres_fort}ifelse }ifelse }ifelse -3 bitshift % 0 9 T % dup 8#3 and 1 eq{gblc_1}if % -3 bitshift % 0 1 2{pop % 0 9 T % dup 8#3 and dup 0 eq{pop gblc_0} % {1 eq{gblc_1} % {gblc_2}ifelse % }ifelse % -3 bitshift % }for }if pop grestore }! % -- Pipe-Tabor en Do -- % % début de ligne % string pt_head /pt_tete{/Helvetica 7 selectfont 0 10 M 90 rotate(PIPE-TABOR)show -90 rotate /Helvetica-Bold 24 selectfont 0 10 M show .5 SLW newpath}! /pt_doux{-3.5 0 M 7 0 RL stroke}! /pt_fort{-3.5 0 M 7 0 RL -3.5 -3.5 RM 0 7 RL stroke}! /pt_tres_fort{-5 0 M 10 0 RL -2.5 -3 RM 0 6 RL -5 0 RM 0 -6 RL stroke}! % trous /pt_0{0 0 3.5 0 360 arc stroke}! /pt_1{0 0 3.5 90 270 arc fill 0 0 3.5 270 90 arc stroke}! /pt_2{0 0 3.5 0 360 arc fill}! % table des trous - de E à d' /pt_trous [8#22210 % F.. B 8#22200 8#22100 8#22000 8#20200 8#20000 8#00000 8#22211 % c .. e 8#22201 8#22101 8#22001 8#21001 8#20001 % f ..b 8#22202 8#22102 8#22002 8#21002 8#20202 8#00202 8#22002 % c' .. d' 8#22203 8#22103 8#00203] def % dessin d'une note % octave pitch x pt_note /pt_note{gsave 8 T % oct pit cvi % (if microtone) 11 sub % oct pit/'E' exch % pit/E oct 0 eq % (1ere octave seulement) 1 index 0 ge and % (pitch = 0 .. 22 = E .. d') 1 index 23 lt and{ pt_trous exch get dup 8#3 and dup 0 eq{pop pt_doux} {dup 1 eq{pop} {2 eq{pt_fort} {pt_tres_fort}ifelse }ifelse }ifelse -3 bitshift 0 9 T dup 8#3 and 1 eq{pt_1}if -3 bitshift 0 1 2{pop 0 9 T dup 8#3 and dup 0 eq{pop pt_0} {1 eq{pt_1} {pt_2}ifelse }ifelse -3 bitshift }for }if pop grestore }! % -- Galoubet en dièze ou Txistu -- % % début de ligne % string xi_head /xi_tete{/Helvetica 7 selectfont 0 10 M 90 rotate(TXISTU)show -90 rotate /Helvetica-Bold 24 selectfont 0 10 M show .5 SLW newpath}! /xi_doux{-3.5 0 M 7 0 RL stroke}! /xi_fort{-3.5 0 M 7 0 RL -3.5 -3.5 RM 0 7 RL stroke}! /xi_tres_fort{-5 0 M 10 0 RL -2.5 -3 RM 0 6 RL -5 0 RM 0 -6 RL stroke}! % trous /xi_0{0 0 3.5 0 360 arc stroke}! /xi_1{0 0 3.5 90 270 arc fill 0 0 3.5 270 90 arc stroke}! /xi_2{0 0 3.5 0 360 arc fill}! % table des trous - de E à d' /xi_trous [8#22210 % E.. _B 8#22200 8#22100 8#22000 8#20000 8#02200 8#00200 8#22210 % B .. ^d 8#22201 8#22101 8#22001 8#20001 8#02001 % e ..g 8#22202 8#22102 8#22002 8#20002 % c' .. d' 8#22203 8#00203 8#22213 8#22203 8#22103 8#22003] def % dessin d'une note % octave pitch xi tw_note /xi_note{gsave 8 T % oct pit cvi % (if microtone) 11 sub % oct pit/'E' exch % pit/E oct 0 eq % (1ere octave seulement) 1 index 0 ge and % (pitch = 0 .. 22 = E .. d') 1 index 23 lt and{ xi_trous exch get dup 8#3 and dup 0 eq{pop xi_doux} {dup 1 eq{pop} {2 eq{xi_fort} {xi_tres_fort}ifelse }ifelse }ifelse -3 bitshift 0 9 T dup 8#3 and 1 eq{xi_1}if -3 bitshift 0 1 2{pop 0 9 T dup 8#3 and dup 0 eq{pop xi_0} {1 eq{xi_1} {xi_2}ifelse }ifelse -3 bitshift }for }if pop grestore }! endps % all tin whistle transpositions tablature #1 pitch=D 35 0 63 tw_head tw_note tablature #2 pitch=C 35 0 63 tw_head tw_note tablature #3 pitch=Eb 60 0 63 tw_head tw_note %tablature #4 pitch=Bb, 60 0 63 tw_head tw_note %tablature #5 pitch=F, 35 0 63 tw_head tw_note %tablature #6 pitch=G, 35 0 63 tw_head tw_note %tablature #7 pitch=A, 35 0 63 tw_head tw_note % galoubet %tablature #3 pitch=C 30 0 60 gbl_tete gbl_note tablature #4 pitch=B,b 50 0 60 gbl_tete gbl_note tablature #5 pitch=G, 30 0 54 pt_tete pt_note tablature #6 pitch=C 30 0 46 gblc_tete gblc_note �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������abcm2ps-7.8.9/format.c������������������������������������������������������������������������������0000644�0001750�0001750�00000100251�12321162655�012616� 0����������������������������������������������������������������������������������������������������ustar �jef�����������������������������jef��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Formatting functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2014 Jean-François Moine * Adapted from abc2ps, Copyright (C) 1996,1997 Michael Methfessel * * 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include #include #include #include "abc2ps.h" struct FORMAT cfmt; /* current format for output */ char *fontnames[MAXFONTS]; /* list of font names */ static char font_enc[MAXFONTS]; /* font encoding */ static char def_font_enc[MAXFONTS]; /* default font encoding */ static char used_font[MAXFONTS]; /* used fonts */ static float swfac_font[MAXFONTS]; /* width scale */ static int nfontnames; static float staffwidth; /* format table */ static struct format { char *name; void *v; char type; #define FORMAT_I 0 /* int */ #define FORMAT_R 1 /* float */ #define FORMAT_F 2 /* font spec */ #define FORMAT_U 3 /* float with unit */ #define FORMAT_B 4 /* boolean */ #define FORMAT_S 5 /* string */ char subtype; /* special cases - see code */ short lock; } format_tb[] = { {"abc2pscompat", &cfmt.abc2pscompat, FORMAT_B, 3}, {"alignbars", &cfmt.alignbars, FORMAT_I, 0}, {"aligncomposer", &cfmt.aligncomposer, FORMAT_I, 0}, {"autoclef", &cfmt.autoclef, FORMAT_B, 0}, {"annotationfont", &cfmt.font_tb[ANNOTATIONFONT], FORMAT_F, 0}, {"barsperstaff", &cfmt.barsperstaff, FORMAT_I, 0}, {"bgcolor", &cfmt.bgcolor, FORMAT_S, 0}, {"botmargin", &cfmt.botmargin, FORMAT_U, 0}, {"breaklimit", &cfmt.breaklimit, FORMAT_R, 3}, {"breakoneoln", &cfmt.breakoneoln, FORMAT_B, 0}, {"bstemdown", &cfmt.bstemdown, FORMAT_B, 0}, {"cancelkey", &cfmt.cancelkey, FORMAT_B, 0}, {"combinevoices", &cfmt.combinevoices, FORMAT_I, 0}, {"composerfont", &cfmt.font_tb[COMPOSERFONT], FORMAT_F, 0}, {"composerspace", &cfmt.composerspace, FORMAT_U, 0}, {"contbarnb", &cfmt.contbarnb, FORMAT_B, 0}, {"continueall", &cfmt.continueall, FORMAT_B, 0}, {"custos", &cfmt.custos, FORMAT_B, 0}, {"dateformat", &cfmt.dateformat, FORMAT_S, 0}, {"dblrepbar", &cfmt.dblrepbar, FORMAT_I, 2}, {"dynalign", &cfmt.dynalign, FORMAT_B, 0}, {"footer", &cfmt.footer, FORMAT_S, 0}, {"footerfont", &cfmt.font_tb[FOOTERFONT], FORMAT_F, 0}, {"flatbeams", &cfmt.flatbeams, FORMAT_B, 0}, {"gchordbox", &cfmt.gchordbox, FORMAT_B, 0}, {"gchordfont", &cfmt.font_tb[GCHORDFONT], FORMAT_F, 3}, {"graceslurs", &cfmt.graceslurs, FORMAT_B, 0}, {"gracespace", &cfmt.gracespace, FORMAT_I, 5}, {"header", &cfmt.header, FORMAT_S, 0}, {"headerfont", &cfmt.font_tb[HEADERFONT], FORMAT_F, 0}, {"historyfont", &cfmt.font_tb[HISTORYFONT], FORMAT_F, 0}, {"hyphencont", &cfmt.hyphencont, FORMAT_B, 0}, {"indent", &cfmt.indent, FORMAT_U, 0}, {"infofont", &cfmt.font_tb[INFOFONT], FORMAT_F, 0}, {"infoline", &cfmt.infoline, FORMAT_B, 0}, {"infospace", &cfmt.infospace, FORMAT_U, 0}, {"keywarn", &cfmt.keywarn, FORMAT_B, 0}, {"landscape", &cfmt.landscape, FORMAT_B, 0}, {"leftmargin", &cfmt.leftmargin, FORMAT_U, 0}, {"lineskipfac", &cfmt.lineskipfac, FORMAT_R, 0}, {"linewarn", &cfmt.linewarn, FORMAT_B, 0}, {"maxshrink", &cfmt.maxshrink, FORMAT_R, 2}, {"maxstaffsep", &cfmt.maxstaffsep, FORMAT_U, 0}, {"maxsysstaffsep", &cfmt.maxsysstaffsep, FORMAT_U, 0}, {"measurebox", &cfmt.measurebox, FORMAT_B, 0}, {"measurefirst", &cfmt.measurefirst, FORMAT_I, 0}, {"measurefont", &cfmt.font_tb[MEASUREFONT], FORMAT_F, 2}, {"measurenb", &cfmt.measurenb, FORMAT_I, 0}, {"micronewps", &cfmt.micronewps, FORMAT_B, 0}, {"microscale", &cfmt.microscale, FORMAT_I, 0}, {"musicspace", &cfmt.musicspace, FORMAT_U, 0}, {"notespacingfactor", &cfmt.notespacingfactor, FORMAT_R, 1}, {"oneperpage", &cfmt.oneperpage, FORMAT_B, 0}, {"pageheight", &cfmt.pageheight, FORMAT_U, 0}, {"pagewidth", &cfmt.pagewidth, FORMAT_U, 0}, #ifdef HAVE_PANGO {"pango", &cfmt.pango, FORMAT_B, 2}, #endif {"parskipfac", &cfmt.parskipfac, FORMAT_R, 0}, {"partsbox", &cfmt.partsbox, FORMAT_B, 0}, {"partsfont", &cfmt.font_tb[PARTSFONT], FORMAT_F, 1}, {"partsspace", &cfmt.partsspace, FORMAT_U, 0}, {"pdfmark", &cfmt.pdfmark, FORMAT_I, 0}, {"repeatfont", &cfmt.font_tb[REPEATFONT], FORMAT_F, 0}, {"rightmargin", &cfmt.rightmargin, FORMAT_U, 0}, {"scale", &cfmt.scale, FORMAT_R, 0}, {"setdefl", &cfmt.setdefl, FORMAT_B, 0}, {"setfont-1", &cfmt.font_tb[1], FORMAT_F, 0}, {"setfont-2", &cfmt.font_tb[2], FORMAT_F, 0}, {"setfont-3", &cfmt.font_tb[3], FORMAT_F, 0}, {"setfont-4", &cfmt.font_tb[4], FORMAT_F, 0}, #if FONT_UMAX!=5 # error Bad number of user fonts #endif // {"shifthnote", &cfmt.shiftunison, FORMAT_B, 0}, /*to remove*/ {"shiftunison", &cfmt.shiftunison, FORMAT_I, 0}, {"shiftunisson", &cfmt.shiftunison, FORMAT_I, 0}, /*to remove*/ {"slurheight", &cfmt.slurheight, FORMAT_R, 0}, {"splittune", &cfmt.splittune, FORMAT_B, 0}, {"squarebreve", &cfmt.squarebreve, FORMAT_B, 0}, {"staffnonote", &cfmt.staffnonote, FORMAT_I, 0}, {"staffsep", &cfmt.staffsep, FORMAT_U, 0}, {"staffwidth", &staffwidth, FORMAT_U, 1}, {"stemheight", &cfmt.stemheight, FORMAT_R, 0}, {"straightflags", &cfmt.straightflags, FORMAT_B, 0}, {"stretchlast", &cfmt.stretchlast, FORMAT_R, 2}, {"stretchstaff", &cfmt.stretchstaff, FORMAT_B, 0}, {"subtitlefont", &cfmt.font_tb[SUBTITLEFONT], FORMAT_F, 0}, {"subtitlespace", &cfmt.subtitlespace, FORMAT_U, 0}, {"sysstaffsep", &cfmt.sysstaffsep, FORMAT_U, 0}, {"tempofont", &cfmt.font_tb[TEMPOFONT], FORMAT_F, 0}, {"textfont", &cfmt.font_tb[TEXTFONT], FORMAT_F, 0}, {"textoption", &cfmt.textoption, FORMAT_I, 4}, {"textspace", &cfmt.textspace, FORMAT_U, 0}, {"titlecaps", &cfmt.titlecaps, FORMAT_B, 0}, {"titlefont", &cfmt.font_tb[TITLEFONT], FORMAT_F, 0}, {"titleformat", &cfmt.titleformat, FORMAT_S, 0}, {"titleleft", &cfmt.titleleft, FORMAT_B, 0}, {"titlespace", &cfmt.titlespace, FORMAT_U, 0}, {"titletrim", &cfmt.titletrim, FORMAT_B, 0}, {"timewarn", &cfmt.timewarn, FORMAT_B, 0}, {"topmargin", &cfmt.topmargin, FORMAT_U, 0}, {"topspace", &cfmt.topspace, FORMAT_U, 0}, {"transpose", &cfmt.transpose, FORMAT_I, 1}, {"tuplets", &cfmt.tuplets, FORMAT_I, 3}, {"vocalfont", &cfmt.font_tb[VOCALFONT], FORMAT_F, 0}, {"vocalspace", &cfmt.vocalspace, FORMAT_U, 0}, {"voicefont", &cfmt.font_tb[VOICEFONT], FORMAT_F, 0}, {"wordsfont", &cfmt.font_tb[WORDSFONT], FORMAT_F, 0}, {"wordsspace", &cfmt.wordsspace, FORMAT_U, 0}, {"writefields", &cfmt.fields, FORMAT_B, 1}, {0, 0, 0, 0} /* end of table */ }; /* -- search a font and add it if not yet defined -- */ static int get_font(char *fname, int encoding) { int fnum; /* get or set the default encoding */ for (fnum = nfontnames; --fnum >= 0; ) if (strcmp(fname, fontnames[fnum]) == 0) { if (encoding < 0) encoding = def_font_enc[fnum]; if (encoding == font_enc[fnum]) return fnum; /* font found */ break; } while (--fnum >= 0) { if (strcmp(fname, fontnames[fnum]) == 0 && encoding == font_enc[fnum]) return fnum; } /* add the font */ if (nfontnames >= MAXFONTS) { error(1, NULL, "Too many fonts"); return 0; } if (file_initialized> 0 && (epsf <= 1 && !svg)) error(1, NULL, "Cannot have a new font when the output file is opened"); fnum = nfontnames++; fontnames[fnum] = strdup(fname); if (encoding < 0) encoding = 0; font_enc[fnum] = encoding; return fnum; } /* -- set a dynamic font -- */ static int dfont_set(struct FONTSPEC *f) { int i; for (i = FONT_DYN; i < cfmt.ndfont; i++) { if (cfmt.font_tb[i].fnum == f->fnum && cfmt.font_tb[i].size == f->size) return i; } if (i >= FONT_MAX - 1) { error(1, NULL, "Too many dynamic fonts"); return FONT_MAX - 1; } memcpy(&cfmt.font_tb[i], f, sizeof cfmt.font_tb[0]); cfmt.ndfont = i + 1; return i; } /* -- define a font -- */ static void fontspec(struct FONTSPEC *f, char *name, int encoding, float size) { if (name) f->fnum = get_font(name, encoding); else name = fontnames[f->fnum]; f->size = size; f->swfac = size; if (swfac_font[f->fnum] != 0) { f->swfac *= swfac_font[f->fnum]; } else if (strncmp(name, "Times", 5) == 0) { if (strcmp(name, "Times-Bold") == 0) f->swfac *= 1.05; } else if (strcmp(name, "Helvetica-Bold") == 0) { f->swfac *= 1.15; } else if (strncmp(name, "Helvetica", 9) == 0 || strncmp(name, "Palatino", 8) == 0) { f->swfac *= 1.10; } else if (strncmp(name, "Courier", 7) == 0) { f->swfac *= 1.35; } else { f->swfac *= 1.2; /* unknown font */ } if (f == &cfmt.font_tb[GCHORDFONT]) cfmt.gcf = dfont_set(f); else if (f == &cfmt.font_tb[ANNOTATIONFONT]) cfmt.anf = dfont_set(f); else if (f == &cfmt.font_tb[VOCALFONT]) cfmt.vof = dfont_set(f); } /* -- output the font definitions with their encodings -- */ /* This output must occurs after user PostScript definitions because * these ones may change the default behaviour */ void define_fonts(void) { int i; static char *mkfont = "/mkfont{findfont dup length 1 add dict begin\n" " {1 index/FID ne{def}{pop pop}ifelse}forall\n" " CharStrings/double_sharp known not{\n" " /CharStrings CharStrings dup length dict copy def\n" " CharStrings/sharp{pop 460 0 setcharwidth usharp ufill}bind put\n" " CharStrings/flat{pop 460 0 setcharwidth uflat ufill}bind put\n" " CharStrings/natural{pop 400 0 setcharwidth unat ufill}bind put\n" " CharStrings/double_sharp{pop 460 0 setcharwidth udblesharp ufill}bind put\n" " CharStrings/double_flat{pop 500 0 setcharwidth udbleflat ufill}bind put\n" " }if currentdict definefont pop end}!\n"; fputs(mkfont, fout); make_font_list(); for (i = 0; i < nfontnames; i++) { if (used_font[i]) define_font(fontnames[i], i, font_enc[i]); } } /* -- mark the used fonts -- */ void make_font_list(void) { struct FORMAT *f; int i; f = &cfmt; for (i = FONT_UMAX; i < FONT_DYN; i++) used_font[f->font_tb[i].fnum] = 1; } /* -- set the name of an information header type -- */ /* the argument is * [ ] * this information is kept in the 'I' information */ static void set_infoname(char *p) { struct SYMBOL *s, *prev; if (*p == 'I') return; s = info['I' - 'A']; prev = NULL; while (s) { if (s->as.text[0] == *p) break; prev = s; s = s->next; } if (p[1] == '\0') { /* if delete */ if (s) { if (!prev) info['I' - 'A'] = s->next; else if ((prev->next = s->next) != 0) prev->next->prev = prev; } return; } if (!s) { s = (struct SYMBOL *) getarena(sizeof *s); memset(s, 0, sizeof *s); if (!prev) info['I' - 'A'] = s; else { prev->next = s; s->prev = prev; } } s->as.text = (char *) getarena(strlen(p) + 1); strcpy(s->as.text, p); } /* -- set the default format -- */ /* this function is called only once, at abcm2ps startup time */ void set_format(void) { struct FORMAT *f; f = &cfmt; memset(f, 0, sizeof *f); f->pageheight = PAGEHEIGHT; f->pagewidth = PAGEWIDTH; f->leftmargin = MARGIN; f->rightmargin = MARGIN; f->topmargin = 1.0 CM; f->botmargin = 1.0 CM; f->topspace = 0.8 CM; f->titlespace = 0.2 CM; f->subtitlespace = 0.1 CM; f->composerspace = 0.2 CM; f->musicspace = 0.2 CM; f->partsspace = 0.3 CM; f->staffsep = 46.0 PT; f->sysstaffsep = 34.0 PT; f->maxstaffsep = 2000.0 PT; f->maxsysstaffsep = 2000.0 PT; f->vocalspace = 23.0 PT; f->textspace = 0.5 CM; f->scale = 0.75; f->slurheight = 1.0; f->maxshrink = 0.65; f->breaklimit = 0.7; f->stretchlast = 0.2; f->stretchstaff = 1; f->graceslurs = 1; f->hyphencont = 1; f->lineskipfac = 1.1; f->parskipfac = 0.4; f->measurenb = -1; f->measurefirst = 1; f->autoclef = 1; f->breakoneoln = 1; f->dblrepbar = (B_COL << 12) + (B_CBRA << 8) + (B_OBRA << 4) + B_COL; f->dynalign = 1; f->keywarn = 1; f->linewarn = 1; #ifdef HAVE_PANGO if (!svg && epsf <= 1) f->pango = 1; else lock_fmt(&cfmt.pango); /* SVG output does not use panga */ #endif f->staffnonote = 1; f->titletrim = 1; f->aligncomposer = A_RIGHT; f->notespacingfactor = 1.414; f->stemheight = STEM; #ifndef WIN32 f->dateformat = strdup("%b %e, %Y %H:%M"); #else f->dateformat = strdup("%b %#d, %Y %H:%M"); #endif f->gracespace = (65 << 16) | (80 << 8) | 120; /* left-inside-right - unit 1/10 pt */ f->textoption = T_LEFT; f->ndfont = FONT_DYN; fontspec(&f->font_tb[ANNOTATIONFONT], "Helvetica", 0, 12.0); fontspec(&f->font_tb[COMPOSERFONT], "Times-Italic", 0, 14.0); fontspec(&f->font_tb[FOOTERFONT], "Times-Roman", 0, 12.0); /* not scaled */ fontspec(&f->font_tb[GCHORDFONT], "Helvetica", 0, 12.0); fontspec(&f->font_tb[HEADERFONT], "Times-Roman", 0, 12.0); /* not scaled */ fontspec(&f->font_tb[HISTORYFONT], "Times-Roman", 0, 16.0); fontspec(&f->font_tb[INFOFONT], "Times-Italic", 0, 14.0); /* same as composer by default */ fontspec(&f->font_tb[MEASUREFONT], "Times-Italic", 0, 14.0); fontspec(&f->font_tb[PARTSFONT], "Times-Roman", 0, 15.0); fontspec(&f->font_tb[REPEATFONT], "Times-Roman", 0, 13.0); fontspec(&f->font_tb[SUBTITLEFONT], "Times-Roman", 0, 16.0); fontspec(&f->font_tb[TEMPOFONT], "Times-Bold", 0, 15.0); fontspec(&f->font_tb[TEXTFONT], "Times-Roman", 0, 16.0); fontspec(&f->font_tb[TITLEFONT], "Times-Roman", 0, 20.0); fontspec(&f->font_tb[VOCALFONT], "Times-Bold", 0, 13.0); fontspec(&f->font_tb[VOICEFONT], "Times-Bold", 0, 13.0); fontspec(&f->font_tb[WORDSFONT], "Times-Roman", 0, 16.0); f->fields[0] = (1 << ('C' - 'A')) | (1 << ('M' - 'A')) | (1 << ('O' - 'A')) | (1 << ('P' - 'A')) | (1 << ('Q' - 'A')) | (1 << ('T' - 'A')) | (1 << ('W' - 'A')); f->fields[1] = (1 << ('w' - 'a')); set_infoname("R \"Rhythm: \""); set_infoname("B \"Book: \""); set_infoname("S \"Source: \""); set_infoname("D \"Discography: \""); set_infoname("N \"Notes: \""); set_infoname("Z \"Transcription: \""); set_infoname("H \"History: \""); } /* -- print the current format -- */ void print_format(void) { struct format *fd; static char *yn[2] = {"no","yes"}; for (fd = format_tb; fd->name; fd++) { printf("%-15s ", fd->name); switch (fd->type) { case FORMAT_B: switch (fd->subtype) { #ifdef HAVE_PANGO case 2: /* pango = 0, 1 or 2 */ if (cfmt.pango == 2) { printf("2\n"); break; } /* fall thru */ #endif default: case 0: printf("%s\n", yn[*((int *) fd->v)]); break; case 1: { /* writefields */ int i; for (i = 0; i < 32; i++) { if (cfmt.fields[0] & (1 << i)) printf("%c", (char) ('A' + i)); if (cfmt.fields[1] & (1 << i)) printf("%c", (char) ('a' + i)); } printf("\n"); break; } } break; case FORMAT_I: switch (fd->subtype) { default: printf("%d\n", *((int *) fd->v)); break; case 1: { /* transpose */ int t; t = *((int *) fd->v); if (t >= 0) putchar('+'); printf("%d", t / 3); switch ((t + 240) % 3) { case 1: putchar('#'); break; case 2: putchar('b'); break; } putchar('\n'); break; } case 2: { /* dblrepbar */ int v; char tmp[16], *p; p = &tmp[sizeof tmp - 1]; *p = '\0'; for (v = cfmt.dblrepbar; v != 0; v >>= 4) { switch (v & 0x0f) { case B_BAR: *--p = '|'; break; case B_OBRA: *--p = '['; break; case B_CBRA: *--p = ']'; break; default: // case B_COL: *--p = ':'; break; } } printf("%s\n", p); break; } case 3: /* tuplets */ printf("%d %d %d\n", cfmt.tuplets >> 8, (cfmt.tuplets >> 4) & 0x0f, cfmt.tuplets & 0x0f); break; // case 4: /* textoption */ // break; case 5: /* gracespace */ printf("%d.%d %d.%d %d.%d\n", (cfmt.gracespace >> 16) / 10, (cfmt.gracespace >> 16) % 10, ((cfmt.gracespace >> 8) & 0xff) / 10, ((cfmt.gracespace >> 8) & 0xff) % 10, (cfmt.gracespace & 0xff) / 10, (cfmt.gracespace & 0xff) % 10); break; } break; case FORMAT_R: printf("%.2f\n", *((float *) fd->v)); break; case FORMAT_F: { struct FONTSPEC *s; s = (struct FONTSPEC *) fd->v; printf("%s", fontnames[s->fnum]); printf(" %s", font_enc[s->fnum] ? "native" : "utf-8"); printf(" %.1f", s->size); if ((fd->subtype == 1 && cfmt.partsbox) || (fd->subtype == 2 && cfmt.measurebox) || (fd->subtype == 3 && cfmt.gchordbox)) printf(" box"); printf("\n"); break; } case FORMAT_U: if (fd->subtype == 0) printf("%.2fcm\n", *((float *) fd->v) / (1 CM)); else printf("%.2fcm\n", (cfmt.pagewidth - cfmt.leftmargin - cfmt.rightmargin) / (1 CM)); break; case FORMAT_S: printf("\"%s\"\n", *((char **) fd->v) != 0 ? *((char **) fd->v) : ""); break; } } } /* -- get an encoding -- */ static int parse_encoding(char *p) { return strncasecmp(p, "native", 6) == 0; } /* -- get a position -- */ static int get_posit(char *p) { if (strcmp(p, "up") == 0 || strcmp(p, "above") == 0) return SL_ABOVE; if (strcmp(p, "down") == 0 || strcmp(p, "below") == 0) return SL_BELOW; if (strcmp(p, "hidden") == 0 || strcmp(p, "opposite") == 0) return SL_HIDDEN; return 0; /* auto (!= SL_AUTO) */ } /* -- get the option for text -- */ int get_textopt(char *p) { if (*p == '\0' || strncmp(p, "obeylines", 9) == 0) return T_LEFT; if (strncmp(p, "align", 5) == 0 || strncmp(p, "justify", 7) == 0) return T_JUSTIFY; if (strncmp(p, "ragged", 6) == 0 || strncmp(p, "fill", 4) == 0) return T_FILL; if (strncmp(p, "center", 6) == 0) return T_CENTER; if (strncmp(p, "skip", 4) == 0) return T_SKIP; if (strncmp(p, "right", 5) == 0) return T_RIGHT; return -1; } /* -- get the double repeat bar -- */ static int get_dblrepbar(char *p) { int bar_type; bar_type = 0; for (;;) { switch (*p++) { case '|': bar_type <<= 4; bar_type |= B_BAR; continue; case '[': bar_type <<= 4; bar_type |= B_OBRA; continue; case ']': bar_type <<= 4; bar_type |= B_CBRA; continue; case ':': bar_type <<= 4; bar_type |= B_COL; continue; default: break; } break; } return bar_type; } /* -- get a boolean value -- */ static int g_logv(char *p) { switch (*p) { case '\0': case '1': case 'y': case 'Y': case 't': case 'T': return 1; case '0': case 'n': case 'N': case 'f': case 'F': break; default: error(0, NULL, "Unknown logical '%s' - false assumed", p); break; } return 0; } /* -- get a font specifier -- */ static void g_fspc(char *p, struct FONTSPEC *f) { char fname[80]; int encoding; float fsize; p = get_str(fname, p, sizeof fname); if (isalpha((unsigned char) *p) || *p == '*') { if (*p == '*') encoding = font_enc[f->fnum]; else encoding = parse_encoding(p); while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; } else { encoding = -1; } fsize = f->size; if (*p != '\0' && *p != '*') { char *q; float v; v = strtod(p, &q); if (v <= 0 || (*q != '\0' && *q != ' ')) error(1, NULL, "Bad font size '%s'", p); else fsize = v; } fontspec(f, strcmp(fname, "*") != 0 ? fname : 0, encoding, fsize); if (file_initialized <= 0) used_font[f->fnum] = 1; if (f - cfmt.font_tb == outft) outft = -1; #ifdef HAVE_PANGO pg_reset_font(); #endif } /* -- parse a 'tablature' definition -- */ /* %%tablature * [#] * [pitch= # | b)>] * [[
] * ] * * * * [] */ struct tblt_s *tblt_parse(char *p) { struct tblt_s *tblt; int n; char *q; static char notes_tb[] = "CDEFGABcdefgab"; static char pitch_tb[14] = {60, 62, 64, 65, 67, 69, 71, 72, 74, 76, 77, 79, 81, 83}; /* number */ if (*p == '#') { p++; n = *p++ - '0' - 1; if ((unsigned) n >= MAXTBLT || (*p != '\0' && *p != ' ')) { error(1, NULL, "Invalid number in %%%%tablature"); return 0; } if (*p == '\0') return tblts[n]; while (isspace((unsigned char) *p)) p++; } else { n = -1; } /* pitch */ tblt = malloc(sizeof *tblt); memset(tblt, 0, sizeof *tblt); if (strncmp(p, "pitch=", 6) == 0) { p += 6; if (*p == '^' || *p == '_') { if (*p == '^') { tblt->pitch++; tblt->instr[1] = '#'; } else { tblt->pitch--; tblt->instr[1] = 'b'; } p++; } if (*p == '\0' || (q = strchr(notes_tb, *p)) == NULL) { error(1, NULL, "Invalid pitch in %%%%tablature"); return 0; } tblt->pitch += pitch_tb[q - notes_tb]; tblt->instr[0] = toupper(*p++); while (*p == '\'' || *p == ',') { if (*p++ == '\'') tblt->pitch += 12; else tblt->pitch -= 12; } if (*p == '#' || *p == 'b') { if (*p == '#') tblt->pitch++; else tblt->pitch--; tblt->instr[1] = *p++; } while (*p == '\'' || *p == ',') { if (*p++ == '\'') tblt->pitch += 12; else tblt->pitch -= 12; } while (isspace((unsigned char) *p)) p++; } /* width and heights */ if (!isdigit(*p)) { error(1, NULL, "Invalid width/height in %%%%tablature"); return 0; } tblt->hu = scan_u(p); while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; if (isdigit(*p)) { tblt->ha = tblt->hu; tblt->hu = scan_u(p); while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; if (isdigit(*p)) { tblt->wh = tblt->ha; tblt->ha = tblt->hu; tblt->hu = scan_u(p); while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; } } if (*p == '\0') goto err; /* PS functions */ p = strdup(p); tblt->head = p; while (*p != '\0' && !isspace((unsigned char) *p)) p++; if (*p == '\0') goto err; *p++ = '\0'; while (isspace((unsigned char) *p)) p++; tblt->note = p; while (*p != '\0' && !isspace((unsigned char) *p)) p++; if (*p != '\0') { *p++ = '\0'; while (isspace((unsigned char) *p)) p++; tblt->bar = p; while (*p != '\0' && !isspace((unsigned char) *p)) p++; if (*p != '\0') goto err; } /* memorize the definition */ if (n >= 0) tblts[n] = tblt; return tblt; err: error(1, NULL, "Wrong values in %%%%tablature"); return 0; } /* functions to set a voice parameter */ #define F_SET_PAR(param) \ static void set_ ## param(struct VOICE_S *p_voice, int val)\ {\ p_voice->posit.param = val;\ } F_SET_PAR(dyn) F_SET_PAR(gch) F_SET_PAR(orn) F_SET_PAR(voc) F_SET_PAR(vol) F_SET_PAR(std) F_SET_PAR(gsd) struct vpar { char *name; void (*f)(struct VOICE_S *p_voice, int val); int max; }; static const struct vpar vpar_tb[] = { {"dynamic", set_dyn, 3}, /* 0 */ {"gchord", set_gch, 3}, /* 1 */ {"gstemdir", set_gsd, 3}, /* 2 */ {"ornament", set_orn, 3}, /* 3 */ {"stemdir", set_std, 2}, /* 4 */ {"vocal", set_voc, 3}, /* 5 */ {"volume", set_vol, 3}, /* 6 */ {} }; /* -- set a voice parameter -- */ void set_voice_param(struct VOICE_S *p_voice, /* current voice */ int state, /* tune state */ char *w, /* keyword */ char *p) /* argument */ { const struct vpar *vpar, *vpar2 = NULL; int i, val; for (vpar = vpar_tb; vpar->name; vpar++) { if (strcmp(w, vpar->name)) continue; if (!isdigit(*p)) val = get_posit(p); else val = strtod(p, 0); if ((unsigned) val > vpar->max) goto err; break; } if (!vpar->name) { /* compatibility with previous versions */ val = -1; switch (*w) { case 'e': if (strcmp(w, "exprabove") == 0) { vpar = &vpar[0]; /* dyn */ vpar2 = &vpar[6]; /* vol */ if (g_logv(p)) val = SL_ABOVE; else val = SL_BELOW; break; } if (strcmp(w, "exprbelow") == 0) { vpar = &vpar[0]; /* dyn */ vpar2 = &vpar[6]; /* vol */ if (g_logv(p)) val = SL_BELOW; else val = SL_ABOVE; break; } break; case 'v': if (strcmp(w, "vocalabove") == 0) { /* compatibility */ vpar = &vpar[5]; /* voc */ if (g_logv(p)) val = SL_ABOVE; else val = SL_BELOW; break; } break; } if (val < 0) goto err; } if (state == ABC_S_TUNE) { vpar->f(p_voice, val); if (vpar2) vpar2->f(p_voice, val); return; } for (i = MAXVOICE, p_voice = voice_tb; /* global */ --i >= 0; p_voice++) { vpar->f(p_voice, val); if (vpar2) vpar2->f(p_voice, val); } cfmt.posit = voice_tb[0].posit; return; err: error(1, NULL, "Bad value %%%%%s %s", w, p); } /* -- parse a format line -- */ void interpret_fmt_line(char *w, /* keyword */ char *p, /* argument */ int lock) { struct format *fd; switch (*w) { case 'b': if (strcmp(w, "barnumbers") == 0) /* compatibility */ w = "measurenb"; break; case 'c': if (strcmp(w, "comball") == 0) { /* compatibility */ cfmt.combinevoices = 2; return; } break; case 'f': if (strcmp(w, "font") == 0) { int i, fnum, encoding; float swfac; char fname[80]; if (file_initialized > 0 && !svg && epsf <= 1) { /* PS */ error(1, NULL, "Cannot define a font when the output file is opened"); return; } p = get_str(fname, p, sizeof fname); swfac = 0; /* defaults to 1.2 */ encoding = 0; if (*p != '\0') { if (isalpha((unsigned char) *p)) { encoding = parse_encoding(p); while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; } if (isdigit((unsigned char) *p)) { char *q; float v; v = strtod(p, &q); if (v > 2 || (*q != '\0' && *q != '\0')) goto bad; swfac = v; } } fnum = get_font(fname, encoding); def_font_enc[fnum] = encoding; swfac_font[fnum] = swfac; used_font[fnum] = 1; for (i = FONT_UMAX; i < FONT_MAX; i++) { if (cfmt.font_tb[i].fnum == fnum) cfmt.font_tb[i].swfac = cfmt.font_tb[i].size * swfac; } return; } break; case 'i': if (strcmp(w, "infoname") == 0) { if (*p < 'A' || *p > 'Z') goto bad; set_infoname(p); return; } break; case 'm': if (strcmp(w, "musiconly") == 0) { /* compatibility */ if (g_logv(p)) cfmt.fields[1] &= ~(1 << ('w' - 'a')); else cfmt.fields[1] |= (1 << ('w' - 'a')); return; } break; case 'p': if (strcmp(w, "printparts") == 0) { /* compatibility */ if (g_logv(p)) cfmt.fields[0] |= (1 << ('P' - 'A')); else cfmt.fields[0] &= ~(1 << ('P' - 'A')); return; } if (strcmp(w, "printtempo") == 0) { /* compatibility */ if (g_logv(p)) cfmt.fields[0] |= (1 << ('Q' - 'A')); else cfmt.fields[0] &= ~(1 << ('Q' - 'A')); return; } break; case 'w': if (strcmp(w, "withxrefs") == 0) { /* compatibility */ if (g_logv(p)) cfmt.fields[0] |= (1 << ('X' - 'A')); else cfmt.fields[0] &= ~(1 << ('X' - 'A')); return; } if (strcmp(w, "writehistory") == 0) { /* compatibility */ struct SYMBOL *s; int bool; unsigned u; bool = g_logv(p); for (s = info['I' - 'A']; s != 0; s = s->next) { u = s->as.text[0] - 'A'; if (bool) cfmt.fields[0] |= (1 << u); else cfmt.fields[0] &= ~(1 << u); } return; } break; } for (fd = format_tb; fd->name; fd++) if (strcmp(w, fd->name) == 0) break; if (fd->name == 0) return; { int l; l = strlen(p); if (strcmp(p + l - 5, " lock") == 0) { p[l - 5] = '\0'; lock = 1; } } if (lock) fd->lock = 1; else if (fd->lock) return; switch (fd->type) { case FORMAT_B: switch (fd->subtype) { #ifdef HAVE_PANGO case 2: /* %%pango = 0, 1 or 2 */ if (*p == '2') { cfmt.pango = 2; break; } /* fall thru */ #endif default: case 0: case 3: /* %%abc2pscompat */ *((int *) fd->v) = g_logv(p); if (fd->subtype == 3) { if (cfmt.abc2pscompat) deco['M'] = deco_define("tenuto"); else deco['M'] = deco_define("lowermordent"); } break; case 1: { /* %%writefields */ char *q; int bool, i; unsigned u; q = p; while (*p != '\0' && !isspace((unsigned char) *p)) p++; while (isspace((unsigned char) *p)) p++; bool = g_logv(p); while (*q != '\0' && !isspace((unsigned char) *q)) { u = *q - 'A'; if (u < 26) { i = 0; } else { u = *q - 'a'; if (u < 26) i = 1; else break; /*fixme: error */ } if (bool) cfmt.fields[i] |= (1 << u); else cfmt.fields[i] &= ~(1 << u); q++; } break; } } break; case FORMAT_I: if (fd->subtype == 3) { /* tuplets */ unsigned i1, i2, i3; if (sscanf(p, "%d %d %d", &i1, &i2, &i3) != 3 || i1 > 2 || i2 > 2 || i3 > 2) goto bad; cfmt.tuplets = (i1 << 8) | (i2 << 4) | i3; break; } if (fd->subtype == 5) { /* gracespace */ unsigned i1, i2, i3; float f1, f2, f3; if (sscanf(p, "%f %f %f", &f1, &f2, &f3) != 3 || f1 > 256 || f2 > 256 || f3 > 256) goto bad; i1 = f2 * 10; i2 = f2 * 10; i3 = f3 * 10; cfmt.gracespace = (i1 << 16) | (i2 << 8) | i3; break; } if (fd->subtype == 4 && !isdigit(*p)) /* textoption */ cfmt.textoption = get_textopt(p); else if (fd->subtype == 2) /* dblrepbar */ cfmt.dblrepbar = get_dblrepbar(p); else if (isdigit(*p) || *p == '-' || *p == '+') sscanf(p, "%d", (int *) fd->v); else *((int *) fd->v) = g_logv(p); switch (fd->subtype) { case 1: /* transpose */ cfmt.transpose *= 3; if (p[strlen(p) - 1] == '#') { if (cfmt.transpose > 0) cfmt.transpose++; else cfmt.transpose -= 2; } else if (p[strlen(p) - 1] == 'b') { if (cfmt.transpose > 0) cfmt.transpose += 2; else cfmt.transpose--; } break; // case 2: /* (free) */ // break; case 4: /* textoption */ if (cfmt.textoption < 0) goto bad; break; } break; case FORMAT_R: { char *q; int i; float v; v = strtod(p, &q); if (*q != '\0' && *q != ' ') goto bad; switch (fd->subtype) { default: if (v <= 0) goto bad; break; case 1: { /* note spacing factor */ float v2; if (v < 1 || v > 2) goto bad; i = C_XFLAGS; /* crotchet index */ v2 = space_tb[i]; for ( ; --i >= 0; ) { v2 /= v; space_tb[i] = v2; } i = C_XFLAGS; v2 = space_tb[i]; for ( ; ++i < NFLAGS_SZ; ) { v2 *= v; space_tb[i] = v2; } break; } case 2: /* maxshrink / stretchlast */ if (v < 0 || v > 1) goto bad; break; case 3: /* breaklimit */ if (v < 0.5 || v > 1) goto bad; break; } *((float *) fd->v) = v; break; } case FORMAT_F: { int b; g_fspc(p, (struct FONTSPEC *) fd->v); b = strstr(p, "box") != NULL; switch (fd->subtype) { case 1: cfmt.partsbox = b; break; case 2: cfmt.measurebox = b; break; case 3: cfmt.gchordbox = b; break; } break; } case FORMAT_U: *((float *) fd->v) = scan_u(p); if (fd->subtype == 1) { float rmargin; rmargin = (cfmt.landscape ? cfmt.pageheight : cfmt.pagewidth) - staffwidth - cfmt.leftmargin; if (rmargin < 0) error(1, NULL, "'staffwidth' too big\n"); cfmt.rightmargin = rmargin; } break; case FORMAT_S: { int l; l = strlen(p) + 1; *((char **) fd->v) = getarena(l); if (*p == '"') get_str(*((char **) fd->v), p, l); else strcpy(*((char **) fd->v), p); break; } } return; bad: error(1, NULL, "Bad value '%s' for '%s' - ignored", p, w); } /* -- lock a format -- */ void lock_fmt(void *fmt) { struct format *fd; for (fd = format_tb; fd->name; fd++) if (fd->v == fmt) break; if (fd->name == 0) return; fd->lock = 1; } /* -- start a new font -- */ void set_font(int ft) { int fnum; struct FONTSPEC *f, *f2; if (ft == outft) return; f = &cfmt.font_tb[ft]; if (outft >= 0) { f2 = &cfmt.font_tb[outft]; outft = ft; fnum = f->fnum; if (fnum == f2->fnum && f->size == f2->size) return; } else { outft = ft; fnum = f->fnum; } if (!used_font[fnum] && epsf <= 1 && !svg) { /* (not usefull for svg output) */ if (file_initialized <= 0) { used_font[fnum] = 1; } else { error(1, NULL, "Font '%s' not predefined; using first in list", fontnames[fnum]); fnum = 0; } } if (f->size == 0) { error(0, NULL, "Font '%s' with a null size - set to 8", fontnames[fnum]); f->size = 8; } a2b("%.1f F%d ", f->size, fnum); } /* -- get the encoding of a font -- */ int get_font_encoding(int ft) { return font_enc[ft]; } abcm2ps-7.8.9/format.txt0000644000175000017500000016316412314503276013227 0ustar jefjef Format parameters ================= Note: This file will be soon removed from the abcm2ps distribution. ==== The format parameters documentation is now online: http://moinejf.free.fr/abcm2ps-doc/index.html The general layout of the printed scores may be changed in many ways. For example, when running the program, one or more format files may be specified as program arguments using the command line option -F (see the file options.txt). A format file contains a sequence of lines where empty and lines beginning with a '%' are ignored. Each line contains a pair consisting of the parameter name (without the "%%") and the associated value(s). Alternatively one or more format parameters may be specified directly as run time argument pairs using the following syntax. The first argument is the format parameter name preceded by two dashes (eg. --vocalfont) and the second argument is the new value. If the value contains spaces, it should be enclosed by quotes when the program is run from a shell. For example, the following command will run abcm2ps on the file myfile.abc changing the format parameter vocalfont to 'Arial 13'. abcm2ps --vocalfont 'Arial 13' myfile.abc Format parameters may be specified inside an ABC tune in one of two ways. Pseudo-comments are specified by beginning a line with '%%'. The syntax is simply: %%parameter_name new_value Alternatively, a parameter change may be indicated inside the body of the tune using the I: information field. For example: CDEF | [I:annotationfont Arial 13] "^bla" GABc | The keyword "lock" may appear at the end of a parameter value. After such a keyword has been found, the parameter will not be changed anymore unless "lock" appears again. It is implicitly appended in the command line arguments so that these parameters take precedence and override any other changes. example: abcm2ps --vocalfont 'Arial 13' myfile.abc in myfile.abc: %%vocalfont Times-Roman * % <- ignored %%vocalfont Helvetica * lock % <- vocalfont = 'Helvetica 13' Scope ----- This section describes the meaning of the 'Scope:' found in the following command descriptions. This concept is tied to the way the music is generated. All the commands appearing in the program arguments (including those in format files) are inserted as pseudo-comments at the head of the ABC file to be processed. Then, the whole source is parsed. The music is generated as ABC music elements are processed, but it is not directly written to the output file. Instead, it is buffered until some event occurs. This may be either the end of a tune, the end of a page (page full, %%newpage or new tune with %%splittune), or some specific music element or command (see 'restart' below). At this moment, if the output file was still empty, the global output parameters are written (PostScript global definitions), and then the buffered music is written. Here are the possible values of 'Scope:': - 'page' Each output page has specific information (dimensions, header/footer, ...) which needs to be known at the time a new page is opened in the output file. As the exact moment of writing the buffered music may not be known, the commands of scope 'page' should be set near the beginning of the ABC file or at least immediately after a 'newpage' command is issued. - 'tune' Commands with the scope 'tune' have to do with the tune headers (title, composer, tempo...) and footers (lyrics after tune and notes). They behave either globally or locally depending on their placement. When they appear outside a tune, they apply to the tunes which are yet to be processed. The parameter values are said to be 'global'. When they appear inside a tune, they apply locally to only this tune, the remaining tunes assume the global values again. In this case, since the exact write moment is not known, such commands should appear in the tune header or immediately after the first K:. - 'generation' As explained above, the generation of the music is done element by element, independently of the buffering and file output. It starts at the beginning of a tune and stops naturally at the end of this tune, but it may be interrupted and restarted when encountering some specific information field (T: only) or command (see 'restart' below). The commands with a scope 'generation' are globally applied to each generation sequence (between start and stop). In other words, when a parameter is changed many times in a generation sequence, only the last value is used. This value remains for the next generation phases. They have the same global and local behaviour as the 'tune' commands, i.e. when starting the generation a new tune, all parameters have the global value. - 'immediate' Such commands are executed as they are found in the source file. Their effects are immediate and apply to the next music elements. Some of them may do a generation restart (see 'restart' below). - 'voice' Commands with this scope may appear only inside tunes and apply to the current voice only. Their main scope type may be 'generation' or 'immediate'. There is no associated global value. - 'restart' This information indicates that the execution of the command is preceded by a stop of the generation (see 'generation' above).. Common value types ------------------ A value may be: - 'true', 'yes', '1' or (empty) - 'false', 'no' or '0' Only the first character is checked. is a whole number, usually positive. may be either 'native' or any other string in which case 'utf-8' is assumed (default value). It is used only for PostScript output without pango. When the is not 'native', the utf-8 characters are replaced by the name of their glyphs as they appear in the font files. This is done thanks to an internal table which contains the ASCII and most Latin characters. This table may be extended by the command %%glyph to handle more characters (see the addition of '...' ellipsis - in the file sample.abc). is a number which may have a decimal point number (eg. 0.5). is used in font definitions. It is expressed in graphic points (see ). is a dimension of which the unit is defined by the suffix: - 'pt' or no suffix: graphic points, - 'in': inches, or - 'cm': centimeters. The height of a 5 lines staff is always 24pt. , and appear in font definitions. They may be specified as '*' (asterisk), in which case their values remain unchanged. may be omitted, in which case its value defaults to 'utf-8' for the first declaration of the font or it remains unchanged. When is omitted, it remains unchanged. Examples: %%vocalfont Arial 12 % Arial utf-8 12pt %%vocalfont Times-Roman % Times-Roman utf-8 12pt %%vocalfont * 13 % Times-Roman utf-8 13pt %%vocalfont UKaiCN-UTF8-H native % UKaiCN-UTF8-H native 13pt List of the format parameters ----------------------------- abc2pscompat Default: 0 Compilation: none Command line: none Scope: generation Description: Handle old abc2ps tunes. When set, 'M' becomes the !tenuto! decoration and a pitch translation may be done for the bass and alto clefs (respectively, 2 and 1 octaves down). It is preferable to rewrite the old tunes to comply with the current standard rather than using this parameter. For example, you could include in the tune, U: M = !tenuto! and/or: K:C clef=bass octave=-2 and the old tune would be interpreted correctly. abcm2ps []* Default: % Compilation: none Command line: none Scope: immediate Description: Change the pseudo-comment prefix(es). By default, pseudo-comments are lines starting with two percent signs ("%%"). This command redefines a list of possible second characters of these commands (up to 3 different characters). This permits to avoid conflicts with pseudo-comments of other programs and also to have a simple conditional generation. Example 1: %%abcm2ps * %*voice Mib % the voices which name contains "Mib" %*transpose -3 % are transposed a minor third lower %*voice end %*abcm2ps % % restore standard pseudo-comments Example 2: - tune.abc: X:1 ... K:C % % default 4 staves %Fstaves [(S A) (T B)] % 2 staves %Sstaves S % Soprano only %Astaves A % Alto only V:S ... V:A ... V:T ... V:B ... - command line: abcm2ps --abcm2ps %A tune.abc # generate alto only alignbars Default: 0 Compilation: none Command line: none Scope: immediate, restart and restart after music lines Description: Align the bars of the next music lines. Such an alignment works only when there is only one voice (i.e. no V:, %%staves or %%score are permitted). aligncomposer Default: 1 Compilation: none Command line: none Scope: tune Description: This parameter specifies where the composer field is displayed. A negative value means 'on the left', 0 means 'center', and a positive value means 'on the right'. annotationfont [] [] Default: Helvetica 12 Compilation: none Command line: none Scope: immediate Description: Set the annotation font. autoclef Default: 1 Compilation: none Command line: none Scope: generation Description: When this parameter is false, the voices which don't contain a 'clef=' in K: or V: use the treble clef, according to the ABC standard. When true, the clefs and possibly the clef changes for these voices are determined from the note pitches and inserted automatically. barsperstaff Default: 0 Compilation: none Command line: -B Scope: generation Description: Try to typeset with bars on each line. beginps ["nosvg"] Default: none Compilation: none Command line: none Scope: immediate Description: This command introduces a PostScript sequence that ends with '%%endps' and which will be included in the PostScript output file. Such a sequence cannot be greater than 128 Kb. When the output file format is SVG (command options '-g', '-v' or '-X'), the PostScript code is executed by the small abcm2ps PS interpreter. Sequences which cannot be executed (as font redefinitions) must be skipped checking the presence of the symbol 'svg': /svg where {pop} { .. PostScript code which cannot be executed by abcm2ps .. } ifelse When the option "nosvg" is present, the sequence is not executed on SVG output. beginsvg Default: none Compilation: none Command line: none Scope: immediate Description: This command introduces a SVG sequence that ends with '%%endsvg' and which will be included in the SVG output file. It allows adding a CSS to the generated SVG files. The sequence is ignored when the SVG output file has begun to be written (for example if it is found after the first K: information field). begintext [