本文整理汇总了C++中parseArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ parseArgs函数的具体用法?C++ parseArgs怎么用?C++ parseArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseArgs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MAIN
MAIN(argc, argv) {
TIMER_T start;
TIMER_T stop;
GOTO_REAL();
parseArgs(argc, (char** const)argv);
long sz = (long)global_params[PARAM_SIZE];
global_array = (aligned_type_t*) malloc(sz * sizeof(aligned_type_t));
long k = 0;
for (; k < sz; k++) {
global_array[k].value = 0;
}
long numThread = global_params[PARAM_THREADS];
SIM_GET_NUM_CPU(numThread);
TM_STARTUP(numThread);
P_MEMORY_STARTUP(numThread);
thread_startup(numThread);
printf("Running clients... ");
fflush(stdout);
TIMER_READ(start);
GOTO_SIM();
thread_start(client_run, (void*)&numThread);
GOTO_REAL();
TIMER_READ(stop);
puts("done.");
printf("Time = %0.6lf\n", TIMER_DIFF_SECONDS(start, stop));
fflush(stdout);
long i = 0;
long sum = 0;
for (;i < sz; i++) {
sum += global_array[i].value;
// printf("%ld\n", global_array[i].value);
}
if (sum != 0) {
printf("Problem, sum was not zero!: %ld\n", sum);
}
TM_SHUTDOWN();
P_MEMORY_SHUTDOWN();
GOTO_SIM();
thread_shutdown();
MAIN_RETURN(0);
}
开发者ID:nmldiegues,项目名称:stamp-rtm,代码行数:50,代码来源:array-locks.c
示例2: PyErr_SetArgsError
static PyObject *t_regexmatcher_appendReplacement(t_regexmatcher *self,
PyObject *args)
{
UnicodeString *u0, _u0;
UnicodeString *u1, _u1;
if (!parseArgs(args, "SS", &u0, &_u0, &u1, &_u1))
{
STATUS_CALL(self->object->appendReplacement(*u0, *u1, status));
Py_RETURN_SELF();
}
return PyErr_SetArgsError((PyObject *) self, "appendReplacement", args);
}
开发者ID:fish2000,项目名称:pyicu-praxa,代码行数:14,代码来源:regex.cpp
示例3: main
int main(int argc, const char **argv) {
if (parseArgs(argc, argv) < 0) {
puts("ERROR: failure parsing args.");
return -1;
}
if (initController() < 0) {
puts("ERROR: failure in setup function.");
return -1;
}
enterLoop();
return 0;
}
开发者ID:Chryel,项目名称:PINT,代码行数:14,代码来源:filter.c
示例4: main
int main(int argc, char** argv)
{
if (init(argc, argv)) return -1;
if (parseArgs(argc, argv)) return -1;
if (checkSubstitutes()) return -1;
if (getRuntime()) return -1;
switch (runtime)
{
case JavaRuntime: return runJava();
case DotnetRuntime: return runDotnet();
default: return err("internal error in main");
}
return 0;
}
开发者ID:nomit007,项目名称:f4,代码行数:14,代码来源:launcher.cpp
示例5: PyErr_SetArgsError
static PyObject *t_searchiterator_setAttribute(t_searchiterator *self,
PyObject *args)
{
USearchAttribute attribute;
USearchAttributeValue value;
if (!parseArgs(args, "ii", &attribute, &value))
{
STATUS_CALL(self->object->setAttribute(attribute, value, status));
Py_RETURN_NONE;
}
return PyErr_SetArgsError((PyObject *) self, "setAttribute", args);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:14,代码来源:search.cpp
示例6: main
int main(int argc, char** argv)
{
//Determine which switches are activated early on
parseArgs(argc,argv);
//this int will be used to print lines held in char**
int i;
//arbitrary sizes that will be used to allocate memory for char* and char**
int size = 32;
int size2 = 32;
//arr_str will hold the strings of each line
char ** arr_str = malloc(size * sizeof(char*));
//will be used to read each character of line
char * str = malloc(size2 * sizeof(char));
//num_sentences is really number of lines
int num_sentences = 0;
/*
* This while loop places all of the characters of the stdin into the str array
* of characters and ensures the arr_str is large enough to hold all the
* character arrays
*/
while( (str = readline()) ){
if(num_sentences == size)
arr_str = realloc(arr_str, sizeof(char)*(size*=2));
/*
* To make life easier, swap the characters in a line before they're placed
* into the arr_str since they will always be switched (-c is assumed)
*/
if(c) swapline(str);
//Place character arrays into arr_str
arr_str[num_sentences++] = str;
}
/*
* Call the swaplineorder function that takes an array of "strings" and the number
* of lines to be switched
*/
if(l) swaplineorder(arr_str, num_sentences);
//Once the switches have been accounted for, print the desired product
for(i = 0; i < num_sentences; i++){
puts(arr_str[i]);
}
return 0;
}
开发者ID:VeraJulian,项目名称:verse,代码行数:49,代码来源:verse.c
示例7: main
int main(int argc, char *argv[])
{
serverInputs inputs;
struct sigaction sa;
int sd;
pid_t pid;
logger * logg;
/*Parse all Arguments*/
memset(&inputs, 0, sizeof(serverInputs));
parseArgs(&inputs, argc, argv);
printf("Log File Path: %s\n", inputs.logPath);
printf("Documents Path: %s\n", inputs.directory);
logg = init_logger(inputs.logPath);
sd = init_socket(&inputs);
sa.sa_handler = kidhandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) == -1)
err(1, "sigaction failed");
printf("Server up and listening on port: %d\n", inputs.port);
daemon(1,1);
for(;;) {
request req;
memset(&req, 0, sizeof(req));
req.l = logg;
int clientsd = accept_connection(sd, &req.client);
req.inputsDIR = inputs.directory;
req.requestSD = &clientsd;
pid = fork();
if (pid == -1)
err(1, "fork failed");
if(pid == 0) {
handle_request(&req);
exit(0);
}
close(clientsd);
}
}
开发者ID:ryant26,项目名称:379Assig2,代码行数:49,代码来源:server_f.c
示例8: main
int main(int argc, char** argv){
//define the files to be used
char *fileName, *inputFile, *outFile;
int port;
long fileLength=0;
int opt, err;
//add salt according to taste
char *password, *salt = "NaCl";
int keyLength = 32, macLength = 32, blockLength = 16;
int numberOfIterations = 4096;
char *initCounter;
char *key;
//parse the arguments and let the program decide the mode to be followed
opt = parseArgs(argc, argv, &fileName, NULL, &port);
checkErr(opt, USAGE_STR);
if(D_DAEMON == opt){
err = receiveFile(port, &inputFile, &fileLength);
checkErr(err, "File receive error");
} else if(L_LOCAL == opt){
err = readFile(fileName, &fileLength, &inputFile );
checkErr(err, "File read error");
}
password = getpass("Password:");
initializeGcryptRoutine();
err = keyDerivation(password, salt, numberOfIterations, keyLength, &key);
checkErr(err, "Key derivation error");
printKey(key, keyLength);
err = verifyMac(key, keyLength, inputFile, fileLength, macLength);
checkErr(err, "HMAC verification error");
initCounter = (char*)(malloc(blockLength * sizeof(char)));
memset((void *)initCounter, 0, (size_t)(blockLength * sizeof(char)));
err = aesCounter(key, keyLength, inputFile, fileLength - macLength, initCounter,
blockLength, &outFile);
checkErr(err, "Decryption error");
err = writeFile(fileName, outFile, fileLength - macLength, NULL, 1, opt);
checkErr(err, "Error in output file operation");
printf("%ld bytes written.\n", fileLength - macLength);
return 0;
}
开发者ID:kamleshkc2002,项目名称:Gatorcrypt,代码行数:49,代码来源:gatordec.c
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
int nLevel = 1;
if (a.arguments().contains("--verbose"))
{
nLevel = 0;
}
Logger::setInstance(new Logger(nLevel, QString("%1/.Hobbyist_Software/VLC_Streamer/").arg(QDir::homePath())));
LOG_IN("VLCStreamer Client Started");
a.setOrganizationName("Hobbyist_Software");
a.setOrganizationDomain("Hobbyist_Software.Com");
a.setApplicationName("VLC_Streamer");
a.setApplicationVersion(APP_VERSION);
LOG_IN(QString(" Version %1").arg(a.applicationVersion()));
LOG_IN(QString(" Beta"));
//LOG_IN(QString(" (c) J.Stockhausen"));
parseArgs(a.arguments());
if (!VLCEncoder::hasSystemValidVLC())
{
return 1;
}
VLCStreamer streamer;
MainDialog w(&streamer);
w.show();
streamer.slotStartService();
int ret = a.exec();
streamer.slotStopService();
Logger::setInstance(0);
return ret;
}
开发者ID:ConfusedVorlon,项目名称:VLC-Streamer-Linux,代码行数:49,代码来源:main.cpp
示例10: switch
static PyObject *t_resourcebundle_getStringEx(t_resourcebundle *self,
PyObject *args)
{
UnicodeString *u;
UnicodeString _u;
charsArg key;
int i;
switch (PyTuple_Size(args)) {
case 1:
if (!parseArgs(args, "i", &i))
{
STATUS_CALL(_u = self->object->getStringEx(i, status));
return PyUnicode_FromUnicodeString(&_u);
}
if (!parseArgs(args, "n", &key))
{
STATUS_CALL(_u = self->object->getStringEx(key, status));
return PyUnicode_FromUnicodeString(&_u);
}
case 2:
if (!parseArgs(args, "iU", &i, &u))
{
STATUS_CALL(u->setTo(self->object->getStringEx(i, status)));
Py_RETURN_ARG(args, 1);
}
if (!parseArgs(args, "nU", &key, &u))
{
STATUS_CALL(u->setTo(self->object->getStringEx(key, status)));
Py_RETURN_ARG(args, 1);
}
break;
}
return PyErr_SetArgsError((PyObject *) self, "getStringEx", args);
}
开发者ID:ezmiller,项目名称:pyicu,代码行数:36,代码来源:locale.cpp
示例11: parseArgs
MStatus skinClusterWeights::doIt( const MArgList& args )
//
// Description
//
{
MStatus status = parseArgs(args);
if (status != MS::kSuccess) return status;
if (editUsed) {
redoIt();
} else if (queryUsed) {
doItQuery();
}
return MS::kSuccess;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:15,代码来源:skinClusterWeights.cpp
示例12: main
int main(int argc, char const *argv[])
{
try
{
parseArgs(argc-1, argv+1);
}
catch (std::exception const &x)
{
error(std::string("Error during command option parsing: ") + x.what());
}
mainLoop();
return 0;
}
开发者ID:amaula,项目名称:ode-0.12,代码行数:15,代码来源:main.cpp
示例13: main
int main(int argc, char* argv[])
{
parseArgs(argc, argv);
sTitle = "eiskaltdcpp-daemon (EiskaltDC++ core 2.2)";
#ifdef _DEBUG
sTitle += " [debug]";
#endif
Util::PathsMap override;
if (config_dir[0] != 0) {
override[Util::PATH_USER_CONFIG] = config_dir;
override[Util::PATH_USER_LOCAL] = config_dir;
}
开发者ID:bhaavanmerchant,项目名称:eiskaltdcpp,代码行数:15,代码来源:nasdc.cpp
示例14: main
int main(int argc, char* argv[]){
int ret;
AppContext ctx;
ret = parseArgs(argc, argv, ctx);
CHECK_RETURN(ret);
ret = loadWords(ctx);
CHECK_RETURN(ret);
ret = process(ctx);
return ret;
}
开发者ID:fanyunfeng,项目名称:mtools,代码行数:15,代码来源:fword.cpp
示例15: main
// Function Definitions ******************************************************
int main (int argc, char* argv[]) {
#ifdef _DEBUG
std::cout << caesarCipherUnitTests () << std::endl;
#endif
if (!parseArgs (argc, argv)) {
return -1;
}
return 0;
}
开发者ID:CharlesETD,项目名称:CCUtil,代码行数:16,代码来源:CCUtil.cpp
示例16: main
int main(int argc, char** argv) {
std::string inputfile;
float radius;
float initx, inity, initTheta, goalx, goaly, goalr, goalTheta;
int depth;
bool heuristic;
float inflate;
goalTheta = 0;
parseArgs(argc, argv, inputfile, radius, initx, inity, initTheta, goalx, goaly, goalr, goalTheta, depth, heuristic, inflate);
// Load grid
OccupancyGrid grid;
grid.load(inputfile);
if (grid.empty()) {
std::cerr << "error loading grid!\n";
return 1;
}
// expand obstacles
if (radius > 0) {
OccupancyGrid tmp;
expandObstacles(grid, radius, tmp, false);
grid = tmp;
}
// Run search
DubinSearch helper;
GridChecker* checker = new GridChecker(&grid);
Dubin* goal = helper.search(initx, inity, initTheta, goalx, goaly, goalr, goalTheta, checker, depth, heuristic, inflate);
if (goal==NULL) {
cout<<"Search failed"<<endl;
std::string filename = "DebugImage.svg";
helper.makeSVG(NULL,filename,grid,goalx,goaly,goalr);
return -1;
}
else {
cout<<"Search successful after "<<helper.getCount()<<" expansions"<<endl;
std::string filename = "DebugImage.svg";
helper.makeSVG(goal,filename,grid,goalx,goaly,goalr);
}
return 0;
}
开发者ID:swatbotics,项目名称:e91-final,代码行数:48,代码来源:main.cpp
示例17: main
int main(int argc, char *argv[])
{
argmap_t argmap;
argmap["R"] = "1";
argmap["p"] = "2";
argmap["r"] = "1";
argmap["d"] = "1";
argmap["c"] = "2";
argmap["k"] = "80";
argmap["L"] = "0";
argmap["s"] = "0";
argmap["m"] = "0";
argmap["repeat"] = "1";
// get parameters from the command line
if (!parseArgs(argc, argv, argmap)) usage(argv[0]);
long R = atoi(argmap["R"]);
long p = atoi(argmap["p"]);
long r = atoi(argmap["r"]);
long d = atoi(argmap["d"]);
long c = atoi(argmap["c"]);
long k = atoi(argmap["k"]);
// long z = atoi(argmap["z"]);
long L = atoi(argmap["L"]);
if (L==0) { // determine L based on R,r
L = 3*R+3;
if (p>2 || r>1) { // add some more primes for each round
long addPerRound = 2*ceil(log((double)p)*r*3)/(log(2.0)*NTL_SP_NBITS) +1;
L += R * addPerRound;
}
}
long s = atoi(argmap["s"]);
long chosen_m = atoi(argmap["m"]);
long repeat = atoi(argmap["repeat"]);
long w = 64; // Hamming weight of secret key
// long L = z*R; // number of levels
long m = FindM(k, L, c, p, d, s, chosen_m, true);
setTimersOn();
for (long repeat_cnt = 0; repeat_cnt < repeat; repeat_cnt++) {
TestIt(R, p, r, d, c, k, w, L, m);
}
}
开发者ID:2080,项目名称:HElib,代码行数:48,代码来源:Test_LP.cpp
示例18: init
void init(int argc, char *argv[])
{
int usageExit = 1;
char *opthelp[512]; // more than enough
int i;
for (i = 0; flags[i].name != 0; i++) {
opthelp[i] = (char *) flags[i].flag;
flags[i].flag = NULL;
}
for (;;) {
int c;
c = getopt_long_only(argc, argv, "", flags, NULL);
if (c == -1)
break;
switch (c) {
case 'h': // -help
usageExit = 0;
goto usage;
case '?':
// getopt_long_only() should have printed something since we did not set opterr to 0
goto usage;
default:
fprintf(stderr, "internal error: getopt_long_only() returned %d\n", c);
exit(1);
}
}
if (parseArgs(argc, argv) != TRUE)
goto usage;
initwin();
return;
usage:
fprintf(stderr, "usage: %s [options]", argv[0]);
if (args != NULL && *args != '\0')
fprintf(stderr, " %s", args);
fprintf(stderr, "\n");
for (i = 0; flags[i].name != 0; i++)
fprintf(stderr, "\t-%s%s - %s\n",
flags[i].name,
(flags[i].has_arg == required_argument) ? " string" : "",
opthelp[i]);
exit(usageExit);
}
开发者ID:andlabs,项目名称:misctestprogs,代码行数:48,代码来源:winmsgboxhiddenwin.c
示例19: signalCallback
static void signalCallback (int sig)
{
switch (sig) {
case SIGHUP :
message (LOG_INFO, "got SIGHUP - reconfiguring\n");
parseArgs (args.argc, args.argv);
setupIdleTimer ();
break;
case SIGTERM :
case SIGINT :
message (LOG_INFO, "got %s - exiting\n", sig == SIGTERM ? "SIGTERM" : "SIGINT");
writePidFile (NULL);
exit (0);
break;
}
}
开发者ID:Gems,项目名称:majormaco,代码行数:16,代码来源:sleepwatcher.c
示例20: switch
static PyObject *t_breakiterator_nextBoundary(t_breakiterator *self,
PyObject *args)
{
int32_t n;
switch (PyTuple_Size(args)) {
case 0:
return PyInt_FromLong(self->object->next());
case 1:
if (!parseArgs(args, "i", &n))
return PyInt_FromLong(self->object->next(n));
break;
}
return PyErr_SetArgsError((PyObject *) self, "nextBoundary", args);
}
开发者ID:nikolamilosevic86,项目名称:SerbianComparisonExtractor,代码行数:16,代码来源:iterators.cpp
注:本文中的parseArgs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论