3 # Expand include files in praat script.
4 # Writes the expanded script to STDOUT.
5 # Concatenates all arguments.
8 # perl expandPraatScripts.pl <file1> ...
12 foreach my $input (@ARGV)
17 sub expand
# (filename)
20 my $directory = `dirname $filename`;
22 open(FILE
, "<$filename") || die "$!: $filename\n";
23 my @CurrentScript = <FILE
>;
25 foreach my $line (@CurrentScript) {
26 if($line =~ /^([^\#]*)include\s+(\S+)/){
27 my ($previous, $match, $following) = ($1, $2, $');
28 print "$previous\n" if $previous =~ /\S/;
29 # Insert included file
30 expand("$directory/$match");
31 print "$following" if $following =~ /\S/;
44 open(HEAD, "<../.git/HEAD");
47 if($headRef =~ /^\s*ref\:\s+/){
50 open(HEAD
, "<../.git/$refPtr");
58 print "\nmaster_SHA\$ = \"$headSHA\"\n";