diff --git a/Filters/VLBIABType.reader b/Filters/VLBIABType.reader index 38defb2..dcfe715 100755 --- a/Filters/VLBIABType.reader +++ b/Filters/VLBIABType.reader @@ -61,17 +61,17 @@ KEY = [[ 0, 1], [ 3,-1], [-2,-1], [ 5,-1], [ 0,-1], [-5,-1], [ 2,-1], [ 4,-1], [ 6,-1], [ 3,-1], [ 5,-1], [ 7,-1]] -$stdin.read(1) # Skip 1 Byte -titleLen = $stdin.read(1)[0] -OUTPUT['title'] = $stdin.read(titleLen) +INFILE.read(1) # Skip 1 Byte +titleLen = INFILE.read(1)[0] +OUTPUT['title'] = INFILE.read(titleLen) -$stdin.read(2) # Skip 2 Bytes -gr = $stdin.read(1)[0]-1 +INFILE.read(2) # Skip 2 Bytes +gr = INFILE.read(1)[0]-1 groove = GROOVE[gr] || ['Swing'] -key = KEY[$stdin.read(1)[0]] +key = KEY[INFILE.read(1)[0]] PROP['key'] = key[0] PROP['mode'] = key[1] -OUTPUT['tempo'] = $stdin.read(1)[0] +OUTPUT['tempo'] = INFILE.read(1)[0] # # Style map - not processed yet @@ -79,12 +79,12 @@ OUTPUT['tempo'] = $stdin.read(1)[0] STYLES = [] i=0 while i < 256 - st = $stdin.read(1)[0] + st = INFILE.read(1)[0] if st > 0 STYLES[i-1] = st i += 1 else - i += $stdin.read(1)[0] + i += INFILE.read(1)[0] end end @@ -282,12 +282,12 @@ EXT = [ STEPS = [] i = 0 while i < 1020 - ex = $stdin.read(1)[0] + ex = INFILE.read(1)[0] if ex > 0 STEPS[i] = EXT[ex] i += 1 else - i += $stdin.read(1)[0] + i += INFILE.read(1)[0] end end @@ -297,7 +297,7 @@ CHORDS = [] ROOTS = [] i = 0 while i < 1021 - cr = $stdin.read(1)[0] + cr = INFILE.read(1)[0] if cr > 0 CHORDS[i] = PITCHES[cr % 18] if cr > 18 @@ -305,15 +305,15 @@ while i < 1021 end i += 1 else - i += $stdin.read(1)[0] + i += INFILE.read(1)[0] end end -$stdin.read(1) # Start measure -numMeasures = $stdin.read(1)[0] -numRepeats = $stdin.read(1)[0] +INFILE.read(1) # Start measure +numMeasures = INFILE.read(1)[0] +numRepeats = INFILE.read(1)[0] -biab = $stdin.read +biab = INFILE.read styleFile = nil if biab =~ /B.(.{1,8})\.STY/m diff --git a/Filters/VLLilypondType.reader b/Filters/VLLilypondType.reader index c6780b7..f03bcb3 100755 --- a/Filters/VLLilypondType.reader +++ b/Filters/VLLilypondType.reader @@ -14,7 +14,7 @@ OUTPUT = {'measures' => []} # Lex # tokens = [] -$stdin.each do |line| +INFILE.each do |line| line.chomp!.sub!(/%.*/, "") line.scan(%r$\G\s*(\{|\}|\(|\)|\||=|~|<<|>>|--|#'|#\(|##t|##f|\\\w+|\".*?\"|\w[-+\w\d.',:*/]+|.)$) do |token| tokens.push(token[0]) diff --git a/Filters/VLMusicXMLType.reader b/Filters/VLMusicXMLType.reader index 2a56620..77fc881 100755 --- a/Filters/VLMusicXMLType.reader +++ b/Filters/VLMusicXMLType.reader @@ -444,7 +444,7 @@ class MusicXMLListener end listener = MusicXMLListener.new -REXML::Document.parse_stream($stdin, listener) +REXML::Document.parse_stream(INFILE, listener) writePlist($stdout, OUTPUT) # Local Variables: diff --git a/Filters/VLMusicXMLType.writer b/Filters/VLMusicXMLType.writer index 3f489dd..0d129f7 100755 --- a/Filters/VLMusicXMLType.writer +++ b/Filters/VLMusicXMLType.writer @@ -7,7 +7,7 @@ require File.dirname($0)+'/plistReader' require File.dirname($0)+'/vl' require 'rexml/document' -INPUT = readPlist($stdin) +INPUT = readPlist(INFILE) $USE_FLATS = false $DIVISIONS = 3 diff --git a/Filters/vl.rb b/Filters/vl.rb index 933d045..30abb39 100644 --- a/Filters/vl.rb +++ b/Filters/vl.rb @@ -112,7 +112,7 @@ class VL @denom /= g end - def -() + def -@() return Fract.new(-@num, @denom) end @@ -129,3 +129,9 @@ class VL end end end + +if ARGV.size > 0 + INFILE = File.new(ARGV[0], "r") +else + INFILE = $stdin +end