Esempio n. 1
0
void loadLibrary(Thread& thread, std::string path, std::string name) {
	Environment* env = new Environment(thread.state.path.back());
	
	std::string p = path + "/" + name + ("/R/");

	dirent* file;
	struct stat info;

	// Load R files
	DIR* dir = opendir(p.c_str());
	if(dir != NULL) {
		while((file=readdir(dir))) {
			if(file->d_name[0] != '.') {
				stat(file->d_name, &info);
				std::string name = file->d_name;
				if(!S_ISDIR(info.st_mode) && 
						(name.length()>2 && name.substr(name.length()-2,2)==".R")) {
					sourceFile(thread, p+name, env);
				}
			}
		}
		closedir(dir);
	}

	// Load dynamic libraries
	p = path + "/" + name + "/libs/";
	dir = opendir(p.c_str());
	if(dir != NULL) {
		while((file=readdir(dir))) {
			if(file->d_name[0] != '.') {
				stat(file->d_name, &info);
				std::string name = file->d_name;
				if(!S_ISDIR(info.st_mode) && 
						(name.length()>2 && name.substr(name.length()-3,3)==".so")) {
					openDynamic(thread, p+name, env);
				}
			}
		}
		closedir(dir);
	}

	thread.state.path.push_back(env);
	thread.state.global->init(thread.state.path.back(), 0, Null::Singleton());
}
Esempio n. 2
0
void MainWindow::openImage()
{
    determinateImageType();

    this->setCursor(Qt::BusyCursor);
    switch (imageType) {
        case Static:
            openStatic();
            break;
        case Dynamic:
            openDynamic();
            break;
        case Webp:
            openStatic();
    }
    this->setCursor(Qt::ArrowCursor);
    this->pushNewFile();
    this->updateWindowTitle();
}