abcm2ps-6.6.17/Changes0000644000175000017500000007311011765041061012532 0ustar jefjef---- Version 6.6.17 - 12/06/10 ---- Fix bad tie when at end of repeat and start of new repeat ("c- :|2 c") (reported by Nils Liberg). Fix abnormal line with one note when line cut should be on a clef change (reported by Alex Scheutzow - was forgotten in 6.6.16). Fix presence of meter at start of line when empty voice (was forgotten in 6.6.16). ---- Version 6.6.16 - 12/06/02 ---- Better hyphen in lyrics lines when great space between notes (reported by Nils Liberg). Fix presence of tempo when "%%writefields Q 0" before first K: (reported by Nils Liberg). Don't remove '%%' in %%beginps/%%endps sequences. Fix array overflow and possible crash with empty %%beginxxx/%endxxx (reported by Nils Liberg). ---- Version 6.6.15 - 12/05/28 ---- Fix crash when K: without more symbol at end of tune (reported by Nils Liberg). Fix clash of '8' in clef with octave +/-8 (reported by David Lacroix). ---- Version 6.6.14 - 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 6.6.13 - 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 lack of tempo at start of tune when "%%writefields Q 0" later. ---- Version 6.6.12 - 12/05/16 ---- Fix bad line numbers in errors and svg annotations (reported by Nils Liberg). ---- Version 6.6.11 - 12/05/13 ---- Fix lack of key signature when K: + clef inside music line. Fix placement errors when scaled voice or staff (reported by: 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 6.6.10 - 12/04/30 ---- Bad offset of %%EPS since version 5.x.x (reported-by: Glenn Arthur Jr) Handle more lowercase to uppercase letters when %%titlecaps (reported by Christian Schnarr). ---- Version 6.6.9 - 12/03/31 ---- Fix loss of music after abc 2.0 continuation ('\'). Fix misplaced part (P:) when followed by K:, or M: (reported by Richard Walker). Crash when misplaced dble repeat bar in second voice at end of tune (reported by Simon Wascher). ---- Version 6.6.8 - 12/03/09 ---- Don't print the X: value in title when ', The' at end of T: (reported by Paul Hardy). Don't print the tempo in tune when '%%writefields Q 0' (reported by Martin Tarenskeen). ---- Version 6.6.7 - 12/02/21 ---- Don't add the %%transpose values (reported by Alex Scheutzow). Fix lack of key signature change when exp accidental list of the same size. Fix lack of history information since previous version (reported by Jon Freeman). Fix bad slur on grace notes when staffscale != 1 (reported by Pete Showman). Ignore %%sep and %%vskip when global and -E or -g. Fix crash when some output needed in format files by ignoring %%text... Fix %%abc2pscompat again. Fix some errors "??? buffer not empty:". ---- Version 6.6.6 - 12/02/11 ---- Fix vertical offset problems on page breaks with %%multicol. Fix bad page header when %%multicol outside and inside tunes. Ignore %%writefields when outputting %%titleformat (reported by Pete S). Reset the default standard title format when %%titleformat is empty. ---- Version 6.6.5 - 12/02/06 ---- Fix loss of music when voices disappear and reappear by %%score (reported by John Collins). 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. Permit the clefs to go under or above the notes/rests. ---- Version 6.6.4 - 12/01/31 ---- Fix bad bar numbers when time signature change before a measure bar (reported by Jean-Luc ZINS). Fix bad horizontal offset when notes shifted in an other voice. Do TABs in guitar chords work with PS + pango and SVG. Do %%abc2pscompat work again. ---- Version 6.6.3 - 12/01/13 ---- Fix bad guitar chord display when ending with accidental and no pango (reported by Jean-Luc ZINS). Fix bad natural spacement on clef change. Fix too much right shift of second voices when first voice is dotted. Fix bad stem length in beams when notes shifted to avoid voice overlap. Fix bad horizontal offset of voices going from a staff to an other one. Handle the decorations of notes in invisible grace note chords. Fix bad SVG output when nested gsave/grestore and rotation. Fix the horizontal placement of the starting clefs. Fix bad error when music line continuation in a tuplet. Add 'stringwidth' in the PS to SVG interpreter. Fix lack of ties when many ones in chords. Fix bad errors when ties inside and outside chords (reported by Daniel Branning). Fix bad errors when more values after floating values in format parameters (reported by David Lacroix). ---- Version 6.6.2 - 12/01/07 ---- Fix bad PS output when '(' or ')' in T: and %%pdfmark (reported by Jon Freeman). Don't try a new extension when some already in input file names (reported by Hudson Flávio Meneses Lacerda). Fix bad horizontal offset of 1st clefs of secundary staves when no clef at start of the 1st staff (reported by Steve Merrony). Fix bad key signatures when %%transpose inside tune (reported by Alex Scheutzow). Fix lack of tune title when %%titleformat T + T and only one T:. ---- Version 6.6.1 - 12/01/02 ---- Bad tie when at end of repeat sequence (reported by Nils Liberg in july 2010). Fix bad line numbers after insertion of missing X:, T: or K:. Fix compilation errors of abcmfe. Add more checks of some formatting floating values (reported by Reinier Maliepaard). Fix the loss of the first line of included files. Bad output file name when -O= and a .abc file included in a ABC file (reported by Steve Merrony). Bad offset of PS/SVG annotations (-A) when scaled staff or voice. Fix program crash when '+' in %%titleformat (reported by Richard Robinson). ---- Version 6.6.0 - 11/12/28 ---- Fix bad SVG when '&' in text of a repeat bar. Permit ties between enharmonic notes. Fix bad transposition when negative value and '#' or 'b'. Fix bad transposition of K:none. Don't skip the invisible bars when dispatching the lyrics under staff (reported by Hudson Flávio Meneses Lacerda). Don't raise an error when iso-8859-x in %%font/%%xxxfont. Fix program crash when slur ending in next music line and slur from grace note to normal note in current music line. Fix bad handling of P: in secundary voices. Handle key signature with changes in the accidental list. Fix program crash with -v and many pages (reported by Richard Robinson). Fix program crash when -E/-X/-g/-v after a second input file in the command line. Update documentation. ---- Version 6.5.16 - 11/12/21 ---- Fix loss of previous U: definitions on new abc files. Better handling of the source line numbers in error messages. Handle %%abc-insert. Change the treatment of %%format. Fix bad end of PostScript sequence when %%format with a PS file. Fix crash when %%combinevoices and rest under beam (reported by Atte André Jensen). Fix bad vertical offset of SVG annotations. Fix some string escape sequences and add more ligatures (reported by Janus Meuris). ---- Version 6.5.15 - 11/11/28 ---- Add lacking elements relative to ABC state (empty lines, X:, K: - reported by Hudson Flávio Meneses Lacerda). Do '-i' work when ABC parse errors only. Set only EXIT_SUCCESS or EXIT_FAILURE as program exit level. Set the exit severity level in more error cases. Accept (back) %%encoding/%%abc-charset with a single digit. ---- Version 6.5.14 - 11/11/26 ---- Fix bad use of pango in SVG output since previous version (reported by Hudson Flávio Meneses Lacerda). Fix program loop when no %%endxx after %%beginxx. Fix erroneous errors on comment lines starting with spaces/tabs (reported by Hudson Flávio Meneses Lacerda). Fix compilation error of abcmfe. ---- Version 6.5.13 - 11/11/23 ---- Treat only one output type (PS, EPS or SVG..) per run (this fixes conditional sequences in format files). Fix the 'end's in musicfont.fmt. Add an option in 'configure' to not use pango. ---- Version 6.5.12 - 11/11/17 ---- Fix erroneous detection of latin encoding when accidentals as \20x at start of file. Don't handle %%postscript (and %%beginps/%%endps) as global when appearing after text formatting commands. Treat 'utf-8' and 'native' in %%abc-charset. Do %%abc-charset work. Fix alteration of user PS definitions in SVG output (bad SVG generation of 2nd and next files - reported by Jon Freeman). May set back the SVG transparency by no value after %%bgcolor. ---- Version 6.5.11 - 11/11/16 ---- Add '%%linewarn' (asked by Hudson Flávio Meneses Lacerda). Add '%%bgcolor' for pure SVG output (asked by Jon Freeman). Remove '%%' inside %%beginxx/%%endxx (reported by Hudson Flávio Meneses Lacerda). Fix bad detection of latin encodings. ---- Version 6.5.10 - 11/11/10 ---- Crash when %%text in tune and EPS or -g output (reported by Atte André Jensen). ---- Version 6.5.9 - 11/11/07 ---- Check again the '%%end' suffix. Set the max size of %%beginxx/%%endxx sequences to 128Kb. Accept more values to 'copy' in the PS to SVG interpreter. Fix bad handling of %%format since 6.5.6. Don't raise error when font not predefined and SVG/XHTML output. Treat %%writefields as it appears. Fix bad treatment of the file names since 6.5.6 (reported by Hudson Flávio Meneses Lacerda). ---- Version 6.5.8 - 11/11/05 ---- Fix bad horizontal offset of %%begintext center (reported by Hudson Flávio Meneses Lacerda). Add 'lock' in formatting commands. Update the examples in the Makefile. Remove the warning about 'line overfull'. ---- Version 6.5.7 - 11/11/03 ---- Fix bad beam vertical offset when grace notes in n-plet. Fill the background to white when pure SVG generation. Remove warnings when music lines too shrunk or too stretched. Fix bad handling of comments (%xx) and '\'s at end of line. ---- Version 6.5.6 - 11/11/02 ---- Bad global values when generation of many files. Fix clash of lyrics when more staves added later (reported by Atte André Jensen). Simplify internal treatments. ---- Version 6.5.5 - 11/10/28 ---- Fix bug in %%beginps with PS outout since last release. ---- Version 6.5.4 - 11/10/27 ---- Remove/add some ABC examples. More functions in the PS to SVG interpreter. Fix overload of internal functions in the PS to SVG interpreter. Fix bad header/footer horizontal offset with "\t" (reported by Atte André Jensen). Fix bad UTF-16 to UTF-8 translation for surrogates. Add 'svg' / 'nosvg' parameter to %%beginps. Add %%beginsvg. Handle %%beginxx / %%end. Handle better the abc2.0 continuation lines. ---- Version 6.5.3 - 11/10/24 ---- Add 'svg' for test in the PostScript code. Add 'where' in the PS to SVG interpreter. Fix bad scanning of embedded information fields when space after ':'. Limit the number of simultaneous format files. Extend %%transpose with suffix "#" or "b". Fix the transposition of some guitar chords. Set '!' the decoration character when %%linebreak with no '!'. ---- Version 6.5.2 - 11/10/17 ---- Don't ignore some global information fields. Don't display Q: in tune when defined in %%titleformat. Don't apply M: to all voices when found in tune body as the first information. Add 'octave=' in K: and V:. Fix bad transposition when %%transpose inside tune (reported by many people). ---- Version 6.5.1 - 11/10/16 ---- Fix double '\'s in strings. (reported by Hudson Flávio Meneses Lacerda). Fix bad date since previous version. !! There should not be anymore couples of '\'s in %%dateformat !! Fix bad SVG when "%%scale 1" and some rotation (reported by Jon Freeman). Add %%transpose. Add dummy 'composefont' in the PS to SVG interpreter. Update the documentation about and %%encoding. ---- Version 6.5.0 - 11/10/10 ---- Add simple PS font functions in the PS to SVG interpreter. May overload the standard decorations. Accept a quoted string as decoration string. Don't handle 'end' anymore in format files. Accept latin1..latin6, thanks to %%encoding or %%abc-charset. !! The escape sequences are now limited to those in abc 2.1 !! !! There cannot be implicit utf-8 and latin1 encodings in a same file !! !! There should not be \\ in w: lines before escape sequences !! Fix bad great integer values in the PS to SVG interpreter (reported by Jon Freeman). Fix bad SVG display of 'arc' after '(r)lineto'. (reported by Jon Freeman). ---- Version 6.4.7 - 11/10/03 ---- Add %%decoration. Remove the pseudo-decorations 'linebreak' and 'decosep'. Fix the lack of tablature of the first tune after %%tablature. Ignore empty 'newpath' in the PS to SVG interpreter (for galoubet in flute.fmt - reported by Jon Freeman). Do '-x' work again (reported by Daniel Branning). Fix bad tremolo on crotchet after beamed notes without space (reported by Jean-Luc Zins). ---- Version 6.4.6 - 11/09/27 ---- Do %%linebreak work. Fix again compilation errors when pango is not available (reported by Guido Gonzato). ---- Version 6.4.5 - 11/09/24 ---- Fix a ms-win file access problem raised by a previous change (reported by Marc Philippe). Fix compilation errors when pango is not available (reported by Guido Gonzato). Add %%linebreak (not fully compliant yet). Add the function 'repeat' in the PS to SVG interpreter. Fix bad PS when parenthesis in tablatures with w:. ---- Version 6.4.4 - 11/09/19 ---- Simplify the PS function rendering latin note names in deco.abc. Do string array indexing and character as string work in the PS to SVG interpreter. Fix display offset after rotation in the PS to SVG interpreter. Fix inversion of condition code in the PS to SVG interpreter. Bad page header/footer when empty or blank %%header/%%footer (reported by Marc Philippe). Do '%%pango 2' work again. ---- Version 6.4.3 - 11/08/26 ---- Add more functions and fix some bugs in the PS to SVG interpreter. Remove the command options '-n' (%%writehistory), '-k' (same as '-j') and '-Q' (%%writefields Q). Remove %%freechord. Set %%exprabove, %%exprbelow, %%vovalabove, %%printparts, %%printtempo %%musiconly, %%withxrefs and %%writehistory as obsolete. Add %%dynamic, %%gchord, %%ornament, %%vocal, %%volume and %%writefields (from requests by Nils Liberg) (%%ornament does not work yet). Add "%%pdfmark" as pdfmarks output condition. (asked by Nils Liberg). Convert some latin1 octal escape sequences to utf-8. Delay PS code generation when staves not defined. Crash when %%staves/%%score error and complex staff system. Ignore the spaces after the ':' of information fields and after '%%'. (asked by Nils Liberg). ---- Version 6.4.2 - 11/08/11 ---- Crash when many voices ending at different times without bars (reported by Nils Liberg). Change the default extension of the '-X' output files to '.xhtml'. Fix the encoding of the titles in pdf marks (reported by Nils Liberg). Check if the title in eps/svg files is correct UTF-8 (reported by Nils Liberg). Fix the display of the tuplet numbers with SVG output. ---- Version 6.4.1 - 11/07/31 ---- Check the sequences or measures to repeat in I:repeat. Crash or bad generation of repeat sequences (reported by David Lacroix). Don't ignore leading spaces in ABC lines. Fix some problems about the pdf marks: - trim the titles - accept more than 3 title/subtitles (reported by Chuck Boody). ---- Version 6.4.0 - 11/07/28 ---- Skip correctly %%begintext/%%endtext outside tunes when -E or -g. Fix bad width of -E and -g bounding boxes. Accept output to stdout with '-g'. Accept '-O-' for output to stdout file. Output the pdfmark later in the PS output for Adobe Distiller (reported by Chuck Boody). ---- Version 6.3.9 - 11/07/22 ---- SVG output: - fix 'rotate' behaviour. - fix bad scale when 'gsave' / 'scale' / 'grestore' between 'show's in PS sequences. - add 'le', 'lt', 'and' and 'or' in the PS interpreter. - accept PS 'stroke' or 'fill' with no path. Bad output file extension when '-O=' and many dots in filename (reported by Hudson Flávio Meneses Lacerda). Accept 'middle=' to a high pitch (as "d'") (reported by Hudson Flávio Meneses Lacerda). Bad title when %%withxrefs and X: absent or empty (reported by Hudson Flávio Meneses Lacerda). Handle absence of the PS pdfmark function. Simplify the latin chord name translation in deco.abc. Change the output annotations of '-A'. (asked by Nils Liberg). ---- Version 6.3.8 - 11/06/26 ---- Fix a possible problem with the memory allocator. Display tunes without X:. Set the PS level to 2.0. Add PDF marks for table of content (proposed by Nils Liberg). ---- Version 6.3.7 - 11/06/17 ---- %%multicol did not work when at start of tune. Bad %%partbox when SVG output. (reported by Nils Liberg and Chuck Boody). Better handling of some SVG attributes (colors, line width..). More decimals in scale change. Bad treatment of %%postscript at start of new tune in SVG output. Add the PS function 'bdef' for SVG output (reported by Nils Liberg). Loop when line too much shrunk on beamed notes. Don't apply K: to all voices when it does not end the tune header (reported by Seymour Shlien). Update sample3.abc for double ^F in K:. The %%font directive is not useful when SVG output. Don't use pango when '-g' or '-X'. ---- Version 6.3.6 - 11/05/30 ---- Lack of page footer in SVG output. Add the '-X' command flag (XML + SVG output). Crash when PS 'dup' and stack empty in SVG generation (fixed by Nils Liberg). Bad hyphen and line of lyrics in SVG output. Fix and add PS operators for SVG output. ---- Version 6.3.5 - 11/05/14 ---- Fix and add PS operators. Bad SVG output when PS 'moveto' (reported by Nils Liberg). Bad SVG definition of the white and whole notes (no "oddeven") (reported by Jon Freeman). Bad SVG output when %%scale 1. ---- Version 6.3.4 - 11/05/11 ---- Pseudo-decorations 'linebreak' and 'decosep' added (proof of concept - not documented). Error when escape sequences in guitar chord or annotations. Bad tempo since previous release. Remove the 'tex' sequences '\o', \O', '\cc' and '\cC'. ---- Version 6.3.3 - 11/05/10 ---- Ignore the normal newlines when '!' found as newline and abc-version < 2.0. Add some compose sequences from X11 (including \O:, \U:, \O" and \U") (reported by Nils Liberg). Change/add some rfc1345 escape sequences. Bad / no output of the '=' of the tempo by lack of font. This did the program to crash when no title and SVG output (reported by Nils Liberg). Cleanly close a tune when no blank line before next tune (reported by Nils Liberg). Crash when X: in tune followed by %%text. Bad page header/footer in SVG output file. Fix standard C library problem (in isupper) with some systems/compilers (reported by Nils Liberg). Bad treatment in %%titlecaps. Optimize the size of the SVG output file. Support for line width in SVG output. ---- Version 6.3.2 - 11/05/03 ---- Accept %%EPS when SVG output. Add the '-v' command flag (SVG output per page). More PS symbols in the svg PS interpreter. Bug fixes in the svg PS interpreter. ---- Version 6.3.1 - 11/04/29 ---- Handle microtonality in tablatures. Compilation problem when no pango (reported by Guido Gonzato). Add more output annotations. Add more PS symbols in the svg PS interpreter. Fix bad SVG output. Fix the help for SVG output. ---- Version 6.3.0 - 11/04/24 ---- Crash when global texts and '-e' != first tune with '-E' or '-g'. Crash when PS buffer overflow with '-E' or '-g'. Crash when %%oneperpage or %%splittune with '-E' or '-g'. Fix lanscape mode for EPS. Fix EPS bounding box when %%scale in tune. Add the '-g' command flag (SVG output). ---- Version 6.2.13 - 11/04/18 ---- Add the '-S' command flag (secure mode) (asked by Bart Humphries). Don't ignore the normal newlines when '!' found as newline (asked by Hudson Flávio Meneses Lacerda). Add more information for tune index creation (second and third titles) (asked by Paul Hardy). ---- Version 6.2.12 - 11/04/04 ---- Fix some compilation errors. Crash due to memory allocation bug. ---- Version 6.2.11 - 11/04/03 ---- Bad text justification without pango (reported by Hudson Flávio Meneses Lacerda). Bad PostScript output when empty line at end of justified text (reported by Hudson Flávio Meneses Lacerda). Bad note length when bad tuplet at end of line and multi voices. May have tuplet with one note. Crash when new voice starting with a key signature. Optimize the memory allocation. ---- Version 6.2.10 - 11/03/06 ---- Remove test '%%fmt ...'. Do pango output for filled and justified text. Better pango output. Remove %%pangoembedded. Bad horizontal offset of centered or right aligned texts. Bad stem direction in some cases since 6.2.8 (reported by Hudson Flávio Meneses Lacerda). Bad font after new page when text with '$n". Bad (latin1) UTF-8 character width. Fix loss of space in justified text (reported by Hudson Flávio Meneses Lacerda). Fix link error with last versions of pango. ---- Version 6.2.9 - 11/02/08 ---- Don't display negative bar numbers (reported by Janus Meuris). Fix bad clef change again with K: or V: when stafflines or staffscale present. Fix voice clashes raised by previous version. Don't count the upbeat measure when %%measurenb (reported by Hudson Flávio Meneses Lacerda). Less note shift when voices inverted in a staff. Add the width scale factor in %%font. ---- Version 6.2.8 - 11/01/31 ---- Bad tempo note duration of Q:Cxx or Q:Lxx (reported by Paul Rosen). Crash when note length divisor = 0. Fix bad PostScript when %%font defined (and used) in the middle of a tune. Bad horizontal offset of notes when music line too much shrunk (reported by Paul Rosen). Handle "+++" as a valid decoration (reported by Guido Gonzato). Bad measure bars when "|" in %%score and many voices per staff (reported by Marc Sabatella). Set the rests of multi-voices staves closer to the middle of the staff (reported by Marc Sabatella). Fix the loss of gchord/annot when defined in a lower voice and %%combinevoices (reported by Atte André Jensen). Don't display the second slash of "\\" with pango (reported by Hudson Flávio Meneses Lacerda). Add "\Uxxxxxxxx" for unicode 32 bits characters. Limit the number of hexadecimal characters to 4 for unicode 16 bits characters "\uxxxx". Build and install abcm2ps from outside the source tree (fixed by Matthias Rustler). ---- Version 6.2.7 - 10/12/26 ---- Bad clef when voice going to a different staff after %%score. Bad generation after %%score when the previous %%score did not contain the first declared voice (reported by Marc Sabatella). Output the lyrics (W:) in the last page when %%newpage's in the tune. Bad scale when %%newpage in tune (reported by Paul Rosen). Avoid bad PostScript when "$n" used before definition of %%setfont-n (reported by Paul Rosen). Treat "\uxxxx" in text as a hexadecimal Unicode character. Bad font when texts with both standard fonts and pango (reported by Hudson Flávio Meneses Lacerda). Fix some warnings. Crash when a nested slur started on a grace note (reported by Paul Rosen). ---- Version 6.2.6 - 10/11/30 ---- Part display missing when P: defined before a clef change at start of line (reported by Paul Rosen). Bad horizontal offset of text between %%begintext and %%endtext when empty line and new PostScript page. Lack of %%postscript output when defined just after K:. Bad clef change with K: or V: when stafflines or staffscale present (reported by Paul Rosen). Adjust the K: / V: 'middle=' value when the defined clef is not on a line. Handle "middle=" without 'clef=' in K: or V:. ---- Version 6.2.5 - 10/11/26 ---- Bad clef changes when many voices per staff. Bad key signatures on all staff systems but the first one when clef different from treble. Bad measure numbers after measure repeat (Zn) and many voices. ---- Version 6.2.4 - 10/11/20 ---- Bad memory allocation mechanism making random crashes. Bad staff scale when change inside a tune. Bad staff clef when the music line starts with a clef change. Don't cut beamed notes when %%continueall. Bad horizontal offset of notes far outside the staff after a clef or a key or time signature. Bad horizontal offset of long decorations when many at the same time. Use pango in header/footer as required. PostScript error when parenthesis alone in a header/footer. ---- Version 6.2.3 - 10/11/01 ---- Move the accidentals to a separate font. Use standard rendering when '%%pangoembedded 0'. '%%pangoembedded' added. Change pango output mechanism. ---- Version 6.2.2 - 10/10/29 ---- Better text center and right align with pango. Do pango generation when character >= c6xx. May force pango with '%%pango 2'. Define the character '...' (ellipsis) in sample.abc for show without pango. Define UTF-8 characters e008080..e2cfdf stubs for show without pango. Add characters 'ldot' to 'longs' (UTF-8 c580..c5bf) for show without pango. Better rendering with pango (scale changes). Do pango work when not in a graphic context (use cairo instead of gdk). Remove a useless malloc(). ---- Version 6.2.1 - 10/10/16 ---- Bad vertical offset of key signature when clef change. Bad horizontal offset of lyrics starting with parenthesis. Change some PS definitions (treble and bass clefs, full head). Use encoded number strings in user paths. Convert some standard drawing to user paths. Bad box around guitar chord when not all ASCII characters. ---- Version 6.2.0 - 10/10/06 ---- Fix combination of rests (when %%combinevoices). May combine 3 or 4 voices (when %%combinevoices). Add quiet mode (-q in command line). Extend the U: syntax (see features.txt). ---- Version 6.1.1 - 10/09/17 ---- Bad scale when a voice moves to a staff with an other scale. Loop when '%%staves' inside the tune with a cloned voice. Loop when '%%staves' without any parameter (reported by Reinier Maliepaard). Expand the special characters of %%infoname texts. Use standard values for exit codes and max length of file names. The '*' (star) is no more allowed (it was ignored as the '`' - back quote). Check the character in U: definition. ---- Version 6.1.0 - 10/08/02 ---- Don't forget the %%infoname at start of file. Crash on '%%infoname R' (reported by Chuck Boody). Crash when clef in V: and no note in the tune (reported by Reinier Maliepaard). ---- Version 6.0.11 - 10/07/20 ---- Clash of rest under beam when multi-voices. Clash of notes/clefs/grace notes/dots when multi-voices and strunk lines. Don't display dots on the last square note of the tune. Bad stem direction of grace notes in secundary voices. Reduce the natural spacing when only long notes in a tune. Define the user decorations when needed. Erroneous bar error and bad placement when grace note before measure bar and multi-voices. Bad tie direction when dotted (reported by Hudson Lacerda). Bad PS output when parenthesis in P: (reported by Hudson Lacerda). ---- Version 6.0.10 - 10/06/22 ---- Bad tune selection when absent in "-e". Bad title when title trim. More horizontal space for flat accidental in texts. Change the directory separator for MAC systems. Fix a crash when unknown glyph with pango. Fix lyrics error in chinese.abc. ---- Version 6.0.9 - 10/04/11 ---- Fix more security vulnerabilities (thanks to Tim Starling). ---- Version 6.0.8 - 10/04/05 ---- Change the utf-8 font mechanism from CMAP to composite font (FontType 0). Fix some security vulnerabilities (thanks to Tim Starling). Add %%Begin/EndDocument when inserting a EPS file (thanks to Reinier Maliepaard). Fix bad guitar chord / annotation offset when non latin characters and pango. Have flats a bit higher in texts. Have more space between accidentals in key signatures. ---- Version 6.0.7 - 10/02/24 ---- Fix measure bar numbering when %%setbarnb and many voices. Fix measure bar numbering when M:none. Fix the EPS output when use of pango. Fix a crash when '-E' at start of command line and use of pango. Fix the EPS output when accidentals. Fix the output of user postscript sequences when many output files. Fix a crash when slur ending on a grace note at end of a secundary voice. Include back chinese.abc in the tarball. ---- Version 6.0.6 - 10/02/19 ---- Handle font changes inside lyric words. More flute tablatures from Michel Bellon. Add information about pango in the INSTALL file. Force recompilation after configure. Change the glyphs of accidentals. Speed up the PS rendering of pango text. Do the TAB in guitar chords work again. Fix the parenthesis problem with pango. Adjust some compose characters sequences. Move the setcachedevice from the Extra font to the extra-draw dict. This permits to add characters from various sizes. Fix a crash when a tune ends with T:. ---- Version 6.0.5 - 10/02/12 ---- Add the 'pango' parameter. Add an arabic title in chinese.abc. Fix a crash when non ascii characters in tunes, outside of text strings. Print some texts with the pango/freetype libraries. ---- Version 6.0.4 - 10/02/09 ---- Do the hyphen work again in lyrics. Prepare the 'pango' job. Fix bad horizontal spacing of accidentals. Add O/obreve. Add some compose characters from the ABC standard version 2. ---- Version 6.0.3 - 10/01/31 ---- Change the character values for accidentals to correct utf-8 sequences. Fix bar numbering when incomplete measure at start of tune. Fix bar numbering when incomplete measure at end of previous line. ---- Version 6.0.2 - 10/01/28 ---- Change the utf-8 mechanism for extra characters. Fix lyrics display when not enough or too many lyrics in a music line. ---- Version 6.0.1 - 10/01/20 ---- Remove the latin parameters. Do the accidentals in string ('\201'.. and '#'.. in guitar chords) work again. Accept ABC files coded in latin1. ---- Version 6.0.0 - 10/01/19 ---- Remove multilang.abc. Add chinese.abc. Generate PostScript level 3 only. Add UTF-8 support. !! COMPATIBILITY !! The other encodings (latin-x) are no more supported. Add all whistle types in flute.fmt (thanks to Guido Gonzato). Creation from abcm2ps version 5.9.7. abcm2ps-6.6.17/INSTALL0000644000175000017500000000331211336716162012272 0ustar jefjef --- 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-6.6.17/License0000644000175000017500000004307607005373333012556 0ustar jefjef 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-6.6.17/Makefile0000644000175000017500000000752511764331367012720 0ustar jefjef# Makefile source for abcm2ps VERSION = 6.6.17 CC = gcc INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} CPPFLAGS = -DHAVE_CONFIG_H -DHAVE_PANGO=1 -pthread -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/cairo -I. CFLAGS = -g -O2 -Wall -pipe LDFLAGS = -pthread -lpangocairo-1.0 -lcairo -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lfreetype -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 music.o parse.o \ subs.o svg.o syms.o abcm2ps: $(OBJECTS) $(CC) $(CFLAGS) -o abcm2ps $(OBJECTS) $(LDFLAGS) $(OBJECTS): abcparse.h abc2ps.h config.h Makefile abc2ps.o front.o: front.h abcmfe: front.c $(CC) -g -O2 front.c -DMAIN -o abcmfe 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)/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)/fbook.fmt \ abcm2ps-$(VERSION)/features.txt \ abcm2ps-$(VERSION)/flute.fmt \ abcm2ps-$(VERSION)/fonts.fmt \ abcm2ps-$(VERSION)/format.c \ abcm2ps-$(VERSION)/format.txt \ abcm2ps-$(VERSION)/front.c \ abcm2ps-$(VERSION)/front.h \ 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)/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-6.6.17/Makefile.in0000644000175000017500000000675511674150156013324 0ustar jefjef# Makefile source for abcm2ps VERSION = @VERSION@ CC = @CC@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ CPPFLAGS = @DEFS@ @CPPFLAGS@ -I. 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 music.o parse.o \ subs.o svg.o syms.o abcm2ps: $(OBJECTS) $(CC) $(CFLAGS) -o abcm2ps $(OBJECTS) $(LDFLAGS) $(OBJECTS): abcparse.h abc2ps.h config.h Makefile abc2ps.o front.o: front.h abcmfe: front.c $(CC) -g -O2 front.c -DMAIN -o abcmfe 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)/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)/fbook.fmt \ abcm2ps-$(VERSION)/features.txt \ abcm2ps-$(VERSION)/flute.fmt \ abcm2ps-$(VERSION)/fonts.fmt \ abcm2ps-$(VERSION)/format.c \ abcm2ps-$(VERSION)/format.txt \ abcm2ps-$(VERSION)/front.c \ abcm2ps-$(VERSION)/front.h \ 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)/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-6.6.17/README0000644000175000017500000000512111625670526012125 0ustar jefjef --- abcm2ps version 6.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-6.6.17/abc2ps.c0000644000175000017500000005472711704003461012565 0ustar jefjef/* * abcm2ps: a program to typeset tunes written in ABC format using PostScript * * Copyright (C) 1998-2012 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_glob[256], deco_tune[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 */ 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); /* -- do a tune selection -- */ static void do_select(struct abctune *t, int first_tune, int last_tune) { struct abcsym *s; int print_tune, i; while (t != 0) { i = first_tune - 1; for (s = t->first_sym; s != 0; s = s->next) { if (s->type != ABC_T_INFO) continue; if (s->text[0] == 'X') { if (sscanf(s->text, "X:%d", &i) != 1) i = 0; break; } if (s->text[0] == 'K') { i = 0; /* T: without X: */ break; } } print_tune = i >= first_tune && i <= last_tune; if (print_tune || !t->client_data) { /* (parse the global symbols) */ do_tune(t, !print_tune); t->client_data = (void *) 1; /* treated */ } t = t->next; } } /* -- do filtering on an input file -- */ static void do_filter(struct abctune *t, char *sel) { int cur_sel, end_sel, n; for (;;) { if (sscanf(sel, "%d%n", &cur_sel, &n) != 1) break; sel += n; if (*sel == '-') { sel++; end_sel = (int) ((unsigned) (~0) >> 1); if (sscanf(sel, "%d%n", &end_sel, &n) != 1) end_sel = (unsigned) ~0 >> 1; else sel += n; } else { end_sel = cur_sel; } do_select(t, cur_sel, end_sel); if (*sel != ',') break; sel++; } } static FILE *open_ext(char *fn, char *ext) { FILE *fp; char *p; if ((fp = fopen(fn, "rb")) != 0) return fp; if ((p = strrchr(fn, DIRSEP)) == 0) p = fn; if (strrchr(p, '.') != 0) return 0; strcat(p, "."); strcat(p, ext); if ((fp = fopen(fn, "rb")) != 0) return fp; return 0; } /* -- 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 != 0 && in_fname != fn && (p = strrchr(in_fname, DIRSEP)) != 0) { l = p - in_fname + 1; strncpy(rfn, in_fname, l); strcpy(&rfn[l], fn); if ((fp = open_ext(rfn, ext)) != 0) return fp; } /* try locally */ strcpy(rfn, fn); if ((fp = open_ext(rfn, ext)) != 0) return fp; /* try a format in the format directory */ if (*ext != 'f' || *styd == '\0') return 0; l = strlen(styd) - 1; if (styd[l] == DIRSEP) sprintf(rfn, "%s%s", styd, fn); else sprintf(rfn, "%s%c%s", styd, DIRSEP, fn); if ((fp = open_ext(rfn, ext)) != 0) return fp; return 0; } /* -- 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(&mtime); } else { struct stat sbuf; fin = open_file(fn, ext, tex_buf); if (fin == 0) return 0; if (fseek(fin, 0L, SEEK_END) < 0) { fclose(fin); return 0; } fsize = ftell(fin); rewind(fin); if ((file = malloc(fsize + 2)) == 0) { fclose(fin); return 0; } if (fread(file, 1, fsize, fin) != fsize) { fclose(fin); free(file); return 0; } fstat(fileno(fin), &sbuf); memcpy(&mtime, &sbuf.st_mtime, sizeof mtime); fclose(fin); } file[fsize] = '\0'; return file; } /* call back to handle %%format/%%abc-include - see front.c */ static void treat_file(char *fn, char *ext, char *sel); static void include_cb(unsigned char *fn) { char abc_fn_sav[FILENAME_MAX]; strcpy(abc_fn_sav, abc_fn); treat_file((char *) fn, "fmt", 0); strcpy(abc_fn, abc_fn_sav); } /* -- treat an input file and generate the ABC file -- */ static void treat_file(char *fn, char *ext, char *sel) { struct abctune *t; char *file, *file2, *p; int file_type, l; static int nbfiles; /* initialize if not already done */ if (fout == 0) { read_def_format(); if (*ext == 'a') make_font_list(); } if (nbfiles == 0) { /* if first file, init the front-end */ front_init(0, 0, include_cb); } else if (nbfiles > 2) { error(1, 0, "Too many included files"); return; } /* read the file into memory */ /* the real/full file name is in tex_buf[] */ if ((file = read_file(fn, ext)) == 0) { if (strcmp(fn, "default.fmt") != 0) { #if defined(unix) || defined(__unix__) perror("read_file error: "); #endif error(1, 0, "Cannot read the input file '%s'", fn); } return; } if (!quiet) fprintf(stderr, "File %s\n", tex_buf); p = file; /* 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; } nbfiles++; file2 = (char *) frontend((unsigned char *) p, 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); if (t == 0) { if (file_type == FE_ABC) error(1, 0, "File '%s' is empty!", tex_buf); return; } if (file_type == FE_ABC) { /* ABC file */ if (sel) do_filter(t, sel); else do_select(t, -32000, (int) ((unsigned) (~0) >> 1)); } else { do_tune(t, 1); /* format or PS file */ } /* 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", 0); } /* -- set extension on a file name -- */ void strext(char *fn, char *ext) { char *p, *q; if ((p = strrchr(fn, DIRSEP)) == 0) p = fn; if ((q = strrchr(p, '.')) == 0) 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" " .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" " xref list of tunes to select\n" " -u abc2ps behaviour\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, '/')) == 0) 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")) == 0) 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, 0, "++++ Too many '-T'"); return 0; } if (*p == '\0') val = -1; else { val = *p++ - '0' - 1; if ((unsigned) val > MAXTBLT) { error(1, 0, "++++ Bad tablature number in '-T'\n"); return 0; } } cmdtblt = &cmdtblts[ncmdtblt++]; cmdtblt->index = val; cmdtblt->vn = p; return cmdtblt; } /* -- main program -- */ int main(int argc, char **argv) { unsigned j; char *p, *sel, c, *aaa; if (argc <= 1) usage(); /* set the global flags */ s_argc = argc; s_argv = argv; while (--argc > 0) { argv++; p = *argv; if (*p != '-' || p[1] == '-' || p[1] == '\0') continue; while ((c = *++p) != '\0') { 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; } } } if (!quiet) display_version(0); /* initialize */ outfn[0] = '\0'; clrarena(0); /* global */ clrarena(1); /* tunes */ clrarena(2); /* generation */ clear_buffer(); 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(); #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; sel = 0; while (--argc > 0) { argv++; p = *argv; if ((c = *p) == '\0') continue; if (c == '-') { int i; if (p[1] == '\0') { /* '-' alone */ if (in_fname != 0) { treat_file(in_fname, "abc", sel); sel = 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, 0, "++++ 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, 0, "++++ No argument for '--'"); return EXIT_FAILURE; } argv++; interpret_fmt_line(p, *argv, 1); 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 == 0) { 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 'u': cfmt.abc2pscompat = 1; lock_fmt(&cfmt.abc2pscompat); 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; case 'e': /* filtering */ if (sel != 0) error(1, 0, "Previous '-e' ignored"); sel = p + 1; if (sel[0] == '\0') { if (--argc <= 0) { error(1, 0, "No filter in '-e'"); break; } argv++; sel = *argv; } else { while (p[1] != '\0') /* stop */ p++; } 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 'F': case 'I': case 'j': 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, 0, "Missing parameter after flag -%c", c); return EXIT_FAILURE; } } else { while (p[1] != '\0') /* stop */ p++; } if (strchr("BbfjNsv", 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, 0, "Invalid parameter <%s> for flag -%c", aaa, c); return EXIT_FAILURE; } } } switch (c) { case 'a': interpret_fmt_line("maxshrink", aaa, 1); break; case 'B': interpret_fmt_line("barsperstaff", aaa, 1); break; case 'b': interpret_fmt_line("measurefirst", aaa, 1); break; case 'D': styd = aaa; break; case 'd': interpret_fmt_line("staffsep", aaa, 1); break; case 'F': treat_file(aaa, "fmt", 0); break; case 'I': interpret_fmt_line("indent", aaa, 1); 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 'm': interpret_fmt_line("leftmargin", aaa, 1); break; case 'N': sscanf(aaa, "%d", &pagenumbers); if ((unsigned) pagenumbers > 4) { error(1, 0, "'-N' value %s - changed to 2", aaa); pagenumbers = 2; } break; case 'O': if (strlen(aaa) >= sizeof outfn) { error(1, 0, "'-O' too large"); exit(EXIT_FAILURE); } strcpy(outfn, aaa); break; case 's': interpret_fmt_line("scale", aaa, 1); break; case 'T': { struct cmdtblt_s *cmdtblt; cmdtblt = cmdtblt_parse(aaa); if (cmdtblt != 0) cmdtblt->active = 1; break; } case 'w': interpret_fmt_line("staffwidth", aaa, 1); break; } break; default: error(1, 0, "Unknown flag: -%c ignored", c); break; } } continue; } if (in_fname != 0) { treat_file(in_fname, "abc", sel); sel = 0; } in_fname = p; } if (in_fname != 0) treat_file(in_fname, "abc", sel); if (!epsf && fout == 0) { error(1, 0, "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]) == 0) { 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, 0, "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-6.6.17/abc2ps.h0000644000175000017500000004705311753763663012611 0ustar jefjef/* -- 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 (was 5.3) */ /* 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 BUFFSZ 64000 /* size of output buffer */ #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_glob[256], deco_tune[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 */ }; /* 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 */ 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 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 */ struct SYMBOL *ts_next, *ts_prev; /* time linkage */ 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_RBSTOP 0x8000 /* repeat bracket stop */ #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 */ unsigned short posit; /* indication position / staff (2 bits) */ /* 0: auto, 1: above, 2: below */ #define POS_DYN 0 /* shifts */ #define POS_GCH 2 #define POS_ORN 4 #define POS_VOC 6 #define POS_VOL 8 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) */ unsigned char gcf; /* font for guitar chords */ unsigned char anf; /* font for annotations */ short u; /* auxillary information: * - CLEF: small clef * - KEYSIG: old key signature * - BAR: new bar number * - TUPLET: tuplet format * - NOTE: tremolo number * - 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; /* offset of stem end */ 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 lyrics *ly; /* lyrics */ struct SYMBOL *extra; /* extra symbols (grace notes, tempo... */ signed char doty; /* dot y pos when voices overlap * forced when STBRK */ }; /* 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, staffsep, vocalspace, textspace; float scale, maxshrink, lineskipfac, parskipfac, sysstaffsep; float indent, infospace, slurheight, notespacingfactor; float maxstaffsep, maxsysstaffsep, stemheight; int abc2pscompat, alignbars, aligncomposer, autoclef; int barsperstaff, breakoneoln, bstemdown, comball; int combinevoices, contbarnb, continueall, dynalign, dynamic; int flatbeams; int infoline, gchord, gchordbox, graceslurs, gracespace, hyphencont; int landscape, linewarn, measurebox, measurefirst, measurenb; int oneperpage, ornament; #ifdef HAVE_PANGO int pango; #endif int partsbox, pdfmark; int setdefl, shiftunisson, splittune, squarebreve; int staffnonote, straightflags, stretchstaff, stretchlast; int textoption, titlecaps, titleleft, titletrim; int timewarn, transpose, tuplets, vocal, volume; 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 short posit; /* position of indications / staff */ unsigned int fields[2]; /* info fields to print *[0] is 'A'..'Z', [1] is 'a'..'z' */ }; 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 nbar_rep; /* last repeat bar 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 SYMBOL *sym; /* associated symbols */ struct SYMBOL *last_sym; /* last symbol while scanning */ struct VOICE_S *next; /* link */ 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 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 while 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 while parsing */ unsigned hy_st; /* lyrics hyphens at start of line (bit array) */ unsigned ignore:1; /* ignore this voice */ 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) */ short wmeasure; /* measure duration while parsing */ short transpose; /* transposition while parsing */ short bar_start; /* bar type at start of staff / 0 */ unsigned short posit; /* position of indications / staff */ signed char clone; /* duplicate from this voice number */ unsigned char staff; /* staff (0..n-1) */ unsigned char cstaff; /* staff while parsing */ signed char stem; /* stem direction while parsing */ signed char gstem; /* grace stem direction while 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 */ #define PUT0(f) a2b(f) #define PUT1(f,a) a2b(f,a) #define PUT2(f,a,b) a2b(f,a,b) #define PUT3(f,a,b,c) a2b(f,a,b,c) #define PUT4(f,a,b,c,d) a2b(f,a,b,c,d) #define PUT5(f,a,b,c,d,e) a2b(f,a,b,c,d,e) void a2b(char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif ; void abskip(float h); void buffer_eob(void); void marg_init(void); void bskip(float h); void check_buffer(void); void clear_buffer(void); void close_output_file(void); void close_page(void); float get_bposy(void); void write_buffer(void); void open_output_file(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); 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(float top, int any_part, int any_tempo); 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(struct SYMBOL *s, int up, float x, float w, float h); void y_set(struct SYMBOL *s, 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); 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); struct tblt_s *tblt_parse(char *p); /* music.c */ void output_music(void); void reset_gen(void); /* parse.c */ extern float multicol_start; void do_tune(struct abctune *t, int header_only); void identify_note(struct SYMBOL *s, int len, int *p_head, int *p_dots, int *p_flags); 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 str_ft_out(char *p, int end); 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, int first); 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, 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_cmap(void); void define_font(char *name, int num, int enc); void define_symbols(void); abcm2ps-6.6.17/abcparse.c0000644000175000017500000016276611754416405013211 0ustar jefjef/* * Generic ABC parser. * * Copyright (C) 1998-2012 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 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 */ signed char add_pitch; /* key transpose */ 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_DECO, 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); } #if 0 static void print_warning(char *s) { fprintf(stderr, "Warning in line %d: %s\n", linenum, s); } #endif /* -- 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 == 0) break; s = t->first_sym; /* free the associated symbols */ for (;;) { sn = s->next; abc_delete(s); if ((s = sn) == 0) 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 != 0) { 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) { char *p; struct abctune *t; /* 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()) == 0) break; /* done */ if (*p == '\0') break; /* blank line --> done */ /*fixme-insert: don't accept X: nor T:*/ /* 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 != 0) { s->text = alloc_f(strlen(text) + 1); strcpy(s->text, text); } if (comment != 0) { s->comment = alloc_f(strlen(comment) + 1); strcpy(s->comment, comment); } if (t->last_sym == 0) { t->first_sym = s; } else { if ((s->next = t->last_sym->next) != 0) 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) { char *p; struct abctune *first_tune = 0; struct abctune *t, *last_tune; /* saved global variables */ int g_abc_vers, g_ulen; char g_char_tb[128]; /* initialize */ file = file_api; t = 0; abc_state = ABC_S_GLOBAL; if (level_f) level_f(0); linenum = 0; last_tune = 0; g_abc_vers = g_ulen = 0; /* (have gcc happy) */ if (strncmp(file, "%abc-", 5) == 0) get_vers(file + 5); /* scan till end of file */ for (;;) { if ((p = get_line()) == 0) { if (abc_state == ABC_S_HEAD) { syntax("Unexpected EOF in header definition", p); severity = 1; } if (t != 0) t->abc_vers = abc_vers; if (abc_state != ABC_S_GLOBAL) { abc_vers = g_abc_vers; ulen = g_ulen; memcpy(char_tb, g_char_tb, sizeof g_char_tb); } break; /* done */ } /* start a new tune if not done */ if (t == 0) { if (*p == '\0') continue; t = alloc_f(sizeof *t); memset(t, 0 , sizeof *t); if (last_tune == 0) { first_tune = t; } else { last_tune->next = t; t->prev = last_tune; } 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; 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 = 0; abc_vers = g_abc_vers; ulen = g_ulen; 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 = 0; 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; } /* -- skip a clef definition -- */ static char *clef_skip(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 != 0) syntax("Double clef name", p); *p_name = p; } else if (strncmp(p, "middle=", 7) == 0 || strncmp(p, "m=", 2) == 0) { if (*p_middle != 0) syntax("Double clef middle", p); *p_middle = p + (p[1] == '=' ? 2 : 7); } else if (strncmp(p, "octave=", 7) == 0) { if (*p_octave != 0) syntax("Double clef octave", p); *p_octave = p + 7; } else if (strncmp(p, "stafflines=", 11) == 0) { if (*p_lines != 0) syntax("Double clef stafflines", p); *p_lines = p + 11; } else if (strncmp(p, "staffscale=", 11) == 0) { if (*p_scale != 0) syntax("Double clef 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 != 0 && 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.nacc < 0) { syntax("'none' and explicit accidentals", 0); return p; } nacc = s->u.key.nacc; for (;;) { if (nacc >= sizeof s->u.key.pits) { syntax("Too many accidentals", 0); break; } p = parse_basic_note(p, &pit, &len, &acc, &nostem); s->u.key.pits[nacc] = pit - curvoice->add_pitch; s->u.key.accs[nacc++] = acc; if (*p == '\0') break; if (*p != '^' && *p != '_' && *p != '=') break; } 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, char *octave) { int clef = -1; int transpose = 0; int clef_line = 2; char str[80]; str[0] = '\0'; if (name != 0 && 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': transpose = -7; case 'G': clef = TREBLE; break; case 'f': transpose = -14; clef = BASS; clef_line = 4; break; case 'F': transpose = -7; clef = BASS; clef_line = 4; break; case 'c': transpose = -7; case 'C': clef = ALTO; clef_line = 3; break; case 'P': clef = PERC; break; } if (clef >= 0) { name++; while (*name == ',') { transpose += 7; name++; } while (*name == '\'') { transpose -= 7; name++; } } } if (name != 0 && 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') { if (*name == '-') s->u.clef.octave = -1; else if (*name == '+') s->u.clef.octave = 1; } } if (middle != 0) { int pit, len, acc, nostem, l; static char line_tb[7] = {ALTO, TREBLE, ALTO, BASS, ALTO, BASS, ALTO}; /* 'middle=' */ curvoice->add_pitch = 0; /* (for parse_basic_note) */ 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; if (octave != 0) { int o; o = atoi(octave) * 7 + transpose; if (o > -4 * 7 && o < 4 * 7) transpose = o; else syntax("Bad value of octave", octave); } curvoice->add_pitch = transpose; s->u.clef.stafflines = -1; s->u.clef.staffscale = 0; if (lines != 0) { int l; l = atoi(lines); if ((unsigned) l < 10) s->u.clef.stafflines = l; else syntax("Bad value of stafflines", lines); } if (scale != 0) { float sc; sc = atof(scale); if (sc >= 0.5 && sc <= 3) s->u.clef.staffscale = sc; else syntax("Bad value of staffscale", scale); } } /* -- parse a 'K:' -- */ static void parse_key(char *p, struct abcsym *s) { int sf, mode; char *clef_name, *clef_middle, *clef_lines, *clef_scale, *clef_octave; clef_name = clef_middle = clef_lines = clef_scale = clef_octave = 0; if (strncmp(p, "none", 4) == 0) { s->u.key.empty = 2; p += 4; while (isspace((unsigned char) *p)) p++; } p = clef_skip(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, & clef_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: syntax("Key not recognized", p); 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 = clef_skip(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, &clef_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 'n': case 'N': if (strncasecmp(p, "none", 4) == 0) { p += 4; while (!isspace((unsigned char) *p) && *p != '\0') p++; s->u.key.nacc = -1; /* explicit no accidental */ continue; } 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; if (clef_name != 0 || clef_middle != 0 || clef_lines != 0 || clef_scale != 0 || clef_octave != 0) { s = abc_new(s->tune, 0, 0); s->type = ABC_T_CLEF; parse_clef(s, clef_name, clef_middle, clef_lines, clef_scale, clef_octave); if (abc_state == ABC_S_HEAD) { /* if first K: */ int i; for (i = MAXVOICE; --i >= 0; ) voice_tb[i].add_pitch = curvoice->add_pitch; } } } /* -- set default length from 'L:' -- */ static char *get_len(char *p, struct abcsym *s) { int l1, l2, d; char *error_txt = 0; 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 (*p == 'N' || *p == 'n') p++; /* 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 '(': q = p + 1; while (*q != '\0') { if (*q == ')' || *q == '/') break; q++; } if (*q == ')') { p++; /* stay on top */ continue; } /* 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 == ')') 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; 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; } } } 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, have_error = 0; 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 = parse_len(p + 1, &len); if (len <= 0) have_error++; else s->u.tempo.length[0] = len * ulen / BASE_LEN; while (isspace((unsigned char) *p)) 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) { have_error++; break; } l = (BASE_LEN * top) / bot; if (l <= 0 || i >= sizeof s->u.tempo.length / sizeof s->u.tempo.length[0]) have_error++; else 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); } return have_error ? "Invalid tempo" : 0; } /* -- 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, "nil") == 0) char_tb[c] = CHAR_IGN; else if (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 = 0; char name[VOICE_NAME_SZ]; char *clef_name, *clef_middle, *clef_lines, *clef_scale, *clef_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 unit note length of the previous voice */ curvoice->ulen = ulen; 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 unit note length */ if (abc_state == ABC_S_TUNE || abc_state == ABC_S_EMBED) ulen = curvoice->ulen; /* parse the other parameters */ clef_name = clef_middle = clef_lines = clef_scale = clef_octave = 0; p_stem = &s->u.voice.stem; for (;;) { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; p = clef_skip(p, &clef_name, &clef_middle, &clef_lines, &clef_scale, &clef_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; } } if (clef_name != 0 || clef_middle != 0 || clef_lines != 0 || clef_scale != 0 || clef_octave != 0) { s = abc_new(s->tune, 0, 0); s->type = ABC_T_CLEF; parse_clef(s, clef_name, clef_middle, clef_lines, clef_scale, clef_octave); } 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 = 0; */ if (vover > 0) { curvoice = &voice_tb[curvoice->mvoice]; vover = 0; } s = abc_new(t, gchord, 0); if (gchord) { if (free_f) free_f(gchord); gchord = 0; } 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 (!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 != 0) { s = abc_new(t, repeat_value, 0); 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 == '/')) { int n, d; char *q; n = d = 1; if (*p != '/') { n = strtol(p, (char **) &q, 10); p = q; } if (*p == '/') { p++; if (!isdigit((unsigned char) *p)) d = 2; else { d = strtol(p, (char **) &q, 10); p = q; } } 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 == 0 || p_n - all_notes >= 14) { 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); len = len * ulen / BASE_LEN; *pitch = pit + curvoice->add_pitch; *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) == 0) is = deco_start; else deco_cont = 0; /* scan the decoration line */ while (*p != '\0') { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; switch (*p) { case '|': while (is != 0 && (is->type != ABC_T_BAR || is->u.bar.type == B_OBRA)) is = is->next; if (is == 0) { syntax("Not enough bar lines for deco line", p); return 0; } is = is->next; p++; continue; case '*': while (is != 0 && is->type != ABC_T_NOTE) is = is->next; if (is == 0) { syntax("Not enough notes for deco line", p); return 0; } is = is->next; p++; continue; case '\\': if (p[1] == '\0') { if (is == 0) return "Not enough notes for deco line"; deco_cont = is; return 0; } 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 != 0 && (is->type != ABC_T_NOTE || (is->flags & ABC_F_GRACE))) is = is->next; if (is == 0) return "Not enough notes for deco line"; if (gchord != 0) { if (is->text != 0) { 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 = 0; } 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 0; } /* -- 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, (char **) &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, (char **) &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 music 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 = 0; 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) { s = abc_new(t, 0, 0); s->type = ABC_T_NULL; } return 0; } return 1; case '%': if (p[1] == '@') { /* line number - see front.c */ linenum = atol(p + 2); return 0; } if (p[1] == '%') { if (strncmp(p + 2, "begin", 5) != 0) comment = decomment_line(p + 2); else comment = 0; 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_IGN; break; case '+': char_tb['+'] = CHAR_DECOS; char_tb['!'] = CHAR_IGN; break; } return 0; } if (strncasecmp(p, "linebreak ", 10) == 0) { char_tb['\n'] = CHAR_IGN; char_tb['$'] = CHAR_IGN; char_tb['!'] = CHAR_DECOS; p += 10; for (;;) { while (isspace((unsigned char) *p)) p++; if (*p == '\0') break; switch (*p) { case '!': char_tb['+'] = CHAR_DECOS; /* fall thru */ 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: syntax("Invalid character in %%%%linebreak", p); return 0; } } return 0; } return 0; } /* fall thru */ case '\\': /* abc2mtex specific lines */ if (keep_comment) { s = abc_new(t, p, 0); 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; lyric_started = 0; deco_start = deco_cont = 0; 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 = 0; 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['$'] != CHAR_LINEBREAK && check_nl(p)) { s = abc_new(t, 0, 0); /* 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, 0, 0); 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, 0, 0); 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'; } abc_state = ABC_S_EMBED; parse_info(t, q, 0); abc_state = ABC_S_TUNE; *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, (char **) &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, (char **) &q, 10); p = q; } if (*p == ':') { p++; if (isdigit((unsigned char) *p)) { rplet = strtol(p, (char **) &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, 0, 0); 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, 0, 0); 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] == '.') 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 == 0) { syntax("Bad start of voice overlay", p); break; } s = abc_new(t, 0, 0); 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, 0, 0); s->type = ABC_T_V_OVER; s->u.v_over.type = V_OVER_E; s->u.v_over.voice = curvoice->mvoice; curvoice->last_note = 0; /* ?? */ 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 == 0 || curvoice->last_note->type != ABC_T_NOTE) goto bad_char; if (p[-2] == '.') 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 == 0) 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 != 0) 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, 0, 0); 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, 0, 0); else { s = abc_new(t, gchord, 0); if (gchord) { if (free_f) free_f(gchord); gchord = 0; } } s->type = ABC_T_NOTE; s->flags |= flags; if (*p != 'Z' && !lyric_started && !(flags & ABC_F_GRACE)) { lyric_started = 1; s->flags |= ABC_F_LYRIC_START; deco_start = s; } /* rest */ switch (*p) { case 'Z': /* multi-rest */ s->type = ABC_T_MREST; p++; len = 1; if (isdigit((unsigned char) *p)) { len = strtol(p, &q, 10); 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--; } if (*p == '.' && p[1] == '(') p++; if (*p == '(') { s->u.note.sl1[m] <<= 3; if (p[-1] == '.') s->u.note.sl1[m] |= SL_DOTTED; p++; switch (*p) { case '\'': s->u.note.sl1[m] += SL_ABOVE; p++; break; case ',': s->u.note.sl1[m] += SL_BELOW; p++; break; default: s->u.note.sl1[m] += SL_AUTO; break; } } } 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 * BASE_LEN / 4 / ulen; tmp = 0; } 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) */ if ((t->last_sym = s->prev) == 0) { t->first_sym = 0; } else { s->prev->next = 0; s->prev->flags |= (s->flags & ABC_F_ERROR); } return p; } s->u.note.nhd = m - 1; do_brhythm: if (curvoice->last_note != 0 && 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; } 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 = 0; 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 == 0) { 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; } break; case 'L': error_txt = get_len(p, s); 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 != 0) 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 != 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 != 0) 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].add_pitch = curvoice->add_pitch; curvoice = &voice_tb[voice]; } abcm2ps-6.6.17/abcparse.h0000644000175000017500000001623711674415101013176 0ustar jefjef/*++ * 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 */ 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:) */ #define ABC_S_EMBED 3 /* embedded header (between [..]) */ unsigned short colnum; /* ABC source column number */ 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 */ int linenum; /* ABC source line number */ 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 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 */ 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 */ struct deco dc; /* decorations */ int type; char repeat_bar; char len; /* len if mrest or mrep */ char dotted; } 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; 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 abctune *prev; /* previous 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-6.6.17/accordion.abc0000644000175000017500000000445111654555736013671 0ustar jefjef% 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-6.6.17/buffer.c0000644000175000017500000005126411715414646012672 0ustar jefjef/* * Postscript buffering functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2012 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 #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; /* for eps (-E) and svg (-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 epsf/svg output files */ static int nbpages; /* number of pages in the output file */ 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 PUTx() */ int use_buffer; /* 1 if lines are being accumulated */ /* -- 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 -- */ 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 { 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++) { fprintf(fout, strchr(s_argv[i], ' ') != 0 ? " \'%s\'" : " %s", s_argv[i]); } 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(); 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"); #else file_initialized = 0; /* force full reinit */ #endif define_svg_symbols(str, (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 = 0; file_initialized = 0; } /* -- close the output file -- */ /* epsf is always null */ void close_output_file(void) { if (fout == 0) return; if (multicol_start != 0) { /* if no '%%multicol end' or filtering */ multicol_start = 0; write_buffer(); } if (tunenum == 0) error(0, 0, "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) close_fout(); else fputs("

\n", fout); } else fputs("%%PageTrailer\n" "grestore\n" "showpage\n", fout); 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, '$')) != 0) *q = '\0'; d += sprintf(d, "%s", p); if (q == 0) 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'] == 0) 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 = 2; } else { p = cfmt.footer; f = &cfmt.font_tb[FOOTERFONT]; size = f->size; y = - (pheight - cfmt.topmargin - cfmt.botmargin) - size + 2; } 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); wsize = 0; str_font(f - cfmt.font_tb); output(fout, "%.1f F%d ", size, f->fnum); outft = f - cfmt.font_tb; /* may have 2 lines */ if ((r = strstr(p, "\\n")) != 0) { 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')) != 0) { 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')) != 0) *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 != 0) { 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 == 0) break; *r = '\\'; p = r + 2; r = 0; 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 postscript page -- */ /* the flag 'in_page' is always false */ static void init_page(void) { float pheight, pwidth; p_fmt = info['X' - 'A'] == 0 ? &cfmt : &dfmt; /* global format */ if (svg) { if (!file_initialized) { if (svg == 1 && fout == 0) { int i; i = strlen(outfnam) - 7; sprintf(&outfnam[i], "%03d.svg", ++nepsf); if ((fout = fopen(outfnam, "w")) == 0) { error(1, 0, "Cannot create output file %s - abort", outfnam); exit(EXIT_FAILURE); } } define_svg_symbols(in_fname, 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, 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; nbpages++; 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 == 0) { char *p = 0; 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 != 0) cfmt.header = strdup(p); } if (cfmt.header != 0) { float dy; dy = headfooter(1, pwidth, pheight); if (dy != 0) { output(fout, "0 %.1f T\n", -dy); maxy -= dy; } } if (cfmt.footer != 0) maxy -= headfooter(0, pwidth, pheight); pagenum++; outft = -1; } /* -- cut off extension on a file identifier -- */ static void cutext(char *fid) { char *p; if ((p = strrchr(fid, DIRSEP)) == 0) p = fid; if ((p = strrchr(p, '.')) != 0) *p = '\0'; } /* -- open the output file -- */ void open_output_file(void) { int i; char fnm[FILENAME_MAX]; strcpy(fnm, outfn); i = strlen(fnm) - 1; if (i < 0) { strcpy(fnm, svg ? "Out.xhtml" : OUTPUTFILE); } else if (i == 0 && fnm[0] == '-') { if (svg == 1) { error(1, 0, "Cannot use stdout with '-v' - abort"); exit(EXIT_FAILURE); } } else { 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) { 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")) == 0) { error(1, 0, "Cannot create output file %s - abort", fnm); exit(EXIT_FAILURE); } } else { fout = stdout; } } /* -- 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'] == 0) 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, 0, "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")) == 0) { error(1, 0, "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 -- */ /* called from the PUTx() macros */ void a2b(char *fmt, ...) { va_list args; if (mbf + BSIZE > outbuf + BUFFSZ) { if (epsf) { error(1, 0, "Possible buffer overflow - abort"); exit(EXIT_FAILURE); } error(0, 0, "Possible buffer overflow"); write_buffer(); use_buffer = 0; } va_start(args, fmt); mbf += vsnprintf(mbf, outbuf + BUFFSZ - mbf, fmt, args); va_end(args); } /* -- translate down by 'h' absolute points in output buffer -- */ void abskip(float h) { PUT1("0 %.2f T\n", -h / cfmt.scale); bposy -= h; } /* -- translate down by 'h' scaled points in output buffer -- */ void bskip(float h) { bposy -= h * cfmt.scale; PUT1("0 %.2f T\n", -h); } /* -- clear_buffer -- */ void clear_buffer(void) { bposy = 0; ln_num = 0; if (outbuf == 0) outbuf = malloc(BUFFSZ); 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")) == 0) { error(1, 0, "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, "??? buffer not empty:\n%s\n", p_buf); #else if (epsf == 2 || svg) svg_write(p_buf, strlen(p_buf)); else fwrite(p_buf, 1, strlen(p_buf), fout); #endif clear_buffer(); outft = outft_sav; } /* -- 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) { // if (bposy == 0 && mbf == outbuf) 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; if (ln_num >= BUFFLN) { char c, *p; error(1, 0, "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; } if (maxy + bposy < 0 && !epsf && multicol_start == 0) { // if (tunenum > 1) // newpage(); maxy = 0; /* force new page */ write_buffer(); use_buffer = 0; } } /* -- dump buffer if not enough place for a music line -- */ void check_buffer(void) { if (mbf + 5000 > outbuf + BUFFSZ) { /* assume music line < 5000 bytes */ error(0, 0, "Possibly bad page breaks, BUFFSZ exceeded"); write_buffer(); use_buffer = 0; } } /* -- return the current vertical offset in the page -- */ float get_bposy(void) { return maxy + bposy; } abcm2ps-6.6.17/chinese.abc0000644000175000017500000000514611701345541013330 0ustar jefjef% 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-6.6.17/configure0000755000175000017500000042137511765041156013165 0ustar jefjef#! /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 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=6.6.17 VDATE='June 10, 2012' 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 `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-6.6.17/configure.in0000644000175000017500000000345411765041132013553 0ustar jefjefdnl Configure source for abcm2ps -*- sh -*- dnl Copyright (C) 2001-2012 JF Moine. AC_INIT(abc2ps.h) VERSION=6.6.17 VDATE='June 10, 2012' 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 `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_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_DEFINE_UNQUOTED(VDATE, "$VDATE") AC_DEFINE_UNQUOTED(DEFAULT_FDIR, "$DEFAULT_FDIR") AC_OUTPUT(Makefile) abcm2ps-6.6.17/config.h0000644000175000017500000000103011765041171012647 0ustar jefjef/* 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 "6.6.17" #define VDATE "June 10, 2012" abcm2ps-6.6.17/config.h.in0000644000175000017500000000064011334064351013257 0ustar jefjef/* 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-6.6.17/config.guess0000644000175000017500000012753411124661330013562 0ustar jefjef#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-23' # 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 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 - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. 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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 # 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 tupples: *-*-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 __ELF__ >/dev/null 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 ;; *: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'` exit ;; 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 ;; 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:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-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:*:[456]) 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 __LP64__ >/dev/null 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:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) 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 ;; 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-gnu`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/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix 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-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu 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 ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${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-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; 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.0*:*) 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 i386. echo i386-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; } ;; 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.0*:*) 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 ;; 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 case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac 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 ;; 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 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 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-6.6.17/config.sub0000644000175000017500000010115311124661334013216 0ustar jefjef#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # 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 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 - Fifth Floor, Boston, MA # 02110-1301, USA. # # 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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. # 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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) 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) os= basic_machine=$1 ;; -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*) 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 \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | 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 | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-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-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | 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-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | 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-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; # 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 ;; 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 ;; c90) basic_machine=c90-cray os=-unicos ;; 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) 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 ;; 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'm not sure what "Sysv32" means. Should this be sysv3.2? 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 ;; mingw32) basic_machine=i386-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-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; 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 ;; 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) basic_machine=powerpc-unknown ;; ppc-*) 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) 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 ;; 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 ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-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 ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-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[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. -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* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -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* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -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*) # 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 ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 ;; # 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 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) 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 ;; -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-6.6.17/deco.c0000644000175000017500000014161311753765410012331 0ustar jefjef/* * Decoration handling. * * This file is part of abcm2ps. * * Copyright (C) 2000-2012, 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 "abc2ps.h" int nbar; /* current measure number */ int nbar_rep; /* last repeat bar number */ 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 str; /* 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 10 6 6", "fermata 3 hld 12 7 7", "emphasis 3 accent 8 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 8 4 4", "> 3 accent 8 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 4 4", "ff 6 pf 18 5 11", "fff 6 pf 18 7 17", "ffff 6 pf 18 8 24", "mf 6 pf 18 5 11", "mp 6 pf 18 5 11", "mordent 3 lmrd 10 2 2", "open 3 opend 10 2 2", "p 6 pf 18 4 4", "pp 6 pf 18 5 11", "ppp 6 pf 18 7 17", "pppp 6 pf 18 8 24", "pralltriller 3 umrd 10 2 2", "sfz 6 sfz 18 7 17", "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", 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(struct SYMBOL *s, int up, float x, float w, float h) { struct STAFF_S *p_staff; int i, j; float y; p_staff = &staff_tb[s->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) { /*fprintf(stderr, "y_get i:%d", j);*/ 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++; } y -= h; } return y; } /* -- adjust the vertical offsets -- */ void y_set(struct SYMBOL *s, int up, float x, float w, float y) { struct STAFF_S *p_staff; int i, j; p_staff = &staff_tb[s->staff]; i = (int) (x / realwidth * YSTEP); if (i < 0) { fprintf(stderr, "y_set i:%d\n", i); i = 0; } j = (int) ((x + w) / realwidth * YSTEP); if (j >= YSTEP) { /*fprintf(stderr, "y_get i:%d", j);*/ 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 marks -- */ static int dyn_p(struct SYMBOL *s, int pos_idx) { switch ((s->posit >> pos_idx) & 3) { case SL_ABOVE: return 1; case SL_BELOW: return 0; } if (s->multi != 0) return s->multi > 0 ? 1 : 0; if (!voice_tb[s->voice].have_ly) return 0; /* above if the lyrics are below the staff */ if ((s->posit >> POS_VOC) == SL_ABOVE) return 0; return 1; } /* -- 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 != 0) { 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 = dyn_p(s2, POS_DYN); if (up) de->flags |= DE_UP; /* shift the starting point if any dynamic mark on the left */ if (de1 != 0 && de1->prev != 0 && 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 != 0 && 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(s2, up, x, dx, 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]; up = s->stem > 0 ? 0 : 1; if (s->multi) up = !up; 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->x = s->x + s->shhd[s->stem >= 0 ? 0 : s->nhd]; de->y = (float) y; } /* 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]; up = dyn_p(s, POS_VOL); if (up) de->flags |= DE_UP; x = s->x - dd->wl; if (de->prev != 0 && 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; } } str = dd->name; if (dd->str != 0 && dd->str != 255) str = str_tb[dd->str]; de->v = dd->wl + dd->wr; de->x = x; de->y = y_get(s, up, s->x, de->v, 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; struct deco_def_s *dd; int staff, up; float x, y, w; struct SYMBOL *s2; if (de->flags & DE_LDST) return; s2 = de->s; if (de->start != 0) { /* 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(s2, up, x, w, dd->h); if (up) { float stafft; stafft = staff_tb[s->staff].topbar + 2; if (y < stafft) y = stafft; } else { float staffb; 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(s2, up, x, w, 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->str != 0) de->str = dd->str == 255 ? dd->name : str_tb[dd->str]; if (strcmp(dd->name, "roll") == 0) { if (s->multi < 0 || (s->multi == 0 && s->stem > 0)) { yc = y_get(s, 0, s->x - dd->wl, w, 0); if (yc > staffb) yc = staffb; yc -= dd->h; y_set(s, 0, s->x, 0, yc); inv = 1; } else { yc = y_get(s, 1, s->x, 0, 0) + 3; if (yc < stafft) yc = stafft; if (s->stem <= 0 && (s->dots == 0 || ((int) s->y % 6))) yc -= 2; y_set(s, 1, s->x - dd->wl, w, 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 != 0; s = s->ts_next) if (s->shrink != 0) break; if (s != 0) 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, 1, s->x - dd->wl, w, 0); if (yc < stafft) yc = stafft; y_set(s, 1, s->x - dd->wl, w, yc + dd->h); } else { yc = y_get(s, 0, s->x - dd->wl, w, 0); if (yc > staffb) yc = staffb; yc -= dd->h; y_set(s, 0, s->x - dd->wl, w, yc); if (strcmp(dd->name, "fermata") == 0 || strcmp(dd->name, "invertedfermata") == 0) inv = 1; } } 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 = 0; d->next = user_deco; user_deco = d; } static unsigned char deco_build(char *text) { struct deco_def_s *dd; int c_func, deco, h, o, wl, wr, n; unsigned l, ps_x, str_x; 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 > 38)) { 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 (deco = 1, dd = &deco_def_tb[1]; deco < 128; deco++, dd++) { if (dd->name == 0 || strcmp(dd->name, name) == 0) break; } if (deco == 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') { str_x = 0; } else if (strcmp(text, name) == 0) { str_x = 255; } else { for (str_x = 1; str_x < sizeof str_tb / sizeof str_tb[0]; str_x++) { if (str_tb[str_x] == 0) { if (*text == '"') { text++; l = strlen(text); str_tb[str_x] = malloc(l); memcpy(str_tb[str_x], text, l - 1); str_tb[str_x][l - 1] = '\0'; } else { str_tb[str_x] = strdup(text); } break; } if (strcmp(str_tb[str_x], text) == 0) break; } if (str_x == sizeof str_tb / sizeof str_tb[0]) { error(1, 0, "Too many decoration strings"); return 128; } } /* set the values */ if (dd->name == 0) dd->name = strdup(name); /* new decoration */ dd->func = c_func; if (ps_func_tb[ps_x] == 0) { 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->str = str_x; /* link the start and end of long decorations */ l = strlen(name); if (l == 0) return deco; 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 == 0) 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 = deco; break; } } } } return deco; } /* -- 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 deco; static char must_note_fmt[] = "Deco !%s! must be on a note"; for (i = dc->n; --i >= 0; ) { if ((deco = dc->t[i]) == 0) continue; if (deco < 128) { deco = deco_tune[deco]; if (deco == 0) error(1, s, "Notation '%c' not treated", dc->t[i]); } else { deco = deco_intern(deco); } dc->t[i] = deco; if (deco == 0) continue; /* special decorations */ dd = &deco_def_tb[deco]; 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 == 0 || 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; } dc->t[i] = 0; } } /* -- 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 != 0; d = d->next) { if (strncmp(d->text, name, l) == 0 && d->text[l] == ' ') return deco_build(d->text); } return 128; } /* -- define a standard decoration -- */ static unsigned char deco_define(char *name) { unsigned char deco, d_deco; int l; l = strlen(name); for (deco = 0; ; deco++) { if (std_deco_tb[deco] == 0) return 128; if (strncmp(std_deco_tb[deco], name, l) == 0 && std_deco_tb[deco][l] == ' ') break; } d_deco = deco_build(std_deco_tb[deco]); return d_deco; } /* -- convert the external deco number to the internal one -- */ unsigned char deco_intern(unsigned char deco) { char *name; if (deco == 0) return deco; name = deco_tb[deco - 128]; for (deco = 1; deco < 128; deco++) { if (deco_def_tb[deco].name == 0) { deco = user_deco_define(name); /* try a user decoration */ if (deco == 128) /* try a standard decoration */ deco = deco_define(name); break; } if (strcmp(deco_def_tb[deco].name, name) == 0) break; } if (deco == 128) { error(1, 0, "Decoration %s not treated", name); deco = 0; } return deco; } /* -- update the x position of a decoration -- */ void deco_update(struct SYMBOL *s, float dx) { struct deco_elt *de; for (de = deco_head; de != 0; de = de->next) { if (de->s == s) { while (de != 0 && 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->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 != 0; 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; while (s->staff != staff) s = s->ts_prev; y2 = y_get(s, !(de->flags & DE_UP), de->x, de->v, dd->h) + staff_tb[staff].y; if (((de->flags & DE_UP) && y2 > ym) || (!(de->flags & DE_UP) && y2 < ym)) { y = ym; y_set(de->s, de->flags & DE_UP, de->x, de->v, ((de->flags & DE_UP) ? y + dd->h : y) - staff_tb[de->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 != 0) { 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_scale(0); /* restore the scale */ } /* -- draw a decoration relative to a note head -- */ /* return 1 if the decoration is a head */ int draw_deco_head(int deco, float x, float y, int stem) { struct deco_def_s *dd; char *str; if (deco == 0) return 0; dd = &deco_def_tb[deco]; if (dd->ps_func < 0) return 0; if (cfmt.setdefl) { int fl; fl = stem >= 0 ? DEF_STEMUP : 0; if (defl != fl) { defl = fl; PUT1("/defl %d def ", fl); } } switch (dd->func) { case 2: case 5: case 7: PUT0("0 "); break; case 3: case 4: if (dd->str == 0) break; /* fall thru */ case 6: str = dd->name; if (dd->str != 0 && dd->str != 255) str = str_tb[dd->str]; PUT1("(%s)", str); break; } putxy(x, y); PUT1("%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 deco; 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 ((deco = dc->t[k]) == 0) continue; dd = &deco_def_tb[deco]; if (strncmp(dd->name, "head-", 5) != 0) continue; draw_deco_head(deco, 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; unsigned char deco; 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 ((deco = dc->t[k]) == 0) continue; dd = &deco_def_tb[deco]; #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 ((deco = dc->t[k]) == 0) continue; dd = &deco_def_tb[deco]; 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 /* 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); if ((de->prev = deco_tail) == 0) 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 = 0; first = 0; for (s = tsfirst; s != 0; 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 == 0) 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 != 0; 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 != 0; 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 != 0; de2 = de2->next) if (de2->t == t && de2->s->voice == voice) break; if (de2 == 0) { /* search in the staff */ staff = de->s->staff; for (de2 = de->next; de2 != 0; de2 = de2->next) if (de2->t == t && de2->s->staff == staff) break; } if (de2 == 0) { /* 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; struct VOICE_S *p_voice; float x, y, w; struct deco_elt *de; int some_gchord; struct { float ymin, ymax; } minmax[MAXSTAFF]; /* search the vertical offset for the guitar chords */ memset(minmax, 0, sizeof minmax); some_gchord = 0; for (s = tsfirst; s != 0; s = s->ts_next) { char *p; if (s->as.text == 0) continue; switch (s->type) { case NOTEREST: case SPACE: case MREST: break; case BAR: if (!s->as.u.bar.repeat_bar) break; default: continue; } some_gchord = 1; w = cwid('a') * cfmt.font_tb[s->gcf].swfac; if ((p = strchr(s->as.text, '\n')) != 0 || (p = strchr(s->as.text, ';')) != 0) w *= p - s->as.text; /*fixme:utf8*/ else w *= strlen(s->as.text); y = y_get(s, 0, s->x, w, 0); if (y < minmax[s->staff].ymin) minmax[s->staff].ymin = y; y = y_get(s, 1, s->x, w, 0); if (y > minmax[s->staff].ymax) minmax[s->staff].ymax = y; } /* draw the guitar chords if any */ if (some_gchord) { int i; for (i = 0; i <= nstaff; i++) { minmax[i].ymin -= 4; if (minmax[i].ymin > -10) minmax[i].ymin = -10; minmax[i].ymax += 4; if (minmax[i].ymax < 34) minmax[i].ymax = 34; } for (s = tsfirst; s != 0; s = s->ts_next) { if (s->as.text == 0) 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 == 0) continue; set_sscale(p_voice->staff); /* search the max y offset */ y = staff_tb[p_voice->staff].topbar + 6 + 20; first_repeat = 0; for (s = p_voice->sym->next; s != 0; 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 == 0) break; if (first_repeat == 0) { set_font(REPEATFONT); first_repeat = s; } s1 = s; i = s1->as.text ? 4 : 2; for (;;) { if (s->next == 0) 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(s1, 1, s1->x, s->x - s1->x, 0); if (y < y2) y = y2; /* have room for the repeat numbers */ if (s1->as.text != 0) { w = cwid('2') * cfmt.font_tb[REPEATFONT].swfac /*fixme:utf8*/ * strlen(s1->as.text); y2 = y_get(s1, 1, s1->x + 4, w, 0); 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 */ repnl = 0; for (s = first_repeat; s != 0; 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 == 0) 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; /*fixme*/ 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 == 0) { i--; /* no bracket start (1) or not drawn */ p = ""; } if (i == 0 && s2->next == 0 /* 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) { PUT3("(%s)-%.1f %d ", p, cfmt.font_tb[REPEATFONT].size * 0.8 + 1, i); putx(w); putxy(x, y); PUT1("y%d repbra\n", s1->staff); y_set(s1, 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 != 0; 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 != 0; 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->s, 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) { float x, y, w, yspca, yspcc, gchya, gchyb, gchyc, gchyl, gchyr; float xmin, xmax, ymin, ymax, xspc; int box, gch_place, action; char *p, *q, sep, antype; float expdx; p = s->as.text; gch_place = ((voice_tb[s->voice].posit >> POS_GCH) & 3) == SL_BELOW ? -1 : 1; yspcc = cfmt.font_tb[s->gcf].size; yspca = cfmt.font_tb[s->anf].size; gchya = gchyb = gchyc = 0; gchyl = gchyr = s->yav + yspca * 0.25; box = cfmt.gchordbox; /* calculate the y offset of the top lines */ antype = '\0'; sep = '\n'; for (;;) { if (*p != '\0' && strchr("^_<>@", *p) != 0) antype = *p++; else if (sep == '\n') antype = '\0'; switch (antype) { default: /* guitar chord */ if (box) box = 2; if (gch_place < 0) break; /* below */ gchya += yspcc; if (box) gchya += 2; gchyc = gchya; break; case '^': /* above */ gchya += yspca; break; case '_': /* below */ break; case '<': /* left */ gchyl += yspca * 0.5; break; case '>': /* right */ gchyr += yspca * 0.5; break; case '@': /* absolute */ break; } for (;;) { if (*p == '\0' || *p == ';' || *p == '\n') break; p++; if (p[-1] == '\\') { if (*p == '\\' || *p == ';') p++; } } sep = *p; if (sep == '\0') break; p++; } /*fixme: should have got the max width*/ p = s->as.text; /*fixme:utf8*/ w = cwid('0') * yspca * strlen(p); gchya += y_get(s, 1, s->x, w, 0) + 4; if (gchya < gchy_max + gchyc) gchya = gchy_max + gchyc; gchyb += y_get(s, 0, s->x, w, 0) - 4; if (gch_place >= 0) { ymax = 0; ymin = 100; } else { ymax = -100; ymin = 0; } xmin = xmax = s->x; action = A_GCHORD;; x = y = expdx = 0; /* (compiler warning) */ /* loop on each line */ set_sscale(s->staff); antype = '\0'; sep = '\n'; for (;;) { if (*p == '@') { int n; float xo, yo; x = s->x; if (sscanf(p, "@%f,%f%n", &xo, &yo, &n) != 2) { error(1, s, "Error in annotation \"@\""); y = s->yav; } else { x += xo; y = s->yav + yo; p += n; if (*p == ' ') p++; } antype = '@'; } else if (*p != '\0' && strchr("^_<>", *p) != 0) antype = *p++; else if (sep == '\n') antype = '\0'; for (q = p; ; q++) { if (*q == '\\') { q++; if (*q == '\\' || *q == ';') continue; } if (*q == '\0' || *q == ';' || *q == '\n') { sep = *q; *q = '\0'; break; } } w = tex_str(p); if (antype == '\0') { /* guitar chord */ str_font(s->gcf); if (strchr(tex_buf, '\t') == 0) action = A_GCHORD; else { struct SYMBOL *next; char *r; int n; /* some TAB: expand the guitar chord */ x = realwidth; next = s->next; while (next != 0) { 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 == 0) break; r++; } expdx = (x - s->x - w) / n; action = A_GCHEXP; } } else { str_font(s->anf); action = A_ANNOT; } switch (antype) { case '_': /* below */ xspc = w; xspc *= GCHPRE; if (xspc > 8) xspc = 8; x = s->x - xspc; gchyb -= yspca; y = gchyb; y_set(s, 0, x, w, gchyb - 2); break; case '^': /* above */ xspc = w; xspc *= GCHPRE; if (xspc > 8) xspc = 8; x = s->x - xspc; y_set(s, 1, x, w, gchya); gchya -= yspca; y = gchya; break; default: /* guitar chord */ xspc = w; xspc *= GCHPRE; if (xspc > 8) xspc = 8; x = s->x - xspc; if (gch_place < 0) { /* below */ if (gchyb > gchy_min) gchyb = gchy_min; y = gchyb - yspcc; if (!box) y_set(s, 0, x, w, y - 2); } else { y = gchya - yspcc; if (!box) y_set(s, 1, x, w, gchya); } if (!box) { if (gch_place < 0) gchyb = y; else gchya = y; } else { if (x < xmin) xmin = x; w += x; if (w > xmax) xmax = w; if (ymax < y + yspcc) ymax = y + yspcc; if (ymin > y) ymin = y; y -= 1; if (gch_place < 0) gchyb = y - 1; else gchya = y - 1; } break; case '<': /* left */ /*fixme: what symbol space?*/ x = s->x - w - 6; if (s->as.u.note.accs[0]) x -= s->shac[0]; gchyl -= yspca; y = gchyl; break; case '>': /* right */ x = s->x + s->xmx + 6; if (s->dots > 0) x += 1.5 + 3.5 * s->dots; gchyr -= yspca; y = gchyr; break; case '@': /* absolute */ antype = '\001'; break; case '\001': /* next absolute */ y -= yspca; break; } putxy(x, y); a2b("y%d M ", s->staff); if (antype == '\0' && box == 2) { a2b("boxstart "); box = 3; } if (action == A_GCHEXP) a2b("%.2f ", expdx); str_out(tex_buf, action); a2b("\n"); if (antype == '\0' && box == 3) a2b("boxmark "); if (sep == '\0') break; *q = sep; p = q + 1; } /* draw the box of the guitar chords */ if (box == 3) { /* if any normal guitar chord */ xmin -= 2; w = xmax - xmin + 2; y_set(s, 1, xmin, w, ymax + 2); putxy(xmin, ymin - 5); a2b("y%d %.1f boxdraw ", s->staff, ymax - ymin + 4); } } /* -- draw the measure bar numbers -- */ void draw_measnb(void) { struct SYMBOL *s; char *showm; int any_nb, bar_num; float x, y, w; showm = cfmt.measurebox ? "showb" : "show"; any_nb = 0; s = tsfirst; /* clef */ bar_num = nbar; if (bar_num > 1) { if (cfmt.measurenb == 0) { set_font(MEASUREFONT); any_nb = 1; x = 0; w = 20; y = y_get(s, 1, x, w, 0); if (y < staff_tb[0].topbar + 14) y = staff_tb[0].topbar + 14; PUT0("0 "); puty(y); PUT2("y0 M(%d)%s", bar_num, showm); y_set(s, 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; } 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(s, 1, x, w, 0); if (y < staff_tb[0].topbar + 6) y = staff_tb[0].topbar + 6; y += 2; putxy(x, y); PUT2("y0 M(%d)%s", bar_num, showm); y += cfmt.font_tb[MEASUREFONT].size; y_set(s, 1, x, w, y); s->ymx = y; } } for ( ; s != 0; s = s->ts_next) { if (s->type != BAR || s->u == 0) continue; bar_num = s->u; if (bar_num <= 0) continue; if (cfmt.measurenb == 0 || (bar_num % cfmt.measurenb) != 0 || s->next == 0) continue; 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(s, 1, x, w, 0); if (y < staff_tb[0].topbar + 6) y = staff_tb[0].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; PUT0(" "); putxy(x, y); PUT2("y0 M(%d)%s", bar_num, showm); y += cfmt.font_tb[MEASUREFONT].size; y_set(s, 1, x, w, y); s->ymx = y; } if (any_nb) PUT0("\n"); nbar = bar_num; } /* -- 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; PUT1("gsave %.2f dup scale 8 3 RM currentpoint ", sc); identify_note(s, len, &head, &dots, &flags); switch (head) { case H_OVAL: PUT0("HD"); break; case H_EMPTY: PUT0("Hd"); break; default: PUT0("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) { PUT1(" %.1f 0 dt", dotx); dx = dotx; dotx += 3.5; } } if (len < SEMIBREVE) { if (flags <= 0) PUT1(" %d su", STEM); else { PUT2(" %d %d sfu", flags, STEM); if (dx < 6) dx = 6; } } PUT1(" 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 != 0) 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 != 0) 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 != 0) 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 != 0) put_str(s->as.u.tempo.str2, A_LEFT); } /* -- draw the parts and the tempo information -- */ /* (the staves are being defined) */ float draw_partempo(float top, int any_part, int any_tempo) { struct SYMBOL *s, *g; float h, ht, w, y, ymin, dy; /* put the tempo indication at top */ dy = 0; if (any_tempo) { int beat, dosh, shift; float x; ht = cfmt.font_tb[TEMPOFONT].size + 2 + 2; str_font(TEMPOFONT); /* get the minimal y offset */ ymin = staff_tb[0].topbar + 12; dosh = 0; shift = 1; x = 0; /*fixme:have tempo on other voices but the 1st?*/ for (s = voice_tb[cursys->top_voice].sym; s != 0; s = s->next) { if ((g = s->extra) == 0) continue; for (; g != 0; g = g->next) if (g->type == TEMPO) break; if (g == 0) continue; w = tempo_width(g); y = y_get(s, 1, s->x - 5, w, 0) + 2; if (y > ymin) ymin = y; if (x >= s->x - 5 && !(dosh & (shift >> 1))) dosh |= shift; shift <<= 1; x = s->x - 5 + w; } 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 = voice_tb[cursys->top_voice].sym; s != 0; s = s->next) { if (s->type == TIMESIG) beat = get_beat(&s->as.u.meter); if ((g = s->extra) == 0) continue; for (; g != 0; g = g->next) if (g->type == TEMPO) break; if (g == 0) continue; /*fixme: cf left shift (-5)*/ PUT2("%.1f %.1f M ", s->x - 5, (dosh & 1) ? h : y); dosh >>= 1; write_tempo(g, beat, 1); } } else { ht = 0; } /* then, put the parts */ if (!any_part) return dy; /*fixme: should reduce if parts don't overlap tempo...*/ h = cfmt.font_tb[PARTSFONT].size + 2 + 2; /* + cfmt.partsspace; */ str_font(PARTSFONT); ymin = staff_tb[0].topbar + 14; for (s = voice_tb[cursys->top_voice].sym; s != 0; s = s->next) { if ((g = s->extra) == 0) continue; for (; g != 0; g = g->next) if (g->type == PART) break; if (g == 0) continue; w = tex_str(&g->as.text[2]); y = y_get(s, 1, s->x - 10, w + 15, 0) + 5; if (ymin < y) ymin = y; } if (top < ymin + h + ht) dy = ymin + h + ht - top; set_font(PARTSFONT); for (s = voice_tb[cursys->top_voice].sym; s != 0; s = s->next) { if ((g = s->extra) == 0) continue; for (; g != 0; g = g->next) if (g->type == PART) break; if (g == 0) continue; w = tex_str(&g->as.text[2]); a2b("%.1f %.1f M", s->x - 10, 2 - ht - h); put_str(tex_buf, A_LEFT); if (cfmt.partsbox) a2b("%.1f %.1f %.1f %.1f box\n", s->x - 10 - 2, 2 - ht - h - 4, w + 4, h); } return dy; } /* -- initialize the default decorations -- */ void reset_deco(void) { memset(&deco_glob, 0, sizeof deco_glob); /* standard */ deco_glob['.'] = deco_define("dot"); #ifdef DECO_IS_ROLL deco_glob['~'] = deco_define("roll"); #endif deco_glob['H'] = deco_define("fermata"); deco_glob['L'] = deco_define("emphasis"); deco_glob['M'] = deco_define("lowermordent"); deco_glob['O'] = deco_define("coda"); deco_glob['P'] = deco_define("uppermordent"); deco_glob['S'] = deco_define("segno"); deco_glob['T'] = deco_define("trill"); deco_glob['u'] = deco_define("upbow"); deco_glob['v'] = deco_define("downbow"); /* non-standard */ #ifndef DECO_IS_ROLL deco_glob['~'] = deco_define("gmark"); #endif deco_glob['J'] = deco_define("slide"); deco_glob['R'] = deco_define("roll"); /* abc2ps */ if (cfmt.abc2pscompat) deco_glob['M'] = deco_define("tenuto"); } /* -- set the decoration flags -- */ void set_defl(int new_defl) { if (defl == new_defl) return; defl = new_defl; PUT1("/defl %d def ", new_defl); } abcm2ps-6.6.17/deco.abc0000644000175000017500000003012311637306510012616 0ustar jefjef%!! 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 /gcshow{ dup 0 get dup dup 65 ge exch 71 le and{ 65 sub[(La)(Si)(Do)(Ré)(Mi)(Fa)(Sol)]exch get }if show dup length 1 sub 1 exch getinterval 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 %%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-6.6.17/draw.c0000644000175000017500000031234511764331346012355 0ustar jefjef/* * Drawing functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2012 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 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 (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); a2b("%.1f %d\n", s->wl + s->wr + 4, s->ymx - s->ymn + 4); } /* -- 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; } /* -- 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 & s1->next->as.flags & ABC_F_INVIS) return 0; /* find first and 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) continue; 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; } 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 = s->ts_prev; for (; s != 0 && 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->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) - 7; if (y < 0) b += y; } break; case GRACE: g = s->extra; for ( ; g != 0; g = g->next) { if (g->type != NOTEREST) continue; y = a * g->x + b; if (s1->stem > 0) { y = g->ys - y + BEAM_DEPTH + BEAM_SHIFT * (nflags - 1) + 2; if (y > 0) b += y; } else { y = g->y - y - BEAM_DEPTH - BEAM_SHIFT * (nflags - 1) - 7; 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; 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); PUT0("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; 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); 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; } /* other beams with two or more flags */ shift = 0; for (i = 2; i <= bm->nflags; i++) { shift += bshift; 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 || (k1->sflags & S_BEAM_BR1) || ((k1->sflags & S_BEAM_BR2) && i > 2)) { x1 += bstub; } else if (k1 == s2) { 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; } } } /* -- 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; PUT4("%.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 < nst; 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--; } 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_scale(0); yb = staff_tb[j].y + staff_tb[j].botbar * staff_tb[j].clef.staffscale; PUT3("%.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 = staff_tb[staff].clef.stafflines; switch (nlines) { case 0: return; case 1: y += 12; break; case 2: case 3: y += 6; break; } putx(x2 - x1); PUT1("%d ", nlines); putxy(x1, y); PUT0("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') PUT1("%s ", meter); dx = (float) (13 * l); putxy(x + dx * .5, staff_tb[staff].y); PUT1("%s\n", f); x += dx; } } /* -- 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] / 2; if (clef_ix < 0) clef_ix += 7; else if (clef_ix >= 7) clef_ix -= 7; /* normal accidentals */ if (s->as.u.key.nacc == 0) { /* if flats to sharps, or sharps to flats, put neutrals */ 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); PUT0("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); PUT0("nt0 "); shift += *p_seq++; x += 5.5; } if (s->as.u.key.sf != 0) x += 3; /* extra space */ /* if less sharps or flats, put neutrals */ /* sharps */ } else if (s->as.u.key.sf > 0) { 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); PUT0("nt0 "); shift += *p_seq++; x += 5.5; } x += 3; /* extra space */ } /* flats */ } else /*if (s->as.u.key.sf < 0)*/ { 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); PUT0("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); PUT0("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); PUT0("ft0 "); shift += *p_seq++; x += 5.5; } } else { int 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++) { if (s->as.u.key.accs[i] != last_acc) { last_acc = s->as.u.key.accs[i]; x += 3; } shift = clef_ix * 6 + 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; /* same note */ last_shift = shift; putxy(x, staffb + shift); PUT2("%s%d ", acc_tb[last_acc & 0x07], micro_tb[last_acc >> 3]); x += 5.5; } } if (old_sf != 0 || s->as.u.key.sf != 0 || s->as.u.key.nacc >= 0) PUT0("\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 = (B_COL << 12) + (B_CBRA << 8) + (B_OBRA << 4) + B_COL; break; } return bar_type; } /* -- draw a measure bar -- */ static void draw_bar(struct SYMBOL *s) { int staff, bar_type, dotted; float x, yb, h; char *psf; staff = s->staff; yb = staff_tb[staff].y; h = s->ys; 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); PUT0("mrep\n"); } else { putxy(x, yb); PUT0("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); PUT1("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 */ yb += staff_tb[staff].botbar * staff_tb[staff].clef.staffscale; 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_scale(0); PUT4("%.1f %.1f %.1f %s ", h, x, yb, psf); break; case B_COL: set_sscale(staff); putxy(x + 1, staff_tb[staff].y); PUT0("rdots "); break; } bar_type >>= 4; if (bar_type == 0) break; x -= 3; } PUT0("\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 *prev; if (s->next != 0) x = s->next->x; else x = realwidth; prev = s->prev; if (prev == 0) prev = s; else if (prev->type != BAR && !(s->sflags & S_SECOND)) { for (prev = prev->ts_next; ; prev = prev->ts_next) { switch (prev->type) { case CLEF: case KEYSIG: case TIMESIG: case FMTCHG: continue; default: break; } prev = prev->ts_prev; break; } } x = (x + prev->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) PUT0("srep\n"); else { PUT0("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); PUT1("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 */ PUT1("%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); PUT0("hl "); } break; case 7: /* semibreve */ if (y < yb || y >= yt - 6) { putxy(x, y + 6 + staffb); PUT0("hl "); } break; default: if (y < yb || y >= yt - 6) { putxy(x,y + 6 + staffb); PUT0("hl "); } if (i == 9) /* longa */ y -= 6; if (y <= yb || y >= yt) { putxy(x, y + staffb); PUT0("hl "); } break; } } dotx = 8; for (i = 0; i < s->dots; i++) { PUT1("%.1f 3 dt ", dotx); dotx += 3.5; } PUT0("\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; float staffb; struct SYMBOL *g, *last; struct BEAM bm; /* draw the notes */ bm.s2 = 0; /* (draw flags) */ for (g = s->extra; ; 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); } if (annotate) anno_out(s, 'g'); draw_note(g->x, g, bm.s2 == 0); if (g == bm.s2) bm.s2 = 0; /* (draw flags again) */ if (g->as.flags & ABC_F_SAPPO) { /* (on 1st note only) */ if (g->next == 0) { /* 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); PUT1("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 == 0) break; } /* 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 == 0 || s->next->as.type != ABC_T_NOTE) return; last = g; yy = 127; for (g = s->extra; g != 0; g = g->next) { if (g->type != NOTEREST) continue; if (g->y < yy) { yy = g->y; last = g; } } x0 = last->x; y0 = (last->stem >= 0 ? (float) last->y : last->ys) - 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; dy2 = (y0 - y3) * .2; dy1 = (y0 - y3) * .8; bet1 = 0; } else if (y3 > y0 + 4) { y3 = y0 + 4; x0 = last->x + 2; y0 = (last->stem >= 0 ? last->y : last->ys) - 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; staffb = staff_tb[s->staff].y; /* bottom of staff */ a2b("%.2f %.2f %.2f %.2f %.2f %.2f ", x1 - x0, y1 - y0, x2 - x0, y2 - y0, x3 - x0, y3 - y0); putxy(x0, y0 + staffb); PUT0("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)) { PUT0("/x "); /* set x y */ putx(x + shhd); PUT0("def/y "); puty(y + staffb); PUT0("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); PUT0("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 (cursys->staff[s->staff].clef.type == 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 == 0 && s->next != 0 && s->next->type == BAR && s->next->next == 0) dots = 0; break; case H_EMPTY: p = "Hd"; break; default: p = "hd"; break; } } PUT1("%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) { PUT2(" %.1f %d dt", dotx - shhd, doty); dotx += 3.5; } } /* draw the accidental */ if ((i = s->as.u.note.accs[m]) != 0 && cursys->staff[s->staff].clef.type != PERC) { x -= s->shac[m] * cur_scale; PUT0(" "); putx(x); PUT2((s->as.flags & ABC_F_GRACE) ? "gsc %s%d grestore" : "y %s%d", acc_tb[i & 0x07], micro_tb[i >> 3]); } } /* -- 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); PUT1("%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); PUT1("%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; } PUT3(" %.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'; PUT4(" %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; PUT1(" %.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; PUT1(" %d ", s->u); putxy(x1, staffb + slen); PUT0("trem"); } /* draw the other note heads */ for (m = 0; m <= s->nhd; m++) { if (m == ma) continue; PUT0(" "); draw_basic_note(x, s, m, y_tb); } PUT0("\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 != 0; 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 != 0 && 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 != 0; 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 != 0 && s->as.text[0] != '1'))) return s; } /* return sym before first note/rest/bar */ sym = voice_tb[voice].sym; for (s = sym->next; s != 0; 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; 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 = s; dz = .2 + .001 * (x2 - x1); if (dz > .6) dz = .6; dz *= s; if (!dotted) a2b("%.2f %.2f %.2f %.2f %.2f %.2f 0 %.2f ", (xx2 - dx - x2) / cur_scale, (yy2 + dy - y2 - dz) / cur_scale, (xx1 + dx - x2) / cur_scale, (yy1 + dy - y2 - dz) / cur_scale, (x1 - x2) / cur_scale, (y1 - y2 - dz) / cur_scale, dz); a2b("%.2f %.2f %.2f %.2f %.2f %.2f ", (xx1 - x1) / cur_scale, (yy1 - y1) / cur_scale, (xx2 - x1) / cur_scale, (yy2 - y1) / cur_scale, (x2 - x1) / cur_scale, (y2 - y1) / cur_scale); putxy(x1, y1); if (staff >= 0) a2b("y%d ", staff); PUT0(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 != 0; 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"); /* 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 != 0; k = k->ts_next) if (k->type == STAVES) break; if (k == 0) 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 */ && (!(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 { 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; } } } } } 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 { 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; } } } 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) { y2 = y1 + 1.2 * s; if (k1 != k2) x2 = k2->x - k2->wl * .3; } if (nn >= 3) { if (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->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->ys + 2) y = k->ys + 2; y -= a * k->x + addy; if (y > h) h = y; } else { y = 3 * (k->pits[0] - 18) - 6; if (y > k->ys - 2) y = k->ys - 2; y -= a * k->x + addy; if (y < h) h = y; } break; case GRACE: { struct SYMBOL *g; for (g = k->extra; g != 0; g = g->next) { 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; } } 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 = k->next) { if (k == k2) break; if (k->staff == upstaff) { 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; else dx = k->next->x; if (k != k1) x1 = k->x; dx -= x1; y_set(k, 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 = 0; s = first; for (;;) { if (s == 0 || s == last) { if (gr1 == 0 || (s = gr1->next) == 0 || s == last) break; gr1 = 0; } 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 = 0; /* find matching slur end */ s1 = s->next; gr1_out = 0; for (;;) { if (s1 == 0) { if (gr2 != 0) { s1 = gr2->next; gr2 = 0; continue; } if (gr1 == 0 || 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 != 0 && 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 != 0) { /* if in grace note sequence */ for (k = s1; k->next != 0; k = k->next) ; k->next = gr2->next; if (gr2->next != 0) gr2->next->prev = k; // gr2->as.u.note.slur_st = SL_AUTO; k = 0; } draw_slurs(s1, last); if (gr2 != 0 && gr2->next != 0) { gr2->next->prev->next = 0; gr2->next->prev = gr2; } } if (s1 == last) break; s1 = s1->next; } if (s1 == 0) { k = next_scut(s); } else if (k == 0) { s = s1; if (s == last) break; continue; } /* if slur in grace note sequence, change the linkages */ if (gr1 != 0) { for (s1 = s; s1->next != 0; s1 = s1->next) ; s1->next = gr1->next; if (gr1->next != 0) gr1->next->prev = s1; gr1->as.u.note.slur_st = SL_AUTO; } if (gr2 != 0) { 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 == 0 || 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 != 0 && gr1->next != 0) { gr1->next->prev->next = 0; gr1->next->prev = gr1; } if (gr2 != 0) { gr2->prev->next = gr2; gr2->extra->prev = 0; } 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 != 0; 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 = 0; some_slur = 0; upstaff = s->staff; for (s2 = s; s2 != 0; s2 = s2->next) { if (s2 != s) { for (g = s2->extra; g != 0; 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 != 0; 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 || (s2->sflags & S_SL1)) some_slur = 1; if (s2->staff < upstaff) upstaff = s2->staff; if (s1 == 0) s1 = s2; if (--r <= 0) break; } if (s2 == 0) return next; /* no solution... */ if (s2->time > next->time) next = s2; /* draw the slurs when inside the tuplet */ if (some_slur) draw_slurs(s1, s2); if (s1 == s2) { /* if 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 != 0; 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 != 0; 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) /* if 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, 1, xm - 3, 6, 0); if (ym > yy) b += ym - yy; b += 4; } else { ym = y_get(s1, 0, xm - 3, 6, 0); if (ym < yy) b += ym - yy; b -= 12; } 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 */ PUT1("(%d)", t->as.u.tuplet.p_plet); else PUT2("(%d:%d)", t->as.u.tuplet.p_plet, t->as.u.tuplet.q_plet); putxy(xm, ym); PUT1("y%d bnum\n", s1->staff); for (sy = s1; ; sy = sy->next) { if (sy->x >= xm) break; } if (s1->stem > 0) { ym += 8; if (sy->ymx < ym) sy->ymx = (short) ym; y_set(sy, 1, xm - 3, 6, ym); } else { if (sy->ymn > ym) sy->ymn = (short) ym; y_set(sy, 0, xm - 3, 6, ym); } return next; } 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; x2 = s2->x + 4; r = s2->stem >= 0 ? 0 : s2->nhd; if (s2->shhd[r] > 0) x2 += s2->shhd[r]; 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(sy, 1, sy->x, 0, 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(sy, 1, sy->x, 0, 0); if (ym > y2) y2 = ym; if (s2->stem > 0) x2 += 3; } if (s2->as.type == ABC_T_NOTE && s2->prev->as.type == ABC_T_NOTE && s2->dur > s2->prev->dur) x2 += 5; 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(sy, 1, sy->x, 0, 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); PUT1("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(sy, 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 - 8; x2 = s2->x + 2; if (s2->shhd[s2->nhd] > 0) x2 += s2->shhd[s2->nhd]; if (s2->as.type == ABC_T_NOTE && s2->prev->as.type == ABC_T_NOTE && s2->dur > s2->prev->dur) x2 += 5; 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(sy, 0, sy->x, 0, 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(sy, 0, sy->x, 0, 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(sy, 0, sy->x, 0, 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); PUT1("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(sy, 0, sy->x, sy->next->x - sy->x, yy); } if (sy == s2) break; } } /* lower voice */ if ((t->u & 0x0f) == 1) { /* if 'value' == none */ PUT0("\n"); return next; } yy = .5 * (y1 + y2); if ((t->u & 0x0f) == 0) /* if 'value' == number */ PUT1("(%d)", t->as.u.tuplet.p_plet); else PUT2("(%d:%d)", t->as.u.tuplet.p_plet, t->as.u.tuplet.q_plet); putxy(xm, yy); PUT1("y%d bnumb\n", upstaff); 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, p1, p2, y1, y2; float x1, x2, h; for (i = 0; i < ntie; i++) { m1 = mhead1[i]; p1 = k1->pits[m1]; m2 = mhead2[i]; p2 = k2->pits[m2]; if ((k1->as.u.note.ti1[m1] & 0x03) == SL_ABOVE) s = 1; else s = -1; x1 = k1->x; h = k1->shhd[m1]; /* head shift */ if (s > 0) { if (m1 < k1->nhd && k1->pits[m1] + 1 == k1->pits[m1 + 1]) if (k1->shhd[m1 + 1] > h) h = k1->shhd[m1 + 1]; } else { if (m1 > 0 && k1->pits[m1] == k1->pits[m1 - 1] + 1) if (k1->shhd[m1 - 1] > h) h = k1->shhd[m1 - 1]; } if (h > 0) x1 += h; x2 = k2->x; h = k2->shhd[m2]; if (s > 0) { if (m2 < k2->nhd && k2->pits[m2] + 1 == k2->pits[m2 + 1]) if (k2->shhd[m2 + 1] < h) h = k2->shhd[m2 + 1]; } else { if (m2 > 0 && k2->pits[m2] == k2->pits[m2 - 1] + 1) if (k2->shhd[m2 - 1] < h) h = k2->shhd[m2 - 1]; } if (h < 0) x2 += h; if (job == 2) { /* half tie from last note in line */ if (k1 != k2) { x2 -= k2->wl; } else { struct SYMBOL *k; for (k = k2->ts_next; k != 0; k = k->ts_next) if (k->type == STAVES) break; if (k == 0) x2 = realwidth; else x2 = k->x; } if (x2 < x1 + 16) x2 = x1 + 16; } else if (job == 1) { /* half tie to first note in line */ x1 = k1->x; if (x1 > x2 - 20) x1 = x2 - 20; } if (x2 - x1 > 20) { x1 += 2; x2 -= 2; } y1 = 3 * (p1 - 18) + 2 * s; y2 = 3 * (p2 - 18) + 2 * s; if (job != 1) { if (k1->nhd != 0) x1 += 4.5; else y1 += ((p1 % 2) ? 3 : 2) * s; if (s > 0) { if (k1->nflags > -2 && k1->stem > 0 && k1->nhd == 0) x1 += 4.5; if (!(p1 % 2) && k1->dots > 0) y1 = 3 * (p1 - 18) + 6; } } if (job != 2) { if (k2->nhd != 0) x2 -= 4.5; else y2 += ((p2 % 2) ? 3 : 2) * s; if (s < 0) { if (k2->nflags > -2 && k2->stem < 0 && k2->nhd == 0) x2 -= 4.5; } if (job != 0) y1 = y2; } else { y2 = y1; 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; } } /* tie between 2 staves */ /*fixme: should also do that when clef change?*/ /*fixme:dotted not treated*/ if (k1->staff != k2->staff) { s = k1->staff - k2->staff; y1 = 3 * (p1 - 18) + 3 * s; y2 = 3 * (p2 - 18) - 3 * s; x1 += 4; x2 -= 4; putxy(x1, staff_tb[k1->staff].y + y1); PUT0("M "); putxy(x2, staff_tb[k2->staff].y + y2); PUT0("lineto stroke\n"); continue; } h = (.04 * (x2 - x1) + 8) * s; slur_out(x1, staff_tb[k1->staff].y + y1, x2, staff_tb[k1->staff].y + y2, 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: at start of line * 2: at end of line */ { struct SYMBOL *k3; int i, m1, nh1, pit, ntie, tie2, ntie3, time; int mhead1[MAXHD], mhead2[MAXHD], mhead3[MAXHD]; ntie = ntie3 = 0; nh1 = k1->nhd; time = k1->time + k1->dur; /* 2-note case: set up list of ties to draw */ if (job != 2 && k2->time == time) { 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: tie2 = m1; break; case 0: mhead1[ntie] = i; mhead2[ntie++] = m1; goto found; } } if (tie2 >= 0) { /* second choice */ mhead1[ntie] = i; mhead2[ntie++] = tie2; break; } mhead3[ntie3++] = i; /* no match */ found: ; } draw_note_ties(k1, k2, ntie, mhead1, mhead2, job); if (ntie3 == 0) return; /* no bad tie */ } else { /* half ties from last note in line */ for (i = 0; i <= nh1; i++) { if (k1->as.u.note.ti1[i]) mhead3[ntie3++] = i; } } if (job != 2) { /* try an other voice of the same staff */ k3 = k1->ts_next; while (k3 != 0 && k3->time < time) k3 = k3->ts_next; while (k3 != 0 && 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) { if (job == 2) draw_note_ties(k1, k2 ? k2 : k1, ntie3, mhead3, mhead3, job); else 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; for (s1 = p_voice->sym->next; s1 != 0; s1 = s1->next) if (s1->type != KEYSIG && s1->type != TIMESIG) break; rtie = p_voice->rtie; /* tie from 1st repeat bar */ for (s2 = s1; s2 != 0; s2 = s2->next) { if (s2->as.type == ABC_T_NOTE) break; if (s2->type != BAR || !s2->as.u.bar.repeat_bar || s2->as.text == 0) continue; if (s2->as.text[0] == '1') /* 1st repeat bar */ rtie = p_voice->tie; else p_voice->tie = rtie; } if (s2 == 0) return; if (p_voice->tie != 0) { /* tie from previous line */ p_voice->tie->x = s1->x + s1->wr; s1 = p_voice->tie; p_voice->tie = 0; 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 */ } for (;;) { for (s1 = s2; s1 != 0; s1 = s1->next) { if (s1->sflags & S_TI1) break; if (rtie == 0) continue; if (s1->type != BAR || !s1->as.u.bar.repeat_bar || s1->as.text == 0) continue; if (s1->as.text[0] == '1') { /* 1st repeat bar */ rtie = 0; continue; } for (s2 = s1->next; s2 != 0; s2 = s2->next) if (s2->as.type == ABC_T_NOTE) break; if (s2 == 0) { s1 = 0; 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 == 0) break; for (s2 = s1->next; s2 != 0; s2 = s2->next) { if (s2->as.type == ABC_T_NOTE) 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 == 0) continue; if (s2->as.text[0] != '1') break; rtie = s1; /* 1st repeat bar */ } } if (s2 == 0) { draw_ties(s1, s1, 2); p_voice->tie = s1; break; } 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; if ((s = p_voice->sym->next) == 0) return; slur_type = p_voice->slur_st; p_voice->slur_st = 0; /* the slurs 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, 0); /* do unbalanced slurs still left over */ for ( ; s != 0; 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 == 0 || 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 == 0 || 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; PUT2("/y{%.1f y%d}def ", y, p_voice->staff); set_font(VOCALFONT); PUT3("%.1f 0 y %d %s\n", realwidth, nly, tblt->head); for (j = 0; j < nly ; j++) { for (s = p_voice->sym->next; s != 0; s = s->next) { if ((ly = s->ly) == 0 || (lyl = ly->lyl[j]) == 0) { if (s->type == BAR) { if (tblt->bar == 0) 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); } PUT0("\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); PUT4("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 != 0; 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]; } PUT0("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] != 0) { if (p_voice->tblts[0]->pitch == 0) return y; /* yes */ if (p_voice->tblts[1] != 0 && p_voice->tblts[1]->pitch == 0) return y; /* yes */ } outft = -1; /* force font output */ lskip = 0; /* (compiler warning) */ f = 0; /* (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 { j = nly - 1; nly = -1; if (y < 24 + cfmt.vocalspace - cfmt.font_tb[VOCALFONT].size) y = 24 + 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; PUT2("/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 != 0*/; s = s->next) if (s->type != CLEF && s->type != KEYSIG && s->type != TIMESIG) break; if (s->prev != 0) lastx = s->prev->x; else lastx = 0; x0 = 0; if (f != 0) lskip = f->size * 1.1; for ( ; s != 0; s = s->next) { if ((ly = s->ly) == 0 || (lyl = ly->lyl[j]) == 0) { switch (s->type) { case NOTEREST: if (s->as.type == ABC_T_NOTE) break; /* fall thru */ case MREST: if (lflag) { PUT2("%.1f %.1f y wln ", x0 - lastx, lastx + 3); 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 '-' */ PUT2("%.1f %.1f y hyph ", s->x - shift - lastx, lastx); hyflag = 0; lastx = s->x + s->wr; } } if (lflag && *p != LY_UNDER) { /* not '_' */ PUT2("%.1f %.1f y wln ", x0 - lastx + 3, lastx + 3); 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; } a2b("%.1f y M ", x0); put_str(p, A_LYRIC); lastx = x0 + w; } if (hyflag) { x0 = realwidth - 10; if (x0 < lastx + 10) x0 = lastx + 10; PUT2("%.1f %.1f y hyph ", x0 - lastx, lastx); if (cfmt.hyphencont) p_voice->hy_st |= (1 << j); } /* see if any underscore in the next line */ for (s = tsnext; s != 0; s = s->ts_next) if (s->voice == p_voice - voice_tb) break; for ( ; s != 0; s = s->next) { if (s->as.type == ABC_T_NOTE) { if (s->ly != 0 && 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) PUT2("%.1f %.1f y wln", x0 - lastx + 3, lastx + 3); PUT0("\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] != 0) break; } if (p_voice == 0) 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 == 0) 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 != 0; s = s->next) { struct lyrics *ly; float x, w; if ((ly = s->ly) == 0) 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(s, 1, x, w, 0); if (top < y) top = y; y = y_get(s, 0, x, w, 0); 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->sym, 1, 0, realwidth, 0); if (top < y) top = y; y = y_get(p_voice->sym, 0, 0, realwidth, 0); 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 >> POS_VOC) & 3) != 0) above_tb[voice] = ((p_voice->posit >> POS_VOC) & 3) == SL_ABOVE; else if (p_voice->next != 0 /*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 == 0) continue; if (!p_voice->have_ly && p_voice->tblts[0] == 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]) == 0) continue; 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 == 0) 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 != 0; s = s->next) { /*fixme: may have lyrics crossing a next symbol*/ if (s->ly != 0) { /*fixme:should set the real width*/ y_set(s, 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 != 0; s = s->next) { if (s->ly != 0) { /*fixme:should set the real width*/ y_set(s, 0, s->x - 2, 10, bot); } } } else { y_set(p_voice->sym, 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 */ void draw_sym_near(void) { struct VOICE_S *p_voice; struct SYMBOL *s; /* calculate the beams but don't draw them (the staves are undefined) */ for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { struct BEAM bm; for (s = p_voice->sym; s != 0; s = s->next) { if (s->as.type == ABC_T_NOTE && (s->sflags & S_BEAM_ST) && !(s->sflags & S_BEAM_END)) 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 != 0; s = s->ts_next) { int y; struct SYMBOL *g; if (s->prev == 0) continue; /* skip the clefs */ if (s->as.flags & ABC_F_INVIS) continue; if (s->type == GRACE) { g = s->extra; for ( ; g != 0; g = g->next) { y_set(s, 1, g->x - g->wl, g->wl + g->wr, g->ymx); y_set(s, 0, g->x - g->wl, g->wl + g->wr, g->ymn); } continue; } if (s->type != MREST) { y_set(s, 1, s->x - s->wl, s->wl + s->wr, s->ymx); y_set(s, 0, s->x - s->wl, s->wl + s->wr, s->ymn); } else { y_set(s, 1, s->x - 16, 32, s->ymx); } 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, 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, 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) { if ((s = p_voice->sym) == 0) continue; set_sscale(s->staff); for (s = s->next; s != 0; s = s->next) { struct SYMBOL *g; if ((s->sflags & S_IN_TUPLET) && (g = s->extra) != 0) { for ( ; g != 0; g = g->next) { if (g->type == TUPLET) { s = draw_tuplet(g, s); break; } } } } draw_all_slurs(p_voice); } /* 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(); outft = -1; /* force font output */ draw_deco_staff(); /* restore the scale parameters */ set_sscale(-1); } /* -- 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 == 0) continue; staff = p_voice->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 == 0) 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; if ((p = strstr(p, "\\n")) == 0 || 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]; if ((q = strstr(p, "\\n")) != 0) *q = '\0'; PUT2("%.1f %.1f M ", indent, y); put_str(p, A_CENTER); y -= 18.; if (q != 0) *q = '\\'; } } } /* -- set the y offset of the staves and return the whole height -- */ static float set_staff(void) { struct SYSTEM *sy; struct SYMBOL *s, *g; int staff, any_part, any_tempo; float y, staffsep, dy, maxsep, mbot; struct { float mtop; int not_empty; } delta_tb[MAXSTAFF], *p_delta; /* search the empty staves in each parts */ sy = cursys; for (staff = 0; staff <= nstaff; staff++) { sy->staff[staff].empty = 1; staff_tb[staff].empty = 0; } memset(delta_tb, 0, sizeof delta_tb); if (cfmt.staffnonote) { for (s = tsfirst; s != 0; s = s->ts_next) { switch (s->type) { case STAVES: for (staff = 0; staff <= nstaff; staff++) if (!sy->staff[staff].empty) delta_tb[staff].not_empty = 1; sy = sy->next; for (staff = 0; staff <= nstaff; staff++) sy->staff[staff].empty = 1; break; case NOTEREST: case SPACE: case BAR: case MREST: case GRACE: sy->staff[s->staff].empty = 0; break; } } } else { for (s = tsfirst; s != 0; s = s->ts_next) { switch (s->type) { case STAVES: for (staff = 0; staff <= nstaff; staff++) if (!sy->staff[staff].empty) delta_tb[staff].not_empty = 1; sy = sy->next; for (staff = 0; staff <= nstaff; staff++) sy->staff[staff].empty = 1; break; case NOTEREST: if (s->as.type == ABC_T_REST) break; if (!(s->as.flags & ABC_F_INVIS)) sy->staff[s->staff].empty = 0; break; } } } /* 'sy' is the last staff system - here are the staff distances */ for (staff = 0; staff <= nstaff; staff++) if (!sy->staff[staff].empty) delta_tb[staff].not_empty = 1; /* if a system brace has empty and non empty staves, keep all staves */ for (staff = 0; staff <= nstaff; staff++) { int i, empty_fl; if (!(cursys->staff[staff].flags & (OPEN_BRACE | OPEN_BRACE2))) continue; empty_fl = 0; i = staff; while (staff <= nstaff) { if (delta_tb[staff].not_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) delta_tb[i++].not_empty = 1; } } { int i, prev_staff; float v; prev_staff = -1; for (staff = 0, p_delta = delta_tb; staff <= nstaff; staff++, p_delta++) { if (!p_delta->not_empty) { staff_tb[staff].empty = 1; continue; } if (prev_staff >= 0) { 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 (p_delta->mtop < v) p_delta->mtop = v; } } else { for (i = 0; i < YSTEP; i++) { v = staff_tb[staff].top[i] * staff_tb[staff].clef.staffscale; if (p_delta->mtop < v) p_delta->mtop = v; } } prev_staff = staff; } mbot = 0; for (i = 0; i < YSTEP; i++) { v = staff_tb[prev_staff].bot[i] * staff_tb[prev_staff].clef.staffscale; if (mbot > v) mbot = v; } } /* handle the empty staves and their tablatures * and output the scale of the voices */ { struct VOICE_S *p_voice; int i; float ha, hu; for (p_voice = first_voice; p_voice; p_voice = p_voice->next) { if (p_voice->scale != 1) PUT2("/scvo%d{gsave %.2f dup scale}!\n", (int) (p_voice - voice_tb), p_voice->scale); staff = p_voice->staff; if (!staff_tb[staff].empty) continue; ha = hu = 0; for (i = 0; i < 2; i++) { if (p_voice->tblts[i] != 0 && p_voice->tblts[i]->pitch == 0) { ha += p_voice->tblts[i]->ha * staff_tb[staff].clef.staffscale; hu += p_voice->tblts[i]->hu * staff_tb[staff].clef.staffscale; } } if (ha == 0 && hu == 0) { staff_tb[staff].topbar = 0; continue; } delta_tb[staff].mtop += ha; if (staff < nstaff) delta_tb[staff + 1].mtop += hu; else mbot -= hu; delta_tb[staff].not_empty = 1; } } /* scan the first voice to see if any part or tempo */ any_part = any_tempo = 0; for (s = voice_tb[cursys->top_voice].sym; s != 0; s = s->next) { if ((g = s->extra) == 0) continue; for ( ; g != 0; g = g->next) { switch (g->type) { case PART: any_part = 1; break; case TEMPO: any_tempo = 1; break; } } if (any_part && any_tempo) break; } /* draw the parts and tempo indications if any */ if (any_part || any_tempo) { dy = delta_tb[0].mtop; if (dy == 0) /* first staff not displayed */ dy = 24 + 14; dy = draw_partempo(dy, any_part, any_tempo); } else { dy = 0; } /* set the staff offsets */ staffsep = cfmt.staffsep * 0.5; maxsep = cfmt.maxstaffsep * 0.5; y = 0; for (staff = 0, p_delta = delta_tb; staff <= nstaff; staff++, p_delta++) { dy += p_delta->mtop; if (!staff_tb[staff].empty) { staffsep += staff_tb[staff].topbar; if (dy < staffsep) dy = staffsep; maxsep += staff_tb[staff].topbar; if (dy > maxsep) dy = maxsep; } y += dy; staff_tb[staff].y = -y; /*fixme: handle tablature?*/ if (staff_tb[staff].clef.staffscale != 1 && staff_tb[staff].clef.staffscale != 0) { a2b("/scst%d{gsave 0 %.2f translate %.2f dup scale}!\n", staff, -y, staff_tb[staff].clef.staffscale); a2b("/y%d{}!\n", staff); } else { a2b("/y%d{%.1f add}!\n", staff, -y); } if (sy->staff[staff].sep != 0) staffsep = sy->staff[staff].sep; else staffsep = cfmt.sysstaffsep; if (sy->staff[staff].maxsep != 0) maxsep = sy->staff[staff].maxsep; else maxsep = cfmt.maxsysstaffsep; dy = 0; } if (mbot == 0) { for (staff = nstaff; staff >= 0; staff--) { if (delta_tb[staff].not_empty) 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 height of the measure bars -- */ static void bar_set(float *bar_height) { int staff; float dy; dy = 0; for (staff = 0; staff <= nstaff; staff++) { if (cursys->staff[staff].empty) { bar_height[staff] = 0; if (dy == 0) continue; } else { if (dy == 0) dy = staff_tb[staff].y + staff_tb[staff].topbar * staff_tb[staff].clef.staffscale; bar_height[staff] = dy - staff_tb[staff].y - staff_tb[staff].botbar * staff_tb[staff].clef.staffscale; } if (cursys->staff[staff].flags & STOP_BAR) dy = 0; else dy = staff_tb[staff].y + staff_tb[staff].botbar * staff_tb[staff].clef.staffscale; } } /* -- draw the staff systems and the measure bars -- */ float draw_systems(float indent) { struct SYMBOL *s; int staff, staff_st; float xstaff[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_height); staff_st = 1; for (s = tsfirst; s != 0; s = s->ts_next) { staff = s->staff; switch (s->type) { case STAVES: if (staff_st) { if (cursys->nstaff > 0) { for (staff = 0; staff <= nstaff; staff++) { if ((x = xstaff[staff]) >= 0) { draw_lstaff(x); break; } } staff_st = 0; } } cursys = cursys->next; for (staff = 0; staff <= nstaff; staff++) { if (cursys->staff[staff].empty) { if ((x = xstaff[staff]) >= 0) { #if 1 if (s->ts_prev->type == BAR) x2 = s->ts_prev->x; else x2 = s->x; #else x2 = s->ts_prev->x; if (s->ts_prev->type != BAR) x2 += s->ts_prev->wr; #endif draw_staff(staff, x, x2); xstaff[staff] = -1; } } else if (xstaff[staff] < 0) { #if 1 if (s->ts_next->type != BAR) xstaff[staff] = s->x; else xstaff[staff] = s->ts_next->x; #else xstaff[staff] = s->ts_next->x - s->ts_next->wl; /* (clef) */ #endif } } bar_set(bar_height); break; case BAR: if (s->as.flags & ABC_F_INVIS) break; if ((s->sflags & S_SECOND) || cursys->staff[staff].empty) s->as.flags |= ABC_F_INVIS; else s->ys = bar_height[staff]; break; case STBRK: if (s->prev == 0 || (x = xstaff[staff]) < 0) continue; x2 = s->prev->x; if (x2 <= x) continue; if (s->prev->type != BAR) x2 += s->prev->wr; draw_staff(staff, x, x2); if (staff == 0) { if (staff_st && cursys->nstaff > 0) draw_lstaff(x); staff_st = s->xmx > .5 CM; } if (s->xmx != 0) { xstaff[staff] = s->x; if (s->ts_next != 0 && s->ts_next->type == STAVES) s->ts_next->x = s->x; } else { xstaff[staff] = x2; } break; default: 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); if (staff_st) { draw_lstaff(x); staff_st = 0; } } set_scale(0); return line_height; } /* -- output PostScript sequences -- */ void output_ps(struct SYMBOL *s, int state) { struct SYMBOL *g, *g2; g = s->extra; g2 = 0; 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 == 0) s->extra = g->next; else g2->next = g->next; } else { g2 = g; } if ((g = g->next) == 0) 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; /* output the PostScript code at start of line */ for (s = p_voice->sym; s != 0; s = s->next) { if (s->extra != 0) 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 = 0; for (s = p_voice->sym; s != 0; s = s->next) { if (s->extra != 0) 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) { if (annotate) anno_out(s, 'b'); if (calculate_beam(&bm, s)) draw_beams(&bm); } if (annotate) anno_out(s, 'N'); draw_note(x, s, bm.s2 == 0); if (s == bm.s2) bm.s2 = 0; if (annotate && (s->sflags & (S_BEAM_ST | S_BEAM_END)) == S_BEAM_END) anno_out(s, 'e'); break; } if (annotate) anno_out(s, 'R'); draw_rest(s); break; case BAR: if (annotate) anno_out(s, 'B'); draw_bar(s); break; 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 != 0) PUT1("%s\n", s->as.u.clef.name); else PUT2("%c%cclef\n", s->u ? 's' : ' ', "tcbp"[(unsigned) s->as.u.clef.type]); if (s->as.u.clef.octave == 0) break; /*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); PUT1("oct%c\n", s->as.u.clef.octave > 0 ? 'u' : 'l'); 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); 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); break; case MREST: set_scale(s); PUT1("(%d)", s->as.u.bar.len); putxy(x, staff_tb[s->staff].y); PUT0("mrest\n"); break; case GRACE: set_scale(s); draw_gracenotes(s); break; case SPACE: case STAVES: case STBRK: case FMTCHG: break; /* nothing */ 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 == 0) #else if (staff_tb[p_voice->staff].empty || p_voice->sym == 0) #endif continue; draw_symbols(p_voice); } } /* -- output a floating value, and x and y according to the current scale -- */ void putf(float v) { PUT1("%.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) PUT2("%.1f %.1f ", x / cur_scale, y / cur_scale); /* scaled voice */ else PUT2("%.1f %.1f ", x / cur_scale, y - cur_trans); /* scaled staff */ } /* -- set the staff or voice scale -- */ void set_scale(struct SYMBOL *s) { int staff; float scale, trans; staff = -1; if (s != 0) { scale = voice_tb[s->voice].scale; if (scale == 1) { staff = s->staff; scale = staff_tb[staff].clef.staffscale; } /*fixme: KO when scale of staff != 1*/ } else { scale = 1; } if (staff >= 0 && scale != 1) { trans = staff_tb[staff].y; scale_voice = 0; } else { trans = 0; scale_voice = 1; } if (scale == cur_scale && trans == cur_trans) return; if (cur_scale != 1) PUT0("grestore "); cur_scale = scale; cur_trans = trans; if (scale != 1) { if (scale_voice) PUT1("scvo%d ", s->voice); else PUT1("scst%d ", staff); } } /* -- set the staff scale (only) -- */ void set_sscale(int staff) { float scale, trans; scale_voice = 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) PUT0("grestore "); cur_scale = scale; cur_trans = trans; if (scale != 1) PUT1("scst%d ", 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 != 0; 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 + 1; 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->as.u.note.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) { if ((s = p_voice->sym) == 0 || (s = s->next) == 0) continue; set_tie_dir(s); for ( ; s != 0; 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 != 0 && s2->as.type != ABC_T_NOTE) s2 = s2->next; if (s2 != 0) { 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 != 0 && s2->ymx < y) s2->ymx = y; y_set(s, 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 != 0 && s2->ymn > y) s2->ymn = y; y_set(s, 0, s->x + 5, dx, y); } } } } abcm2ps-6.6.17/fbook.fmt0000644000175000017500000000105107005373527013051 0ustar jefjef % Emulates the Jazz Fakebook style. % Use caps for title, parts or Q: for tempo. scale 0.70 topmargin 1.5cm titlefont Helvetica-Bold 13 subtitlefont Helvetica-Bold 10 titleleft false titlecaps composerfont Helvetica 9 composerspace 0.3cm partsfont Times-Bold 10 vocalfont Times-Bold 13 musicspace 0.7cm gchordfont Times-Roman 12 parskipfac 1.0 leftmargin 1.3cm staffwidth 18.4cm staffsep 45 maxshrink 0.65 lineskipfac 1.1 parskipfac 0 textspace 0.2cm textfont Times-Roman 10 abcm2ps-6.6.17/features.txt0000644000175000017500000002417611676661554013646 0ustar jefjef Features of abcm2ps 6.6.0 (J.F. Moine, December 2011) ===================================================== 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 standard. Features not implemented. ======================== Information fields. - The continuation field ('+:') is not implemented. - The charsets iso-8859-5 .. iso-8859-8 are not implemented. Tune body. - Multi-measure invisible rests ('X') are not implemented. - 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. Data format. - 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 X: header field may be omitted in tunebooks in which case a tune starts on a T: header field. - 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). - In 'U:' fields, !none! means that the character must not appear in the body. - In 'U:' fields, !nil! means that the character is ignored. This is the default value for the character '`' (back-quote). - In 'U:' fields, !beambreak! means that the character stops note beaming. This is the default value for the characters '\ ' (space) and '\t' (tabulation). Tune body. - Some bar lines are drawn as defined (ex: ':|:'), some other ones are expanded, as '|::' to '[|::'. - 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 a note with its pitch optionnaly followed by the staff line on which it is defined. The note may be only 'G' (treble clef), 'C' (alto clef) or 'F' (bass clef). The two following definitions are equivalent: K: clef=f K: bass middle=d Multiple voices. - When the voices are synchronized, a P: field alone in a line (not enclosed by '[' and ']') 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 in '%%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 new 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 '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'). - The field 'd:' is the same as 's:' (symbol line). Tune body. - Microtone pitches are indicated by a fraction after an accidental, as "^3/4c". When omitted, the numerator defaults to 1 and the denominator to 2 ("^/c" is the same as "^1/2c"). The numerator and denominator cannot be greater than 256. Support exists for 1/2 and 3/2 sharps and flats. For other values, PostScript functions must be defined (by %%postscript). The name of such a function is: where: - is "sh" (sharp) or "ft" (flat) (may be also "nt", "dsh" or "dft" !) - is computed from the fraction as: ( - 1 ) * 256 + - 1 - 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). - 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 note 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 - 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" G "_ann1;ann2" "G3;4" G "_ann1\nann2" "G3\n4" G (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 the new line as: "^above;_below" Clefs. - '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 a PostScript function which will draw the clef. This function arguments are the x and y offsets. Multiple voices. - 'stem=auto' and 'gstem=auto' in a V: field re-enables the automatic computation of the direction of the stems (default values). - 'gstem=up' or 'gstem=down' in a V: field forces the direction of the stems of the grace notes. - For compatibility with previous abcm2ps version, V: fields may contain: - 'gchord=up' (default) and 'gchord=down' which forces the display of guitar chords above or below the staff, - 'dyn=up', 'dyn=down' or 'dyn=auto' which forces the place of the dynamic marks (above or below the staff - default is 'auto'). - 'lyrics=up', 'lyrics=down' or 'lyrics=auto' which forces the place of the lyrics (above or below the staff - default is 'auto'). (use pseudo comments instead - see format.txt) - 'staffscale=' in a V: field sets the scale of the associated staff. The default value is '1'. - '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. Data format. - The guitar chords and annotations may contain '\#', '\b' and '\=' to display accidentals. - 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. 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 continuation mechanism. abcm2ps-6.6.17/flute.fmt0000644000175000017500000002032311642276716013077 0ustar jefjef% 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 28 0 63 tw_head tw_note tablature #2 pitch=C 28 0 63 tw_head tw_note tablature #3 pitch=Eb 28 0 63 tw_head tw_note %tablature #4 pitch=Bb, 54 0 63 tw_head tw_note %tablature #5 pitch=F, 54 0 63 tw_head tw_note %tablature #6 pitch=G, 54 0 63 tw_head tw_note %tablature #7 pitch=A, 54 0 63 tw_head tw_note % galoubet %tablature #3 pitch=C 28 0 60 gbl_tete gbl_note tablature #4 pitch=B,b 50 0 60 gbl_tete gbl_note tablature #5 pitch=G, 28 0 54 pt_tete pt_note tablature #6 pitch=C 28 0 46 gblc_tete gblc_note abcm2ps-6.6.17/fonts.fmt0000644000175000017500000000007307005373535013104 0ustar jefjef font AvantGarde-Demi font Palatino-Bold font Bookman-Demi abcm2ps-6.6.17/format.c0000644000175000017500000007327311755224323012710 0ustar jefjef/* * Formatting functions. * * This file is part of abcm2ps. * * Copyright (C) 1998-2012 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, 0}, {"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}, {"breakoneoln", &cfmt.breakoneoln, FORMAT_B, 0}, {"bstemdown", &cfmt.bstemdown, FORMAT_B, 0}, {"combinevoices", &cfmt.combinevoices, FORMAT_B, 0}, {"comball", &cfmt.comball, FORMAT_B, 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}, {"dateformat", &cfmt.dateformat, FORMAT_S, 0}, {"dynalign", &cfmt.dynalign, FORMAT_B, 0}, {"dynamic", &cfmt.dynamic, FORMAT_I, 6}, {"footer", &cfmt.footer, FORMAT_S, 0}, {"footerfont", &cfmt.font_tb[FOOTERFONT], FORMAT_F, 0}, {"flatbeams", &cfmt.flatbeams, FORMAT_B, 0}, {"gchord", &cfmt.gchord, FORMAT_I, 6}, {"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}, {"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, 0}, {"maxstaffsep", &cfmt.maxstaffsep, FORMAT_U, 0}, {"maxsysstaffsep", &cfmt.maxsysstaffsep, FORMAT_U, 0}, {"measurebox", &cfmt.measurebox, FORMAT_B, 0}, {"measurefirst", &cfmt.measurefirst, FORMAT_I, 2}, {"measurefont", &cfmt.font_tb[MEASUREFONT], FORMAT_F, 2}, {"measurenb", &cfmt.measurenb, FORMAT_I, 0}, {"musicspace", &cfmt.musicspace, FORMAT_U, 0}, {"notespacingfactor", &cfmt.notespacingfactor, FORMAT_R, 1}, {"oneperpage", &cfmt.oneperpage, FORMAT_B, 0}, {"ornament", &cfmt.ornament, FORMAT_I, 6}, {"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.shiftunisson, FORMAT_B, 0}, /*to remove*/ {"shiftunisson", &cfmt.shiftunisson, FORMAT_B, 0}, {"slurheight", &cfmt.slurheight, FORMAT_R, 0}, {"splittune", &cfmt.splittune, FORMAT_B, 0}, {"squarebreve", &cfmt.squarebreve, FORMAT_B, 0}, {"staffnonote", &cfmt.staffnonote, FORMAT_B, 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_B, 0}, {"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}, {"vocal", &cfmt.vocal, FORMAT_I, 6}, {"vocalfont", &cfmt.font_tb[VOCALFONT], FORMAT_F, 0}, {"vocalspace", &cfmt.vocalspace, FORMAT_U, 0}, {"voicefont", &cfmt.font_tb[VOICEFONT], FORMAT_F, 0}, {"volume", &cfmt.volume, FORMAT_I, 6}, {"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, 0, "Too many fonts"); return 0; } if (file_initialized && (epsf != 2 && !svg)) error(1, 0, "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, 0, "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 != 0) 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 -- */ void define_fonts(void) { int i; define_cmap(); 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; f = &cfmt; used_font[f->font_tb[ANNOTATIONFONT].fnum] = 1; used_font[f->font_tb[COMPOSERFONT].fnum] = 1; used_font[f->font_tb[FOOTERFONT].fnum] = 1; used_font[f->font_tb[GCHORDFONT].fnum] = 1; used_font[f->font_tb[HEADERFONT].fnum] = 1; used_font[f->font_tb[HISTORYFONT].fnum] = 1; used_font[f->font_tb[INFOFONT].fnum] = 1; used_font[f->font_tb[MEASUREFONT].fnum] = 1; used_font[f->font_tb[PARTSFONT].fnum] = 1; used_font[f->font_tb[REPEATFONT].fnum] = 1; used_font[f->font_tb[SUBTITLEFONT].fnum] = 1; used_font[f->font_tb[TEMPOFONT].fnum] = 1; used_font[f->font_tb[TEXTFONT].fnum] = 1; used_font[f->font_tb[TITLEFONT].fnum] = 1; used_font[f->font_tb[VOCALFONT].fnum] = 1; used_font[f->font_tb[VOICEFONT].fnum] = 1; used_font[f->font_tb[WORDSFONT].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 = 0; while (s != 0) { if (s->as.text[0] == *p) break; prev = s; s = s->next; } if (p[1] == '\0') { /* if delete */ if (s != 0) { if (prev == 0) info['I' - 'A'] = s->next; else if ((prev->next = s->next) != 0) prev->next->prev = prev; } return; } if (s == 0) { s = (struct SYMBOL *) getarena(sizeof *s); memset(s, 0, sizeof *s); if (prev == 0) 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->stretchstaff = 1; f->graceslurs = 1; f->lineskipfac = 1.1; f->parskipfac = 0.4; f->measurenb = -1; f->measurefirst = 1; f->autoclef = 1; f->breakoneoln = 1; f->dynalign = 1; f->linewarn = 1; #ifdef HAVE_PANGO if (!svg && epsf != 2) 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 << ('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][5] = {"no","yes"}; static char posit[3][8] = {"auto", "above", "below"}; 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 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 3: /* tuplets */ printf("%d %d %d\n", cfmt.tuplets >> 8, (cfmt.tuplets >> 4) & 0x0f, cfmt.tuplets & 0x0f); 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; case 6: /* position */ printf("%s\n", posit[*((int *) fd->v)]); 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]); // if (font_enc[s->fnum] != cfmt.encoding) 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 get_encoding(char *p) { int l; l = 0; while (p[l] != '\0' && !isspace((unsigned char) p[l])) l++; if (strncasecmp(p, "native", l) == 0) return 1; /* no error */ return 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; return 0; /* 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 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, 0, "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 = get_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, 0, "Bad font size '%s'", p); else fsize = v; } fontspec(f, strcmp(fname, "*") != 0 ? fname : 0, encoding, fsize); if (!file_initialized) 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[14] = "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, 0, "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)) == 0) { error(1, 0, "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, 0, "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, 0, "Wrong values in %%%%tablature"); return 0; } /* -- parse a format line -- */ void interpret_fmt_line(char *w, /* keyword */ char *p, /* argument */ int lock) { struct format *fd; switch (w[0]) { case 'b': if (strcmp(w, "barnumbers") == 0) w = "measurenb"; break; case 'd': if (strcmp(w, "deco") == 0) { deco_add(p); return; } break; case 'e': if (strcmp(w, "exprabove") == 0) { /* compatibility */ cfmt.posit &= ~((1 << POS_DYN) | (1 << POS_VOL)); if (g_logv(p)) cfmt.posit |= (1 << POS_DYN) | (1 << POS_VOL); return; } if (strcmp(w, "exprbelow") == 0) { /* compatibility */ cfmt.posit &= ~((1 << POS_DYN) | (1 << POS_VOL)); if (g_logv(p)) cfmt.posit |= (2 << POS_DYN) | (2 << POS_VOL); return; } break; case 'f': if (strcmp(w, "font") == 0) { int fnum, encoding; float swfac; char fname[80]; if (file_initialized) { error(1, 0, "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 = get_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')) { error(1, 0, "Bad value '%s' for '%s'", p, w); break; } swfac = v; } } fnum = get_font(fname, encoding); def_font_enc[fnum] = encoding; swfac_font[fnum] = swfac; used_font[fnum] = 1; return; } break; case 'i': if (strcmp(w, "infoname") == 0) { if (*p < 'A' || *p > 'Z') { error(1, 0, "Bad info type '%c' in %%%%infoname", *p); return; } 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, "postscript") == 0) { if (!file_initialized && mbf == outbuf) user_ps_add(p, 'b'); else if (svg || epsf == 2 || !secure) a2b("%s\n", p); return; } 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 't': if (strcmp(w, "tablature") == 0) { tblt_parse(p); return; } break; case 'v': if (strcmp(w, "vocalabove") == 0) { /* compatibility */ cfmt.posit &= ~(1 << POS_VOC); if (g_logv(p)) cfmt.posit |= (1 << POS_VOC); 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 case 0: *((int *) fd->v) = g_logv(p); 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); switch (*q) { case 'Q': cfmt.fields[u] = 0; break; } } 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) { error(1, 0, "Bad 'tuplets' values '%s' - ignored", p); return; } 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) { error(1, 0, "Bad 'gracespace' values '%s' - ignored", p); return; } 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 == 6 && !isdigit(*p)) /* position */ *((int *) fd->v) = get_posit(p); else sscanf(p, "%d", (int *) fd->v); 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: nbar = nbar_rep = cfmt.measurefirst; break; case 4: /* 'textoption' */ if (cfmt.textoption < 0) { error(1, 0, "Bad 'textoption' value '%s'", p); cfmt.textoption = T_LEFT; } break; case 6: /* position */ if ((unsigned) *((int *) fd->v) > 2) { error(1, 0, "Bad position - set to 'auto'", *((int *) fd->v)); *((int *) fd->v) = SL_AUTO; } cfmt.posit = (cfmt.dynamic << POS_DYN) | (cfmt.gchord << POS_GCH) | (cfmt.ornament << POS_ORN) | (cfmt.vocal << POS_VOC) | (cfmt.volume << POS_VOL); break; } break; case FORMAT_R: { char *q; float v; v = strtod(p, &q); if (v <= 0 || (*q != '\0' && *q != ' ')) { error(1, 0, "Bad value '%s' for '%s'", p, w); break; } *((float *) fd->v) = v; } if (fd->subtype == 1) { /* note spacing factor */ int i; float v; if (cfmt.notespacingfactor <= 0) { error(1, 0, "Bad value for 'notespacingfactor'"); cfmt.notespacingfactor = 1; break; } i = C_XFLAGS; /* crotchet index */ v = space_tb[i]; for ( ; --i >= 0; ) { v /= cfmt.notespacingfactor; space_tb[i] = v; } i = C_XFLAGS; v = space_tb[i]; for ( ; ++i < NFLAGS_SZ; ) { v *= cfmt.notespacingfactor; space_tb[i] = v; } } break; case FORMAT_F: { int b; g_fspc(p, (struct FONTSPEC *) fd->v); b = strstr(p, "box") != 0; 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, 0, "'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; } } } /* -- 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]; f2 = &cfmt.font_tb[outft]; outft = ft; fnum = f->fnum; if (fnum == f2->fnum && f->size == f2->size) return; if (!used_font[fnum] && epsf != 2 && !svg) { error(1, 0, "Font '%s' not predefined; using first in list", fontnames[fnum]); fnum = 0; } if (f->size == 0) { error(0, 0, "Font '%s' with a null size - set to 8", fontnames[fnum]); f->size = 8; } PUT2("%.1f F%d ", f->size, fnum); } abcm2ps-6.6.17/format.txt0000644000175000017500000011155411715527035013302 0ustar jefjef Format parameters ================= The general layout of the printed scores may be changed in four ways: 1- at compilation time setting the values in abc2ps.h, 2- at running time in a 'format' file, 3- at startup time in the command line, 4- by pseudo-comments inside the tunes. For more about 3), have a look at options.txt. A format file contains lines giving the parameters values, format: parameter [parameter list] In a format file, empty lines and lines starting with '%' are ignored. The pseudo-comments used for formatting have the format: %%parameter [parameter list] Format parameters may appear in the command line as: --parameter [parameter list] The keyword "lock" may appear at the end of the parameter list, in which case, the parameter will not be settable anymore (except with "lock" again). It is implicitly added in the command line parameters. Some pseudo-comments are treated while being parsed and cannot appear in a format file nor in the command line. These ones are listed at the end of this file. In font definitions, , and may be specified as '*' (star), in which case the font, encoding or size remains the same. When the is omitted, it defaults to 'utf-8' or to the last 'font' definition of the same font. The values are described in 'annotationfont'. List of the format parameters ----------------------------- abc2pscompat Default: 0 Compilation: none Command line: -u Description: When true, set 'M' as the +tenuto+ decoration and do a pitch translation for the bass and alto clefs. alignbars Default: 0 Compilation: none Command line: none Description: Align the bars of the next music lines. Such an alignment works only when there is only one voice in each music line (no V:, %%staves or %%score is allowed). aligncomposer Default: 1 Compilation: none Command line: none Description: Tell where to display the composer field. 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 Description: Set the annotation font to with a size . When present, may be either 'us-ascii', 'utf-8' or 'native'. It is used only for PostScript output without pango. When the is not 'native', a PostScript convertion table is build to handle most latin characters. It may be extended to handle more characters, but a good PostScript knowledge is required (see the file sample.abc). autoclef Default: 1 Compilation: none Command line: none Description: When true, set the clefs and possibly insert clef changes when no clef is defined in K: or V:. barnumbers Same as 'measurenb'. barsperstaff Default: 0 Compilation: none Command line: -B Description: Try to typeset with bars on each line. breakoneoln Default: 1 Compilation: none Command line: none Description: When set, on finding an end of line (eoln), do as if a space was set before the next note or rest. This prevents a beam to be continued between two music lines. beginps Default: none Compilation: none Command line: none Description: Start a PostScript sequence which ends on 'endps'. This parameter may be found only in a format or a ABC file (it cannot appear in the command line). Each line between 'beginps' and 'endps' is 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 beginsvg Default: none Compilation: none Command line: none Description: Start a SVG sequence which ends on 'endsvg'. This parameter may be found only in a format or a ABC file (it cannot appear in the command line). Each line between 'beginsvg' and 'endsvg' is included in the SVG output file. It permits to add CSS to the generated SVG files. It is ignored when the SVG generation is started (as after the first K: information field). bgcolor Default: none Compilation: none Command line: none Description: Define the background color of SVG images. This parameter is used only when the output is pure SVG (options '-g' and '-v'). The may be a color name (as 'white') or a hexadecimal RGB color (as '#faf0e6'). botmargin Default: 1cm Compilation: none Command line: none Description: Set the bottom margin to . bstemdown Default: 0 Compilation: none Command line: none Description: When set, the stem of the note in the middle of the staff goes downwards. Otherwise, it goes upwards or downwards according to the previous note. comball Default: 0 Compilation: none Command line: none Description: When 'combinevoices' is set, voice combination does not occurs when the pitches are a second, unisson or inverted. Setting this flag makes the combination to occur in all cases. combinevoices Default: 0 Compilation: none Command line: none Description: If 1, the notes of same duration belonging to voices of the same staff are combined giving chords. composerfont [] [] Default: Times-Italic 14 Compilation: none Command line: none Description: Set the composer font to with a size . composerspace Default: 0.2cm Compilation: none Command line: none Description: Set the vertical space before the composer to . contbarnb Default: 0 Compilation: none Command line: none Description: If 0, the bar number of the second repeat(s) is reset to the number of the first repeat. If 1, the bars are sequencially numbered. continueall Default: 0 Compilation: none Command line: -c Description: If true, ignore the line breaks in tune. This parameter is deprecated in favour of '%%linebreak '. dateformat Default: "\%b \%e, \%Y \%H:\%M" Compilation: none Command line: none Description: Define the format of the date and time. The possible values of this parameter are described in the manual pages of date(1) and strftime(3). Note: the '%'s must be escaped as '\%'. deco [] Default: none Compilation: none Command line: none Description: Define a decoration. !! this is an experimental feature which is subject to change in next releases and asks for a good knowledge of the internals of abcm2ps - see deco.abc for examples !! The actual arguments are: : name of the decoration. If it is the name of an existing decoration, this one is redefined. : index of a C function (defined in deco.c). The possible values are: 0, 1, 2: decoration near the note, inside the staff. 0: 'dot' and 'tenuto' 1: 'slide' 2: 'arpeggio' 3, 4, 5: decoration near the note, outside the staff, generally printed above the staff. 3: general 4: below the staff 5: long 'trill' (with start and stop) 6, 7: decoration tied to the staff (dynamic marks), generally printed below the staff. 6: general 7: long dynamic (with start and stop) : postscript function name or '-' if start of a long decoration. : decoration height. It is the minimum height for +arpeggio+. and : left and right widths. These values are actually used for general dynamic marks only. : text to display (for some postscript functions - see code). Decorations which names begin with 'head-' prevent the note head(s) to be drawn. decoration Default: ! Compilation: none Command line: none Description: Define the decoration separator. It may be set only to '!' (default) or '+' (for compatibility with the ABC standard 2.0). dynalign Default: 1 Compilation: none Command line: none Description: When true, horizontally align the dynamic marks. dynamic Default: 0 Compilation: none Command line: none Description: Set the position from the staff of the dynamic informations (crescendo, diminuendo..). may be 0 or 'auto' for automatic position (it depends on the presence and position of lyrics) 1 or 'above' above the staff 2 or 'below' below the staff When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. This parameter may also be set by the parameter 'dyn=' of the V: information field. encoding | Default: 0 Compilation: none Command line: none Description: Define the character encoding of the next ABC strings. This parameter is the same as 'abc-charset'. The recognized charset encodings and the associated values are: us-ascii or utf-8 0 iso-8859-1 or latin1 1 iso-8859-2 or latin2 2 iso-8859-3 or latin3 3 iso-8859-4 or latin4 4 iso-8859-9 or latin5 5 or 9 iso-8859-10 or latin6 6 or 10 The extra value 'native' may be used in format files when a font is direclty acceded by PostScript code. flatbeams Default: 0 Compilation: none Command line: -f Description: Draw flat beams. font [[] scale] Default: none Compilation: none Command line: none Description: Define a font and its encoding. This parameter is required with PostScript output when specific fonts are defined later in ABC files/tunes. It must be defined before any PostScript output is done, generally in a format file. When absent, defaults to the current 'encoding' parameter (see above). is the width factor to apply to the Time-Roman character width. It is needed to adjust the string width in case the computation with the default scale gives erroneous values (if string clash, set lower than 1.0 - if too much space, set it greater than 1.0). footer Default: none Compilation: none Command line: none Description: Define the text printed at the bottom of each page. There may be one or two lines. When 2 lines, these ones must be separated by the 2 characters "\n" (not a real 'newline'). In each lines 3 areas may be defined: left, center and right. These areas are separated by tabulations (real TABs, not "\t") and may be empty (if the left area is empty, double quote the string - see sample3.abc for example). The character '$' introduces variable expansion: - '$d' is the date and time of the last modification of the current ABC input file, - '$D' is the current date and time, - '$F' is the current input file name, - '$Ix' is any header information type ('x' is a letter range 'A' to 'Z'). - '$P' is the current page number, - '$P0' and '$P1' are also the page number, but only when this one is even ('0') or odd ('1'), - '$T' is the current tune title, - '$V' is 'abcm2ps-' followed by the program version. For example, the command line option '-N3' is the same as: %%header "$P0 $P1" (note the 2 TABs). If the footer (or header) begins with '-' (hyphen/minus), it is not printed on the first page. footerfont [] [] Default: Times-Roman 12 Compilation: none Command line: none Description: Set the footer font to with a size . Note that the footer is not scaled. format Default: none Compilation: none Command line: none Description: Read the format (or PostScript) file . When found in the command line, this parameter is the same as '-F'. gchord Default: 0 Compilation: none Command line: none Description: Set the position from the staff of the guitar chords. may be 0 or 'auto' for automatic position (usually above the staff) 1 or 'above' above the staff 2 or 'below' below the staff When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. This parameter may also be set by the parameter 'gchord=' of the V: information field. gchordbox Default: 0 Compilation: none Command line: none Description: Draw a box around the guitar chords. This value may be set to 'true' by %%gchordfont. gchordfont [] [box] Default: Helvetica 12 Compilation: none Command line: none Description: Set the guitar chord font to with a size . If 'box' is present, draw a box around the guitar chords. graceslurs Default: 1 Compilation: none Command line: -G Description: Draw slurs on grace notes. gracespace Default: 6.5 8.0 12.0 Compilation: none Command line: none Description: Define the space before, inside and after the grace notes. header Default: none Compilation: none Command line: none Description: Set the text printed at the top of each page. See 'footer' above for the header syntax. headerfont [] [] Default: Times-Roman 12 Compilation: none Command line: none Description: Set the header font to with a size . Note that the header is not scaled. historyfont [] [] Default: Times-Roman 16 Compilation: none Command line: none Description: Set the history font to with a size . hyphencont Default: 0 Compilation: none Command line: none Description: When a word of lyric under staff ends with a hyphen, put a hyphen in the next line. indent Default: 0 Compilation: none Command line: -I Description: Indent the first line of the tune by . infofont [] [] Default: Times-Italic 14 Compilation: none Command line: none Description: Set the infoline font to with a size . infoline Default: 0 Compilation: none Command line: none Description: Display the rhythm (R:) and area (A:) on a same line before the first music line: Rhythm (Area) infoname Default: R "Rhythm: " B "Book: " S "Source: " D "Discography: " N "Notes: " Z "Transcription: " H "History: " Compilation: none Command line: none Description: Define the information types and names to be printed after the tunes. Note: each information to be displayed may be adjusted by %%writefields. infospace Default: 0 Compilation: none Command line: none Description: Set the vertical space before the infoline to . landscape Default: 0 Compilation: none Command line: -l Description: Set the page orientation to landscape. leftmargin Default: 1.8cm Compilation: none Command line: -m Description: Set the left margin to . linebreak Default: Compilation: none Command line: none Description: Define the character(s) which break(s) the music lines. The is a blank separated list of none, one or more of: (system End Of Line) $ ! For compatibility, when is in the list, the character '!' may do a linebreak is it does not seem to introduce a decoration. The value '' must be alone in the list. In this case the program computes itself the linebreaks. This behaviour is the same when the list is empty. Tjis replaces the previous '%%continueall 1'. lineskipfac Default: 1.1 Compilation: none Command line: none Description: Set the factor for spacing between lines of text to . linewarn Default: 1 Compilation: none Command line: none Description: When set, raise a warning when there are too few or too much elements in a music line. maxshrink Default: 0.65 Compilation: none Command line: -a Description: Set how much to compress horizontally when staff breaks are chosen automatically. must be between 0 and 1. maxstaffsep Default: 2000pt Compilation: none Command line: none Description: Do not put a staff system further than from the previous system. maxsysstaffsep Default: 2000pt Compilation: none Command line: none Description: Do not put the staves further than inside a system. This values applies to all staves when global or in the tune header. Otherwise, it defines the maximum vertical offset of the next staff. measurebox Default: 0 Compilation: none Command line: trailing 'b' at end of -j or -k - see measurenb. Description: Draw a box around the measure numbers. This value may be set to 'true' by %%measurefont. measurefirst Default: 1 Compilation: none Command line: -b Description: Start numbering the measures of the tune from . This parameter is obsolete and should be replaced by '%%setbarnb' (outside the tune body). measurefont [] [box] Default: Times-Italic 14 Compilation: none Command line: none Description: Set the measure font to with a size . If 'box' is present, draw a box around the measure number. measurenb Default: -1 Compilation: none Command line: -j[b] or -k[b] Description: If positive, draw the measure number each bars. If = 0, the measure number appears only on the left of each staff system. On the command line, if a trailing 'b' is present, a box is drawn around the measure numbers. musiconly Default: 0 Compilation: none Command line: -M Description: If true, don't output the lyrics under staff. musicspace Default: 0.2cm Compilation: none Command line: none Description: Set the vertical space before the first staff to . notespacingfactor Default: 1.414 Compilation: none Command line: none Description: Set the note spacing factor to . This value is used to compute the natural space of the notes. The base space of the crotchet is always 40 pts. When the duration of a note type is twice the one of an other note type, its space is multiplied by this factor. The default value makes a note space to be multiplied by 2 when its duration is multiplied by 4, i.e. the space of the semibreve is 80 pts and the space of the semiquaver is 20 pts. Setting this value to 1 sets all note spaces to 40 pts. oneperpage Default: 0 Compilation: none Command line: -1 Description: Output one tune per page. ornament Default: 0 Compilation: none Command line: none Description: Set the position from the staff of the ornaments (mordent, trill..). may be 0 or 'auto' for automatic position (usually above the staff) 1 or 'above' above the staff 2 or 'below' below the staff When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. pageheight Default: PAGEHEIGHT Compilation: PAGEHEIGHT= (A4: 29.7cm - US: 11in) Command line: none Description: Set the page height to . pagewidth Default: PAGEWIDTH Compilation: PAGEWIDTH= (A4: 21.0cm - US: 8.5in) Command line: none Description: Set the page width to . pango Default: 1 Compilation: HAVE_PANGO Command line: none Description: When abcm2ps is compiled with pango/freetype support, enable or disable the text generation with pango glyphs. Trick: This parameter may be set to '2' to force pango generation of texts which contain only ASCII and latin1 characters. parskipfac Default: 0.4 Compilation: none Command line: none Description: Set the factor for spacing between text paragraphs to . partsbox Default: 0 Compilation: none Command line: none Description: Draw a box around the part names. This value may be set to 'true' by %%partsfont. partsfont [] [box] Default: Times-Roman 15 Compilation: none Command line: none Description: Set the part font to with a size . If 'box' is present, draw a box around the part names. partsspace Default: 0.3cm Compilation: none Command line: none Description: Set the vertical space before a new part to . pdfmark Default: 0 Compilation: none Command line: none Description: If different from 0, output PostScript marks to generate a PDF index (after PS translation to PDF). If greater than 1, generate pdfmarks for titled and subtitles, otherwise, if is 1, generate pdfmarks for main titles only. postscript Default: none Compilation: none Command line: none Description: Define a line to be included in the PostScript output file. This parameter may be used to override any PostScript function or to define new functions for use in a 'deco' format. See 'beginps' above. repeatfont [] [] Default: Times-Roman 13 Compilation: none Command line: none Description: Set the repeat number/text font to with a size . rightmargin Default: 1.8cm Compilation: none Command line: none Description: Set the right margin to . scale Default: 0.75 Compilation: none Command line: -s Description: Set the page scale factor to . Note that the header and footer are not scaled. setdefl Default: 0 Compilation: none Command line: none Description: When true, output some indications about the note/chord and/or decorations for customization purpose. These indications are stored in the PostScript variable 'defl'. setfont-1 [] setfont-2 [] setfont-3 [] setfont-4 [] Default: Times-Roman 0 Compilation: none Command line: none Description: Set the alternate fonts of strings. In most strings, the current font may be changed by "$n" (n = 0, 1 .. 4 - "$0" resets the font to its default value. Note: is mandatory at the first definition.. shiftunisson Default: 0 Compilation: none Command line: none Description: In multivoice tunes, when voices go to unisson, there is often only one head. Setting this flag keeps the two notes with a shift when there is a minim (half note) and a note smaller than crotchet (black note), and also when one note is dotted and not the other one. slurheight Default: 1.0 Compilation: none Command line: none Description: Set the slur height factor to . splittune Default: 0 Compilation: none Command line: -0 Description: If false, a tune starts on a new page if it does not fit in the current one. If true, there is no page check, and the tune may be splitted. squarebreve Default: 0 Compilation: none Command line: none Description: Display the breve notes in square format. staffnonote Default: 1 Compilation: none Command line: none Description: If not set, do not display the staves which have no note in the music lines. staffsep Default: 46pt Compilation: none Command line: -d Description: Do not put a staff system closer than from the previous system. staffwidth Default: none Compilation: none Command line: -w Description: Adjust the right margin so that the staff width is . stemheight Default: 20.0 Compilation: none Command line: none Description: Set the stem height to . straightflags Default: 0 Compilation: none Command line: none Description: Have straight flags on stems in bagpipe tunes. stretchlast Default: 0 Compilation: none Command line: none Description: Stretch the last music line of a tune when more expanded than the previous line. stretchstaff Default: 1 Compilation: none Command line: none Description: Stretch underfull music lines inside a tune. subtitlefont [] [] Default: Times-Roman 16 Compilation: none Command line: none Description: Set the subtitle font to with a size . subtitlespace Default: 0.1cm Compilation: none Command line: none Description: Set the vertical space before the subtitle to . sysstaffsep Default: 36pt Compilation: none Command line: none Description: Do not put the staves closer than inside a system. This values applies to all staves when global or in the tune header. Otherwise, it defines the minimum vertical offset of the next staff. tempofont [] [] Default: Times-Bold 15 Compilation: none Command line: none Description: Set the tempo font to with a size . textfont [] [] Default: Times-Roman 16 Compilation: none Command line: none Description: Set the text font to with a size . textoption Default: 0 (obeylines) Compilation: none Command line: none Description: Set the default text option to . This option is used for text between '%%begintext' and '%%endtext', '%%text' and '%%EPS'. may be an integer or a keyword. The values are: 0: obeylines 1: justify 2: fill 3: center 4: skip 5: right When is 4 (skip), neither text (including %%center) nor EPS is output. textspace Default: 0.5cm Compilation: none Command line: none Description: Set to the vertical space before the history. timewarn Default: 0 Compilation: none Command line: none Description: When set, if a time signature occurs at the beginning of a music line, a cautionary time signature is added at the end of the previous line. titlecaps Default: 0 Compilation: none Command line: none Description: Output the titles in uppercase letters. titlefont [] [] Default: Times-Roman 20 Compilation: none Command line: none Description: Set the title font to with a size . titleformat Default: none Compilation: none Command line: none Description: Define the format of the tune title. This format overrides the standard way to display the tune title. Then, parameters as %%titleleft, %%infoline are not used. The format is a set of letters, numbers, commas and plus and minus signs. Unrecognized characters are ignored. A letter gives the ABC header information type. It may be any type range 'A' to 'Z', but 'I', 'K', 'L', 'M', 'U' and 'V'. Alignment is defined by a number and/or a minus sign following the letter. It may be: '0' for 'center', '1' for 'right align' '-1' (or '-') for 'left align'. When absent, alignment defaults to center ('0'). A plus sign ('+') may appear between two fields in which case these fields are concatenated (this works only with fields of the same type and same alignment). A comma defines a box edge. In each box, the fields are vertically added in their alignment zones. Example: %%titleformat R-1 P-1 Q-1 T C1 O1 , T + T N1 displays: - in the 1st box: - on the left: the rhythm, part and tempo - in the middle: the main title (only) - on the right: the composer and origin - in the 2nd box: - in the middle: the concatenated subtitles - on the right: the notes titleleft Default: 0 Compilation: none Command line: none Description: Output the title on the left (instead of centered). titlespace Default: 0.2cm Compilation: none Command line: none Description: Set the vertical space before the title to . titletrim Default: 1 Compilation: none Command line: none Description: When set, if the last word of a title starts with a capital letter and is preceded by a comma and a space, this word is moved at the head. For example: the title T:Clair de la lune, Au is printed as Au Clair de la lune topmargin Default: 1cm Compilation: none Command line: none Description: Set the top margin to . topspace Default: 0.8cm Compilation: none Command line: none Description: Set the top vertical space to . This space is put above the tune and also on top of continuation pages. transpose [ "#" | "b" ] Default: 0 Compilation: none Command line: none Description: Transpose the displayed music. is a signed number of half-tones. When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. When "#" or "b" is present, the new key signature(s) will have sharps or flats in case of enharmonic keys. Note: the name of the latin guitar chords is not transposed. tuplets Default: 0 0 0 Compilation: none Command line: none Description: Define how to draw the tuplets. The first tells when to draw: 0: auto (draw when no beam at endings) 1: never 2: always The second tells what to draw: 0: a square bracket 1: a slur 2: do beam extension on rests (does not work yet) The third tells which value to print: 0: a simple number (value of 'p') 1: no value 2: a ratio ('p':'q') vocal Default: 0 Compilation: none Command line: none Description: Set the position from the staff of the lyrics. may be 0 or 'auto' for automatic position (usually above the staff) 1 or 'above' above the staff 2 or 'below' below the staff When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. vocalabove Default: 0 Compilation: none Command line: none Description: Force the vocals to be above the staff. vocalfont [] [] Default: Times-Bold 13 Compilation: none Command line: none Description: Set the font of the lyrics under staves to with a size . vocalspace Default: 23pt Compilation: none Command line: none Description: Set the vertical space before the lyrics under staves to . voicefont [] [] Default: Times-Bold 13 Compilation: none Command line: none Description: Set the font of the voice names to with a size . volume Default: 0 Compilation: none Command line: none Description: Set the position from the staff of the volume decorations (!p!, !fff!...). may be 0 or 'auto' for automatic position (usually below the staff) 1 or 'above' above the staff 2 or 'below' below the staff When this parameter appears outside a tune or inside a tune header, it applies to all voices. When inside a tune body, it applies to the current voice only. wordsfont [] [] Default: Times-Roman 16 Compilation: none Command line: none Description: Set the font of the lyrics at end of tune to with a size . wordsspace Default: 0cm Compilation: none Command line: none Description: Set the vertical space before the lyrics at end of tune to . writefields Default: COPQTWw 1 Compilation: none Command line: -M, -x Description: is a list of letters, each being the type of an information field. tells if the information field may be displayed or not. List of the pseudo-comments treated while parsed ------------------------------------------------ begintext [