本文整理汇总了C++中processArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ processArgs函数的具体用法?C++ processArgs怎么用?C++ processArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("plasmadiscover")));
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
KCrash::initialize();
KLocalizedString::setApplicationDomain("plasma-discover");
KAboutData about(QStringLiteral("discover"), i18n("Discover"), version, i18n("An application explorer"),
KAboutLicense::GPL, i18n("© 2010-2016 Plasma Development Team"));
about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), QStringLiteral("[email protected]"));
about.addAuthor(i18n("Jonathan Thomas"), QString(), QStringLiteral("[email protected]"));
about.setProductName("discover/discover");
KAboutData::setApplicationData(about);
DiscoverMainWindow *mainWindow = nullptr;
{
QScopedPointer<QCommandLineParser> parser(createParser());
parser->process(app);
about.processCommandLine(parser.data());
DiscoverBackendsFactory::processCommandLine(parser.data(), parser->isSet(QStringLiteral("test")));
if (parser->isSet(QStringLiteral("test"))) {
QStandardPaths::setTestModeEnabled(true);
}
KDBusService* service = new KDBusService(KDBusService::Unique, &app);
mainWindow = new DiscoverMainWindow(s_decodeCompactMode->value(parser->value(QStringLiteral("compact")), DiscoverMainWindow::Full));
QObject::connect(&app, &QCoreApplication::aboutToQuit, mainWindow, &DiscoverMainWindow::deleteLater);
QObject::connect(service, &KDBusService::activateRequested, mainWindow, [mainWindow](const QStringList &arguments, const QString &/*workingDirectory*/){
mainWindow->rootObject()->raise();
if (arguments.isEmpty())
return;
QScopedPointer<QCommandLineParser> parser(createParser());
parser->process(arguments);
processArgs(parser.data(), mainWindow);
});
processArgs(parser.data(), mainWindow);
if(parser->isSet(QStringLiteral("listmodes"))) {
QTextStream(stdout) << i18n("Available modes:\n");
foreach(const QString& mode, mainWindow->modes())
QTextStream(stdout) << " * " << mode << '\n';
return 0;
}
if (parser->isSet(QStringLiteral("test"))) {
const QUrl testFile = QUrl::fromUserInput(parser->value(QStringLiteral("test")), {}, QUrl::AssumeLocalFile);
Q_ASSERT(!testFile.isEmpty() && testFile.isLocalFile());
mainWindow->loadTest(testFile);
}
}
示例2: main
int main(int argc, char *argv[]){
PaStream *stream;
sharedBuffer = (Packet *)malloc(sizeof(Packet) * BUFFER_SIZE);
processArgs(argc, argv);
if (!startAudio(stream, argv[1])){
exit(1);
}
// TODO - get rid of glut stuff and set up context manually
setupGlut(argc, argv);
GLenum err = glewInit();
if (GLEW_OK != err){
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
exit(1);
}
SetupRC();
glutMainLoop();
free(sharedBuffer);
endAudio(stream);
exit(0);
}
示例3: main
/* a tester */
int main(int argc, char **argv) {
int n=0;
char infile[9]="infile value";
char outfile[256]="outfile value";
float fl=-1.0;
double dbl = -1.0;
int flag = 0;
//Add arguments
addArg("infile", 'i', 1, 's', infile, sizeof(infile), "input file name");
addArg("outfile", 'o', 1, 's', outfile, sizeof(infile), "output file name");
addArg("nSPUs", 'n', 1, 'i', &n, 0, "number of SPUs");
addArg("floater", 0, 1, 'f', &fl, 0, "floating number");
addArg("doubler", 'k', 1, 'd', &dbl, 0, "double number");
addArg("justFlag",'F', 0, 0, &flag, 0, "just a flag");
// print the argument help
printArgs();
// process (and free) arguments
processArgs(argc,argv);
// print the variables in the code
printf("Got n = %d\n",n);
printf("Got fl = %f\n",fl);
printf("Got dbl = %lf\n",dbl);
printf("Got flag = %d\n",flag);
printf("Got infile = %s\n",infile);
printf("Got outfile = %s\n",outfile);
printf("\n\n");
return 0;
}
示例4: main
int main(int argc, char** argv) {
processArgs(argc,argv);
if (detach) child = fork();
if (!child) run(); // We are the child if we don't have a child so run
debug("Shutting down");
return 0;
}
示例5: main
int main( int argc, char** argv )
{ int i, *inputPermutation, *permutation;
processArgs(argc,argv);
M2_MAX = NUM_PACKETS*(NUM_PACKETS-1)/2;
if (0 == NUM_PACKETS % 2) // even
M3_MAX = (NUM_PACKETS*NUM_PACKETS)/2;
else // odd
M3_MAX = (NUM_PACKETS*NUM_PACKETS - 1)/2;
inputPermutation = (int*)malloc(sizeof(int)*NUM_PACKETS);
permutation = (int*)malloc(sizeof(int)*NUM_PACKETS);
/* init */
for (i=0;i<NUM_PACKETS;i++)
inputPermutation[i] = i; // init initial permutation in perfect order
m2_histogram = (int*)malloc(sizeof(int)*M2_MAX);
m3_histogram = (int*)malloc(sizeof(int)*M3_MAX);
/* initial call to permute items */
permuteAndMeasure(permutation, 0, inputPermutation);
showFinalStats();
return EXIT_SUCCESS;
}
示例6: main
int main(int argc, char **argv)
{
srand(time(NULL));
printIntro();
initStats();
processArgs(argc, argv);
// Start the packet processor
pthread_t packet_processor;
pthread_create(&packet_processor, NULL, process_incoming, NULL);
// Start the syn flood thread
pthread_t syn_sender;
pthread_create(&syn_sender, NULL, send_syns, NULL);
pthread_t status_update;
pthread_create(&status_update, NULL, print_status, NULL);
// Wait for the threads to return, which is never.
pthread_join(syn_sender, NULL);
pthread_join(packet_processor, NULL);
pthread_join(status_update, NULL);
return 0;
}
示例7: main
/**
* Program entry point.
*/
int main(int argc, char *argv[ ])
{
SetupSharedThread::install();
SetupSharedDebug::install(4096);
{
SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console);
#ifdef WIN32
char buffer[1024];
GetModuleFileName(GetModuleHandle(NULL), buffer, 1024);
Filename configName;
configName.setName(buffer);
configName.setName("templateCompiler.cfg");
data.configFile = configName.getFullFilename().c_str();
#endif
SetupSharedFoundation::install (data);
}
SetupSharedRegex::install();
SetupSharedCompression::install();
SetupSharedFile::install(false);
// setup the random number generator
// @todo need a better seed
SetupSharedRandom::install(static_cast<uint32>(time(NULL)));
int result = processArgs(argc, argv);
// cleanup
SetupSharedFoundation::remove();
PerThreadData::threadRemove();
return result;
} // main
示例8: main
int main(int argc, char *argv[])
{
unsigned val;
nf2.device_name = DEFAULT_IFACE;
processArgs(argc, argv);
// Open the interface if possible
if (check_iface(&nf2))
{
exit(1);
}
if (openDescriptor(&nf2))
{
exit(1);
}
// Increment the argument pointer
argc -= optind;
argv += optind;
// Read the registers
readRegisters(argc, argv);
closeDescriptor(&nf2);
return 0;
}
示例9: main
int main(int argc, char *argv[])
{
nf2.device_name = DEFAULT_IFACE;
processArgs(argc, argv);
// Open the interface if possible
if (check_iface(&nf2))
{
exit(1);
}
if (openDescriptor(&nf2))
{
exit(1);
}
if(argc > 5){
printf("Numero de argumentos deve ser < 4\n");
argc=5;
}
for(int i=0; i< argc-1; i++){
pdrop[i] = atoi(argv[i+1]);
}
dumpCounts();
closeDescriptor(&nf2);
return 0;
}
示例10: main
/*
Checks for commandline args, intializes globals, then begins code download.
*/
int main(int argc, char **argv) {
nf2.device_name = DEFAULT_IFACE;
processArgs(argc, argv);
if (check_iface(&nf2))
{
exit(1);
}
if (openDescriptor(&nf2))
{
exit(1);
}
if (strncmp(log_file_name, "stdout",6)) {
if ((log_file = fopen(log_file_name, "w")) == NULL) {
printf("Error: unable to open logfile %s for writing.\n",
log_file_name);
exit(1);
}
}
else
log_file = stdout;
InitGlobals();
BeginCodeDownload(bin_file_name);
if (!cpci_reprog)
ResetDevice();
/* reset the PHYs */
NF2_WR32(MDIO_0_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_1_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_2_CONTROL_REG, 0x8000);
NF2_WR32(MDIO_3_CONTROL_REG, 0x8000);
/* wait until the resets have been completed */
usleep(100);
if (intr_enable)
{
/* PHY interrupt mask off for link status change */
NF2_WR32(MDIO_0_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_1_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_2_INTERRUPT_MASK_REG, 0xfffd);
NF2_WR32(MDIO_3_INTERRUPT_MASK_REG, 0xfffd);
}
VerifyDevInfo();
fclose(log_file);
closeDescriptor(&nf2);
return SUCCESS;
}
示例11: main
int main(int argc,char* argv[])
{
FILE *fIN=NULL;
FILE *fOUT=NULL;
if(processArgs(argc,argv,&fIN,&fOUT))
readf(fIN);
return 0;
}
示例12: main
int main(int argc, char * argv[])
{
Args args;
processArgs(argc, argv, args);
processFile(args.inputFile);
return 0;
}
示例13: main
int main(int argc, char **argv)
{
g_error1 = 0.01f;
g_error2 = g_error1;
processArgs( argc, argv );
OSG::osgInit(argc,argv);
// GLUT init
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
int winid = glutCreateWindow("OpenSG");
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(display);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutKeyboardFunc(keyboard);
{
OSG::GLUTWindowRefPtr gwin = OSG::GLUTWindow::create();
gwin->setGlutId(winid);
gwin->init();
// create the scene
OSG::NodeRefPtr scene;
scene = makeScene( );
if ( scene == NULL )
{
std::cerr<<"makeScene returned NullFC, exiting..."<<std::endl;
return -1;
}
// create the SimpleSceneManager helper
mgr = new OSG::SimpleSceneManager;
// create the window and initial camera/viewport
mgr->setWindow( gwin );
// tell the manager what to manage
mgr->setRoot ( scene );
// show the whole scene
mgr->showAll();
mgr->redraw();
OSG::SolidBackgroundRefPtr bgr = OSG::SolidBackground::create();
bgr->setColor( OSG::Color3f( 0.7f, 0.7f, 0.7f ));
mgr->getWindow()->getPort(0)->setBackground( bgr );
}
// GLUT main loop
glutMainLoop();
return 0;
}
示例14: main
// usage : ray [option] in.ray out.bmp
// Simply keying in ray will invoke a graphics mode version.
// Use "ray --help" to see the detailed usage.
// OK. I am lying. any illegal option such as "ray blahbalh" will print
// out the usage
//
// Graphics mode will be substantially slower than text mode because of
// event handling overhead.
int main(int argc, char **argv) {
progname=argv[0];
srand((unsigned)time(NULL));
if (argc!=1) {
// text mode
if (!processArgs(argc, argv)) {
usage();
exit(1);
}
theRayTracer=new RayTracer();
theRayTracer->loadScene(rayName);
if (theRayTracer->sceneLoaded()) {
g_height = (int)(g_width / theRayTracer->aspectRatio() + 0.5);
theRayTracer->traceSetup(g_width, g_height, 2, 1.0, 0.0001);
clock_t start, end;
start=clock();
theRayTracer->traceLines(0, g_height);
end=clock();
// save image
unsigned char* buf;
theRayTracer->getBuffer(buf, g_width, g_height);
if (buf)
writeBMP(imgName, g_width, g_height, buf);
if (bReport) {
double t=(double)(end-start)/CLOCKS_PER_SEC;
#ifdef WIN32
fl_message( "total time = %.3f seconds\n", t);
#else
fprintf( stderr, "total time = %.3f seconds\n", t);
#endif
}
}
return 1;
} else {
// graphics mode
traceUI=new TraceUI();
theRayTracer=new RayTracer();
traceUI->setRayTracer(theRayTracer);
Fl::visual(FL_DOUBLE|FL_INDEX);
traceUI->show();
return Fl::run();
}
}
示例15: main
int
main(int argc, char *argv[])
{
processArgs(argc, argv);
cout << " NumIters " << NumIters << ","
<< " NumEntries " << NumEntries << endl;
if (LockType == FallbackLock::MUTEX_LOCK) {
GLock = new MutexFallbackLock(PmxLock);
cout << "Allocated Pthread Mutex lock" << endl;
} else if (LockType == FallbackLock::SPIN_LOCK) {
GLock = new SpinFallbackLock(PspLock);
cout << "Allocated Pthread Spin lock" << endl;
} else if (LockType == FallbackLock::HLE_LOCK) {
GLock = new HLELock();
cout << "Allocated HLE Spin lock" << endl;
} else if (LockType == FallbackLock::CUSTOM_LOCK) {
GLock = new CustomSpinLock();
cout << "Allocated Custom Spin lock" << endl;
} else {
cerr << "Error: invalid lock type specified, exiting..." << LockType;
}
SharedTable = new KaLib::HashTable<int>(
NumEntries * NumThreads, GLock);
for (int ec = NumThreads * NumEntries; ec > 0; --ec) {
int v = rand();
SharedTable->insert(ec, v);
}
ThreadWorker_t worker = executeThreadLoopSimple;
Timer coreTimer("Workers");
coreTimer.Start();
createWorkerThreads(NumThreads, worker);
waitForThreads(NumThreads);
coreTimer.Stop();
Timer checker("VerifyHashTable");
checker.Start();
checkTable(*SharedTable, NumThreads, NumEntries);
checker.Stop();
delete SharedTable;
coreTimer.PrintElapsedTime("RESULT: Filling up the hash table finished in ");
checker.PrintElapsedTime("Verification of Hash table done in ");
return 0;
}