[Compbench-devel] CompBenchmarks++ cloptions.cpp,1.13,1.14
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-31 20:46:22
|
Update of /cvsroot/compbench/CompBenchmarks++ In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27375 Modified Files: cloptions.cpp Log Message: Updates. Index: cloptions.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/cloptions.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** cloptions.cpp 21 Jan 2007 21:42:17 -0000 1.13 --- cloptions.cpp 31 Jan 2007 20:45:48 -0000 1.14 *************** *** 13,16 **** --- 13,17 ---- #include <unistd.h> #include <getopt.h> + #include <stdio.h> using namespace CBM; *************** *** 20,54 **** int parseExitValue = -1; void cbmOptionsHelp(void) { std::cout << "Usage: compbenchmarks-core [specs]" << std::endl << "Where specs is one of :" << std::endl ! << " --install <b-id> : download and pre-configure specified benchmark" << std::endl ! << " --fetch <b-id> <tarball> : uses local gzipped-tarball file to prepare" << std::endl ! << " installation of <b-id>" << std::endl ! << " --version : display software version" << std::endl ! << " --uninstall <b-id> : remove specified benchmark" << std::endl ! << " --list-benchmarks : show information about supported benchmarks" << std::endl ! << " (including b-id)" << std::endl ! << " --host-infos : detect host system" << std::endl ! << " --program-infos : list used programs" << std::endl ! << " --compiler-infos <c-bin> : use specified binary as compiler and display " << std::endl ! << " information about it" << std::endl ! << " --benchmark-infos <b-id> : display benchmark's information" << std::endl << " --bench <b-id> <c-bin> [c-options]" << std::endl ! << " use specified compiler and options (if provided)" << std::endl ! << " to run benchmark b-id" << std::endl << std::endl << "Fine grained operations gives more specs :" << std::endl ! << " --download <b-id> : download a benchmark" << std::endl ! << " --extract <b-id> : extract a benchmark" << std::endl ! << " --patch <b-id> : patch a benchmark" << std::endl ! << " --preconfigure <b-id> : preconfigure a benchmark" << std::endl ! << " --test <b-id> : test a benchmark" << std::endl ! << " --release <b-id> : release a benchmark" << std::endl << std::endl << "Other options affecting behaviour :" << std::endl ! << " --disable-testsuite : disable package's test suite" << std::endl ! << " --force : force operation" << std::endl << std::endl; } --- 21,59 ---- int parseExitValue = -1; + int optQuery = 0; + int optQueryAll = 0; + void cbmOptionsHelp(void) { std::cout << "Usage: compbenchmarks-core [specs]" << std::endl << "Where specs is one of :" << std::endl ! << " --help | -h : this help" << std::endl ! << " --version | -v : display software version" << std::endl ! << " --install | -i <p-id> : download and pre-configure specified package" << std::endl ! << " --fetch | -f <b-id> <fn> : uses local file <fn> to prepare" << std::endl ! << " installation of <b-id>" << std::endl ! << " --uninstall <b-id> : remove specified benchmark" << std::endl ! << " --list-benchmarks : show information about supported benchmarks" << std::endl ! << " (including b-id)" << std::endl ! << " --host-infos : detect host system" << std::endl ! << " --program-infos : list used programs" << std::endl ! << " --compiler-infos <c-bin> : use specified binary as compiler and display " << std::endl ! << " information about it" << std::endl ! << " --benchmark-infos <b-id> : display benchmark's information" << std::endl << " --bench <b-id> <c-bin> [c-options]" << std::endl ! << " use specified compiler and options (if provided)" << std::endl ! << " to run benchmark b-id" << std::endl << std::endl << "Fine grained operations gives more specs :" << std::endl ! << " --package-download <b-id> : download a benchmark" << std::endl ! << " --extract <b-id> : extract a benchmark" << std::endl ! << " --patch <b-id> : patch a benchmark" << std::endl ! << " --package-preconfigure <b-id> : preconfigure a benchmark" << std::endl ! << " --test <b-id> : test a benchmark" << std::endl ! << " --release <b-id> : release a benchmark" << std::endl << std::endl << "Other options affecting behaviour :" << std::endl ! << " --disable-testsuite : disable package's test suite" << std::endl ! << " --force : force operation" << std::endl << std::endl; } *************** *** 56,65 **** void cbmUnknownBenchmark(char *bench) { ! std::cerr << "Unknow benchmark '" << bench << "'" << std::endl; } void cbmUnknownPackage(char *pack) { ! std::cerr << "Unknow package '" << pack << "'" << std::endl; } --- 61,92 ---- void cbmUnknownBenchmark(char *bench) { ! int i; ! int n = cbmSystem->packageNumber(); ! int j; ! int m; ! ! CBM::Package *P; ! ! std::cerr << "Unknow benchmark '" << bench << "'. Valid entries are :" << std::endl; ! for(i=0; i<n; i++) { ! P=cbmSystem->Package(i); ! m=P->benchmarkNumber(); ! for(j=0;j<m;j++) { ! std::cerr << " * " << P->Benchmark(j)->Name() << std::endl; ! } ! } } void cbmUnknownPackage(char *pack) { ! std::cerr << "Unknow package '" << pack << "'. Valid entries are :" << std::endl; ! int i; ! int n = cbmSystem->packageNumber(); ! CBM::Package *P; ! ! for(i=0; i<n; i++) { ! P=cbmSystem->Package(i); ! std::cerr << " * " << P->Name() << std::endl; ! } } *************** *** 124,146 **** std::string options; ! static struct option long_options[] = { ! {"help", 0, 0, 'h' }, ! {"version", 0, 0, 'v'}, ! {"install", 1, 0, 'i' }, ! {"fetch", 1, 0, 'f'}, ! {"uninstall", 1, 0, 'u' }, ! {"list-benchmarks", 0, 0, 'L'}, ! {"host-infos", 0, 0, 'H' }, ! {"program-infos", 0, 0, 'P' }, ! {"compiler-infos", 1, 0, 'C' }, ! {"benchmark-infos", 1, 0, 'I' }, {"bench", 1, 0, 'B'}, ! {"download", 1, 0, 'D' }, ! {"extract", 1, 0, 'E' }, ! {"patch", 1, 0, 'p' }, ! {"preconfigure", 1, 0, 'g' }, ! {"test", 1, 0, 't' }, ! {"release", 1, 0, 'r' }, {"disable-testsuite", 0, 0, 'T' }, {"force", 0, 0, 'F' }, --- 151,181 ---- std::string options; ! static const struct option long_options[] = { ! {"help", no_argument, 0, 'h' }, ! {"version", no_argument, 0, 'v'}, ! {"install", required_argument, 0, 'i' }, ! {"fetch", required_argument, 0, 'f'}, ! {"uninstall", required_argument, 0, 'u' }, ! ! {"query", 0, 0, 'q' }, ! {"all", 0, 0, 'a' }, ! ! ! {"package", optional_argument, 0, 'p' }, ! {"package-benchmarks-info", 1, 0, 'I' }, ! ! {"benchmarks-info", 0, 0, 'L'}, ! {"host-info", 0, 0, 'H' }, ! {"programs-info", 0, 0, 'P' }, ! {"compiler-info", 1, 0, 'C' }, ! {"bench", 1, 0, 'B'}, ! {"package-download", 1, 0, 'D' }, ! {"package-extract", 1, 0, 'E' }, ! {"package-patch", 1, 0, 1011 }, ! {"package-preconfigure", 1, 0, 'g' }, ! {"package-test", 1, 0, 't' }, ! {"package-release", 1, 0, 'r' }, {"disable-testsuite", 0, 0, 'T' }, {"force", 0, 0, 'F' }, *************** *** 154,158 **** break; ! c = getopt_long (argc, argv, "vhi:u:LHPCF:1:I:B:2", /* :011000112", */ long_options, &option_index); if (c==-1) { --- 189,193 ---- break; ! c = getopt_long (argc, argv, "hvi:f:u:qp::a", // uLHPCFIB", /* :011000112", */ long_options, &option_index); if (c==-1) { *************** *** 165,172 **** --- 200,256 ---- parseExitValue=0; break; + case 'q': + optQuery=1; + break; + case 'a': + optQueryAll=1; + break; case 'h': cbmOptionsHelp(); parseExitValue=0; break; + case 'p': + printf("-p optarg=%s\n", optarg); + if (!optQuery) { + std::cerr << "-p option requires -q" << std::endl; + parseExitValue=1; + break; + } + + if ((optarg) && (!optQueryAll)) { + P=cbmOptionsExpectPackage(optarg); + if (P) + P->display(); + parseExitValue=0; + } else { + if (optQueryAll) { + if (optarg) { + std::cerr << "-qap options' set don't expect any argument" << std::endl; + } else { + printf("qap\n"); + // !!! + } + } else { + printf("there %x\n", (unsigned int) optarg); + if (optarg) { + P=cbmOptionsExpectPackage(optarg); + if (P) + P->display(); + parseExitValue=0; + } else { + P=cbmOptionsExpectPackage(optarg); + } + } + } + break; + /* + case 1011: + P=cbmOptionsExpectPackage(optarg); + if (P) + P->displayBenchmarks(); + parseExitValue=0; + break; + !!! + */ case 'i': P=cbmOptionsExpectPackage(optarg); *************** *** 239,243 **** parseExitValue=!P->Extract(UO_force); break; ! case 'p': P=cbmOptionsExpectPackage(optarg); if (P) --- 323,327 ---- parseExitValue=!P->Extract(UO_force); break; ! case 1011: P=cbmOptionsExpectPackage(optarg); if (P) *************** *** 289,294 **** options=""; } ! O=new CBM::CompilerOptions(C, ! (char*) options.c_str()); P=B->Package(); if (P->getStatus()<CBM::Package::Preconfigured) { --- 373,377 ---- options=""; } ! O=new CBM::CompilerOptions(options); P=B->Package(); if (P->getStatus()<CBM::Package::Preconfigured) { *************** *** 313,316 **** --- 396,401 ---- parseExitValue=0; break; + case '?': + break; } } |