diff options
-rwxr-xr-x | tools/multigcc.pl | 10 | ||||
-rwxr-xr-x | tools/voice.pl | 26 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tools/multigcc.pl b/tools/multigcc.pl index 9be9978bd4..e263638d9d 100755 --- a/tools/multigcc.pl +++ b/tools/multigcc.pl | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | use Switch; | 2 | use feature "switch"; |
3 | use List::Util 'shuffle'; # standard from Perl 5.8 and later | 3 | use List::Util 'shuffle'; # standard from Perl 5.8 and later |
4 | 4 | ||
5 | my $tempfile = "multigcc.out"; | 5 | my $tempfile = "multigcc.out"; |
@@ -26,16 +26,16 @@ my $command = join " ", @params; | |||
26 | 26 | ||
27 | # count number of cores | 27 | # count number of cores |
28 | my $cores; | 28 | my $cores; |
29 | switch($^O) { | 29 | given ($^O) { |
30 | case "darwin" { | 30 | when ("darwin") { |
31 | chomp($cores = `sysctl -n hw.ncpu`); | 31 | chomp($cores = `sysctl -n hw.ncpu`); |
32 | $cores = 1 if ($?); | 32 | $cores = 1 if ($?); |
33 | } | 33 | } |
34 | case "solaris" { | 34 | when ("solaris") { |
35 | $cores = scalar grep /on-line/i, `psrinfo`; | 35 | $cores = scalar grep /on-line/i, `psrinfo`; |
36 | $cores = 1 if ($?); | 36 | $cores = 1 if ($?); |
37 | } | 37 | } |
38 | else { | 38 | default { |
39 | if (open CPUINFO, "</proc/cpuinfo") { | 39 | if (open CPUINFO, "</proc/cpuinfo") { |
40 | $cores = scalar grep /^processor/i, <CPUINFO>; | 40 | $cores = scalar grep /^processor/i, <CPUINFO>; |
41 | close CPUINFO; | 41 | close CPUINFO; |
diff --git a/tools/voice.pl b/tools/voice.pl index ee68c30eb4..9c528299b9 100755 --- a/tools/voice.pl +++ b/tools/voice.pl | |||
@@ -17,9 +17,9 @@ | |||
17 | 17 | ||
18 | use strict; | 18 | use strict; |
19 | use warnings; | 19 | use warnings; |
20 | use feature 'switch'; | ||
20 | use File::Basename; | 21 | use File::Basename; |
21 | use File::Copy; | 22 | use File::Copy; |
22 | use Switch; | ||
23 | use vars qw($V $C $t $l $e $E $s $S $i $v); | 23 | use vars qw($V $C $t $l $e $E $s $S $i $v); |
24 | use IPC::Open2; | 24 | use IPC::Open2; |
25 | use IPC::Open3; | 25 | use IPC::Open3; |
@@ -74,8 +74,8 @@ sub init_tts { | |||
74 | our $verbose; | 74 | our $verbose; |
75 | my ($tts_engine, $tts_engine_opts, $language) = @_; | 75 | my ($tts_engine, $tts_engine_opts, $language) = @_; |
76 | my %ret = ("name" => $tts_engine); | 76 | my %ret = ("name" => $tts_engine); |
77 | switch($tts_engine) { | 77 | given ($tts_engine) { |
78 | case "festival" { | 78 | when ("festival") { |
79 | print("> festival $tts_engine_opts --server\n") if $verbose; | 79 | print("> festival $tts_engine_opts --server\n") if $verbose; |
80 | my $pid = open(FESTIVAL_SERVER, "| festival $tts_engine_opts --server > /dev/null 2>&1"); | 80 | my $pid = open(FESTIVAL_SERVER, "| festival $tts_engine_opts --server > /dev/null 2>&1"); |
81 | my $dummy = *FESTIVAL_SERVER; #suppress warning | 81 | my $dummy = *FESTIVAL_SERVER; #suppress warning |
@@ -83,7 +83,7 @@ sub init_tts { | |||
83 | $SIG{KILL} = sub { kill TERM => $pid; print("boo"); panic_cleanup(); }; | 83 | $SIG{KILL} = sub { kill TERM => $pid; print("boo"); panic_cleanup(); }; |
84 | $ret{"pid"} = $pid; | 84 | $ret{"pid"} = $pid; |
85 | } | 85 | } |
86 | case "sapi" { | 86 | when ("sapi") { |
87 | my $toolsdir = dirname($0); | 87 | my $toolsdir = dirname($0); |
88 | my $path = `cygpath $toolsdir -a -w`; | 88 | my $path = `cygpath $toolsdir -a -w`; |
89 | chomp($path); | 89 | chomp($path); |
@@ -111,12 +111,12 @@ sub init_tts { | |||
111 | # Shutdown TTS engine if necessary. | 111 | # Shutdown TTS engine if necessary. |
112 | sub shutdown_tts { | 112 | sub shutdown_tts { |
113 | my ($tts_object) = @_; | 113 | my ($tts_object) = @_; |
114 | switch($$tts_object{"name"}) { | 114 | given ($$tts_object{"name"}) { |
115 | case "festival" { | 115 | when ("festival") { |
116 | # Send SIGTERM to festival server | 116 | # Send SIGTERM to festival server |
117 | kill TERM => $$tts_object{"pid"}; | 117 | kill TERM => $$tts_object{"pid"}; |
118 | } | 118 | } |
119 | case "sapi" { | 119 | when ("sapi") { |
120 | print({$$tts_object{"stdin"}} "QUIT\r\n"); | 120 | print({$$tts_object{"stdin"}} "QUIT\r\n"); |
121 | close($$tts_object{"stdin"}); | 121 | close($$tts_object{"stdin"}); |
122 | } | 122 | } |
@@ -147,8 +147,8 @@ sub voicestring { | |||
147 | my ($string, $output, $tts_engine_opts, $tts_object) = @_; | 147 | my ($string, $output, $tts_engine_opts, $tts_object) = @_; |
148 | my $cmd; | 148 | my $cmd; |
149 | printf("Generate \"%s\" with %s in file %s\n", $string, $$tts_object{"name"}, $output) if $verbose; | 149 | printf("Generate \"%s\" with %s in file %s\n", $string, $$tts_object{"name"}, $output) if $verbose; |
150 | switch($$tts_object{"name"}) { | 150 | given ($$tts_object{"name"}) { |
151 | case "festival" { | 151 | when ("festival") { |
152 | # festival_client lies to us, so we have to do awful soul-eating | 152 | # festival_client lies to us, so we have to do awful soul-eating |
153 | # work with IPC::open3() | 153 | # work with IPC::open3() |
154 | $cmd = "festival_client --server localhost --otype riff --ttw --output \"$output\""; | 154 | $cmd = "festival_client --server localhost --otype riff --ttw --output \"$output\""; |
@@ -168,22 +168,22 @@ sub voicestring { | |||
168 | close(CMD_OUT); | 168 | close(CMD_OUT); |
169 | close(CMD_ERR); | 169 | close(CMD_ERR); |
170 | } | 170 | } |
171 | case "flite" { | 171 | when ("flite") { |
172 | $cmd = "flite $tts_engine_opts -t \"$string\" \"$output\""; | 172 | $cmd = "flite $tts_engine_opts -t \"$string\" \"$output\""; |
173 | print("> $cmd\n") if $verbose; | 173 | print("> $cmd\n") if $verbose; |
174 | `$cmd`; | 174 | `$cmd`; |
175 | } | 175 | } |
176 | case "espeak" { | 176 | when ("espeak") { |
177 | $cmd = "espeak $tts_engine_opts -w \"$output\""; | 177 | $cmd = "espeak $tts_engine_opts -w \"$output\""; |
178 | print("> $cmd\n") if $verbose; | 178 | print("> $cmd\n") if $verbose; |
179 | open(ESPEAK, "| $cmd"); | 179 | open(ESPEAK, "| $cmd"); |
180 | print ESPEAK $string . "\n"; | 180 | print ESPEAK $string . "\n"; |
181 | close(ESPEAK); | 181 | close(ESPEAK); |
182 | } | 182 | } |
183 | case "sapi" { | 183 | when ("sapi") { |
184 | print({$$tts_object{"stdin"}} "SPEAK\t$output\t$string\r\n"); | 184 | print({$$tts_object{"stdin"}} "SPEAK\t$output\t$string\r\n"); |
185 | } | 185 | } |
186 | case "swift" { | 186 | when ("swift") { |
187 | $cmd = "swift $tts_engine_opts -o \"$output\" \"$string\""; | 187 | $cmd = "swift $tts_engine_opts -o \"$output\" \"$string\""; |
188 | print("> $cmd\n") if $verbose; | 188 | print("> $cmd\n") if $verbose; |
189 | system($cmd); | 189 | system($cmd); |