comparison runner/main.cpp @ 127:f0df07da6f46

Update version, add --minversion flag
author Chris Cannam
date Thu, 09 Oct 2014 12:56:55 +0100
parents 685e5cf3cb1d
children 6b62bae0af33
comparison
equal deleted inserted replaced
126:e6379b2e1c5c 127:f0df07da6f46
135 ++i; 135 ++i;
136 } 136 }
137 return ws; 137 return ws;
138 } 138 }
139 139
140 static bool
141 isVersionNewerThan(QString a, QString b) // from VersionTester in svapp
142 {
143 QRegExp re("[._-]");
144 QStringList alist = a.split(re, QString::SkipEmptyParts);
145 QStringList blist = b.split(re, QString::SkipEmptyParts);
146 int ae = alist.size();
147 int be = blist.size();
148 int e = std::max(ae, be);
149 for (int i = 0; i < e; ++i) {
150 int an = 0, bn = 0;
151 if (i < ae) {
152 an = alist[i].toInt();
153 if (an == 0 && alist[i] != "0") {
154 an = -1; // non-numeric field -> "-pre1" etc
155 }
156 }
157 if (i < be) {
158 bn = blist[i].toInt();
159 if (bn == 0 && blist[i] != "0") {
160 bn = -1;
161 }
162 }
163 if (an < bn) return false;
164 if (an > bn) return true;
165 }
166 return false;
167 }
168
169 static int
170 checkMinVersion(QString myname, QString v)
171 {
172 if (v == RUNNER_VERSION) {
173 return 0;
174 } else if (isVersionNewerThan(RUNNER_VERSION, v)) {
175 return 0;
176 } else {
177 cerr << myname << ": version "
178 << RUNNER_VERSION << " is less than requested min version "
179 << v << ", failing" << endl;
180 return 1;
181 }
182 }
183
140 void printUsage(QString myname) 184 void printUsage(QString myname)
141 { 185 {
142 cerr << endl; 186 cerr << endl;
143 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl; 187 cerr << "Sonic Annotator v" << RUNNER_VERSION << endl;
144 cerr << "A utility for batch feature extraction from audio files." << endl; 188 cerr << "A utility for batch feature extraction from audio files." << endl;
148 cerr << "This program is free software. You may redistribute copies of it under the" << endl; 192 cerr << "This program is free software. You may redistribute copies of it under the" << endl;
149 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl; 193 cerr << "terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl;
150 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl; 194 cerr << "This program is supplied with NO WARRANTY, to the extent permitted by law." << endl;
151 cerr << endl; 195 cerr << endl;
152 cerr << "Usage: " << endl; 196 cerr << "Usage: " << endl;
153 cerr << " " << myname.toStdString() 197 cerr << " " << myname
154 << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl; 198 << " [-mrnf] -t transform.ttl [..] -w <writer> [..] <audio> [..]" << endl;
155 cerr << " " << myname.toStdString() 199 cerr << " " << myname
156 << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl; 200 << " [-mrnf] -T translist.txt [..] -w <writer> [..] <audio> [..]" << endl;
157 cerr << " " << myname.toStdString() 201 cerr << " " << myname
158 << " [-mrnf] -d <plugin> [..] -w <writer> [..] <audio> [...]" << endl; 202 << " [-mrnf] -d <plugin> [..] -w <writer> [..] <audio> [...]" << endl;
159 cerr << " " << myname.toStdString() 203 cerr << " " << myname
160 << " -s <transform>" << endl; 204 << " -s <transform>" << endl;
161 cerr << " " << myname.toStdString() 205 cerr << " " << myname
162 << " [-lhv]" << endl; 206 << " [-lhv]" << endl;
163 cerr << endl; 207 cerr << endl;
164 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl; 208 cerr << "Where <audio> is an audio file or URL to use as input: either a local file" << endl;
165 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl; 209 cerr << "path, local \"file://\" URL, or remote \"http://\" or \"ftp://\" URL;" << endl;
166 cerr << "and <plugin> is a plugin output identified as vamp:libname:plugin:output." << endl; 210 cerr << "and <plugin> is a plugin output identified as vamp:libname:plugin:output." << endl;
183 c += ext.length() + 2; 227 c += ext.length() + 2;
184 if (c >= 80) { 228 if (c >= 80) {
185 cerr << "\n "; 229 cerr << "\n ";
186 c -= 78; 230 c -= 78;
187 } 231 }
188 cerr << ext.toStdString(); 232 cerr << ext;
189 if (i + 1 == extlist.size()) cerr << "."; 233 if (i + 1 == extlist.size()) cerr << ".";
190 else cerr << ", "; 234 else cerr << ", ";
191 } 235 }
192 cerr << endl; 236 cerr << endl;
193 } 237 }
264 cerr << endl; 308 cerr << endl;
265 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl; 309 cerr << " -s, --skeleton <I> Generate a skeleton transform file for transform id <I>" << endl;
266 cerr << " and write it to standard output." << endl; 310 cerr << " and write it to standard output." << endl;
267 cerr << endl; 311 cerr << endl;
268 cerr << " -v, --version Show the version number and exit." << endl; 312 cerr << " -v, --version Show the version number and exit." << endl;
313 cerr << endl;
314 cerr << " --minversion <V> Exit with successful return code if the version of" << endl;
315 cerr << " " << myname << " is at least <V>, failure otherwise." << endl;
316 cerr << " For scripts that depend on certain option support." << endl;
317 cerr << endl;
269 cerr << " -h, --help Show help." << endl; 318 cerr << " -h, --help Show help." << endl;
270 319
271 cerr << endl; 320 cerr << endl;
272 cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl; 321 cerr << "If no -w (or --writer) options are supplied, either the -l -s -v or -h option" << endl;
273 cerr << "(or long equivalent) must be given instead." << endl; 322 cerr << "(or long equivalent) must be given instead." << endl;
293 int spaceage = 16 - int(i->length()) - int(j->name.length()); 342 int spaceage = 16 - int(i->length()) - int(j->name.length());
294 if (j->hasArg) { cerr << "<X> "; spaceage -= 4; } 343 if (j->hasArg) { cerr << "<X> "; spaceage -= 4; }
295 for (int k = 0; k < spaceage; ++k) cerr << " "; 344 for (int k = 0; k < spaceage; ++k) cerr << " ";
296 QString s(j->description.c_str()); 345 QString s(j->description.c_str());
297 s = wrap(s, 56, 22); 346 s = wrap(s, 56, 22);
298 cerr << s.toStdString() << endl; 347 cerr << s << endl;
299 } 348 }
300 } 349 }
301 350
302 cerr << endl; 351 cerr << endl;
303 } 352 }
310 359
311 for (TransformList::const_iterator iter = transforms.begin(); 360 for (TransformList::const_iterator iter = transforms.begin();
312 iter != transforms.end(); ++iter) { 361 iter != transforms.end(); ++iter) {
313 const TransformDescription &transform = *iter; 362 const TransformDescription &transform = *iter;
314 if (transform.type == TransformDescription::Analysis) { 363 if (transform.type == TransformDescription::Analysis) {
315 cout << transform.identifier.toStdString() << endl; 364 cout << transform.identifier << endl;
316 } 365 }
317 } 366 }
318 } 367 }
319 368
320 void 369 void
325 cout << "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ." << endl 374 cout << "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ." << endl
326 << "@prefix vamp: <http://purl.org/ontology/vamp/> ." << endl 375 << "@prefix vamp: <http://purl.org/ontology/vamp/> ." << endl
327 << "@prefix : <#> ." << endl << endl; 376 << "@prefix : <#> ." << endl << endl;
328 QString rdf = RDFTransformFactory::writeTransformToRDF 377 QString rdf = RDFTransformFactory::writeTransformToRDF
329 (transform, ":transform"); 378 (transform, ":transform");
330 cout << rdf.toStdString(); 379 cout << rdf;
331 } 380 }
332 381
333 void 382 void
334 findSourcesRecursive(QString dirname, QStringList &addTo, int &found) 383 findSourcesRecursive(QString dirname, QStringList &addTo, int &found)
335 { 384 {
336 QDir dir(dirname); 385 QDir dir(dirname);
337 386
338 QString printable = dir.dirName().left(20); 387 QString printable = dir.dirName().left(20);
339 cerr << "\rScanning \"" << printable.toStdString() << "\"..." 388 cerr << "\rScanning \"" << printable << "\"..."
340 << QString(" ").left(20 - printable.length()).toStdString() 389 << QString(" ").left(20 - printable.length())
341 << " [" << found << " audio file(s)]"; 390 << " [" << found << " audio file(s)]";
342 391
343 QString extensions = AudioFileReaderFactory::getKnownExtensions(); 392 QString extensions = AudioFileReaderFactory::getKnownExtensions();
344 QStringList extlist = extensions.split(" ", QString::SkipEmptyParts); 393 QStringList extlist = extensions.split(" ", QString::SkipEmptyParts);
345 394
409 bool recursive = false; 458 bool recursive = false;
410 bool normalise = false; 459 bool normalise = false;
411 bool list = false; 460 bool list = false;
412 bool summaryOnly = false; 461 bool summaryOnly = false;
413 QString skeletonFor = ""; 462 QString skeletonFor = "";
463 QString minVersion = "";
414 QString myname = args[0]; 464 QString myname = args[0];
415 myname = QFileInfo(myname).baseName(); 465 myname = QFileInfo(myname).baseName();
416 QStringList otherArgs; 466 QStringList otherArgs;
417 Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries boundaries; 467 Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries boundaries;
418 468
433 return 0; 483 return 0;
434 } 484 }
435 485
436 if (arg == "-w" || arg == "--writer") { 486 if (arg == "-w" || arg == "--writer") {
437 if (last || args[i+1].startsWith("-")) { 487 if (last || args[i+1].startsWith("-")) {
438 cerr << myname.toStdString() << ": argument expected for \"" 488 cerr << myname << ": argument expected for \""
439 << arg.toStdString() << "\" option" << endl; 489 << arg << "\" option" << endl;
440 cerr << helpStr.toStdString() << endl; 490 cerr << helpStr << endl;
441 exit(2); 491 exit(2);
442 } else { 492 } else {
443 string tag = args[++i].toStdString(); 493 string tag = args[++i].toStdString();
444 if (requestedWriterTags.find(tag) != requestedWriterTags.end()) { 494 if (requestedWriterTags.find(tag) != requestedWriterTags.end()) {
445 cerr << myname.toStdString() << ": NOTE: duplicate specification of writer type \"" << tag << "\" ignored" << endl; 495 cerr << myname << ": NOTE: duplicate specification of writer type \"" << tag << "\" ignored" << endl;
446 } else { 496 } else {
447 requestedWriterTags.insert(tag); 497 requestedWriterTags.insert(tag);
448 } 498 }
449 continue; 499 continue;
450 } 500 }
451 } else if (arg == "-t" || arg == "--transform") { 501 } else if (arg == "-t" || arg == "--transform") {
452 if (last || args[i+1].startsWith("-")) { 502 if (last || args[i+1].startsWith("-")) {
453 cerr << myname.toStdString() << ": argument expected for \"" 503 cerr << myname << ": argument expected for \""
454 << arg.toStdString() << "\" option" << endl; 504 << arg << "\" option" << endl;
455 cerr << helpStr.toStdString() << endl; 505 cerr << helpStr << endl;
456 exit(2); 506 exit(2);
457 } else { 507 } else {
458 string transform = args[++i].toStdString(); 508 string transform = args[++i].toStdString();
459 if (requestedTransformFiles.find(transform) != 509 if (requestedTransformFiles.find(transform) !=
460 requestedTransformFiles.end()) { 510 requestedTransformFiles.end()) {
461 cerr << myname.toStdString() << ": NOTE: duplicate specification of transform file \"" << transform << "\" ignored" << endl; 511 cerr << myname << ": NOTE: duplicate specification of transform file \"" << transform << "\" ignored" << endl;
462 } else { 512 } else {
463 requestedTransformFiles.insert(transform); 513 requestedTransformFiles.insert(transform);
464 } 514 }
465 continue; 515 continue;
466 } 516 }
467 } else if (arg == "-T" || arg == "--transforms") { 517 } else if (arg == "-T" || arg == "--transforms") {
468 if (last || args[i+1].startsWith("-")) { 518 if (last || args[i+1].startsWith("-")) {
469 cerr << myname.toStdString() << ": argument expected for \"" 519 cerr << myname << ": argument expected for \""
470 << arg.toStdString() << "\" option" << endl; 520 << arg << "\" option" << endl;
471 cerr << helpStr.toStdString() << endl; 521 cerr << helpStr << endl;
472 exit(2); 522 exit(2);
473 } else { 523 } else {
474 string transform = args[++i].toStdString(); 524 string transform = args[++i].toStdString();
475 if (requestedTransformListFiles.find(transform) != 525 if (requestedTransformListFiles.find(transform) !=
476 requestedTransformListFiles.end()) { 526 requestedTransformListFiles.end()) {
477 cerr << myname.toStdString() << ": NOTE: duplicate specification of transform list file \"" << transform << "\" ignored" << endl; 527 cerr << myname << ": NOTE: duplicate specification of transform list file \"" << transform << "\" ignored" << endl;
478 } else { 528 } else {
479 requestedTransformListFiles.insert(transform); 529 requestedTransformListFiles.insert(transform);
480 } 530 }
481 continue; 531 continue;
482 } 532 }
483 } else if (arg == "-d" || arg == "--default") { 533 } else if (arg == "-d" || arg == "--default") {
484 if (last || args[i+1].startsWith("-")) { 534 if (last || args[i+1].startsWith("-")) {
485 cerr << myname.toStdString() << ": argument expected for \"" 535 cerr << myname << ": argument expected for \""
486 << arg.toStdString() << "\" option" << endl; 536 << arg << "\" option" << endl;
487 cerr << helpStr.toStdString() << endl; 537 cerr << helpStr << endl;
488 exit(2); 538 exit(2);
489 } else { 539 } else {
490 string deft = args[++i].toStdString(); 540 string deft = args[++i].toStdString();
491 if (requestedDefaultTransforms.find(deft) != 541 if (requestedDefaultTransforms.find(deft) !=
492 requestedDefaultTransforms.end()) { 542 requestedDefaultTransforms.end()) {
493 cerr << myname.toStdString() << ": NOTE: duplicate specification of default transform \"" << deft << "\" ignored" << endl; 543 cerr << myname << ": NOTE: duplicate specification of default transform \"" << deft << "\" ignored" << endl;
494 } else { 544 } else {
495 requestedDefaultTransforms.insert(deft); 545 requestedDefaultTransforms.insert(deft);
496 } 546 }
497 continue; 547 continue;
498 } 548 }
499 } else if (arg == "-S" || arg == "--summary") { 549 } else if (arg == "-S" || arg == "--summary") {
500 if (last || args[i+1].startsWith("-")) { 550 if (last || args[i+1].startsWith("-")) {
501 cerr << myname.toStdString() << ": argument expected for \"" 551 cerr << myname << ": argument expected for \""
502 << arg.toStdString() << "\" option" << endl; 552 << arg << "\" option" << endl;
503 cerr << helpStr.toStdString() << endl; 553 cerr << helpStr << endl;
504 exit(2); 554 exit(2);
505 } else { 555 } else {
506 string summary = args[++i].toStdString(); 556 string summary = args[++i].toStdString();
507 requestedSummaryTypes.insert(summary); 557 requestedSummaryTypes.insert(summary);
508 continue; 558 continue;
510 } else if (arg == "--summary-only") { 560 } else if (arg == "--summary-only") {
511 summaryOnly = true; 561 summaryOnly = true;
512 continue; 562 continue;
513 } else if (arg == "--segments") { 563 } else if (arg == "--segments") {
514 if (last) { 564 if (last) {
515 cerr << myname.toStdString() << ": argument expected for \"" 565 cerr << myname << ": argument expected for \""
516 << arg.toStdString() << "\" option" << endl; 566 << arg << "\" option" << endl;
517 cerr << helpStr.toStdString() << endl; 567 cerr << helpStr << endl;
518 exit(2); 568 exit(2);
519 } else { 569 } else {
520 string segmentSpec = args[++i].toStdString(); 570 string segmentSpec = args[++i].toStdString();
521 QStringList segmentStrs = QString(segmentSpec.c_str()).split(','); 571 QStringList segmentStrs = QString(segmentSpec.c_str()).split(',');
522 for (int j = 0; j < segmentStrs.size(); ++j) { 572 for (int j = 0; j < segmentStrs.size(); ++j) {
523 bool good = false; 573 bool good = false;
524 boundaries.insert(Vamp::RealTime::fromSeconds 574 boundaries.insert(Vamp::RealTime::fromSeconds
525 (segmentStrs[j].toDouble(&good))); 575 (segmentStrs[j].toDouble(&good)));
526 if (!good) { 576 if (!good) {
527 cerr << myname.toStdString() << ": segment boundaries must be numeric" << endl; 577 cerr << myname << ": segment boundaries must be numeric" << endl;
528 cerr << helpStr.toStdString() << endl; 578 cerr << helpStr << endl;
529 exit(2); 579 exit(2);
530 } 580 }
531 } 581 }
532 } 582 }
533 } else if (arg == "-m" || arg == "--multiplex") { 583 } else if (arg == "-m" || arg == "--multiplex") {
543 force = true; 593 force = true;
544 continue; 594 continue;
545 } else if (arg == "-l" || arg == "--list") { 595 } else if (arg == "-l" || arg == "--list") {
546 list = true; 596 list = true;
547 continue; 597 continue;
598 } else if (arg == "--minversion") {
599 if (last || args[i+1].startsWith("-")) {
600 cerr << myname << ": usage: "
601 << myname << " " << arg << " <version>" << endl;
602 cerr << helpStr << endl;
603 exit(2);
604 }
605 minVersion = args[++i];
606 continue;
548 } else if (arg == "-s" || arg == "--skeleton") { 607 } else if (arg == "-s" || arg == "--skeleton") {
549 if (last || args[i+1].startsWith("-")) { 608 if (last || args[i+1].startsWith("-")) {
550 cerr << myname.toStdString() << ": usage: " 609 cerr << myname << ": usage: "
551 << myname.toStdString() << " " << arg.toStdString() 610 << myname << " " << arg
552 << " <transform>" << endl; 611 << " <transform>" << endl;
553 cerr << helpStr.toStdString() << endl; 612 cerr << helpStr << endl;
554 exit(2); 613 exit(2);
555 } else { 614 } else {
556 skeletonFor = args[++i]; 615 skeletonFor = args[++i];
557 continue; 616 continue;
558 } 617 }
561 } 620 }
562 } 621 }
563 622
564 if (list) { 623 if (list) {
565 if (!requestedWriterTags.empty() || skeletonFor != "") { 624 if (!requestedWriterTags.empty() || skeletonFor != "") {
566 cerr << helpStr.toStdString() << endl; 625 cerr << helpStr << endl;
567 exit(2); 626 exit(2);
568 } 627 }
569 listTransforms(); 628 listTransforms();
570 exit(0); 629 exit(0);
571 } 630 }
572 if (skeletonFor != "") { 631 if (skeletonFor != "") {
573 if (!requestedWriterTags.empty()) { 632 if (!requestedWriterTags.empty()) {
574 cerr << helpStr.toStdString() << endl; 633 cerr << helpStr << endl;
575 exit(2); 634 exit(2);
576 } 635 }
577 printSkeleton(skeletonFor); 636 printSkeleton(skeletonFor);
578 exit(0); 637 exit(0);
638 }
639 if (minVersion != "") {
640 if (!requestedWriterTags.empty()) {
641 cerr << helpStr << endl;
642 exit(2);
643 }
644 exit(checkMinVersion(myname, minVersion));
579 } 645 }
580 646
581 if (requestedTransformFiles.empty() && 647 if (requestedTransformFiles.empty() &&
582 requestedTransformListFiles.empty() && 648 requestedTransformListFiles.empty() &&
583 requestedDefaultTransforms.empty()) { 649 requestedDefaultTransforms.empty()) {
584 cerr << myname.toStdString() 650 cerr << myname
585 << ": no transform(s) specified" << endl; 651 << ": no transform(s) specified" << endl;
586 cerr << helpStr.toStdString() << endl; 652 cerr << helpStr << endl;
587 exit(2); 653 exit(2);
588 } 654 }
589 655
590 if (requestedWriterTags.empty()) { 656 if (requestedWriterTags.empty()) {
591 cerr << myname.toStdString() 657 cerr << myname
592 << ": no writer(s) specified" << endl; 658 << ": no writer(s) specified" << endl;
593 cerr << helpStr.toStdString() << endl; 659 cerr << helpStr << endl;
594 exit(2); 660 exit(2);
595 } 661 }
596 662
597 if (!boundaries.empty()) { 663 if (!boundaries.empty()) {
598 if (requestedSummaryTypes.empty()) { 664 if (requestedSummaryTypes.empty()) {
599 cerr << myname.toStdString() 665 cerr << myname
600 << ": summary segment boundaries provided, but no summary type specified" 666 << ": summary segment boundaries provided, but no summary type specified"
601 << endl; 667 << endl;
602 cerr << helpStr.toStdString() << endl; 668 cerr << helpStr << endl;
603 exit(2); 669 exit(2);
604 } 670 }
605 } 671 }
606 672
607 QSettings settings; 673 QSettings settings;
628 manager.setNormalise(normalise); 694 manager.setNormalise(normalise);
629 695
630 if (!requestedSummaryTypes.empty()) { 696 if (!requestedSummaryTypes.empty()) {
631 if (!manager.setSummaryTypes(requestedSummaryTypes, 697 if (!manager.setSummaryTypes(requestedSummaryTypes,
632 boundaries)) { 698 boundaries)) {
633 cerr << myname.toStdString() 699 cerr << myname
634 << ": failed to set requested summary types" << endl; 700 << ": failed to set requested summary types" << endl;
635 exit(1); 701 exit(1);
636 } 702 }
637 } 703 }
638 704
644 i != requestedWriterTags.end(); ++i) { 710 i != requestedWriterTags.end(); ++i) {
645 711
646 FeatureWriter *writer = FeatureWriterFactory::createWriter(*i); 712 FeatureWriter *writer = FeatureWriterFactory::createWriter(*i);
647 713
648 if (!writer) { 714 if (!writer) {
649 cerr << myname.toStdString() << ": unknown feature writer \"" 715 cerr << myname << ": unknown feature writer \""
650 << *i << "\"" << endl; 716 << *i << "\"" << endl;
651 cerr << helpStr.toStdString() << endl; 717 cerr << helpStr << endl;
652 exit(2); 718 exit(2);
653 } 719 }
654 720
655 map<string, string> writerArgs; 721 map<string, string> writerArgs;
656 FeatureWriter::ParameterList pl(writer->getSupportedParameters()); 722 FeatureWriter::ParameterList pl(writer->getSupportedParameters());
673 if (pl[k].hasArg) { 739 if (pl[k].hasArg) {
674 if (j < otherArgs.size()) { 740 if (j < otherArgs.size()) {
675 writerArgs[argbase] = otherArgs[j].toStdString(); 741 writerArgs[argbase] = otherArgs[j].toStdString();
676 otherArgs.removeAt(j); 742 otherArgs.removeAt(j);
677 } else { 743 } else {
678 cerr << myname.toStdString() << ": " 744 cerr << myname << ": "
679 << "argument required for \"" 745 << "argument required for \""
680 << literal.toStdString() << "\" option" 746 << literal << "\" option"
681 << endl; 747 << endl;
682 cerr << helpStr.toStdString() << endl; 748 cerr << helpStr << endl;
683 exit(2); 749 exit(2);
684 } 750 }
685 } else { 751 } else {
686 writerArgs[argbase] = ""; 752 writerArgs[argbase] = "";
687 } 753 }
693 writers.push_back(writer); 759 writers.push_back(writer);
694 } 760 }
695 761
696 for (int i = 0; i < otherArgs.size(); ++i) { 762 for (int i = 0; i < otherArgs.size(); ++i) {
697 if (otherArgs[i].startsWith("-")) { 763 if (otherArgs[i].startsWith("-")) {
698 cerr << myname.toStdString() << ": unknown option \"" 764 cerr << myname << ": unknown option \""
699 << otherArgs[i].toStdString() << "\"" << endl; 765 << otherArgs[i] << "\"" << endl;
700 cerr << helpStr.toStdString() << endl; 766 cerr << helpStr << endl;
701 exit(2); 767 exit(2);
702 } 768 }
703 } 769 }
704 770
705 if (otherArgs.empty()) { 771 if (otherArgs.empty()) {
706 cerr << myname.toStdString() << ": no input(s) specified" << endl; 772 cerr << myname << ": no input(s) specified" << endl;
707 cerr << helpStr.toStdString() << endl; 773 cerr << helpStr << endl;
708 exit(2); 774 exit(2);
709 } 775 }
710 776
711 for (set<string>::const_iterator i = requestedTransformListFiles.begin(); 777 for (set<string>::const_iterator i = requestedTransformListFiles.begin();
712 i != requestedTransformListFiles.end(); ++i) { 778 i != requestedTransformListFiles.end(); ++i) {
715 vector<QString> files = reader.load(); 781 vector<QString> files = reader.load();
716 for (int j = 0; j < (int)files.size(); ++j) { 782 for (int j = 0; j < (int)files.size(); ++j) {
717 requestedTransformFiles.insert(files[j].toStdString()); 783 requestedTransformFiles.insert(files[j].toStdString());
718 } 784 }
719 } else { 785 } else {
720 cerr << myname.toStdString() << ": failed to read template list file \"" << *i << "\"" << endl; 786 cerr << myname << ": failed to read template list file \"" << *i << "\"" << endl;
721 exit(2); 787 exit(2);
722 } 788 }
723 } 789 }
724 790
725 QStringList sources; 791 QStringList sources;
790 good = false; 856 good = false;
791 } 857 }
792 } 858 }
793 859
794 if (!haveFeatureExtractor) { 860 if (!haveFeatureExtractor) {
795 cerr << myname.toStdString() << ": no feature extractors added" << endl; 861 cerr << myname << ": no feature extractors added" << endl;
796 good = false; 862 good = false;
797 } 863 }
798 } 864 }
799 865
800 if (good) { 866 if (good) {