#!/usr/bin/perl # # abcprog [sched] # # This generates a musical "program" from a schedule which describes # the abc files to be combined. A single file will be produced, called # "Out.abc" by default, and it will be fed to abc2ps to produce # "Out.ps". You can then view it with any handy PostScript viewer, or # print it on a PostScript printer. # # The sched file, which will be read from standard input if not named # on the command line, consists of a list of lines that look a lot # like abc header lines. But there are a few extras. # # Two of the added commnds are: # # < file # This tells abcprog to read from the named file. If there is no # suffix, ".abc" will be appended. This is similar to the "source" # command in perl, and #include in C. When the end of the file is # reached, abcprog will return and continue reading from the current # file. # > file # This tells abcprog to send subsequent output to the named file. If # no suffix is given, ".abc" is added. Also, abcprog remembers the # files that it writes to, and at the end, feeds each to abc2ps to # produce the corresponding ".ps" files. # # AUTHOR: John Chambers $| = 1; $stat = 0; ($me = $0) =~ s".*/""; $D = $ENV{"D_$me"} || 0; for $l (<>) { if ($l =~ /#/) { } else { &cmd(chomp $l); } } exit $stat; proc cmd { if ($l =~ /^<\s*(\w*)/) { &infile($1); } }