예제 #1
0
//**********************************************************************************************************************
vector<string> GetSAbundCommand::setParameters(){	
	try {
		CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none","sabund",false,false, true); parameters.push_back(plist);
        CommandParameter pcount("count", "InputTypes", "", "", "none", "none", "none","",false,false, false); parameters.push_back(pcount);
		CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none","sabund",false,false, true); parameters.push_back(prabund);		
		CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "GetSAbundCommand", "setParameters");
		exit(1);
	}
}
예제 #2
0
//**********************************************************************************************************************
vector<string> RenameFileCommand::setParameters(){
    try {
        CommandParameter pflow("flow", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pflow);
        CommandParameter pfile("file", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pfile);
        CommandParameter pbiom("biom", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pbiom);
        CommandParameter pphylip("phylip", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pphylip);
        CommandParameter pcolumn("column", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pcolumn);
        CommandParameter psummary("summary", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(psummary);
        CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pfasta);
        CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pname);
        CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pgroup);
        CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(plist);
        CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(ptaxonomy);
        CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pqfile);
        CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(paccnos);
        CommandParameter prabund("rabund", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(prabund);
        CommandParameter psabund("sabund", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(psabund);
        CommandParameter pdesign("design", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pdesign);
        CommandParameter porder("order", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(porder);
        CommandParameter ptree("tree", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(ptree);
        CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pshared);
        CommandParameter pcount("count", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pcount);
        CommandParameter poutputname("new", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(poutputname);
        CommandParameter pinputname("input", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(pinputname);
        CommandParameter prelabund("relabund", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(prelabund);
        CommandParameter psff("sff", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(psff);
        CommandParameter pconstaxonomy("constaxonomy", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(pconstaxonomy);
        CommandParameter poligos("oligos", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(poligos);
        CommandParameter pmothurgenerated("shorten", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pmothurgenerated);
        CommandParameter pdeleteold("deleteold", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pdeleteold);
        CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
        CommandParameter pprefix("prefix", "String", "", "", "", "", "","",false,false); parameters.push_back(pprefix);
        CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
        
        vector<string> myArray;
        for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
        return myArray;
    }
    catch(exception& e) {
        m->errorOut(e, "RenameFileCommand", "setParameters");
        exit(1);
    }
}
예제 #3
0
//**********************************************************************************************************************
vector<string> SharedCommand::setParameters(){	
	try {
		CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(plist);
		CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pgroup);
		//CommandParameter pordergroup("ordergroup", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pordergroup);
		CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
		CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "SharedCommand", "setParameters");
		exit(1);
	}
}
예제 #4
0
파일: encap.cpp 프로젝트: Paciik/inspircd
/** ENCAP */
void TreeSocket::Encap(User* who, parameterlist &params)
{
	if (params.size() > 1)
	{
		if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0]))
		{
			parameterlist plist(params.begin() + 2, params.end());
			ServerInstance->Parser->CallHandler(params[1], plist, who);
			// discard return value, ENCAP shall succeed even if the command does not exist
		}

		params[params.size() - 1] = ":" + params[params.size() - 1];

		if (params[0].find_first_of("*?") != std::string::npos)
		{
			Utils->DoOneToAllButSender(who->uuid, "ENCAP", params, who->server);
		}
		else
			Utils->DoOneToOne(who->uuid, "ENCAP", params, params[0]);
	}
}
예제 #5
0
//**********************************************************************************************************************
vector<string> SharedCommand::setParameters(){
	try {
        CommandParameter pbiom("biom", "InputTypes", "", "", "BiomListGroup", "BiomListGroup", "none","shared",false,false); parameters.push_back(pbiom);
		CommandParameter plist("list", "InputTypes", "", "", "BiomListGroup", "BiomListGroup", "ListGroup","shared",false,false,true); parameters.push_back(plist);
        CommandParameter pcount("count", "InputTypes", "", "", "none", "GroupCount", "none","",false,false); parameters.push_back(pcount);
		CommandParameter pgroup("group", "InputTypes", "", "", "none", "GroupCount", "ListGroup","",false,false,true); parameters.push_back(pgroup);
		CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
		CommandParameter pgroups("groups", "String", "", "", "", "", "","group",false,false); parameters.push_back(pgroups);
		CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);

		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "SharedCommand", "setParameters");
		exit(1);
	}
}
예제 #6
0
//**********************************************************************************************************************
vector<string> SensSpecCommand::setParameters(){	
	try {
		CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none","sensspec",false,true,true); parameters.push_back(plist);
		CommandParameter pphylip("phylip", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none","",false,false); parameters.push_back(pphylip);
		CommandParameter pcolumn("column", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none","",false,false); parameters.push_back(pcolumn);
		CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
		CommandParameter pcutoff("cutoff", "Number", "", "-1.00", "", "", "","",false,false); parameters.push_back(pcutoff);
		CommandParameter pprecision("precision", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pprecision);
		CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "SensSpecCommand", "setParameters");
		exit(1);
	}
}
예제 #7
0
//**********************************************************************************************************************
vector<string> SummaryCommand::setParameters() {
    try {
        CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none","summary",false,false,true);
        parameters.push_back(plist);
        CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none","summary",false,false);
        parameters.push_back(prabund);
        CommandParameter psabund("sabund", "InputTypes", "", "", "LRSS", "LRSS", "none","summary",false,false);
        parameters.push_back(psabund);
        CommandParameter pshared("shared", "InputTypes", "", "", "LRSS", "LRSS", "none","summary",false,false,true);
        parameters.push_back(pshared);
        CommandParameter psubsample("subsample", "String", "", "", "", "", "","",false,false);
        parameters.push_back(psubsample);
        CommandParameter piters("iters", "Number", "", "1000", "", "", "","",false,false);
        parameters.push_back(piters);
        CommandParameter plabel("label", "String", "", "", "", "", "","",false,false);
        parameters.push_back(plabel);
        CommandParameter pcalc("calc", "Multiple", "sobs-chao-nseqs-coverage-ace-jack-shannon-shannoneven-npshannon-heip-smithwilson-simpson-simpsoneven-invsimpson-bootstrap-geometric-qstat-logseries-bergerparker-bstick-goodscoverage-efron-boneh-solow-shen", "sobs-chao-ace-jack-shannon-npshannon-simpson", "", "", "","",true,false,true);
        parameters.push_back(pcalc);
        CommandParameter pabund("abund", "Number", "", "10", "", "", "","",false,false);
        parameters.push_back(pabund);
        CommandParameter psize("size", "Number", "", "0", "", "", "","",false,false);
        parameters.push_back(psize);
        CommandParameter pgroupmode("groupmode", "Boolean", "", "T", "", "", "","",false,false);
        parameters.push_back(pgroupmode);
        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false);
        parameters.push_back(pinputdir);
        CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false);
        parameters.push_back(poutputdir);

        vector<string> myArray;
        for (int i = 0; i < parameters.size(); i++) {
            myArray.push_back(parameters[i].name);
        }
        return myArray;
    }
    catch(exception& e) {
        m->errorOut(e, "SummaryCommand", "setParameters");
        exit(1);
    }
}
예제 #8
0
static RetainPtr<CFPropertyListRef> readFontPlist()
{
    CString plistPath = fontsPlistPath().utf8();

    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFileSystemRepresentation(0, reinterpret_cast<const UInt8*>(plistPath.data()), plistPath.length(), false));
    if (!url)
        return 0;

    RetainPtr<CFReadStreamRef> stream(AdoptCF, CFReadStreamCreateWithFile(0, url.get()));
    if (!stream)
        return 0;

    if (!CFReadStreamOpen(stream.get()))
        return 0;

    CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0 | kCFPropertyListXMLFormat_v1_0;
    RetainPtr<CFPropertyListRef> plist(AdoptCF, CFPropertyListCreateFromStream(0, stream.get(), 0, kCFPropertyListMutableContainersAndLeaves, &format, 0));

    CFReadStreamClose(stream.get());

    return plist;
}
예제 #9
0
//**********************************************************************************************************************
vector<string> GetSharedOTUCommand::setParameters(){	
	try {
		CommandParameter pfasta("fasta", "InputTypes", "", "", "sharedFasta", "none", "none","fasta",false,false); parameters.push_back(pfasta);
		CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "groupList","",false,false,true); parameters.push_back(pgroup);
		CommandParameter plist("list", "InputTypes", "", "", "sharedList", "sharedList", "groupList","sharedseq",false,false,true); parameters.push_back(plist);
        CommandParameter pshared("shared", "InputTypes", "", "", "sharedList-sharedFasta", "sharedList", "none","sharedseq",false,false,true); parameters.push_back(pshared);
		CommandParameter poutput("output", "Multiple", "accnos-default", "default", "", "", "","",false,false); parameters.push_back(poutput);
		CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
		CommandParameter puniquegroups("uniquegroups", "String", "", "", "", "", "","",false,false,true); parameters.push_back(puniquegroups);
		CommandParameter psharedgroups("sharedgroups", "String", "", "", "", "", "","",false,false,true); parameters.push_back(psharedgroups);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);

		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "GetSharedOTUCommand", "setParameters");
		exit(1);
	}
}
예제 #10
0
//**********************************************************************************************************************
vector<string> ListSeqsCommand::setParameters(){	
	try {
        CommandParameter pfastq("fastq", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(pfastq);
		CommandParameter pfasta("fasta", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(pfasta);
		CommandParameter pname("name", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(pname);
        CommandParameter pcount("count", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(pcount);
		CommandParameter pgroup("group", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(pgroup);
		CommandParameter plist("list", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(plist);
		CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false,true); parameters.push_back(ptaxonomy);
		CommandParameter palignreport("alignreport", "InputTypes", "", "", "FNGLT", "FNGLT", "none","accnos",false,false); parameters.push_back(palignreport);
		CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "ListSeqsCommand", "setParameters");
		exit(1);
	}
}
예제 #11
0
//**********************************************************************************************************************
vector<string> RemoveRareCommand::setParameters(){	
	try {
		CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(plist);
		CommandParameter prabund("rabund", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(prabund);
		CommandParameter psabund("sabund", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(psabund);
		CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pshared);
		CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pgroup);
		CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
		CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
		CommandParameter pnseqs("nseqs", "Number", "", "0", "", "", "",false,true); parameters.push_back(pnseqs);
		CommandParameter pbygroup("bygroup", "Boolean", "", "f", "", "", "",false,true); parameters.push_back(pbygroup);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "RemoveRareCommand", "setParameters");
		exit(1);
	}
}
PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(SharedBuffer* data)
{
    LOG(Archives, "LegacyWebArchive - Creating from raw data");
    
    RefPtr<LegacyWebArchive> archive = create();
        
    ASSERT(data);
    if (!data)
        return 0;
        
    RetainPtr<CFDataRef> cfData(AdoptCF, data->createCFData());
    if (!cfData)
        return 0;
        
    CFStringRef errorString = 0;
    
    RetainPtr<CFDictionaryRef> plist(AdoptCF, static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));
    if (!plist) {
#ifndef NDEBUG
        const char* cError = errorString ? CFStringGetCStringPtr(errorString, kCFStringEncodingUTF8) : "unknown error";
        LOG(Archives, "LegacyWebArchive - Error parsing PropertyList from archive data - %s", cError);
#endif
        if (errorString)
            CFRelease(errorString);
        return 0;
    }
    
    if (CFGetTypeID(plist.get()) != CFDictionaryGetTypeID()) {
        LOG(Archives, "LegacyWebArchive - Archive property list is not the expected CFDictionary, aborting invalid WebArchive");
        return 0;
    }
    
    if (!archive->extract(plist.get()))
        return 0;

    return archive.release();
}
예제 #13
0
//**********************************************************************************************************************
vector<string> RemoveGroupsCommand::setParameters(){	
	try {
		CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "FNGLT","fasta",false,false,true); parameters.push_back(pfasta);
		CommandParameter pshared("shared", "InputTypes", "", "", "none", "sharedGroup", "none","shared",false,false,true); parameters.push_back(pshared);
        CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname);
        CommandParameter pcount("count", "InputTypes", "", "", "NameCount-CountGroup", "none", "none","count",false,false,true); parameters.push_back(pcount);
		CommandParameter pgroup("group", "InputTypes", "", "", "CountGroup", "sharedGroup", "FNGLT","group",false,false,true); parameters.push_back(pgroup);	        
        CommandParameter pdesign("design", "InputTypes", "", "", "none", "sharedGroup", "FNGLT","design",false,false); parameters.push_back(pdesign);
		CommandParameter plist("list", "InputTypes", "", "", "none", "none", "FNGLT","list",false,false,true); parameters.push_back(plist);
		CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "FNGLT","taxonomy",false,false,true); parameters.push_back(ptaxonomy);
		CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(paccnos);
		CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
		
		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "RemoveGroupsCommand", "setParameters");
		exit(1);
	}
}
예제 #14
0
//**********************************************************************************************************************
vector<string> GetSeqsCommand::setParameters(){	
	try {
		CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pfasta);
		CommandParameter pname("name", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pname);
		CommandParameter pgroup("group", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pgroup);
		CommandParameter plist("list", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(plist);
		CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(ptaxonomy);
		CommandParameter palignreport("alignreport", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(palignreport);
		CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pqfile);
		CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(paccnos);
		CommandParameter pdups("dups", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pdups);
		CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
		CommandParameter paccnos2("accnos2", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(paccnos2);

		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "GetSeqsCommand", "setParameters");
		exit(1);
	}
}
예제 #15
0
 // This will be wrapped as a Python constructor; it accepts an arbitrary Python iterable.
 static SBConvolve * construct(bp::object const & iterable, bool real_space) {
     bp::stl_input_iterator<SBProfile> begin(iterable), end;
     std::list<SBProfile> plist(begin, end);
     return new SBConvolve(plist, real_space);
 }
예제 #16
0
파일: ndp.c 프로젝트: huihong/freebsd
int
main(int argc, char **argv)
{
	int ch, mode = 0;
	char *arg = NULL;

	pid = getpid();
	thiszone = gmt2local(0);
	while ((ch = getopt(argc, argv, "acd:f:Ii:nprstA:HPR")) != -1)
		switch (ch) {
		case 'a':
		case 'c':
		case 'p':
		case 'r':
		case 'H':
		case 'P':
		case 'R':
		case 's':
		case 'I':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = ch;
			arg = NULL;
			break;
		case 'f':
			exit(file(optarg) ? 1 : 0);
		case 'd':
		case 'i':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = ch;
			arg = optarg;
			break;
		case 'n':
			nflag = 1;
			break;
		case 't':
			tflag = 1;
			break;
		case 'A':
			if (mode) {
				usage();
				/*NOTREACHED*/
			}
			mode = 'a';
			repeat = atoi(optarg);
			if (repeat < 0) {
				usage();
				/*NOTREACHED*/
			}
			break;
		default:
			usage();
		}

	argc -= optind;
	argv += optind;

	switch (mode) {
	case 'a':
	case 'c':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		dump(0, mode == 'c');
		break;
	case 'd':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		delete(arg);
		break;
	case 'I':
#ifdef SIOCSDEFIFACE_IN6	/* XXX: check SIOCGDEFIFACE_IN6 as well? */
		if (argc > 1) {
			usage();
			/*NOTREACHED*/
		} else if (argc == 1) {
			if (strcmp(*argv, "delete") == 0 ||
			    if_nametoindex(*argv))
				setdefif(*argv);
			else
				errx(1, "invalid interface %s", *argv);
		}
		getdefif(); /* always call it to print the result */
		break;
#else
		errx(1, "not supported yet");
		/*NOTREACHED*/
#endif
	case 'p':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		plist();
		break;
	case 'i':
		ifinfo(arg, argc, argv);
		break;
	case 'r':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		rtrlist();
		break;
	case 's':
		if (argc < 2 || argc > 4)
			usage();
		exit(set(argc, argv) ? 1 : 0);
	case 'H':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		harmonize_rtr();
		break;
	case 'P':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		pfx_flush();
		break;
	case 'R':
		if (argc != 0) {
			usage();
			/*NOTREACHED*/
		}
		rtr_flush();
		break;
	case 0:
		if (argc != 1) {
			usage();
			/*NOTREACHED*/
		}
		get(argv[0]);
		break;
	}
	exit(0);
}
예제 #17
0
int
main(int argc, char **argv)
{
	int ch;
	int aflag = 0, dflag = 0, sflag = 0, Hflag = 0,
		pflag = 0, rflag = 0, Pflag = 0, Rflag = 0;

	pid = getpid();
	thiszone = gmt2local(0);
	while ((ch = getopt(argc, argv, "acndfIilprstA:HPR")) != -1)
		switch ((char)ch) {
		case 'a':
			aflag = 1;
			break;
		case 'c':
			cflag = 1;
			break;
		case 'd':
			dflag = 1;
			break;
		case 'I':
#ifdef SIOCSDEFIFACE_IN6	/* XXX: check SIOCGDEFIFACE_IN6 as well? */
			if (argc > 2)
				setdefif(argv[2]);
			getdefif(); /* always call it to print the result */
			exit(0);
#else
			errx(1, "not supported yet");
			/*NOTREACHED*/
#endif
		case 'i' :
			argc -= optind;
			argv += optind;
			if (argc < 1)
				usage();
			ifinfo(argc, argv);
			exit(0);
		case 'n':
			nflag = 1;
			continue;
		case 'p':
			pflag = 1;
			break;
		case 'f' :
			if (argc != 3)
				usage();
			file(argv[2]);
			exit(0);
		case 'l' :
			/* obsolete, ignored */
			break;
		case 'r' :
			rflag = 1;
			break;
		case 's':
			sflag = 1;
			break;
		case 't':
			tflag = 1;
			break;
		case 'A':
			aflag = 1;
			repeat = atoi(optarg);
			if (repeat < 0)
				usage();
			break;
		case 'H' :
			Hflag = 1;
			break;
		case 'P':
			Pflag = 1;
			break;
		case 'R':
			Rflag = 1;
			break;
		default:
			usage();
		}

	argc -= optind;
	argv += optind;

	if (aflag || cflag) {
		dump(0);
		exit(0);
	}
	if (dflag) {
		if (argc != 1)
			usage();
		delete(argv[0]);
		exit(0);
	}
	if (pflag) {
		plist();
		exit(0);
	}
	if (rflag) {
		rtrlist();
		exit(0);
	}
	if (sflag) {
		if (argc < 2 || argc > 4)
			usage();
		exit(set(argc, argv) ? 1 : 0);
	}
	if (Hflag) {
		harmonize_rtr();
		exit(0);
	}
	if (Pflag) {
		pfx_flush();
		exit(0);
	}
	if (Rflag) {
		rtr_flush();
		exit(0);
	}

	if (argc != 1)
		usage();
	get(argv[0]);
	exit(0);
}
예제 #18
0
int
main(int argc, char **argv)
{
	int ch;
	int aflag = 0, dflag = 0, sflag = 0, Hflag = 0, pflag = 0, rflag = 0,
	    Pflag = 0, Rflag = 0, lflag = 0, xflag = 0, wflag = 0;

	pid = getpid();
	while ((ch = getopt(argc, argv, "acndfIilprstA:HPRxwW")) != -1)
		switch ((char) ch) {
		case 'a':
			aflag = 1;
			break;
		case 'c':
			cflag = 1;
			break;
		case 'd':
			dflag = 1;
			break;
		case 'I':
			if (argc > 2)
				setdefif(argv[2]);
			getdefif(); /* always call it to print the result */
			exit(0);
		case 'i' :
			argc -= optind;
			argv += optind;
			if (argc < 1)
				usage();
			ifinfo(argc, argv);
			exit(0);
		case 'n':
			nflag = 1;
			continue;
		case 'p':
			pflag = 1;
			break;
		case 'f' :
			if (argc != 3)
				usage();
			file(argv[2]);
			exit(0);
		case 'l' :
			lflag = 1;
			break;
		case 'r' :
			rflag = 1;
			break;
		case 's':
			sflag = 1;
			break;
		case 't':
			tflag = 1;
			break;
		case 'A':
			aflag = 1;
			repeat = atoi(optarg);
			if (repeat < 0)
				usage();
			break;
		case 'H' :
			Hflag = 1;
			break;
		case 'P':
			Pflag = 1;
			break;
		case 'R':
			Rflag = 1;
			break;
		case 'x':
			xflag = 1;
			lflag = 1;
			break;
		case 'w':
			wflag = 1;
			break;
		case 'W':
			if (argc != 3)
				usage();
			write_cga_parameters(argv[2]);
			exit(0);
		default:
			usage();
		}

	argc -= optind;
	argv += optind;

	if (aflag || cflag) {
		if (lflag)
			dump_ext(0, xflag);
		else
			dump(0);
		exit(0);
	}
	if (dflag) {
		if (argc != 1)
			usage();
		delete(argv[0]);
		exit(0);
	}
	if (pflag) {
		plist();
		exit(0);
	}
	if (rflag) {
		rtrlist();
		exit(0);
	}
	if (sflag) {
		if (argc < 2 || argc > 4)
			usage();
		exit(set(argc, argv) ? 1 : 0);
	}
	if (Hflag) {
		harmonize_rtr();
		exit(0);
	}
	if (Pflag) {
		pfx_flush();
		exit(0);
	}
	if (Rflag) {
		rtr_flush();
		exit(0);
	}
	if (wflag) {
		read_cga_parameters();
		exit(0);
	}

	if (argc != 1)
		usage();
	get(argv[0]);
	exit(0);
}
예제 #19
0
void		plist(t_list *list)
{
  printf("Philo number %d\n", list->id);
  if (list->next->id > list->id)
    plist(list->next);
}
예제 #20
0
  bool CSmartPlaylistDirectory::GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const std::string &strBaseDir /* = "" */, bool filter /* = false */)
  {
    bool success = false, success2 = false;
    std::vector<std::string> virtualFolders;

    SortDescription sorting;
    sorting.limitEnd = playlist.GetLimit();
    sorting.sortBy = playlist.GetOrder();
    sorting.sortOrder = playlist.GetOrderAscending() ? SortOrderAscending : SortOrderDescending;
    sorting.sortAttributes = playlist.GetOrderAttributes();
    if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
      sorting.sortAttributes = (SortAttribute)(sorting.sortAttributes | SortAttributeIgnoreArticle);
    items.SetSortIgnoreFolders((sorting.sortAttributes & SortAttributeIgnoreFolders) == SortAttributeIgnoreFolders);

    std::string option = !filter ? "xsp" : "filter";
    const std::string& group = playlist.GetGroup();
    bool isGrouped = !group.empty() && !StringUtils::EqualsNoCase(group, "none") && !playlist.IsGroupMixed();

    // get all virtual folders and add them to the item list
    playlist.GetVirtualFolders(virtualFolders);
    for (std::vector<std::string>::const_iterator virtualFolder = virtualFolders.begin(); virtualFolder != virtualFolders.end(); virtualFolder++)
    {
      CFileItemPtr pItem = CFileItemPtr(new CFileItem(*virtualFolder, true));
      IFileDirectory *dir = CFileDirectoryFactory::Create(pItem->GetURL(), pItem.get());

      if (dir != NULL)
      {
        pItem->SetSpecialSort(SortSpecialOnTop);
        items.Add(pItem);
        delete dir;
      }
    }

    if (playlist.GetType() == "movies" ||
        playlist.GetType() == "tvshows" ||
        playlist.GetType() == "episodes")
    {
      CVideoDatabase db;
      if (db.Open())
      {
        MediaType mediaType = MediaTypes::FromString(playlist.GetType());

        std::string baseDir = strBaseDir;
        if (strBaseDir.empty())
        {
          if (mediaType == MediaTypeTvShow || mediaType == MediaTypeEpisode)
            baseDir = "videodb://tvshows/";
          else if (mediaType == MediaTypeMovie)
            baseDir = "videodb://movies/";
          else
            return false;

          if (!isGrouped)
            baseDir += "titles";
          else
            baseDir += group;
          URIUtils::AddSlashAtEnd(baseDir);

          if (mediaType == MediaTypeEpisode)
            baseDir += "-1/-1/";
        }

        CVideoDbUrl videoUrl;
        if (!videoUrl.FromString(baseDir))
          return false;

        // store the smartplaylist as JSON in the URL as well
        std::string xsp;
        if (!playlist.IsEmpty(filter))
        {
          if (!playlist.SaveAsJson(xsp, !filter))
            return false;
        }

        if (!xsp.empty())
          videoUrl.AddOption(option, xsp);
        else
          videoUrl.RemoveOption(option);
        
        CDatabase::Filter dbfilter;
        success = db.GetItems(videoUrl.ToString(), items, dbfilter, sorting);
        db.Close();

        // if we retrieve a list of episodes and we didn't receive
        // a pre-defined base path, we need to fix it
        if (strBaseDir.empty() && mediaType == MediaTypeEpisode && !isGrouped)
          videoUrl.AppendPath("-1/-1/");
        items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
      }
    }
    else if (playlist.IsMusicType() || playlist.GetType().empty())
    {
      CMusicDatabase db;
      if (db.Open())
      {
        CSmartPlaylist plist(playlist);
        if (playlist.GetType() == "mixed" || playlist.GetType().empty())
          plist.SetType("songs");

        MediaType mediaType = MediaTypes::FromString(plist.GetType());

        std::string baseDir = strBaseDir;
        if (strBaseDir.empty())
        {
          baseDir = "musicdb://";
          if (!isGrouped)
          {
            if (mediaType == MediaTypeArtist)
              baseDir += "artists";
            else if (mediaType == MediaTypeAlbum)
              baseDir += "albums";
            else if (mediaType == MediaTypeSong)
              baseDir += "songs";
            else
              return false;
          }
          else
            baseDir += group;

          URIUtils::AddSlashAtEnd(baseDir);
        }

        CMusicDbUrl musicUrl;
        if (!musicUrl.FromString(baseDir))
          return false;

        // store the smartplaylist as JSON in the URL as well
        std::string xsp;
        if (!plist.IsEmpty(filter))
        {
          if (!plist.SaveAsJson(xsp, !filter))
            return false;
        }

        if (!xsp.empty())
          musicUrl.AddOption(option, xsp);
        else
          musicUrl.RemoveOption(option);

        CDatabase::Filter dbfilter;
        success = db.GetItems(musicUrl.ToString(), items, dbfilter, sorting);
        db.Close();

        items.SetProperty(PROPERTY_PATH_DB, musicUrl.ToString());
      }
    }

    if (playlist.GetType() == "musicvideos" || playlist.GetType() == "mixed")
    {
      CVideoDatabase db;
      if (db.Open())
      {
        CSmartPlaylist mvidPlaylist(playlist);
        if (playlist.GetType() == "mixed")
          mvidPlaylist.SetType("musicvideos");

        std::string baseDir = strBaseDir;
        if (baseDir.empty())
        {
          baseDir = "videodb://musicvideos/";

          if (!isGrouped)
            baseDir += "titles";
          else
            baseDir += group;
          URIUtils::AddSlashAtEnd(baseDir);
        }

        CVideoDbUrl videoUrl;
        if (!videoUrl.FromString(baseDir))
          return false;

        // store the smartplaylist as JSON in the URL as well
        std::string xsp;
        if (!mvidPlaylist.IsEmpty(filter))
        {
          if (!mvidPlaylist.SaveAsJson(xsp, !filter))
            return false;
        }

        if (!xsp.empty())
          videoUrl.AddOption(option, xsp);
        else
          videoUrl.RemoveOption(option);
        
        CFileItemList items2;
        CDatabase::Filter dbfilter;
        success2 = db.GetItems(videoUrl.ToString(), items2, dbfilter, sorting);

        db.Close();
        if (items.Size() <= 0)
          items.SetPath(videoUrl.ToString());

        items.Append(items2);
        if (items2.Size())
        {
          if (items.Size() > items2.Size())
            items.SetContent("mixed");
          else
            items.SetContent("musicvideos");
        }
        items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
      }
    }

    items.SetLabel(playlist.GetName());
    if (isGrouped)
      items.SetContent(group);
    else
      items.SetContent(playlist.GetType());

    items.SetProperty(PROPERTY_SORT_ORDER, (int)playlist.GetOrder());
    items.SetProperty(PROPERTY_SORT_ASCENDING, playlist.GetOrderDirection() == SortOrderAscending);
    if (!group.empty())
    {
      items.SetProperty(PROPERTY_GROUP_BY, group);
      items.SetProperty(PROPERTY_GROUP_MIXED, playlist.IsGroupMixed());
    }

    // sort grouped list by label
    if (items.Size() > 1 && !group.empty())
      items.Sort(SortByLabel, SortOrderAscending, SortAttributeIgnoreArticle);

    // go through and set the playlist order
    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr item = items[i];
      item->m_iprogramCount = i;  // hack for playlist order
    }

    if (playlist.GetType() == "mixed")
      return success || success2;
    else if (playlist.GetType() == "musicvideos")
      return success2;
    else
      return success;
  }
예제 #21
0
void DocSets::initialize()
{
  // -- get config options
  QCString projectName = Config_getString("PROJECT_NAME");
  if (projectName.isEmpty()) projectName="root";
  QCString bundleId = Config_getString("DOCSET_BUNDLE_ID");
  if (bundleId.isEmpty()) bundleId="org.doxygen.Project";
  QCString feedName = Config_getString("DOCSET_FEEDNAME");
  if (feedName.isEmpty()) feedName="FeedName";
  QCString publisherId = Config_getString("DOCSET_PUBLISHER_ID");
  if (publisherId.isEmpty()) publisherId="PublisherId";
  QCString publisherName = Config_getString("DOCSET_PUBLISHER_NAME");
  if (publisherName.isEmpty()) publisherName="PublisherName";
  QCString projectNumber = Config_getString("PROJECT_NUMBER");
  if (projectNumber.isEmpty()) projectNumber="ProjectNumber";

  // -- write Makefile
  {
  QCString mfName = Config_getString("HTML_OUTPUT") + "/Makefile";
  QFile makefile(mfName);
  if (!makefile.open(IO_WriteOnly))
  {
    err("Could not open file %s for writing\n",mfName.data());
    exit(1);
  }
  FTextStream ts(&makefile);

  ts << "DOCSET_NAME=" << bundleId << ".docset\n" 
        "DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n"
        "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n"
        "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n"
        "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n"
        "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n"
        "\n"
        "all: docset\n"
        "\n"
        "docset:\n"
        "\tmkdir -p $(DOCSET_DOCUMENTS)\n"
        "\tcp Nodes.xml $(DOCSET_RESOURCES)\n"
        "\tcp Tokens.xml $(DOCSET_RESOURCES)\n"
        "\tcp Info.plist $(DOCSET_CONTENTS)\n"
        "\ttar --exclude $(DOCSET_NAME) \\\n"
        "\t    --exclude Nodes.xml \\\n"
        "\t    --exclude Tokens.xml \\\n"
        "\t    --exclude Info.plist \\\n"
        "\t    --exclude Makefile -c -f - . \\\n"
        "\t    | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n"
        "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n"
        "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n"
        "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n"
        "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n"
        "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n"
        "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n"
        "\n"
        "clean:\n"
        "\trm -rf $(DOCSET_NAME)\n"
        "\n"
        "install: docset\n"
        "\tmkdir -p $(DESTDIR)\n"
        "\tcp -R $(DOCSET_NAME) $(DESTDIR)\n"
        "\n"
        "uninstall:\n"
        "\trm -rf $(DESTDIR)/$(DOCSET_NAME)\n"
        "\n"
        "always:\n";
  }

  // -- write Info.plist
  {
  QCString plName = Config_getString("HTML_OUTPUT") + "/Info.plist";
  QFile plist(plName);
  if (!plist.open(IO_WriteOnly))
  {
    err("Could not open file %s for writing\n",plName.data());
    exit(1);
  }
  FTextStream ts(&plist);

  ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 
        "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" 
        "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" 
        "<plist version=\"1.0\">\n" 
        "<dict>\n" 
        "     <key>CFBundleName</key>\n" 
        "     <string>" << projectName << "</string>\n" 
        "     <key>CFBundleIdentifier</key>\n"
        "     <string>" << bundleId << "</string>\n" 
        "     <key>CFBundleVersion</key>\n"
        "     <string>" << projectNumber << "</string>\n"
        "     <key>DocSetFeedName</key>\n" 
        "     <string>" << feedName << "</string>\n"
        "     <key>DocSetPublisherIdentifier</key>\n"
        "     <string>" << publisherId << "</string>\n"
        "     <key>DocSetPublisherName</key>\n"
        "     <string>" << publisherName << "</string>\n"
        // markers for Dash
        "     <key>DashDocSetFamily</key>\n" 
        "     <string>doxy</string>\n"
        "     <key>DocSetPlatformFamily</key>\n"
        "     <string>doxygen</string>\n"
        "</dict>\n"
        "</plist>\n";
  }

  // -- start Nodes.xml
  QCString notes = Config_getString("HTML_OUTPUT") + "/Nodes.xml";
  m_nf = new QFile(notes);
  if (!m_nf->open(IO_WriteOnly))
  {
    err("Could not open file %s for writing\n",notes.data());
    exit(1);
  }
  //QCString indexName=Config_getBool("GENERATE_TREEVIEW")?"main":"index";
  QCString indexName="index";
  m_nts.setDevice(m_nf);
  m_nts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
  m_nts << "<DocSetNodes version=\"1.0\">" << endl;
  m_nts << "  <TOC>" << endl;
  m_nts << "    <Node>" << endl;
  m_nts << "      <Name>Root</Name>" << endl;
  m_nts << "      <Path>" << indexName << Doxygen::htmlFileExtension << "</Path>" << endl;
  m_nts << "      <Subnodes>" << endl;
  m_dc = 1;
  m_firstNode.resize(m_dc);
  m_firstNode.at(0)=TRUE;

  QCString tokens = Config_getString("HTML_OUTPUT") + "/Tokens.xml";
  m_tf = new QFile(tokens);
  if (!m_tf->open(IO_WriteOnly))
  {
    err("Could not open file %s for writing\n",tokens.data());
    exit(1);
  }
  m_tts.setDevice(m_tf);
  m_tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
  m_tts << "<Tokens version=\"1.0\">" << endl;
}
예제 #22
0
int main(int argc, char* argv[])
{
  char cmd[BUF_SIZE];
  unsigned j = 0;
  unsigned simul = 0;
  unsigned repeat = 0;

  if (argc != 3)
  {
    printf("Usage: %s simultaneous repeat\n"
           "Where 'simultaneous' is the number of simultaneous processes to \n"
           "start before busywaiting a short while, and 'repeat' how many \n"
           "times this should be repeated.\n", argv[0]
      );
    return -1;
  }

  simul = atoi(argv[1]);
  repeat = atoi(argv[2]);

  if (simul > MAX_SIMULTANEOUS)
  {
    printf("This test program is compiled with a limitation to max %d \n"
           "simultaneos processes.\n", MAX_SIMULTANEOUS);
    return -1;
  }
  
  if (repeat > MAX_REPEAT)
  {
    printf("This test program is compiled with a limitation to max %d \n"
           "repetitions.\n", MAX_REPEAT);
    return -1;
  }
  
  printf("Will try to start a total of %d processes in groups of %d\n",
         simul * repeat, simul);
  
  for (j = 0; j < repeat; ++j)
  {
    /* you may have to increase the multiple to more than 5 */
    int ticks = 10 * 1000 * 1000 * j / repeat;
    
    snprintf(cmd, BUF_SIZE, "generic_parent %s %i %i", "dummy", j*simul, simul);
    
    exec(cmd);
    
    // plist();
    /* since we do not have the wait systemcall yet */
    //printf("Now entering busy-loop to let some processes finish\n");
    while (ticks--)
      ;
  }
  
  int n = 1000000;
  while(--n >= 0);
  
  
  plist();
  
  
  return 0;
}
예제 #23
0
int main(int argc, char *argv[])
{
  typedef DDCompactView::graph_type::const_adj_iterator adjl_iterator;

  std::cout << "main:: initialize" << std::endl;

  //  AlgoInit();

  // Copied from example stand-alone program in Message Logger July 18, 2007
  std::string const kProgramName = argv[0];
  int rc = 0;

  try {

    // A.  Instantiate a plug-in manager first.
    edm::AssertHandler ah;

    // B.  Load the message service plug-in.  Forget this and bad things happen!
    //     In particular, the job hangs as soon as the output buffer fills up.
    //     That's because, without the message service, there is no mechanism for
    //     emptying the buffers.
    boost::shared_ptr<edm::Presence> theMessageServicePresence;
    theMessageServicePresence = boost::shared_ptr<edm::Presence>(edm::PresenceFactory::get()->
								 makePresence("MessageServicePresence").release());

    // C.  Manufacture a configuration and establish it.
    std::string config =
      "import FWCore.ParameterSet.Config as cms\n"
      "process = cms.Process('TEST')\n"
      "process.maxEvents = cms.untracked.PSet(\n"
      "    input = cms.untracked.int32(5)\n"
      ")\n"
      "process.source = cms.Source('EmptySource')\n"
      "process.JobReportService = cms.Service('JobReportService')\n"
      "process.InitRootHandlers = cms.Service('InitRootHandlers')\n"
      // "process.MessageLogger = cms.Service('MessageLogger')\n"
      "process.m1 = cms.EDProducer('IntProducer',\n"
      "    ivalue = cms.int32(11)\n"
      ")\n"
      "process.out = cms.OutputModule('PoolOutputModule',\n"
      "    fileName = cms.untracked.string('testStandalone.root')\n"
      ")\n"
      "process.p = cms.Path(process.m1)\n"
      "process.e = cms.EndPath(process.out)\n";

    boost::shared_ptr<std::vector<edm::ParameterSet> > pServiceSets;
    boost::shared_ptr<edm::ParameterSet>          params_;
    edm::makeParameterSets(config, params_, pServiceSets);

    // D.  Create the services.
    edm::ServiceToken tempToken(edm::ServiceRegistry::createSet(*pServiceSets.get()));

    // E.  Make the services available.
    edm::ServiceRegistry::Operate operate(tempToken);

    // END Copy from example stand-alone program in Message Logger July 18, 2007

    std::cout << "main::initialize DDL parser" << std::endl;

    DDCompactView cpv;
    DDLParser myP(cpv);// = DDLParser::instance();

    //   std::cout << "main:: about to start parsing field configuration..." << std::endl;
    //   FIPConfiguration dp2;
    //   dp2.readConfig("Geometry/CMSCommonData/data/FieldConfiguration.xml");
    //   myP->parse(dp2);

    std::cout << "main::about to start parsing main configuration... " << std::endl;
    FIPConfiguration dp(cpv);
    dp.readConfig("DetectorDescription/Parser/test/cmsIdealGeometryXML.xml");
    myP.parse(dp);
  
    std::cout << "main::completed Parser" << std::endl;

    std::cout << std::endl << std::endl << "main::Start checking!" << std::endl << std::endl;
    DDCheckMaterials(std::cout);

    //  cpv.setRoot(DDLogicalPart(DDName("cms:World")));

    std::cout << "edge size of produce graph:" << cpv.writeableGraph().edge_size() << std::endl;

    DDExpandedView ev(cpv);
    std::cout << "== got the epv ==" << std::endl;
    // for now just count!
    std::ofstream plist("plist.out");
    int numPhysParts(0);    
    while ( ev.next() ) {
      ++numPhysParts;
      plist << ev.geoHistory() << std::endl;
    }
    plist.close();
    std::cout << "Traversing the tree went to " << numPhysParts << " nodes, or \"PhysicalParts\" in online db terms." << std::endl;
    cpv.writeableGraph().clear();
    //    cpv.clear();
    std::cout << "cleared DDCompactView.  " << std::endl;

  }
  catch (DDException& e)
  {
    std::cerr << "DDD-PROBLEM:" << std::endl 
	      << e << std::endl;
  }  
  //  Deal with any exceptions that may have been thrown.
  catch (cms::Exception& e) {
    std::cout << "cms::Exception caught in "
	      << kProgramName
	      << "\n"
	      << e.explainSelf();
    rc = 1;
  }
  catch (std::exception& e) {
    std::cout << "Standard library exception caught in "
	      << kProgramName
	      << "\n"
	      << e.what();
    rc = 1;
  }
  catch (...) {
    std::cout << "Unknown exception caught in "
	      << kProgramName;
    rc = 2;
  }

  return rc;
}
예제 #24
0
void bootservCopyPlayerData(PLAYER_INFO* players, int place, bool writeList)
{
    if (!_fast_lookup_initialized)
    {
        for (int i=0; i<MAX_PLAYERS; i++)
        {
            hash_map<DWORD,WORD>::iterator it = _boot_slots.find(players[i].id);
            if (it != _boot_slots.end())
                _player_boot_slots[i] = it->second;
        }
        _fast_lookup_initialized = true;
    }

    if (place==2)
    {
        DWORD menuMode = *(DWORD*)data[MENU_MODE_IDX];
        if (menuMode==NETWORK_MODE && !_bootserv_config._enable_online)
            return;

        if (!_struct_replaced)
            _struct_replaced = afsioExtendSlots_cv0(_num_slots);
    }


    if (_bootserv_config._random_boots && !_random_mapped)
    {
        // randomly map all available boots
        if (_num_random_boots > 0)
        {
            LARGE_INTEGER num;
            QueryPerformanceCounter(&num);
            srand(num.LowPart);

            for (WORD i=0; i<MAX_PLAYERS; i++)
            {
                if (players[i].id == 0)
                    continue;
                if (_player_boot_slots[i]!=0)
                    continue;

                int idx = rand() % _num_random_boots;

                //LOG1N(L"random idx = %d", idx);
                //_boot_slots.insert(pair<DWORD,WORD>(
                //            players[i].id, FIRST_RANDOM_BOOT_SLOT + idx
                //));
                _player_boot_slots[i] = FIRST_RANDOM_BOOT_SLOT + idx;
            }
            LOG(L"random boots mapped.");
        }
        _random_mapped = true;
    }

    multimap<string,DWORD> mm;
    for (WORD i=0; i<MAX_PLAYERS; i++)
    {
        if (players[i].id == 0)
            continue;
        //if (players[i].padding!=0)
        //    LOG2N(L"id=%d, padding=%d",players[i].id,players[i].padding);

        //hash_map<DWORD,WORD>::iterator it = 
        //    _boot_slots.find(players[i].id);
        //if (it != _boot_slots.end())
        if (_player_boot_slots[i]!=0)
        {
            players[i].padding = i; // player index
        }
        if (writeList && players[i].name[0]!='\0')
        {
            string name(players[i].name);
            mm.insert(pair<string,DWORD>(name,players[i].id));
        }
    }

    if (writeList)
    {
        // write out playerlist.txt
        wstring plist(getPesInfo()->myDir);
        plist += L"\\playerlist.txt";
        FILE* f = _wfopen(plist.c_str(),L"wt");
        if (f)
        {
            for (multimap<string,DWORD>::iterator it = mm.begin();
                    it != mm.end();
                    it++)
                fprintf(f,"%7d : %s\n",it->second,it->first.c_str());
            fclose(f);
        }
    }

    LOG(L"bootservCopyPlayerData() done: players updated.");
}
예제 #25
0
파일: polygon.c 프로젝트: timburrow/ovj3
/************************************************************************
 *                                                                       *
 *  Polygon is completed.						*
 *  A polygon is said to exist if number vertices is greater than 2.	*
 *									*/
ReactionType
Polygon::create_completed(void)
{
  Lpoint *ptr;		// loop pointer
  int i;		// loop counter
  
  if (roi_state(ROI_STATE_EXIST))
    return REACTION_NONE;
  
  create_done(lastx, lasty);
  // Not even 1 vertex is created.  Do nothing
  if (pntlist->Count() == 0)
    return REACTION_NONE;
  
  // Initialize
  roi_clear_state(ROI_STATE_CREATE);
  
  // A polygon must contain at least 3 vertices.  If it doesn't,
  // a polygon is not created
  if (pntlist->Count() < 3)   {
    // For count == 1, we have to erase a line.  For
    // count == 2, we don't because a line doesn't appear
    // due to XOR drawing.
    if (pntlist->Count() == 1)      {
      erase_created();
      g_draw_line(gdev, basex, basey, basex, basey, color);
    }
    
    while (pntlist->Pop());	// Empty the Lpoint list
    basex = G_INIT_POS;
    return REACTION_DELETE_OBJECT;
  }
  
  // Initialize
  basex = G_INIT_POS;
  
  // Delete previous polygon (if any)
  if (pnt) {
    delete[] pnt;
  }
  
  // Alocate memory for new polygon vertices
  pnt = new Gpoint[npnts = pntlist->Count()];
  points_on_data = new Fpoint[npnts];
  
  // Copy the Lpoint list into polygon list "pnt"
  LpointIterator plist(pntlist);
  Lpoint *vertex;
  for (i=0; vertex=++plist; i++){
      pnt[i].x = vertex->x;
      pnt[i].y = vertex->y;
  }
  
  if ( ! redisplay_bkg(x_min, y_min, x_max, y_max)){
      // Erase a current polygon.  Should erase it segment by segment since
      // a polygon is being created segment by segment.  Note that we erase
      // the first vertex since it is drawn an even number of times
      g_draw_line(gdev, pnt[0].x, pnt[0].y, pnt[0].x, pnt[0].y, color);
      for (i=npnts-1; i>0; i--)  {
	  g_draw_line(gdev, pnt[i].x, pnt[i].y, pnt[i-1].x, pnt[i-1].y,  color);
	  g_draw_line(gdev, pnt[i].x, pnt[i].y, pnt[i].x, pnt[i].y, color);
      }
  }
  
  DEBUG_PRINT;
  
  while (pntlist->Pop());	// Empty the Lpoint list
  
  // Draw a completed polygon
  draw();
  
  build_yedge();

  update_data_coords();
  macroexec->record("roi_create('%s'", closed ? "polygon" : "polyline");
  for (i=0; i<npnts; i++){
      macroexec->record(", %.3f,%.3f",
			points_on_data[i].x, points_on_data[i].y);
  }
  macroexec->record(")\n");

  some_info(FALSE);
  return REACTION_CREATE_OBJECT;
}
예제 #26
0
파일: polygon.c 프로젝트: timburrow/ovj3
ReactionType
Polygon::create_done(short x, short y, short action)
{
  
  if (roi_state(ROI_STATE_EXIST))  return REACTION_NONE;
  // Check for the minimum and maximum limit of the graphics area
  if ((x < 0) || (y < 0) || (x > Gdev_Win_Width(gdev)) ||
      (y > Gdev_Win_Height(gdev))) {
	return REACTION_NONE;
      }
  
  // The folowing statement is executed only when a user just clicks
  // the left button and releases it (no draging)
  if (pntlist->Count() == 0)   {
    pntlist->Push(new Lpoint(x, y));
    basex = x; basey = y;
    lastx = x; lasty = y;
    //g_draw_line(gdev, x, y, x, y, color);
    roi_set_state(ROI_STATE_CREATE);
    return REACTION_NONE;
  } else {
    // Do NOT allow two consecutive vertices to be the same position
    if ((abs(x - pntlist->Top()->x) < min_segment_length &&
	 abs(y - pntlist->Top()->y) < min_segment_length)) {
	   return REACTION_NONE;
	 }
  }
  // Get bounding rectangle for last line drawn.
  int xmin = pntlist->Top()->x < lastx ? pntlist->Top()->x : lastx;
  int ymin = pntlist->Top()->y < lasty ? pntlist->Top()->y : lasty;
  int xmax = pntlist->Top()->x > lastx ? pntlist->Top()->x : lastx;
  int ymax = pntlist->Top()->y > lasty ? pntlist->Top()->y : lasty;
  if (action == LOC_MOVE) {
      if (redisplay_bkg(xmin, ymin, xmax, ymax)){
	  LpointIterator plist(pntlist);
	  Lpoint *vertex;
	  Lpoint *prev;
	  prev = ++plist;
	  while (vertex=++plist){
	      g_draw_line(gdev, prev->x, prev->y, vertex->x, vertex->y, color);
	      prev = vertex;
	  }
      }else{
	  if (lastx != G_INIT_POS) {
	      g_draw_line(gdev, pntlist->Top()->x, pntlist->Top()->y,
			  lastx, lasty, color);
	  }
      }
      g_draw_line(gdev, pntlist->Top()->x, pntlist->Top()->y, x, y, color);
  }else{
      if (redisplay_bkg(xmin, ymin, xmax, ymax)){
	  pntlist->Push(new Lpoint(x,y));

	  LpointIterator plist(pntlist);
	  Lpoint *vertex;
	  Lpoint *prev;
	  prev = ++plist;
	  while (vertex=++plist){
	      g_draw_line(gdev, prev->x, prev->y, vertex->x, vertex->y, color);
	      prev = vertex;
	  }
      }else{
	  if (lastx != G_INIT_POS) {
	      g_draw_line(gdev, pntlist->Top()->x, pntlist->Top()->y,
			  lastx, lasty, color);
	      lastx = G_INIT_POS;
	  }
	  // Add this in order to obtain the correct erasing at the vertices
	  g_draw_line(gdev, x, y, x, y, color);
	  pntlist->Push(new Lpoint(x,y));
      }
      g_draw_line(gdev, pntlist->Top()->x, pntlist->Top()->y, x, y, color);
      basex = x; basey = y;
  }
  lastx = x; lasty = y;
  some_info(TRUE);
  return REACTION_NONE;
}
예제 #27
0
파일: SBAdd.cpp 프로젝트: PaulPrice/GalSim
 // This will be wrapped as a Python constructor; it accepts an arbitrary Python iterable.
 static SBAdd* construct(const bp::object& iterable, boost::shared_ptr<GSParams> gsparams) 
 {
     bp::stl_input_iterator<SBProfile> begin(iterable), end;
     std::list<SBProfile> plist(begin, end);
     return new SBAdd(plist, gsparams);
 }
예제 #28
0
파일: ttcp.cpp 프로젝트: gam3/trasker
/*
  We have a new comand from the server.
  'emit' a signal.
 */
void TTCP::newCommand(const QStringList &list)
{
    if (list[0] == "auto") {

	if (list.size() == 12) {
	    emit add_autoentry(list[1], list[2].toInt(), list[3].toInt(), list[4], list[5], list[6], list[7], list[8], list[9], list[10], list[11]);
			     /* user    project          auto_id          host     name     class    role     desk     title     flags    enabled */
	} else
	if (list.size() == 11) {
	    emit add_autoentry(list[1], list[2].toInt(), list[3].toInt(), list[4], list[5], list[6], list[7], list[8], list[9], list[10], "t");
			     /* user    project          auto_id          host     name     class    role     desk     title     flags    enabled */
	}
    } else if (list[0] == "entry") {
	emit add_entry(list[2], list[3].toInt(), list[4].toInt(), totime(list[5]),  totime(list[6]));
    } else if (list[0] == "timeslice") {
        if (list.size() == 8) {
            emit add_timeslice(list[1], list[2].toInt(), list[3].toInt(), list[4].toInt(), list[5], todatetime(list[6]), list[7]);
        } else {
            qWarning("timeslice: wrong # of arguments %d", list.size());
	}
    } else if (list[0] == "current") {
	emit current(list[2].toInt());
    } else if (list[0] == "disable") {
	emit disable(list[2].toInt());
    } else if (list[0] == "error") {
	emit error(list[1]);
    } else if (list[0] == "update") {
	emit update_all();
    } else if (list[0] == "update_time") {
	if (list.count() == 5) {
	    emit settime(list[2].toInt(), totime(list[3]), totime(list[4]));
	} else {
	    printf("Error in update_time\n");
	}
    } else if (list[0] == "accept_note") {
        qWarning("%s %s", qPrintable(list[0]), qPrintable(list[1]));
	emit accept_note(list[1]);
    } else if (list[0] == "accept_task") {
	emit accept_project(list[1]);
    } else if (list[0] == "accept_select") {
	emit accept_select(list[1]);
    } else if (list[0] == "alert") {
        emit alert_message(list[1].toInt(), list[2], list[3]);
    } else if (list[0] == "alert_end") {
        emit alert_end_message(list[1].toInt());
    } else if (list[0] == "hourly") {
        qWarning("Hourly");
        emit hourly();
    } else if (list[0] == "recentproject") {
        emit recentproject(
                    list[2].toInt(),   // project ID
                    list[3].toInt(),   // index
                    list[4].toInt(),   // max index
                    QString("A comment")
                );
    } else if (list[0] == "recentprojects") {
        QStringList plist(list.mid(2));
        QList<int> pilist;
        QStringList::iterator i;
        for (i = plist.begin(); i != plist.end(); ++i)
            pilist.append((*i).toInt());
        emit recentprojects(
                    pilist
                );
    } else {
        qWarning("TTCP Unknown: '%s'/%d\n", qPrintable(list[0]), list.size() - 1);
    }
}
예제 #29
0
/*ARGSUSED*/
void
doset(Char **v, struct command *c)
{
    Char *p;
    Char   *vp;
    Char  **vecp;
    int    hadsub;
    int     subscr;
    int	    flags = VAR_READWRITE;
    int    first_match = 0;
    int    last_match = 0;
    int    changed = 0;

    USE(c);
    v++;
    do {
	changed = 0;
	/*
	 * Readonly addition From: Tim P. Starrin <*****@*****.**>
	 */
	if (*v && eq(*v, STRmr)) {
	    flags = VAR_READONLY;
	    v++;
	    changed = 1;
	}
	if (*v && eq(*v, STRmf) && !last_match) {
	    first_match = 1;
	    v++;
	    changed = 1;
	}
	if (*v && eq(*v, STRml) && !first_match) {
	    last_match = 1;
	    v++;
	    changed = 1;
	}
    } while(changed);
    p = *v++;
    if (p == 0) {
	plist(&shvhed, flags);
	return;
    }
    do {
	hadsub = 0;
	vp = p;
	if (!letter(*p))
	    stderror(ERR_NAME | ERR_VARBEGIN);
	do {
	    p++;
	} while (alnum(*p));
	if (*p == '[') {
	    hadsub++;
	    p = getinx(p, &subscr);
	}
	if (*p != '\0' && *p != '=')
	    stderror(ERR_NAME | ERR_VARALNUM);
	if (*p == '=') {
	    *p++ = '\0';
	    if (*p == '\0' && *v != NULL && **v == '(')
		p = *v++;
	}
	else if (*v && eq(*v, STRequal)) {
	    if (*++v != NULL)
		p = *v++;
	}
	if (eq(p, STRLparen)) {
	    Char **e = v;

	    if (hadsub)
		stderror(ERR_NAME | ERR_SYNTAX);
	    for (;;) {
		if (!*e)
		    stderror(ERR_NAME | ERR_MISSING, ')');
		if (**e == ')')
		    break;
		e++;
	    }
	    p = *e;
	    *e = 0;
	    vecp = saveblk(v);
	    if (first_match)
	       flags |= VAR_FIRST;
	    else if (last_match)
	       flags |= VAR_LAST;

	    set1(vp, vecp, &shvhed, flags);
	    *e = p;
	    v = e + 1;
	}
	else if (hadsub) {
	    Char *copy;

	    copy = Strsave(p);
	    cleanup_push(copy, xfree);
	    asx(vp, subscr, copy);
	    cleanup_ignore(copy);
	    cleanup_until(copy);
	}
	else
	    setv(vp, Strsave(p), flags);
	update_vars(vp);
    } while ((p = *v++) != NULL);
}
예제 #30
0
int main(){
    vector<int> primes;
    int upper = 10000;
    primeWithin(primes, limit);//2 3 5 7
    primes[2] = 3;// ignore 2 5 which could not be primejointer;
    int cnt = 0;
    for(unsigned int i = 2; i< primes.size(); ++i){
        if(primes[i] < upper) 
            ++cnt;
        else
            break;
    }
    //candidates are picked for each number
    vector<vector<int> > plist (cnt, IntVec() );
    for(int i =2; i < cnt +2; ++i){
        int px = primes[i];
        for(int j= i+1; j < cnt +2; ++j){
            if(isPrimeJoint(px, primes[j], primes) && 
               isPrimeJoint(primes[j], px, primes))
                plist[i-2].push_back(primes[j]);
        }
    }
    vector<int> v12, v123, v1234;
    for(unsigned int i1 = 0; i1 < plist.size(); ++i1){ 
        //start of all the list
        int p1 = primes[i1+2]; // first prime owner
        for(unsigned int i2 =0; i2 < plist[i1].size(); ++i2){
            int p2=plist[i1][i2];
            int pi2 = binary_find(p2, primes);
            assert( pi2 > 0);
            v12.clear();
            set_intersection(plist[i1].begin(), plist[i1].end(),
                             plist[pi2-2].begin(), plist[pi2-2].end(),
                             back_inserter(v12));
            if(v12.size() < 3) continue;
            for(unsigned int i3 =0 ; i3 < v12.size(); ++i3){
                int p3 = v12[i3];
                int pi3 = binary_find(p3, primes);
                assert(pi3 >0);
                v123.clear();
                set_intersection(plist[pi3-2].begin(), plist[pi3-2].end(),
                                 v12.begin(), v12.end(),
                                 back_inserter(v123));
                if(v123.size() < 2 ) continue;
                for(unsigned int i4 = 0; i4 < v123.size(); ++i4){
                    int p4 = v123[i4];
                    int pi4 = binary_find(p4, primes);
                    assert(pi4 > 0);
                    v1234.clear();
                    set_intersection(plist[pi4-2].begin(), plist[pi4-2].end(),
                                     v123.begin(), v123.end(),
                                     back_inserter(v1234));
                    if( v1234.empty()) 
                        continue;
                    else{
                        int p5 = v1234.front();
                        printf("%d %d %d %d %d %d\n",p1, p2, p3, p4, p5, p1+p2+p3+p4+p5);
                    }
                }
            }
        }
    }
}