void MainGui::setupLoadThread(QString fname) {
	LoadHdrThread *loadthread = new LoadHdrThread(fname, RecentDirHDRSetting);
	connect(loadthread, SIGNAL(updateRecentDirHDRSetting(QString)), this, SLOT(updateRecentDirHDRSetting(QString)));
	connect(loadthread, SIGNAL(hdr_ready(pfs::Frame*,QString)), this, SLOT(addHdrViewer(pfs::Frame*,QString)));
	connect(loadthread, SIGNAL(load_failed(QString)), this, SLOT(load_failed(QString)));
	loadthread->start();
}
Exemple #2
0
static VALUE
rb_f_load(int argc, VALUE *argv)
{
    VALUE fname, wrap, path, orig_fname;

    rb_scan_args(argc, argv, "11", &fname, &wrap);

    if (RUBY_DTRACE_LOAD_ENTRY_ENABLED()) {
	RUBY_DTRACE_LOAD_ENTRY(StringValuePtr(fname),
			       rb_sourcefile(),
			       rb_sourceline());
    }

    orig_fname = FilePathValue(fname);
    fname = rb_str_encode_ospath(orig_fname);
    path = rb_find_file(fname);
    if (!path) {
	if (!rb_file_load_ok(RSTRING_PTR(fname)))
	    load_failed(orig_fname);
	path = fname;
    }
    rb_load_internal(path, RTEST(wrap));

    if (RUBY_DTRACE_LOAD_RETURN_ENABLED()) {
	RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname),
			       rb_sourcefile(),
			       rb_sourceline());
    }

    return Qtrue;
}
Exemple #3
0
static VALUE
file_to_load(VALUE fname)
{
    VALUE tmp = rb_find_file(FilePathValue(fname));
    if (!tmp) load_failed(fname);
    return tmp;
}
Exemple #4
0
void
rb_load(VALUE fname, int wrap)
{
    VALUE tmp = rb_find_file(FilePathValue(fname));
    if (!tmp) load_failed(fname);
    rb_load_internal(tmp, wrap);
}
Exemple #5
0
VALUE
rb_require_safe(VALUE fname, int safe)
{
    volatile VALUE result = Qnil;
    rb_thread_t *th = GET_THREAD();
    volatile VALUE errinfo = th->errinfo;
    int state;
    struct {
	int safe;
    } volatile saved;
    char *volatile ftptr = 0;

    PUSH_TAG();
    saved.safe = rb_safe_level();
    if ((state = EXEC_TAG()) == 0) {
	VALUE path;
	long handle;
	int found;

	rb_set_safe_level_force(safe);
	FilePathValue(fname);
	rb_set_safe_level_force(0);
	found = search_required(fname, &path, safe);
	if (found) {
	    if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
		result = Qfalse;
	    }
	    else {
		switch (found) {
		  case 'r':
		    rb_load_internal(path, 0);
		    break;

		  case 's':
		    handle = (long)rb_vm_call_cfunc(rb_vm_top_self(), load_ext,
						    path, 0, path);
		    rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
		    break;
		}
		rb_provide_feature(path);
		result = Qtrue;
	    }
	}
    }
    POP_TAG();
    load_unlock(ftptr, !state);

    rb_set_safe_level_force(saved.safe);
    if (state) {
	JUMP_TAG(state);
    }

    if (NIL_P(result)) {
	load_failed(fname);
    }

    th->errinfo = errinfo;

    return result;
}
Exemple #6
0
VALUE
rb_require_safe(VALUE fname, int safe)
{
    FilePathValue(fname);

    // Immediately, check out if we have an AOT feature for this.
    if (rb_vm_aot_feature_load(RSTRING_PTR(fname))) {
	rb_provide_feature(fname);
	return Qtrue;
    }

#if MACRUBY_STATIC
    rb_raise(rb_eRuntimeError, "#require is not supported in MacRuby static");
#else
    VALUE result = Qnil;
    VALUE path;
    int type = 0;

    if (search_required(fname, &path, &type)) {
	if (path == 0) {
	    result = Qfalse;
	}
	else {
	    rb_set_safe_level_force(0);
	    rb_provide_feature(path);
	    switch (type) {
		case TYPE_RB:
		    rb_rescue2(load_try, path, load_rescue, path,
			    rb_eException, 0);
		    break;

		case TYPE_RBO:
		    dln_load(RSTRING_PTR(path), false);
		    break;

		case TYPE_BUNDLE:
		    dln_load(RSTRING_PTR(path), true);
		    break;

		default:
		    abort();
	    }
	    result = Qtrue;
	}
    }

    if (NIL_P(result)) {
	load_failed(fname);
    }

    return result;
#endif
}
Exemple #7
0
VALUE
rb_require_safe(VALUE fname, int safe)
{
    int result = rb_require_internal(fname, safe);

    if (result > TAG_RETURN) {
	JUMP_TAG(result);
    }
    if (result < 0) {
	load_failed(fname);
    }

    return result ? Qtrue : Qfalse;
}
Exemple #8
0
VALUE
rb_require_safe(VALUE fname, int safe)
{
    int result = rb_require_internal(fname, safe);

    if (result > TAG_RETURN) {
	if (result == TAG_RAISE) rb_exc_raise(rb_errinfo());
	EC_JUMP_TAG(GET_EC(), result);
    }
    if (result < 0) {
	load_failed(fname);
    }

    return result ? Qtrue : Qfalse;
}
Exemple #9
0
static VALUE
rb_f_load(int argc, VALUE *argv)
{
    VALUE fname, wrap, path;

    rb_scan_args(argc, argv, "11", &fname, &wrap);
    path = rb_find_file(FilePathValue(fname));
    if (!path) {
	if (!rb_file_load_ok(RSTRING_PTR(fname)))
	    load_failed(fname);
	path = fname;
    }
    rb_load_internal(path, RTEST(wrap));
    return Qtrue;
}
Exemple #10
0
static VALUE
rb_f_load(int argc, VALUE *argv)
{
    VALUE fname, wrap, path, orig_fname;

    rb_scan_args(argc, argv, "11", &fname, &wrap);

    orig_fname = rb_get_path_check_to_string(fname, rb_safe_level());
    fname = rb_str_encode_ospath(orig_fname);
    RUBY_DTRACE_HOOK(LOAD_ENTRY, RSTRING_PTR(orig_fname));

    path = rb_find_file(fname);
    if (!path) {
	if (!rb_file_load_ok(RSTRING_PTR(fname)))
	    load_failed(orig_fname);
	path = fname;
    }
    rb_load_internal(path, RTEST(wrap));

    RUBY_DTRACE_HOOK(LOAD_RETURN, RSTRING_PTR(orig_fname));

    return Qtrue;
}
Exemple #11
0
void
rb_load(VALUE fname, int wrap)
{
#if MACRUBY_STATIC
    rb_raise(rb_eRuntimeError, "#load is not supported in MacRuby static");
#else
    // TODO honor wrap

    // Locate file.
    FilePathValue(fname);
    fname = rb_str_new4(fname);
    VALUE tmp = rb_find_file(fname);
    if (tmp == 0) {
	load_failed(fname);
    }
    fname = tmp;

    // Load it.
    const char *fname_str = RSTRING_PTR(fname);
//printf("load %s\n", fname_str);

    rb_vm_load(fname_str, wrap);
#endif
}
void Portal::open( const QString& fname ) {
   dgd_scopef(trace_gui);

   dgd_echo(fname);

   QUrl url = QUrl::fromUserInput( fname );
   
   dgd_echo( QString(url.toEncoded()) );

   if( url.isValid() ) {
      Document *doc = new Document( url );

      QRect wsgeom = m_workspace->geometry();
      QRect mygeom;

      mygeom.setLeft( 10 );
      mygeom.setTop( 35 );
      mygeom.setWidth( (int)(wsgeom.width() * 0.7) );
      mygeom.setHeight( (int)(wsgeom.height() * 0.7) );

      doc->setGeometry( mygeom );

      connect( doc, SIGNAL(load_failed()), doc, SLOT(close()) );
      connect( doc, SIGNAL(load_finished()), 
	       m_history_mapper, SLOT(map()) );
      connect( doc, SIGNAL(load_finished()), 
	       m_properties_mapper, SLOT(map()) );

      m_history_mapper->setMapping( doc, QString(url.toEncoded()) );
      m_properties_mapper->setMapping( doc, doc );

      m_workspace->addWindow( doc );

      doc->show();
   }
}
Exemple #13
0
VALUE
rb_resolve_feature_path(VALUE klass, VALUE fname)
{
    VALUE path;
    int found;
    VALUE sym;

    fname = rb_get_path_check(fname, 0);
    path = rb_str_encode_ospath(fname);
    found = search_required(path, &path, 0, no_feature_p);

    switch (found) {
      case 'r':
        sym = ID2SYM(rb_intern("rb"));
        break;
      case 's':
        sym = ID2SYM(rb_intern("so"));
        break;
      default:
        load_failed(fname);
    }

    return rb_ary_new_from_args(2, sym, path);
}
Exemple #14
0
			loader(const char* path) { if (!load(path)) throw load_failed(); }