예제 #1
0
파일: bfck.c 프로젝트: cyberpython/Bfck
int main(int argc, char *argv[]){

	if(argc <= 1){
		printProgramInfo();
		return 0;
	}

	initData();
	dataIndex = 0;
	
	pSourceCodeFile = fopen(argv[1], "rb");
	int cmd = 0;
	if (pSourceCodeFile==NULL){
		fatalError(FILE_OPEN_FAILED_ERROR_MSG);
	}
	while(!feof(pSourceCodeFile)){
		cmd = getNextCommand();
		if(cmd!=EOF){
			execCommand(cmd);
		}
	}
	fclose(pSourceCodeFile);
	msg(EXECUTION_FINISHED_MSG);
	return 0;
}
예제 #2
0
void OpenCLPrinter::printKernelInfo(cl::Kernel kernel)
{
	print("--- KernelInfo ---", "");
	cl::STRING_CLASS functionName = kernel.getInfo<CL_KERNEL_FUNCTION_NAME>();
	cl::Context context = kernel.getInfo<CL_KERNEL_CONTEXT>();
	cl::Program program = kernel.getInfo<CL_KERNEL_PROGRAM>();
	print("Function name", functionName);
	printContextInfo(context);
	printProgramInfo(program);

}
예제 #3
0
파일: Settings.cpp 프로젝트: biointec/jabba
Settings::Settings(int argc, char** args)
{
        // parse program arguments
        if (argc < 4) {
                if (argc == 1) {
                        printProgramInfo();
                } else {
                        std::string arg = args[1];
                        if (arg == "-h" || arg == "--help") {
                                printUsage();
                                exit(EXIT_SUCCESS);
                        } else if (arg == "-i" || arg == "--info") {
                                printProgramInfo();
                                exit(EXIT_SUCCESS);
                        }
                }
                printUsage();
                exit(EXIT_FAILURE);
        }

        //set standard values
        num_threads_ = std::thread::hardware_concurrency();
        essa_k_ = 1;
        max_passes_ = 2;
        min_len_ = 20;
        directory_ = "Jabba_output";
        output_mode_ = SHORT;
        std::string graph_name = "DBGraph.fasta";
        FileType file_type(FASTA);
        std::vector<std::string> libraries;
        // extract the other parameters
        for (int i = 1; i < argc; i++) {
                std::string arg(args[i]);
                if (arg.empty()) continue;// this shouldn't happen
                if (arg == "-fastq") { // file type
                        std::cout << "FileType is fastq." << std::endl;
                        file_type = FASTQ;
                 } else if (arg == "-fasta") {
                        std::cout << "FileType is fasta." << std::endl;
                        file_type = FASTA;
                } else if (arg == "-t" || arg == "--threads") {
                        ++i;
                        num_threads_ = std::stoi(args[i]);
                } else if (arg == "-g" || arg == "--graph") {
                        ++i;
                        graph_name = args[i];
                } else if (arg == "-k" || arg == "--dbgk") {
                        ++i;
                        dbg_k_ = std::stoi(args[i]);
                } else if (arg == "-e" || arg == "--essak") {
                        ++i;
                        essa_k_ = std::stoi(args[i]);
                } else if (arg == "-p" || arg == "--passes") {
                        ++i;
                        max_passes_ = std::stoi(args[i]);
                } else if (arg == "-l" || arg == "--length") {
                        ++i;
                        min_len_ = std::stoi(args[i]);
                } else if (arg == "-o" || arg == "--output") {
                        ++i;
                        directory_ = args[i];
                } else if (arg == "-s" || arg == "--short") {
                        std::cerr << "-s --short is deprecated, short is now the default output mode.\n";
                        output_mode_ = SHORT;
                } else if (arg == "-m" || arg == "--outputmode") {
                        ++i;
                        if (std::string(args[i]) == std::string("short")) {
                                output_mode_ = SHORT;
                        } else if (std::string(args[i]) == std::string("long")) {
                                output_mode_ = LONG;
                        } else {
                                std::cerr << args[i] << " is not a valid output mode. Use \"long\" or \"short\" instead.\n";
                        }
                } else {// filename
                        libraries.push_back(args[i]);
                }
        }
        for (auto const &lib : libraries) {
                libraries_.insert(ReadLibrary(lib, directory_));
        }
        //
        graph_ = new ReadLibrary(graph_name, "");
        // try to create the output directory
        #ifdef _MSC_VER
        CreateDirectory(directory_.c_str(), NULL);
        #else
        DIR * dir = opendir(directory_.c_str());
        if ((dir == NULL) && (mkdir(directory_.c_str(), 0777) != 0))
                throw std::ios_base::failure("Can't create directory: " + directory_);
        closedir(dir);
        #endif
        // log the instructions
        logInstructions(argc, args);
        //print settings
        std::cout << "Max Number of Threads is " << num_threads_ << std::endl;
        std::cout << "Graph is " << graph_->getInputFilename() << std::endl;
        std::cout << "DBG K is " << dbg_k_ << std::endl;
        std::cout << "ESSA K is " << essa_k_ << std::endl;
        std::cout << "Max Passes is " << max_passes_ << std::endl;
        std::cout << "Min Seed Size is " << min_len_ << std::endl;
        std::cout << "Output Directory is " << directory_ << std::endl;
        std::cout << "Output Mode is ";
        if (output_mode_ == SHORT){
                std::cout << "short" << std::endl;
        } else if (output_mode_ == LONG){
                std::cout << "long" << std::endl;
        } else {
                std::cout << "not implemented" << std::endl;
        }
}