Exemplo n.º 1
0
int commandLine(int argc, char *argv[])
{
	int Result = OK;

	if (argc >= 3 && strcmp(argv[2], "-q") == 0)
		quietMode = 'y';

	if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "-help") == 0)
	{
		Result = helpMessage(argc >= 3 ? argv[2] : NULL);
	}

	else if (strcmp(argv[1], "-r") == 0)
		Result = callRandomGraphs(argc, argv);

	else if (strcmp(argv[1], "-s") == 0)
		Result = callSpecificGraph(argc, argv);

	else if (strcmp(argv[1], "-rm") == 0)
		Result = callRandomMaxPlanarGraph(argc, argv);

	else if (strcmp(argv[1], "-rn") == 0)
		Result = callRandomNonplanarGraph(argc, argv);

	else
	{
		ErrorMessage("Unsupported command line.  Here is the help for this program.\n");
		helpMessage(NULL);
		Result = NOTOK;
	}

	return Result == OK ? 0 : (Result == NONEMBEDDABLE ? 1 : -1);
}
Exemplo n.º 2
0
int
main(int argc, char **argv)
{
	static int      read, mask;
	int             pins;
	int             c;
	int             option_index = 0;
	char           *serial = NULL;
	static struct option long_options[] = {
		{"mask", required_argument, 0, 'm'},
		{"serial", required_argument, 0, 's'},
		{"read", no_argument, 0, 'r'},
		{"list", no_argument, 0, 'l'},
		{"help", no_argument, 0, 'h'},
		{0, 0, 0, 0}	/* This is a filler for -1 */
	};
	if (argc == 1) {
		helpMessage();
		return 1;
	}
	while ((c = getopt_long(argc, argv, "m:rhls:", long_options, &option_index)) != -1) {
		switch (c) {
		case 'l':
			listRelays();
			return 1;
			break;
		case 'r':
			read = 1;
			break;
		case 'm':
			mask = 1;
			pins = atoi(optarg);
			break;
		case 's':
			serial = optarg;
			break;
		case 'h':
			helpMessage();
			return 0;
			break;
		default:
			helpMessage();
			return 1;
			break;
		}
	}
	if (read || mask) {
		initBoard(serial);
	}
	if (mask) {
		setPins(pins);
	}
	if (read) {
		return readPins();
	}
	exit(0);
	return (0);
}
Exemplo n.º 3
0
int main(int argc,  char  *argv[]) {
FILE *f;
extern void initGlobalStructure(void);
extern void setMetaKeyOptions(int swap);
	parseArguments( argv, argc, args);

	if (versionMe) versionMessage(vmPath);
	if (helpMe) helpMessage(vmPath, "!Help");

	atexit(exit_function);   // setup a clean exit function

	InitRiscOS();
	initGlobalStructure();

	dummyWimpPoll();

	/* read the image file and allocate memory for Squeak heap
	    - the image name has been set to the path parsed by c.sqArgument
	    - if no filename was passed in, the default is to expect an image
	      file (Squeak/image) inside the application directory */
	f = fopen(imageName, "rb");
	PRINTF(("\\t Starting Squeak with image file: %s\n", imageName));
	if (f == NULL) {
		/* give a RPC error message if image file is not found */
		extern char VMVersion[];
		privateErr.errnum = (bits)0;
		sprintf(privateErr.errmess, "Could not open the Squeak image file '%s' (Squeak version: %s)", imageName, VMVersion);
		printf("Squeak version: %s was unable to find and open the image file supposedly at %s\n", VMVersion, imageName);
		printf("If you simply tried to run the !Squeak application, it will have attempted to run a default image within the application directory which is not usually present\n");
		platReportError((os_error *)&privateErr);
		helpMessage(vmPath, "!ImName");
		ioExit();
	}

	setMetaKeyOptions(swapMeta);

	readImageFromFileHeapSize(f, objectHeadroom);
	fclose(f);

	/* run Squeak */
	PRINTF(("\\t start running image\n"));

	interpret();
}
Exemplo n.º 4
0
int main(int argc,  char  *argv[]) {
FILE *f;
extern void initGlobalStructure(void);
extern void setMetaKeyOptions(int swap);
	parseArguments( argv, argc, args);

	if (versionMe) versionMessage(vmPath);
	if (helpMe) helpMessage(vmPath, "!Help");

	atexit(exit_function);   // setup a clean exit function

	InitRiscOS();
	initGlobalStructure();

	dummyWimpPoll();

	/* read the image file and allocate memory for Squeak heap */
	f = fopen(imageName, "rb");
	PRINTF(("\\t Starting Squeak with image file: %s\n", imageName));
	if (f == NULL) {
		/* give a RPC error message if image file is not found */
		extern char VMVersion[];
		privateErr.errnum = (bits)0;
		sprintf(privateErr.errmess, "Could not open the Squeak image file '%s' (Squeak version: %s)", imageName, VMVersion);
		printf("%s\n", privateErr.errmess);
		platReportError((os_error *)&privateErr);
		helpMessage(vmPath, "!ImName");
		ioExit();
	}

	setMetaKeyOptions(swapMeta);

	readImageFromFileHeapSize(f, objectHeadroom);
	fclose(f);

	/* run Squeak */
	PRINTF(("\\t start running image\n"));

	interpret();
}
int saisieAppuisInitQT_main(QApplication &app, int argc, char *argv[])
{
    app.setApplicationName("SaisieAppuisInitQT");
    app.setOrganizationName("Culture3D");

    QStringList cmdline_args = QCoreApplication::arguments();

    if (cmdline_args.back().contains("help"))
    {
        QString help = "Mandatory unnamed args :\n"
                 "* string :: {Full name (Dir+Pattern)}\n"
                 "* string :: {Orientation ; NONE if not used}\n"
                 "* string :: {Point name, or point file name}\n"
                 "* string :: {Output}\n\n"
                "Named args :\n"
                "* [Name=SzW] Pt2di :: {Sz of window}\n"
                "* [Name=NbF] Pt2di :: {Nb of sub window}\n"
                "* [Name=NameAuto] string :: {Prefix for automatic point creation}\n"
                //"* [Name=Pref2Add] string :: {Prefix to add during import (for bug correction ?)}\n"
                "* [Name=ForceGray] bool :: {Force gray image, def=false}\n"
                "* [Name=OriMode] string :: {Orientation type (GRID) (Def=Std)}\n"
                "* [Name=ZMoy] REAL :: {Average Z, Mandatory in PB}\n"
                "* [Name=ZInc] REAL :: {Incertitude on Z, Mandatory in PB}\n\n"

                "Example:\nmm3d " + app.applicationName() + " IMG_558{0-9}[1].tif RadialBasic 100 measures.xml\n\n"
                "NB: visual interface for argument edition available with command:\n\n mm3d v" + app.applicationName() + "\n\n";

        return helpMessage(app, help);
    }

    loadTranslation(app);

    QSettings settings(QApplication::organizationName(), QApplication::applicationName());

    if ((argc>0)&&(string(argv[0]).find("SaisieQT")!= string::npos))
    {
        argv++;
        argc--;
    }

    Pt2di aSzWin(800,800);
    Pt2di aNbFen(-1,-1);

    string aFullName, aDir, aName, aNamePt, aNameOut;   //mandatory arguments
    string aNameOri, aModeOri, aNameAuto, aPrefix2Add;  //named args
    aPrefix2Add = "";
    bool aForceGray = false;

    settings.beginGroup("Misc");
    aNameAuto = settings.value("defPtName", QString("100")).toString().toStdString();
    settings.endGroup();

    settings.beginGroup("Drawing settings");
    aForceGray = settings.value("forceGray", false       ).toBool();
    settings.endGroup();

    double aZInc, aZMoy;

    if (argv[0][0] == 'v')
    {
        MMVisualMode = true;
        argv[0] = (char*) "SaisieAppuisInitQT";
    }
    
    std::string aInputSec;

    SaisieAppuisInit(argc, argv, aSzWin, aNbFen, aFullName, aDir, aName, aNamePt, aNameOri, aModeOri, aNameOut, aNameAuto, aPrefix2Add, aForceGray, aZMoy, aZInc,aInputSec);

    if (!MMVisualMode)
    {
        if (!checkNamePt( QString (aNamePt.c_str()))) return -1;

        QStringList filenames = getFilenames(aDir, aName);

        int aNbW = aNbFen.x * aNbFen.y;
        if (filenames.size() < aNbW)
        {
             aNbW = filenames.size();

             cVirtualInterface::ComputeNbFen(aNbFen, aNbW);
        }

        updateSettings(settings, aSzWin,aNbFen, aForceGray);

        settings.beginGroup("Misc");
        settings.setValue("defPtName", QString(aNameAuto.c_str()));
        settings.endGroup();

        QStringList input;
        input   << QString(MMDir().c_str()) + QString("bin/SaisiePts")
                << QString(MMDir().c_str()) + QString("include/XML_MicMac/SaisieInitiale.xml")
                << QString("DirectoryChantier=") + QString(aDir.c_str())
                << QString("+Image=") +  QString(aName.c_str())
                << QString("+Ori=") + QString(aNameOri.c_str())
                << QString("+NamePt=") + QString(aNamePt.c_str())
                << QString("+NameAuto=") + QString(aNameAuto.c_str())
                << QString("+Sauv=") + QString(aNameOut.c_str())
                << QString("+SzWx=") + QString::number(aSzWin.x)
                << QString("+SzWy=") + QString::number(aSzWin.y)
                << QString("+NbFx=") + QString::number(aNbFen.x)
                << QString("+NbFy=") + QString::number(aNbFen.y);

        if (aModeOri == "GRID")
        {
            input << QString("+ModeOriIm=eGeomImageGrille")
                  << QString("+Conik=false")
                  << QString("+ZIncIsProp=false")
                    //<< QString(+PostFixOri=GRIBin")
                  << QString("+Px1Inc=") + QString::number(aZInc)
                  << QString("+Px1Moy=") + QString::number(aZMoy);

            //<< QString("+Geom=eGeomMNTFaisceauIm1ZTerrain_Px1D");
        }

        if (EAMIsInit(&aForceGray))
           input << QString("+ForceGray=") + QString(((string)(ToString(aForceGray))).c_str());

        if (EAMIsInit(&aPrefix2Add))
           input << QString("+Pref2Add=") + QString(aPrefix2Add.c_str());


        char **output;

        // Copy input to output
        output = new char*[input.size() + 1];
        for (int i = 0; i < input.size(); i++) {
            output[i] = new char[strlen(input.at(i).toStdString().c_str())+1];
            memcpy(output[i], input.at(i).toStdString().c_str(), strlen(input.at(i).toStdString().c_str())+1);
        }
        output[input.size()] = ((char*)NULL);


        cResultSubstAndStdGetFile<cParamSaisiePts> aP2(
                input.size()-2,output+2,
                output[1],
                StdGetFileXMLSpec("ParamSaisiePts.xml"),
                "ParamSaisiePts",
                "ParamSaisiePts",
                "DirectoryChantier",
                "FileChantierNameDescripteur" );

        cAppli_SaisiePts   anAppli (aP2,false);

        SaisieQtWindow w(POINT2D_INIT);

        new cQT_Interface(anAppli,&w);

        w.show();

        w.addFiles(filenames, false);

        return app.exec();
    }
    else
        return EXIT_SUCCESS;
}
Exemplo n.º 6
0
int menu(void)
{
char Choice;

     do {
    	ProjectTitle();

        Message("\n"
                "P. Planar embedding and Kuratowski subgraph isolation\n"
                "D. Planar graph drawing\n"
                "O. Outerplanar embedding and obstruction isolation\n"
                "2. Search for subgraph homeomorphic to K_{2,3}\n"
                "3. Search for subgraph homeomorphic to K_{3,3}\n"
                "4. Search for subgraph homeomorphic to K_4\n"
        		"C. Color the vertices of the graph\n"
        		"H. Help message for command line version\n"
                "R. Reconfigure options\n"
                "X. Exit\n"
        		"\n"
        );

        Prompt("Enter Choice: ");
        fflush(stdin);
        scanf(" %c", &Choice);
        Choice = tolower(Choice);

        if (Choice == 'h')
        	helpMessage(NULL);

        else if (Choice == 'r')
        	Reconfigure();

        else if (Choice != 'x')
        {
        	char *secondOutfile = NULL;
        	if (Choice == 'p'  || Choice == 'o' || Choice == 'd')
        		secondOutfile ="";

            switch (tolower(Mode))
            {
                case 's' : SpecificGraph(Choice, NULL, NULL, secondOutfile); break;
                case 'r' : RandomGraphs(Choice, 0, 0); break;
                case 'm' : RandomGraph(Choice, 0, 0, NULL, NULL); break;
                case 'n' : RandomGraph(Choice, 1, 0, NULL, NULL); break;
            }
        }

        if (Choice != 'r' && Choice != 'x')
        {
            Prompt("\nPress a key then hit ENTER to continue...");
            fflush(stdin);
            scanf(" %*c");
            fflush(stdin);
            Message("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
            FlushConsole(stdout);
        }

     }  while (Choice != 'x');

     // Certain debuggers don't terminate correctly with pending output content
     FlushConsole(stdout);
     FlushConsole(stderr);

     return 0;
}
Exemplo n.º 7
0
/*!
 * \brief Executes a command from telnet interface
 */
void TelnetSocket::execute(const QString &command)
{
	QString arguments;
	Console::Command cmd = parseCommand(command, arguments);

	switch (cmd)
	{
	case Console::Empty:
		show(QString());
		break;
	case Console::Help:
		show(helpMessage(arguments == QLatin1String("0")));
		break;
	case Console::Quit:
		show(quitMessage(), false);
		disconnectFromHost();
		break;
	case Console::Kill:
		show(quitMessage(), false);
		disconnectFromHost();
		Console::execute(Console::Kill);
		break;
	case Console::Download:
	{
		QVariantList arg;

		arg.append(QVariant::fromValue(arguments));
		arg.append(QVariant::fromValue(true));

		if (Console::execute(Console::Download, arg))
			show(color(tr("Link '%1' added").arg(arguments), Cyan));
		else
			show(color(tr("Failed to add link '%1'").arg(arguments), Red));
	}
		break;
	case Console::StartTask:
	case Console::PauseTask:
	case Console::StopTask:
	case Console::DeleteTask:
	{
		QVariantList arg;
		arg.append(QVariant::fromValue(arguments.toInt()));

		if (Console::execute(cmd, arg))
			show(color(tr("Done"), Cyan));
		else
			show(color(tr("Invalid task ID : '%1'").arg(arguments.toInt()), Red));
	}
		break;
	case Console::GetProperty:
	{
		QVariantList arg;
		QVariant result;

		arg.append(QVariant::fromValue(arguments));

		if (Console::execute(cmd, arg, &result))
			show(color(tr("%1 : %2").arg(arguments).arg(result.toString()), Cyan));
		else
			show(color(tr("Invalid property : '%1'").arg(arguments), Red));
	}
		break;
	case Console::SetProperty:
	{
		QVariantList arg;

		arg.append(QVariant::fromValue(arguments.section(QLatin1Char(' '), 0, 0)));
		arg.append(QVariant::fromValue(arguments.section(QLatin1Char(' '), 1, 1).toInt()));

		if (Console::execute(cmd, arg))
			show(color(tr("Done"), Cyan));
		else
			show(color(tr("Invalid property : '%1'").arg(arguments), Red));
	}
		break;
	case Console::Status:
	{
		/// \todo ugly here

		QStringList title;
		QList<QStringList> list;

		title.append(tr("ID"));
		title.append(tr("State"));
		title.append(tr("File"));
		title.append(tr("%"));
		title.append(tr("Size"));
		title.append(tr("DownloadTime"));

		const TaskManager::Tasks &tasks = TaskManager::getInstance()->getTasks();
		for (auto iter = tasks.constBegin(); iter != tasks.constEnd(); ++iter)
		{
			QStringList item;
			item.append(QString::number(iter.key()));
			item.append(iter.value()->getStateString());
			item.append(iter.value()->getName());
			item.append(Utility::HumanReadable::formatPercent(iter.value()->getProgress()));
			item.append(Utility::HumanReadable::formatByte(iter.value()->getSize()));
			item.append(QString::number(iter.value()->getTransferTime()));

			list.append(item);
		}


		// get the max width for each column
		QList<int> width;
		foreach (const QString &columnName, title)
			width.append(columnName.size());

		foreach (const QStringList &item, list)
			for (int i = 0; i < item.size(); ++i)
				width[i] = qMax(width[i], item[i].size());

		// padding
		for (int i = 0; i < width.size(); ++i)	width[i] += 3;


		QString result;

		// title
		for (int i = 0; i < title.size(); ++i)
			result.append(title[i].rightJustified(width[i]));
		result = color(result, Cyan);
		result.append(QLatin1Char('\n'));

		// items
		foreach (const QStringList &item, list)
		{
			for (int i = 0; i < item.size(); ++i)
				result.append(item[i].rightJustified(width[i]));
			result.append(QLatin1Char('\n'));
		}

		// global statistics
		result.append(tr("Download Rate : %1/s Upload Rate : %2/s")
				.arg(Utility::HumanReadable::formatByte(Network::TrafficManager::getInstance()->getDownloadRate()))
				.arg(Utility::HumanReadable::formatByte(Network::TrafficManager::getInstance()->getUploadRate())));

		show(result);
	}
		break;
	default:
		show(color(tr("Invalid command '%1'\n\n").arg(command), Red) + helpMessage(true));
		break;
	}
}
Exemplo n.º 8
0
void interpretCommandLineParameters(int argc, const char* argv[],
                                    int* stateCount,
                                    int* ntaxa,
                                    int* nsites,
                                    bool* manualScaling,
                                    bool* autoScaling,
                                    bool* dynamicScaling,
                                    int* rateCategoryCount,
                                    int* rsrc,
                                    int* nreps,
                                    bool* fullTiming,
                                    bool* requireDoublePrecision,
                                    bool* requireSSE,
                                    int* compactTipCount,
                                    int* randomSeed,
                                    int* rescaleFrequency,
                                    bool* unrooted,
                                    bool* calcderivs,
                                    bool* logscalers,
                                    int* eigenCount,
                                    bool* eigencomplex,
                                    bool* ievectrans,
                                    bool* setmatrix)	{
    bool expecting_stateCount = false;
	bool expecting_ntaxa = false;
	bool expecting_nsites = false;
	bool expecting_rateCategoryCount = false;
	bool expecting_nreps = false;
	bool expecting_rsrc = false;
	bool expecting_compactTipCount = false;
	bool expecting_seed = false;
    bool expecting_rescaleFrequency = false;
    bool expecting_eigenCount = false;
	
    for (unsigned i = 1; i < argc; ++i) {
		std::string option = argv[i];
        
        if (expecting_stateCount) {
            *stateCount = (unsigned)atoi(option.c_str());
            expecting_stateCount = false;
        } else if (expecting_ntaxa) {
            *ntaxa = (unsigned)atoi(option.c_str());
            expecting_ntaxa = false;
        } else if (expecting_nsites) {
            *nsites = (unsigned)atoi(option.c_str());
            expecting_nsites = false;
        } else if (expecting_rateCategoryCount) {
            *rateCategoryCount = (unsigned)atoi(option.c_str());
            expecting_rateCategoryCount = false;
        } else if (expecting_rsrc) {
            *rsrc = (unsigned)atoi(option.c_str());
            expecting_rsrc = false;            
        } else if (expecting_nreps) {
            *nreps = (unsigned)atoi(option.c_str());
            expecting_nreps = false;
        } else if (expecting_compactTipCount) {
            *compactTipCount = (unsigned)atoi(option.c_str());
            expecting_compactTipCount = false;
        } else if (expecting_seed) {
            *randomSeed = (unsigned)atoi(option.c_str());
            expecting_seed = false;
        } else if (expecting_rescaleFrequency) {
            *rescaleFrequency = (unsigned)atoi(option.c_str());
            expecting_rescaleFrequency = false;
        } else if (expecting_eigenCount) {
            *eigenCount = (unsigned)atoi(option.c_str());
            expecting_eigenCount = false;
        } else if (option == "--help") {
			helpMessage();
        } else if (option == "--manualscale") {
            *manualScaling = true;
        } else if (option == "--autoscale") {
        	*autoScaling = true;
        } else if (option == "--dynamicscale") {
        	*dynamicScaling = true;
        } else if (option == "--doubleprecision") {
        	*requireDoublePrecision = true;
        } else if (option == "--states") {
            expecting_stateCount = true;
        } else if (option == "--taxa") {
            expecting_ntaxa = true;
        } else if (option == "--sites") {
            expecting_nsites = true;
        } else if (option == "--rates") {
            expecting_rateCategoryCount = true;
        } else if (option == "--rsrc") {
            expecting_rsrc = true;
        } else if (option == "--reps") {
            expecting_nreps = true;
        } else if (option == "--compact-tips") {
            expecting_compactTipCount = true;
        } else if (option == "--rescale-frequency") {
            expecting_rescaleFrequency = true;
        } else if (option == "--seed") {
            expecting_seed = true;
        } else if (option == "--full-timing") {
            *fullTiming = true;
        } else if (option == "--SSE") {
        	*requireSSE = true;
        } else if (option == "--unrooted") {
        	*unrooted = true;
        } else if (option == "--calcderivs") {
        	*calcderivs = true;
        } else if (option == "--logscalers") {
        	*logscalers = true;
        } else if (option == "--eigencount") {
        	expecting_eigenCount = true;
        } else if (option == "--eigencomplex") {
        	*eigencomplex = true;
        } else if (option == "--ievectrans") {
        	*ievectrans = true;
        } else if (option == "--setmatrix") {
        	*setmatrix = true;
        } else {
			std::string msg("Unknown command line parameter \"");
			msg.append(option);			
			abort(msg.c_str());
        }
    }
    
	if (expecting_stateCount)
		abort("read last command line option without finding value associated with --states");
    
	if (expecting_ntaxa)
		abort("read last command line option without finding value associated with --taxa");
    
	if (expecting_nsites)
		abort("read last command line option without finding value associated with --sites");
	
	if (expecting_rateCategoryCount)
		abort("read last command line option without finding value associated with --rates");

	if (expecting_rsrc)
		abort("read last command line option without finding value associated with --rsrc");
    
	if (expecting_nreps)
		abort("read last command line option without finding value associated with --reps");
    
	if (expecting_seed)
		abort("read last command line option without finding value associated with --seed");
    
	if (expecting_rescaleFrequency)
		abort("read last command line option without finding value associated with --rescale-frequency");

	if (expecting_compactTipCount)
		abort("read last command line option without finding value associated with --compact-tips");

    if (expecting_eigenCount)
		abort("read last command line option without finding value associated with --eigencount");
    
	if (*stateCount < 2)
		abort("invalid number of states supplied on the command line");
        
	if (*ntaxa < 2)
		abort("invalid number of taxa supplied on the command line");
      
	if (*nsites < 1)
		abort("invalid number of sites supplied on the command line");
    
    if (*rateCategoryCount < 1)
        abort("invalid number of rates supplied on the command line");
        
    if (*nreps < 1)
        abort("invalid number of reps supplied on the command line");

    if (*randomSeed < 1)
        abort("invalid number for seed supplied on the command line");   
        
    if (*manualScaling && *rescaleFrequency < 1)
        abort("invalid number for rescale-frequency supplied on the command line");   
    
    if (*compactTipCount < 0 || *compactTipCount > *ntaxa)
        abort("invalid number for compact-tips supplied on the command line");
    
    if (*calcderivs && !(*unrooted))
        abort("calcderivs option requires unrooted tree option");
    
    if (*eigenCount < 1)
        abort("invalid number for eigencount supplied on the command line");
    
    if (*eigencomplex && (*stateCount != 4 || *eigenCount != 1))
        abort("eigencomplex option only works with stateCount=4 and eigenCount=1");
}
Exemplo n.º 9
0
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
	Win32CommandLineConverter cmd_line;
	int argc = cmd_line.argc();
	char **argv = cmd_line.argv();
#else
int main(int argc, char *argv[])
{
#endif

	MMD_InitArgcArgv( argc, argv );
	initQtLibraryPath();

	QApplication app(argc, argv);

	//app.setStyle("fusion");

	// QT Modifie le comportement de sscanf !!!!! problematique quand on parse les fichiers XML
	setlocale(LC_NUMERIC,"C");

	app.setOrganizationName("Culture3D");
	app.setApplicationName("QT graphical tools");

	setStyleSheet(app);

	QString cmds = QObject::tr("Allowed commands:") + "\n\n" +
		QString("SaisieMasqQT\n") +
		QString("SaisieAppuisInitQT\n") +
		QString("SaisieAppuisPredicQT\n")+
		QString("SaisieBascQT\n")+
		QString("SaisieBoxQT\n\n");

	if (argc > 1)
	{
		for (int i=0; i < argc; ++i)
		{
			QString str(argv[i]);

#ifdef _DEBUG
			cout << "\ncommand: " << str.toStdString().c_str()<<endl;
#endif

			if (!str.contains("SaisieQT"))
			{
				if (str.contains("SaisieMasqQT"))
					saisieMasqQT_main(app, argc, argv);
				else if (str.contains("SaisieAppuisInitQT"))
					saisieAppuisInitQT_main(app, argc, argv);
				else if (str.contains("SaisieAppuisPredicQT"))
					saisieAppuisPredicQT_main(app, argc, argv);
				else if (str.contains("SaisieBoxQT"))
					saisieBoxQT_main(app, argc, argv);
				else if (str.contains("SaisieBascQT"))
					saisieBascQT_main(app, argc, argv);
				else
				{
					QString text = str + QObject::tr(" is not a valid command!!!") + "\n\n" + cmds;
					helpMessage(app, text);

					return EXIT_FAILURE;
				}

				return EXIT_SUCCESS;
			}
		}
	}
	else
		helpMessage(app, cmds);

	return EXIT_SUCCESS;
}
Exemplo n.º 10
0
void interpretCommandLineParameters(int argc, const char* argv[],
                                    int* stateCount,
                                    int* ntaxa,
                                    int* nsites,
                                    bool* manualScaling,
                                    bool* autoScaling,
                                    bool* dynamicScaling,
                                    int* rateCategoryCount,
                                    std::vector<int>* rsrc,
                                    int* nreps,
                                    bool* fullTiming,
                                    bool* requireDoublePrecision,
                                    bool* requireSSE,
                                    bool* requireAVX,
                                    int* compactTipCount,
                                    int* randomSeed,
                                    int* rescaleFrequency,
                                    bool* unrooted,
                                    bool* calcderivs,
                                    bool* logscalers,
                                    int* eigenCount,
                                    bool* eigencomplex,
                                    bool* ievectrans,
                                    bool* setmatrix,
                                    bool* opencl)	{
    bool expecting_stateCount = false;
	bool expecting_ntaxa = false;
	bool expecting_nsites = false;
	bool expecting_rateCategoryCount = false;
	bool expecting_nreps = false;
	bool expecting_rsrc = false;
	bool expecting_compactTipCount = false;
	bool expecting_seed = false;
    bool expecting_rescaleFrequency = false;
    bool expecting_eigenCount = false;
	
    for (unsigned i = 1; i < argc; ++i) {
		std::string option = argv[i];
        
        if (expecting_stateCount) {
            *stateCount = (unsigned)atoi(option.c_str());
            expecting_stateCount = false;
        } else if (expecting_ntaxa) {
            *ntaxa = (unsigned)atoi(option.c_str());
            expecting_ntaxa = false;
        } else if (expecting_nsites) {
            *nsites = (unsigned)atoi(option.c_str());
            expecting_nsites = false;
        } else if (expecting_rateCategoryCount) {
            *rateCategoryCount = (unsigned)atoi(option.c_str());
            expecting_rateCategoryCount = false;
        } else if (expecting_rsrc) {
            std::stringstream ss(option);
            int j;
            while (ss >> j) {
                rsrc->push_back(j);
                if (ss.peek() == ',')
                    ss.ignore();
            }
            expecting_rsrc = false;            
        } else if (expecting_nreps) {
            *nreps = (unsigned)atoi(option.c_str());
            expecting_nreps = false;
        } else if (expecting_compactTipCount) {
            *compactTipCount = (unsigned)atoi(option.c_str());
            expecting_compactTipCount = false;
        } else if (expecting_seed) {
            *randomSeed = (unsigned)atoi(option.c_str());
            expecting_seed = false;
        } else if (expecting_rescaleFrequency) {
            *rescaleFrequency = (unsigned)atoi(option.c_str());
            expecting_rescaleFrequency = false;
        } else if (expecting_eigenCount) {
            *eigenCount = (unsigned)atoi(option.c_str());
            expecting_eigenCount = false;
        } else if (option == "--help") {
			helpMessage();
        } else if (option == "--resourcelist") {
            printResourceList();
        } else if (option == "--manualscale") {
            *manualScaling = true;
        } else if (option == "--autoscale") {
        	*autoScaling = true;
        } else if (option == "--dynamicscale") {
        	*dynamicScaling = true;
        } else if (option == "--doubleprecision") {
        	*requireDoublePrecision = true;
        } else if (option == "--states") {
            expecting_stateCount = true;
        } else if (option == "--taxa") {
            expecting_ntaxa = true;
        } else if (option == "--sites") {
            expecting_nsites = true;
        } else if (option == "--rates") {
            expecting_rateCategoryCount = true;
        } else if (option == "--rsrc") {
            expecting_rsrc = true;
        } else if (option == "--reps") {
            expecting_nreps = true;
        } else if (option == "--compact-tips") {
            expecting_compactTipCount = true;
        } else if (option == "--rescale-frequency") {
            expecting_rescaleFrequency = true;
        } else if (option == "--seed") {
            expecting_seed = true;
        } else if (option == "--full-timing") {
            *fullTiming = true;
        } else if (option == "--SSE") {
        	*requireSSE = true;
        } else if (option == "--AVX") {
        	*requireAVX = true;
        } else if (option == "--unrooted") {
        	*unrooted = true;
        } else if (option == "--calcderivs") {
        	*calcderivs = true;
        } else if (option == "--logscalers") {
        	*logscalers = true;
        } else if (option == "--eigencount") {
        	expecting_eigenCount = true;
        } else if (option == "--eigencomplex") {
        	*eigencomplex = true;
        } else if (option == "--ievectrans") {
        	*ievectrans = true;
        } else if (option == "--setmatrix") {
        	*setmatrix = true;
        } else if (option == "--opencl") {
        	*opencl = true;
        } else {
			std::string msg("Unknown command line parameter \"");
			msg.append(option);			
			abort(msg.c_str());
        }
    }