| 1 | #! perl | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package ChordPro::A2Crd; | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use ChordPro::Version; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use ChordPro::Files; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use ChordPro::Paths; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use ChordPro::Chords; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | our $VERSION = $ChordPro::Version::VERSION; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ChordPro::A2Crd - convert lyrics and chords to ChordPro | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | perl -MA2Crd -e run -- [ options ] [ file ... ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | (But no one does that.) | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | When the associated B<chordpro> program has been installed correctly: | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | chordpro --a2crd [ options ] [ file ... ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | B<This program>, referred to as B<a2crd>, will read a text file | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | containing the lyrics of one or many songs with chord information | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | written visually above the lyrics. This is often referred to as I<crd> | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | data. B<a2crd> will then generate equivalent ChordPro output. | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | Typical a2crd input: | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | Title: Swing Low Sweet Chariot | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | D G D | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | Swing low, sweet chariot, | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | A7 | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Comin' for to carry me home. | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | D7 G D | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Swing low, sweet chariot, | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | A7 D | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | Comin' for to carry me home. | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | D G D | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | I looked over Jordan, and what did I see, | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | A7 | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | Comin' for to carry me home. | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | D G D | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | A band of angels comin' after me, | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | A7 D | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | Comin' for to carry me home. | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | Note that the output from the conversion will generally need some | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | additional editing to be useful as input to ChordPro. | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | B<a2crd> is a wrapper around L<ChordPro::A2Crd>, which | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | does all of the work. | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | B<chordpro> will read one or more text files containing the lyrics of | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | one or many songs plus chord information. B<chordpro> will then | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | generate a photo-ready, professional looking, impress-your-friends | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | sheet-music suitable for printing on your nearest printer. | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | B<chordpro> is a rewrite of the Chordii program. | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | For more information about the ChordPro file format, see | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | L<https://www.chordpro.org>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ################ Common stuff ################ | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ################ The Process ################ | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | package main; | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | our $options; | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | our $config; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | package ChordPro::A2Crd; | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | use ChordPro::Config; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | my $local_debug; | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # API: Main entry point. | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 19 | ▶ | sub a2crd { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
a2crd: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 19 | my ($opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | 19 | ▶ | $options = { %$options, %$opts } if $opts; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # One configurator to bind them all. | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 19 | $config = ChordPro::Config::configurator({}); | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | 19 | $local_debug = $config->{debug}->{a2crd}; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # Process input. | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | my $lines = $opts->{lines} | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ? delete($opts->{lines}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 19 | ▶ | : fs_load( @ARGV ? $ARGV[0] : \*STDIN); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 19 | return [ a2cho($lines) ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ################ Subroutines ################ | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # Replace tabs with blanks, retaining layout. | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | my $tabstop; | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 31 | ▶ | sub expand { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expand: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 31 | my ( $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | 31 | ▶ | return $line unless $line; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 31 | ▶ | $tabstop //= $::config->{a2crd}->{tabstop}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tabstop //= $main::config->{"a2crd"}{"tabstop"}
MC/DC0%0/2
$tabstop //= $main::config->{"a2crd"}{"tabstop"}
$tabstop
$main::config->{"a2crd"}{"tabstop"}
Truth table66%2/3
A //= B
A= $tabstopB= $main::config->{"a2crd"}{"tabstop"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 31 | ▶ | return $line unless $tabstop > 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 31 | my ( @l ) = split( /\t/, $line, -1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 31 | ▶ | return $l[0] if @l == 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 31 | $line = shift(@l); | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 31 | ▶ | $line .= " " x ($tabstop-length($line)%$tabstop) . shift(@l) while @l; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 31 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # API: Produce ChordPro data from AsciiCRD lines. | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 19 | ▶ | sub a2cho { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
a2cho: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 19 | my ( $lines ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | 19 | my $map = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 135 | 19 | my @lines_with_tabs_replaced ; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 19 | foreach ( @$lines ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 757 | ▶ | if(/\t/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 31 | $_ = expand($_) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | #s/=20/ /g ; # replace HTML coded space with ascii space, no, MUST LEAVE IN because it can mess up fingering diagrams like A/F#=202220 | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 757 | s/=3D/=/g ; # replace HTML coded equal with ascii = | |||||||||||||||||||||||||||||||||||||||||||||
| 143 | # s/\s*$// ; # remove all trailing whitespace -- no, MUST LEAVE IN so chords indicated above trailing whitespace will be properly formatted | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 757 | my $n_ch_chords=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | #An odd format for chords, [ch]Chordname[\ch], possibly from reformated webpage | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # need to strip out and consider it to be a chord line | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 757 | ▶ | while(s/\[ch\](.*?)\[\/ch\]/$1/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 16 | $n_ch_chords++ ; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 757 | push @lines_with_tabs_replaced, $_ ; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 757 | ▶ | if($n_ch_chords < 1) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 754 | $map .= classify($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 157 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | $map .= "c" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 19 | maplines( $map, \@lines_with_tabs_replaced ); | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # Classify the line and return a single-char token. | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | my $classify; | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | 754 | ▶ | sub classify { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classify: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 754 | my ( $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | 754 | ▶ | return '_' if $line =~ /^\s*$/; # empty line | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 611 | ▶ | return '{' if $line =~ /^\{.+/; # directive | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 601 | ▶ | unless ( defined $classify ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my $classifier = $::config->{a2crd}->{classifier}; | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | $classify = __PACKAGE__->can("classify_".$classifier); | |||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | unless ( $classify ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | warn("No such classifier: $classifier, using classic\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $classify = \&classify_classic; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 601 | $classify->($line); | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub classify_classic { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classify_classic: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my ( $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | # Lyrics or Chords heuristic. | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my @words = split ( /\s+/, $line ); | |||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $len = length($line); | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $line =~ s/\s+//g; | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | my $type = ( $len / length($line) - 1 ) < 1 ? 'l' : 'c'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $p = ChordPro::Chords::Parser->default; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ( $type eq 'l') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | foreach (@words) { | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if (length $_ > 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if (!ChordPro::Chords::parse_chord($_)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return 'l'; | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | return 'c'; | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | return $type; | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # JJW -- attempts at using "relaxed" in the standard chordnames parser were too relaxed | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # so I made this to try to parse unspecified chords that still have well defined "parts" in the chordname | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # these chords probably are understandable by a human, but too out of spec for the chordpro parser to interpret | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # my use of regex is probably not optimal -- I haven't had a lot of regex experience. | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # this currently only works for the roman chord notation | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | sub generic_parse_chord | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 890 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generic_parse_chord: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 890 | my $word = shift ; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 890 | my ($chord,$bass) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | 890 | ▶ | if ( $word =~ m;^(.*)/(.*); ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 15 | $chord = $1; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 15 | $bass = $2; | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 875 | $chord=$word ; | |||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 890 | ▶ | if($bass) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # this was the first attempt, but found it to be to restrictive | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | #return 0 if(! ($bass =~ /^($roots)$/) ) ; | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # now allow anything after the "/" | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # in anticipation of nashville and solfege ; | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 890 | my $roots = "^[A-G]" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 890 | my $found_chord_base="" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # first part of chord needs to be [A-G] | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 890 | ▶ | return 0 if(! ($chord =~ s/($roots)//)) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 48 | $found_chord_base .= $1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 48 | $chord = lc($chord) ; # simplify to lowercase for further parsing | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 48 | ▶ | if($chord =~ s/^([b#]|flat|sharp)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 3 | $found_chord_base .= $1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 48 | ▶ | if($chord =~ s/^(minor|major)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $found_chord_base .= $1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 48 | ▶ | if($chord =~ s/^(min|maj)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $found_chord_base .= $1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 48 | ▶ | if($chord =~ s/^(m|dim|0|o|aug|\+)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 9 | $found_chord_base .= $1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 48 | $chord =~ s/^[\d]*// ; # to get the 7 in "A7", etc | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # all that should remain are note numbers and note modifiers b, #, "sus", "add", "flat", "sharp", -, + | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # strip those possible combinations one at a time | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 48 | ▶ | while( $chord =~ s/^(b|#|\+|\-|flat|sharp|sus|add)*?\d// ) {} ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # if all that remains are digits and "#b-", it's probably a chord | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 48 | my $n_ok = ($chord =~ tr/0123456789#b-//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 48 | ▶ | return 1 if $n_ok == length $chord ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # determine if the input line is a fingering definition for a chord | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | sub decode_fingering | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 787 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_fingering: called CC=20 SCAR=30.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 787 | my ($line,$return_chordpro_fingering) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 787 | my $is_fingering=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | 787 | my $input_line = $line ; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | 787 | my $any_chord_ok=1 ; # allows any text for the chord preceding a fingering pattern to be valid | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # since more than one chord can be defined on a single input text line, | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # hold all results in these two arrays | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 787 | my (@chords,@fingerss) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # THIS ONLY WORKS FOR FRETS <=9 right now | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # is it a fingering notation? | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 787 | my $pre = "^.*?\\s*?" ; # the pattern to match just before a chord name | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | 787 | my $valid = "[A-G]{1}\\S*?" ; # a valid chordname | |||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | # ("chord:") followed by "|x2344x|" or "x2344x" | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 787 | ▶ | while($line =~ /$pre($valid)\:+?\s*?(\|?[xX0-9]{3,7}\|?)/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 38 | my $cname=$1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | 38 | my $fingers_this=$2 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | 38 | my $nobar_fingers=$fingers_this ; | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | 38 | $nobar_fingers =~ s/\|//g ; | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 38 | ▶ | if($any_chord_ok || generic_parse_chord($cname)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$any_chord_ok or generic_parse_chord($cname)
MC/DC0%0/2
$any_chord_ok or generic_parse_chord($cname)
$any_chord_ok
generic_parse_chord($cname)
Truth table33%1/3
A or B
A= $any_chord_okB= generic_parse_chord($cname)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 38 | push @chords,$cname ; | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | 38 | push @fingerss,$nobar_fingers ; | |||||||||||||||||||||||||||||||||||||||||||||
| 298 | 38 | $is_fingering=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 38 | $line =~ s/.*?$nobar_fingers// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # ("chord") followed by "|x2344x|" "x2344x" | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 787 | ▶ | while($line =~ /$pre($valid)\s+?(\|?[xX0-9]{3,7}\|?)/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 32 | my $cname=$1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 308 | 32 | my $fingers_this=$2 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 309 | 32 | my $nobar_fingers=$fingers_this ; | |||||||||||||||||||||||||||||||||||||||||||||
| 310 | 32 | $nobar_fingers =~ s/\|//g ; | |||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 32 | ▶ | if($any_chord_ok || generic_parse_chord($1)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$any_chord_ok or generic_parse_chord($1)
MC/DC0%0/2
$any_chord_ok or generic_parse_chord($1)
$any_chord_ok
generic_parse_chord($1)
Truth table33%1/3
A or B
A= $any_chord_okB= generic_parse_chord($1)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 32 | push @chords,$cname ; | |||||||||||||||||||||||||||||||||||||||||||||
| 314 | 32 | push @fingerss,$nobar_fingers ; | |||||||||||||||||||||||||||||||||||||||||||||
| 315 | 32 | $is_fingering=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 32 | $line =~ s/.*?$nobar_fingers// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # "(chord) = (fingering)" format | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 787 | ▶ | while($line =~ /$pre($valid)\s*?\=\s*?([xX0123456789]{3,7})/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 384 | my $cname=$1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 324 | 384 | my $fingers_this=$2 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 325 | 384 | my $nobar_fingers=$fingers_this ; | |||||||||||||||||||||||||||||||||||||||||||||
| 326 | 384 | $nobar_fingers =~ s/\|//g ; | |||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 384 | ▶ | if($any_chord_ok || generic_parse_chord($1)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$any_chord_ok or generic_parse_chord($1)
MC/DC0%0/2
$any_chord_ok or generic_parse_chord($1)
$any_chord_ok
generic_parse_chord($1)
Truth table33%1/3
A or B
A= $any_chord_okB= generic_parse_chord($1)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 384 | push @chords,$cname ; | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | 384 | push @fingerss,$nobar_fingers ; | |||||||||||||||||||||||||||||||||||||||||||||
| 331 | 384 | $is_fingering=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 384 | $line =~ s/.*?$nobar_fingers// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 787 | ▶ | if($is_fingering) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 402 | ▶ | return 1 if ! $return_chordpro_fingering ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # handle situation where more than one chord is defined on an input text line | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 201 | my @output_lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | #push @output_lines, $input_line if 1 ; # only for debugging | ||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 201 | foreach my $chord (@chords) { | |||||||||||||||||||||||||||||||||||||||||||||
| 346 | 227 | my $fingers = shift @fingerss ; | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | 227 | my $min_fret=100 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | 227 | my $max_fret=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | 227 | my @frets ; | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 227 | ▶ | while($fingers =~ s/(.)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 1359 | my $fret=$1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | 1359 | push @frets, $fret ; | |||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 1359 | ▶ | if($fret =~ /[0-9]/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 1213 | ▶ | $min_fret = $fret if $min_fret > $fret ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1213 | ▶ | $max_fret = $fret if $max_fret < $fret ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # now convert the requested fingering to chordpro format | ||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 227 | my $bf=$min_fret ; | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 227 | my $chordpro = "{define $chord base-fret $bf frets" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 365 | 227 | ▶ | $bf-- if $bf > 0 ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 227 | foreach my $fret (@frets) { | |||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1359 | $chordpro = $chordpro . " " ; | |||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1359 | ▶ | if($fret =~ /[0-9]/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1213 | my $rf = $fret-$bf ; | |||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1213 | $chordpro .= "$rf" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 146 | $chordpro .= '-' ; | |||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 227 | $chordpro .= "}" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | 227 | push @output_lines, $chordpro ; | |||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 201 | return @output_lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 385 | return 0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # classification characters are: | ||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # 'l' = normal text line, usually lyrics but may be other plain text as well | ||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # 'C' = a comment | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # 'f' = a chord fingering request | ||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # 't' = tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # 'c' = chords, usually to be output inline with a subsequent 'l' line | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # '{' = an embedded chordpro directive found in the input file, to be output with no changes | ||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # '_' = a blank line, i.e. it contains only whitespace | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # Alternative classifier by Jeff Welty. | ||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # Strategy: Percentage of recognzied chords. | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 601 | ▶ | sub classify_pct_chords { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classify_pct_chords: called CC=29 SCAR=33.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 601 | my ( $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 402 | 601 | my $lc_line = lc($line) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 601 | ▶ | return 'C' if $line =~ /^\s*\[.+?\]/; # comment | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 595 | ▶ | return 'C' if $line =~ /^\s*\#.+?/; # comment | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 592 | ▶ | return 'C' if $lc_line =~ /(from|email|e\-mail)\:?.+?@+/ ; # email is treated as a comment | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 590 | ▶ | return 'C' if $lc_line =~ /(from|email|e\-mail)\:.+?/ ; # same as above, but there MUST be a colon, and no @ is necessary | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 588 | ▶ | return 'C' if $lc_line =~ /(date|subject)\:.+?/ ; # most likely part of email lines is treated as a comment | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # check for a chord fingering specification, i.e. A=x02220 | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 586 | ▶ | return 'f' if decode_fingering($line,0) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 385 | if(0) { | |||||||||||||||||||||||||||||||||||||||||||||
| 414 | #Oct 31 and before | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | return 't' if $line =~ /^\s*?[A-G|a-g]\s*\|.*?\-.*\|/; # tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | return 't' if $line =~ /^\s*?[A-G|a-g]\s*\-.*?\-.*\|*/; # tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # try to accomodate tablature lines with text after the tab | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 385 | my $longest_tablature_string=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 421 | 385 | my $tmpline = $line ; | |||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # REGEX components: | ||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # start with any amount of whitespace | ||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # ^\s*? | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | # must be one string note | ||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # [A-G|a-g] | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # one or more of : or | | ||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # [:\|]+ | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # in the tablature itself, separators of : or |, modifiers of b=bend,p=pull off,h=hammer on,x=muted,0-9 fret positionsj,\/=slides,() for two digit fret positions | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # [\-:\|bphxBPHX0-9\/\\\(\)]*? | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # one or more of : or | | ||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # [:\|]+ | ||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 385 | ▶ | while($tmpline =~ s/^(\s*?[A-G|a-g][:\|]+[\-:\|bphxBPHX0-9\/\\\(\)]*?[:\|]+)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 55 | ▶ | $longest_tablature_string = length($1) if $longest_tablature_string < length($1) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 385 | ▶ | return 't' if $longest_tablature_string > 8 ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # count number of specific characters to help identify tablature lines | ||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 330 | my $n_v = ($line =~ tr/v//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 446 | 330 | my $n_dash = ($line =~ tr/-//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 447 | 330 | my $n_equal = ($line =~ tr/=//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 448 | 330 | my $n_bar = ($line =~ tr/|//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | 330 | my $n_c_accent = ($line =~ tr/^//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 450 | 330 | my $n_period = ($line =~ tr/.//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 451 | 330 | my $n_space = ($line =~ tr/ //) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | 330 | my $n_slash = ($line =~ tr/\///) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 453 | 330 | my $n_underscore = ($line =~ tr/_//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 454 | 330 | my $n_digit = ($line =~ tr/0123456789//) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # some inputs are of the form "| / / / _ / | / / / / / |", to indicate strumming patterns | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # need to recognize this as tablature for nice formatting, and if chords are in the line | ||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # preceding they will be included in the tablature by maplines() to ensure correct formatting | ||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 330 | my $longest_strumming_string=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 460 | 330 | my $cntline = $line ; | |||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 330 | ▶ | while( $cntline =~ s/([\|\/ _]+?)//) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 3100 | ▶ | $longest_strumming_string = length($1) if $longest_strumming_string < length($1) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 330 | ▶ | return 't' if ($longest_strumming_string >= 6) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # Lyrics or Chords heuristic. | ||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 330 | my @words = split ( /\s+/, $line ); | |||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 330 | my $n_tot_chars = length($line) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | 330 | $line =~ s/\s+//g ; | |||||||||||||||||||||||||||||||||||||||||||||
| 475 | 330 | my $n_nonblank_chars = length($line) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # have to wait until $n_nonblank_chars is computed to do these tests | ||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 330 | ▶ | return 'l' if ($n_dash == $n_nonblank_chars || $n_equal == $n_nonblank_chars) ; # only "-" or "=", meant to be a textual underline indication of the previous line | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$n_dash == $n_nonblank_chars or $n_equal == $n_nonblank_chars
MC/DC100%2/2
$n_dash == $n_nonblank_chars or $n_equal == $n_nonblank_chars
$n_dash == $n_nonblank_chars
$n_equal == $n_nonblank_chars
Truth table100%3/3
A or B
A= $n_dash == $n_nonblank_charsB= $n_equal == $n_nonblank_chars
| |||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 322 | ▶ | return 't' if (($n_period + $n_dash + $n_bar + $n_c_accent + $n_v + $n_digit)/$n_nonblank_chars > 0.8) ; # mostly characters used in standard tablature | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 218 | ▶ | return 't' if (($n_bar + $n_slash + $n_underscore)/$n_nonblank_chars >= 0.5) ; # mostly characters used in strumming tablature | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 216 | my $n_chords=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 484 | 216 | my $n_words=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||
| 486 | #print("CL:") ; # JJW, uncomment for debugging | ||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 216 | foreach (@words) { | |||||||||||||||||||||||||||||||||||||||||||||
| 489 | 1157 | ▶ | if (length $_ > 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1083 | $n_words++ ; | |||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 1083 | ▶ | my $is_chord = ChordPro::Chords::parse_chord($_) ? 1 : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 1083 | ▶ | if(! $is_chord) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 890 | ▶ | if(generic_parse_chord($_)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 9 | ▶ | print STDERR "$_ detected by generic, not internal parse_chord\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 9 | $is_chord=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 1083 | ▶ | $n_chords++ if $is_chord ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 1083 | ▶ | print STDERR " ($is_chord:$_)" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||
| 504 | #print(" \'$is_chord:$_\'") ; # JJW, uncomment for debugging | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 216 | ▶ | print STDERR "\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 216 | ▶ | return '_' if $n_words == 0 ; # blank line, redundant logic with sub classify(), but makes this more robust to changes in classify() ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 216 | ▶ | my $type = $n_chords/$n_words > 0.4 ? 'c' : 'l' ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 216 | ▶ | if($type eq 'l') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # is it likely the line had a lot of unknown chords, check | ||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # the ratio of total chars to nonblank chars , if it is large then | ||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # it's probably a chord line | ||||||||||||||||||||||||||||||||||||||||||||||
| 518 | # $type = 'c' if $n_words > 1 && $n_tot_chars/$n_nonblank_chars > 2. ; | ||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||
| 521 | #print(" --- ($n_chords/$n_words) = $type\n") ; # JJW, uncomment for debugging | ||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 216 | return $type ; | |||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # reformat an input line classified as a comment for the chordpro format | ||||||||||||||||||||||||||||||||||||||||||||||
| 527 | sub format_comment_line | ||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 69 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_comment_line: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 69 | my $line = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||
| 530 | # remove [] from original comment | ||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 69 | $line =~ s/\[// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 532 | 69 | $line =~ s/\]// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 533 | 69 | ▶ | return '' if $line eq '' ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 69 | return "{comment: " . $line . "}" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # Process the lines via the map. | ||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | my $infer_titles; | |||||||||||||||||||||||||||||||||||||||||||||
| 539 | 19 | ▶ | sub maplines { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maplines: called CC=56 SCAR=44.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 19 | my ( $map, $lines ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 541 | 19 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||
| 542 | $infer_titles = $config->{a2crd}->{'infer-titles'} | ||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 19 | ▶ | && !$options->{fragment}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$main::config->{'a2crd'}{'infer-titles'} && !$main::options->{'fragment'}
MC/DC0%0/2
$main::config->{'a2crd'}{'infer-titles'} && !$main::options->{'fragment'}
$main::config->{'a2crd'}{'infer-titles'}
!$main::options->{'fragment'}
Truth table33%1/3
A && not(B)
A= $main::config->{'a2crd'}{'infer-titles'}B= !$main::options->{'fragment'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # Preamble. | ||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # Pass empty lines. | ||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 19 | ▶ | print STDERR "====== _C =====\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 19 | ▶ | print STDERR "MAP: \'$map\' \n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 19 | ▶ | while ( $map =~ s/^([_C])// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | print STDERR "$1 == @{$lines}[0]\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 553 | # simply output blank or comment lines at the start of the file | ||||||||||||||||||||||||||||||||||||||||||||||
| 554 | # but don't count the line as possible title | ||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 13 | ▶ | my $pre = ($1 eq "C" ? "{comment:" : "" ) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 13 | ▶ | my $post = ($1 eq "C" ? "}" : "" ) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 13 | push( @out, $pre . shift( @$lines ) . $post ); | |||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 19 | ▶ | print STDERR "====== infer title =====\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # Infer title/subtitle. | ||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 19 | ▶ | if ( $infer_titles && $map =~ s/^l// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$infer_titles and $map =~ s/^l//u
MC/DC50%1/2
$infer_titles and $map =~ s/^l//u
$infer_titles
$map =~ s/^l//u
Truth table66%2/3
A and B
A= $infer_titlesB= $map =~ s/^l//u
| |||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 18 | push( @out, "{title: " . shift( @$lines ) . "}"); | |||||||||||||||||||||||||||||||||||||||||||||
| 564 | 18 | ▶ | if ( $map =~ s/^l// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 8 | push( @out, "{subtitle: " . shift( @$lines ) . "}"); | |||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 19 | ▶ | print STDERR "====== UNTIL chords or tablature =====\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # Pass lines until we have chords or tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 19 | ▶ | while ($map =~ /^(.)(.)(.)/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 332 | ▶ | push @out, "ULC $map" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # some unusual situations to handle, | ||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # cl. => exit this loop for normal cl processing | ||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # .t => exit the loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # l.t or c.t => output the l or c as comment, then exit the loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # [_f{C].. => output the blank, fingering,directive or comment, and continue the loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||
| 581 | # we have to stop one line before tablature, in case the line before the tablature needs to be included in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 582 | # tablature itself | ||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | print STDERR "$1 == @{$lines}[0]\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 332 | ▶ | last if($1 eq "c" && $2 eq "l") ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$1 eq "c" and $2 eq "l"
MC/DC100%2/2
$1 eq "c" and $2 eq "l"
$1 eq "c"
$2 eq "l"
Truth table100%3/3
A and B
A= $1 eq "c"B= $2 eq "l"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 327 | ▶ | last if($2 eq "t" ) ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 323 | ▶ | if(($1 eq "c" || $1 eq "l") && $3 eq "t") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$1 eq "c" || $1 eq "l" and $3 eq "t"
$1 eq "c" or $1 eq "l"
MC/DC66%2/3
$1 eq "c" || $1 eq "l" and $3 eq "t"
$1 eq "c"
$1 eq "l"
$3 eq "t"
Truth table80%4/5
A or B and C
A= $1 eq "c"B= $1 eq "l"C= $3 eq "t"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 6 | push @out, format_comment_line(shift(@$lines)) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 590 | 6 | $map =~ s/.// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 591 | 6 | last ; | |||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # in the remaining cases, output the line (properly handled), and continue the loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 317 | ▶ | if ( $1 eq "l" or $1 eq "C") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$1 eq "l" or $1 eq "C"
MC/DC100%2/2
$1 eq "l" or $1 eq "C"
$1 eq "l"
$1 eq "C"
Truth table100%3/3
A or B
A= $1 eq "l"B= $1 eq "C"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 59 | push @out, format_comment_line(shift(@$lines)) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 598 | elsif ( $1 eq "f" ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 191 | foreach my $fchart (decode_fingering(shift( @$lines ),1) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 600 | 217 | push( @out, $fchart); | |||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 603 | elsif ( $1 eq "{" ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 8 | my $line = shift @$lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 605 | 8 | push( @out, $line); | |||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 8 | ▶ | if($line =~ /{sot}/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # output all subsequent lines until {eot} is found | ||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 1 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||
| 610 | 8 | $line = shift @$lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 611 | 8 | ▶ | die "Malformed input, {sot} has no matching {eot}" if ! $line ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 8 | $map =~ s/.// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 613 | 8 | push( @out, $line); | |||||||||||||||||||||||||||||||||||||||||||||
| 614 | 8 | ▶ | last if $line =~ /{eot}/ ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 619 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 59 | push( @out, shift( @$lines ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 317 | $map =~ s/.// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 19 | ▶ | push @out, "====== FINAL LOOP =====" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # Process the lines using the map. | ||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 19 | ▶ | while ( $map ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | # warn($map); | ||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 188 | ▶ | push @out, "FL $map" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 188 | $map =~ /(.)/ ; | |||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | print STDERR "$1 == @{$lines}[0]\n" if $local_debug ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||
| 633 | #a fingering line, simply output the directive and continue | ||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 188 | ▶ | if ( $map =~ s/^f// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 10 | foreach my $fchart (decode_fingering(shift( @$lines ),1) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 636 | 10 | push( @out, $fchart); | |||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 10 | next ; | |||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||
| 641 | # Blank line - output the blank line and continue | ||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 178 | ▶ | if ( $map =~ s/^_// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 78 | push( @out, ''); | |||||||||||||||||||||||||||||||||||||||||||||
| 644 | 78 | shift(@$lines); | |||||||||||||||||||||||||||||||||||||||||||||
| 645 | 78 | next ; | |||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # A comment line, output and continue | ||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 100 | ▶ | if ( $map =~ s/^C// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 4 | push @out, format_comment_line(shift(@$lines)) ; | |||||||||||||||||||||||||||||||||||||||||||||
| 651 | 4 | next ; | |||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # Tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 96 | my $in_tablature=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # special case: chords or lyrics before tabs, keep the chords or lyrics in {sot}, which is probably | ||||||||||||||||||||||||||||||||||||||||||||||
| 658 | # what the original text intended for alignment with the tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 96 | ▶ | if ( $map =~ s/^[cl]t/t/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 17 | ▶ | if(! $in_tablature) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 17 | push( @out, "{sot}") ; | |||||||||||||||||||||||||||||||||||||||||||||
| 662 | 17 | $in_tablature=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 17 | push( @out, shift(@$lines)); | |||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 96 | ▶ | while( $map =~ s/^t// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 155 | ▶ | if(! $in_tablature) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 12 | push( @out, "{sot}") ; | |||||||||||||||||||||||||||||||||||||||||||||
| 670 | 12 | $in_tablature=1 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 155 | push( @out, shift(@$lines)); | |||||||||||||||||||||||||||||||||||||||||||||
| 673 | # and Fall through. | ||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 96 | ▶ | if($in_tablature) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 677 | # Text line OR chord line with following blank line or EOF -- make part of tablature | ||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 29 | ▶ | if ( $map =~ s/^[cl](_|$)// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 9 | push( @out, shift(@$lines)); | |||||||||||||||||||||||||||||||||||||||||||||
| 680 | 9 | push( @out, ''); | |||||||||||||||||||||||||||||||||||||||||||||
| 681 | 9 | shift(@$lines); | |||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 29 | push( @out, "{eot}") ; | |||||||||||||||||||||||||||||||||||||||||||||
| 685 | 29 | $in_tablature=0 ; | |||||||||||||||||||||||||||||||||||||||||||||
| 686 | 29 | next ; | |||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||
| 689 | # Blank line preceding lyrics: pass. | ||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 67 | ▶ | if ( $map =~ s/^_l/l/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | push( @out, ''); | |||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | shift(@$lines); | |||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||
| 695 | # The normal case: chords + lyrics. | ||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 67 | ▶ | if ( $map =~ s/^cl// ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 40 | push( @out, combine( shift(@$lines), shift(@$lines), "cl" ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # Empty line preceding a chordless lyrics line. | ||||||||||||||||||||||||||||||||||||||||||||||
| 701 | elsif ( $map =~ s/^__l// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | push( @out, '' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | shift( @$lines ); | |||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | push( @out, combine( shift(@$lines), shift(@$lines), "__l" ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||
| 707 | # Chordless lyrics line. | ||||||||||||||||||||||||||||||||||||||||||||||
| 708 | elsif ( $map =~ s/^_l// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | push( @out, combine( shift(@$lines), shift(@$lines), "_l" ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # Lone directives. | ||||||||||||||||||||||||||||||||||||||||||||||
| 713 | elsif ( $map =~ s/^{// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 1 | my $line = shift @$lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 715 | 1 | push( @out, $line); | |||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 1 | ▶ | if($line =~ /{sot}/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 718 | # output all subsequent lines until {eot} is found | ||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $line = shift @$lines ; | |||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | die "Malformed input, {sot} has no matching {eot}" if ! $line ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $map = s/.// ; | |||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | push( @out, $line); | |||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | ▶ | last if $line =~ /{eot}/ ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||
| 730 | # Lone lyrics. | ||||||||||||||||||||||||||||||||||||||||||||||
| 731 | elsif ( $map =~ s/^l// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 22 | push( @out, shift( @$lines ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||
| 735 | # Lone chords. | ||||||||||||||||||||||||||||||||||||||||||||||
| 736 | elsif ( $map =~ s/^c// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 4 | push( @out, combine( shift(@$lines), '', "c" ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # Empty line. | ||||||||||||||||||||||||||||||||||||||||||||||
| 741 | elsif ( $map =~ s/^_// ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | push( @out, '' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | shift( @$lines ); | |||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # Can't happen. | ||||||||||||||||||||||||||||||||||||||||||||||
| 747 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | croak("MAP: $map"); | |||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 19 | ▶ | return wantarray ? @out : \@out; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||
| 754 | # Combine two lines (chords + lyrics) into lyrics with [chords]. | ||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 44 | ▶ | sub combine { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
combine: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 44 | my ( $l1, $l2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 757 | 44 | my $res = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 758 | 44 | ▶ | while ( $l1 =~ /^(\s*)(\S+)(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 136 | $res .= join( '', | |||||||||||||||||||||||||||||||||||||||||||||
| 760 | substr( $l2, 0, length($1), '' ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 761 | '[' . $2 . ']', | ||||||||||||||||||||||||||||||||||||||||||||||
| 762 | substr( $l2, 0, length($2), '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 136 | $l1 = $3; | |||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 44 | return $res.$l2; | |||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||
| 768 | ################ Options and Configuration ################ | ||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||
| 770 | =head1 COMMAND LINE OPTIONS | ||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||
| 772 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||
| 774 | =item B<--output=>I<FILE> (short: B<-o>) | ||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||
| 776 | Designates the name of the output file where the results are written | ||||||||||||||||||||||||||||||||||||||||||||||
| 777 | to. Default is standard output. | ||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||
| 779 | =item B<--version> (short: B<-V>) | ||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||
| 781 | Prints the program version and exits. | ||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||
| 783 | =item B<--help> (short: -h) | ||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||
| 785 | Prints a help message. No other output is produced. | ||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||
| 787 | =item B<--manual> | ||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||
| 789 | Prints the manual page. No other output is produced. | ||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||
| 791 | =item B<--ident> | ||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||
| 793 | Shows the program name and version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||
| 795 | =item B<--verbose> | ||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||
| 797 | Provides more verbose information of what is going on. | ||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||
| 799 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||
| 801 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | ▶ | use Getopt::Long 2.13; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||
| 805 | # Package name. | ||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 1 | my $my_package; | |||||||||||||||||||||||||||||||||||||||||||||
| 807 | # Program name and version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 1 | my ($my_name, $my_version); | |||||||||||||||||||||||||||||||||||||||||||||
| 809 | 1 | my %configs; | |||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | sub app_setup { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_setup: not called CC=33 SCAR=70.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | goto &ChordPro::app_setup; | |||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | my ($appname, $appversion, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | my $help = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | my $manual = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my $ident = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | my $version = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | my $defcfg = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | my $fincfg = 0; # handled locally | |||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||
| 821 | # Package name. | ||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | $my_package = $args{package}; | |||||||||||||||||||||||||||||||||||||||||||||
| 823 | # Program name and version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | if ( defined $appname ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ($my_name, $my_version) = ($appname, $appversion); | |||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 827 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ($my_name, $my_version) = qw( MyProg 0.01 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||
| 831 | # Config files. | ||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | %configs = %{ CP->configs }; | |||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | my $app_lc = lc("ChordPro"); # common config | |||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | my $options = | |||||||||||||||||||||||||||||||||||||||||||||
| 836 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 837 | verbose => 0, # verbose processing | ||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # Development options (not shown with -help). | ||||||||||||||||||||||||||||||||||||||||||||||
| 840 | debug => 0, # debugging | ||||||||||||||||||||||||||||||||||||||||||||||
| 841 | trace => 0, # trace (show process) | ||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||
| 843 | # Service. | ||||||||||||||||||||||||||||||||||||||||||||||
| 844 | _package => $my_package, | ||||||||||||||||||||||||||||||||||||||||||||||
| 845 | _name => $my_name, | ||||||||||||||||||||||||||||||||||||||||||||||
| 846 | _version => $my_version, | ||||||||||||||||||||||||||||||||||||||||||||||
| 847 | _stdin => \*STDIN, | ||||||||||||||||||||||||||||||||||||||||||||||
| 848 | _stdout => \*STDOUT, | ||||||||||||||||||||||||||||||||||||||||||||||
| 849 | _stderr => \*STDERR, | ||||||||||||||||||||||||||||||||||||||||||||||
| 850 | _argv => [ @ARGV ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 851 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||
| 853 | # Colled command line options in a hash, for they will be needed | ||||||||||||||||||||||||||||||||||||||||||||||
| 854 | # later. | ||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $clo = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # Sorry, layout is a bit ugly... | ||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | if ( !GetOptions | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 859 | ($clo, | ||||||||||||||||||||||||||||||||||||||||||||||
| 860 | "output|o=s", # Saves the output to FILE | ||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||
| 862 | ### Configuration handling ### | ||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 'config|cfg=s@', | ||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 'noconfig|no-config', | ||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 'sysconfig=s', | ||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 'nosysconfig|no-sysconfig', | ||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 'userconfig=s', | ||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 'nouserconfig|no-userconfig', | ||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 'nodefaultconfigs|no-default-configs|X', | ||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 'define=s%', | ||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 'print-default-config' => \$defcfg, | ||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 'print-final-config' => \$fincfg, | ||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||
| 875 | ### Standard options ### | ||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||
| 877 | "version|V" => \$version, # Prints version and exits | ||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 'ident' => \$ident, | ||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 'help|h|?' => \$help, | ||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 'manual' => \$manual, | ||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 'verbose|v+', | ||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 'trace', | ||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 'debug+', | ||||||||||||||||||||||||||||||||||||||||||||||
| 884 | ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 885 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 886 | # GNU convention: message to STDERR upon failure. | ||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | app_usage(\*STDERR, 2); | |||||||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | my $pod2usage = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # Load Pod::Usage only if needed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | require Pod::Usage; | |||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | Pod::Usage->import; | |||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | my $f = "pod/A2Crd.pod"; | |||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | unshift( @_, -input => CP->findres($f) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | &pod2usage; | |||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||
| 899 | # GNU convention: message to STDOUT upon request. | ||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | app_ident(\*STDOUT) if $ident || $help || $manual; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ident or $help or $manual
$ident or $help
MC/DC0%0/3
$ident or $help or $manual
$ident
$help
$manual
Truth table0%0/4
A or B or C
A= $identB= $helpC= $manual
| |||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | if ( $manual or $help ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$manual or $help
MC/DC0%0/2
$manual or $help
$manual
$help
Truth table0%0/3
A or B
A= $manualB= $help
| |||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | app_usage(\*STDOUT, 0) if $help; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | $pod2usage->(VERBOSE => 2) if $manual; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | app_ident(\*STDOUT, 0) if $version; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||
| 907 | # If the user specified a config, it must exist. | ||||||||||||||||||||||||||||||||||||||||||||||
| 908 | # Otherwise, set to a default. | ||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | for my $config ( qw(sysconfig userconfig) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | for ( $clo->{$config} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | if ( defined($_) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | die("$_: $!\n") unless -r $_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # Use default. | ||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | ▶ | next if $clo->{nodefaultconfigs}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | next unless $configs{$config}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | $_ = $configs{$config}; | |||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | ▶ | undef($_) unless -r $_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | for my $config ( qw(config) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | for ( $clo->{$config} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if ( defined($_) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | foreach my $c ( @$_ ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | my $try = $c; | |||||||||||||||||||||||||||||||||||||||||||||
| 927 | # Check for resource names. | ||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | if ( ! -r $try ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $try = CP->findcfg($c); | |||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | ▶ | die("$c: $!\n") unless -r $try; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 935 | # Use default. | ||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | ▶ | next if $clo->{nodefaultconfigs}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | next unless $configs{$config}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | $_ = [ $configs{$config} ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | ▶ | undef($_) unless -r $_->[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 942 | # If no config was specified, and no default is available, force no. | ||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | for my $config ( qw(sysconfig userconfig config) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | $clo->{"no$config"} = 1 unless $clo->{$config}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # Plug in command-line options. | ||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | @{$options}{keys %$clo} = values %$clo; | |||||||||||||||||||||||||||||||||||||||||||||
| 949 | # warn(Dumper($options), "\n") if $options->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | ▶ | if ( $defcfg || $fincfg ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$defcfg or $fincfg
MC/DC0%0/2
$defcfg or $fincfg
$defcfg
$fincfg
Truth table0%0/3
A or B
A= $defcfgB= $fincfg
| |||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | print ChordPro::Config::config_default() | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 953 | if $defcfg; | ||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | print ChordPro::Config::config_final() | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 955 | if $fincfg; | ||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||
| 959 | # Return result. | ||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | $options; | |||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | sub app_ident { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_ident: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | my ($fh, $exit) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | print {$fh} ("This is ", | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 966 | $my_package | ||||||||||||||||||||||||||||||||||||||||||||||
| 967 | ? "$my_package [$my_name $my_version]" | ||||||||||||||||||||||||||||||||||||||||||||||
| 968 | : "$my_name version $my_version", | ||||||||||||||||||||||||||||||||||||||||||||||
| 969 | "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | ▶ | exit $exit if defined $exit; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | sub app_usage { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
app_usage: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | my ($fh, $exit) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | my $cmd = $0; | |||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | $cmd .= " --a2crd" if $cmd !~ m;(?:^|\/|\\)a2crd(?:\.\w+)$;; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | print ${fh} <<EndOfUsage; | |||||||||||||||||||||||||||||||||||||||||||||
| 978 | Usage: $cmd [ options ] [ file ... ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||||
| 980 | Options: | ||||||||||||||||||||||||||||||||||||||||||||||
| 981 | --output=FILE -o Saves the output to FILE | ||||||||||||||||||||||||||||||||||||||||||||||
| 982 | --version -V Prints version and exits | ||||||||||||||||||||||||||||||||||||||||||||||
| 983 | --help -h This message | ||||||||||||||||||||||||||||||||||||||||||||||
| 984 | --manual The full manual | ||||||||||||||||||||||||||||||||||||||||||||||
| 985 | --ident Show identification | ||||||||||||||||||||||||||||||||||||||||||||||
| 986 | --verbose Verbose information | ||||||||||||||||||||||||||||||||||||||||||||||
| 987 | EndOfUsage | ||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | ▶ | exit $exit if defined $exit; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||||
| 991 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||||||
| 993 | Johan Vromans C<< <jv at CPAN dot org > >> | ||||||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||||||
| 995 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||||
| 997 | A2Crd is part of ChordPro (the program). Development is hosted on | ||||||||||||||||||||||||||||||||||||||||||||||
| 998 | GitHub, repository L<https://github.com/ChordPro/chordpro>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | Please report any bugs or feature requests to the GitHub issue tracker, | ||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | L<https://github.com/ChordPro/chordpro/issues>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | A user community discussing ChordPro can be found at | ||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | L<https://groups.google.com/forum/#!forum/chordpro>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | Copyright (C) 2010,2018 Johan Vromans, | ||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | This program is free software. You can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | modify it under the terms of the Artistic License 2.0. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | but without any warranty; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | merchantability or fitness for a particular purpose. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||