//
// run_main
//
int CUTS_CHAOS_CCM_ComponentServer_App::
run_main (int argc, char * argv[])
{
  ACE_ARGV_T <char> argv_list (argc, argv);
  this->parse_args (argv_list.argc (), argv_list.argv ());

  return base_type::run_main (argc, argv);
}
Example #2
0
  SEXP pycall__callable(SEXP Rfun, SEXP Rargv_list, SEXP Rargv_dict) {
#ifdef REMBEDPY_DEBUG
  	Rprintf("callable\n");
#endif
  	Rcpp::S4 fun(Rfun);
  	PyObjPtr pcallable(Rcpp::wrap(fun.slot("ptr")));
  	boost::python::object& callable(*pcallable);
  	boost::python::list argv_list(RembedPy::extract_argv_list(Rargv_list));
    boost::python::dict argv_dict(RembedPy::extract_argv_dict(Rargv_dict));
  	return RembedPy::pycall(callable, argv_list, argv_dict);
  }
Example #3
0
  SEXP pycall__funname(SEXP Rmodule_name, SEXP Rfun_name, SEXP Rargv_list, SEXP Rargv_dict) {
#ifdef REMBEDPY_DEBUG
    Rprintf("funname\n");
#endif
    std::string 
  		fun_name(Rcpp::as<std::string>(Rfun_name)),
  		module_name(Rcpp::as<std::string>(Rmodule_name));
    boost::python::object callable(RembedPy::extract_pyobj(fun_name, module_name));
    boost::python::list argv_list(RembedPy::extract_argv_list(Rargv_list));
    boost::python::dict argv_dict(RembedPy::extract_argv_dict(Rargv_dict));
    return RembedPy::pycall(callable, argv_list, argv_dict);
  }
Example #4
0
File: flmain.c Project: 0/julia
int main(int argc, char *argv[])
{
    char fname_buf[1024];
    fl_context_t *fl_ctx = &fl_global_ctx;

    fl_init(fl_ctx, 512*1024);

    fname_buf[0] = '\0';
    value_t str = symbol_value(symbol(fl_ctx, "*install-dir*"));
    char *exedir = (char*)(str == UNBOUND ? NULL : cvalue_data(str));
    if (exedir != NULL) {
        strcat(fname_buf, exedir);
        strcat(fname_buf, PATHSEPSTRING);
    }
    strcat(fname_buf, "flisp.boot");

    value_t args[2];
    fl_gc_handle(fl_ctx, &args[0]);
    fl_gc_handle(fl_ctx, &args[1]);
    FL_TRY_EXTERN(fl_ctx) {
        args[0] = cvalue_static_cstring(fl_ctx, fname_buf);
        args[1] = symbol(fl_ctx, ":read");
        value_t f = fl_file(fl_ctx, &args[0], 2);
        fl_free_gc_handles(fl_ctx, 2);

        if (fl_load_system_image(fl_ctx, f))
            return 1;

        (void)fl_applyn(fl_ctx, 1, symbol_value(symbol(fl_ctx, "__start")),
                        argv_list(fl_ctx, argc, argv));
    }
    FL_CATCH_EXTERN(fl_ctx) {
        ios_puts("fatal error:\n", ios_stderr);
        fl_print(fl_ctx, ios_stderr, fl_ctx->lasterror);
        ios_putc('\n', ios_stderr);
        return 1;
    }
    return 0;
}
Example #5
0
void PPUThread::InitRegs()
{
	const u32 pc = Memory.Read32(entry);
	const u32 rtoc = Memory.Read32(entry + 4);

	//ConLog.Write("entry = 0x%x", entry);
	//ConLog.Write("rtoc = 0x%x", rtoc);

	SetPc(pc);

	/*
	const s32 thread_num = Emu.GetCPU().GetThreadNumById(GetType(), GetId());

	if(thread_num < 0)
	{
		ConLog.Error("GetThreadNumById failed.");
		Emu.Pause();
		return;
	}
	*/

	/*
	const s32 tls_size = Emu.GetTLSFilesz() * thread_num;

	if(tls_size >= Emu.GetTLSMemsz())
	{
		ConLog.Error("Out of TLS memory.");
		Emu.Pause();
		return;
	}
	*/

	m_stack_point = Memory.AlignAddr(m_stack_point, 0x200) - 0x200;

	GPR[1] = m_stack_point;
	GPR[2] = rtoc;
	/*
	for(int i=4; i<32; ++i)
	{
		if(i != 6)
			GPR[i] = (i+1) * 0x10000;
	}
	*/
	if(m_argv_addr.size())
	{
		u64 argc = m_argv_addr.size();
		m_stack_point -= 0xc + 4 * argc;
		u64 argv = m_stack_point;

		mem64_ptr_t argv_list(argv);
		for(int i=0; i<argc; ++i) argv_list += m_argv_addr[i];

		GPR[3] = argc;
		GPR[4] = argv;
		GPR[5] = argv ? argv + 0xc + 4 * argc : 0; //unk
	}
	else
	{
		GPR[3] = m_args[0];
		GPR[4] = m_args[1];
		GPR[5] = m_args[2];
		GPR[6] = m_args[3];
	}

	GPR[0] = pc;
	GPR[8] = entry;
	GPR[11] = 0x80;
	GPR[12] = Emu.GetMallocPageSize();
	GPR[13] = Memory.PRXMem.GetStartAddr() + 0x7060;
	GPR[28] = GPR[4];
	GPR[29] = GPR[3];
	GPR[31] = GPR[5];

	LR = Emu.GetPPUThreadExit();
	CTR = PC;
	CR.CR = 0x22000082;
	VSCR.NJ = 1;
	TB = 0;
}