本文整理汇总了C++中ruby_init函数的典型用法代码示例。如果您正苦于以下问题:C++ ruby_init函数的具体用法?C++ ruby_init怎么用?C++ ruby_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ruby_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: proxenet_ruby_initialize_vm
int proxenet_ruby_initialize_vm(plugin_t* plugin)
{
interpreter_t *interpreter;
interpreter = plugin->interpreter;
/* checks */
if (interpreter->ready)
return 0;
#ifdef DEBUG
xlog(LOG_DEBUG, "Initializing Ruby VM version %s\n", _RUBY_VERSION_);
#endif
/* init vm */
ruby_init();
interpreter->vm = (void*) rb_mKernel;
ruby_script(PROGNAME);
ruby_init_loadpath();
interpreter->ready = true;
return 0;
}
开发者ID:thorgul,项目名称:proxenet,代码行数:27,代码来源:plugin-ruby.c
示例2: main
int
main(int argc, char **argv)
{
int nRes = 0;
#ifdef RUBY_DEBUG_ENV
ruby_set_debug_option(getenv("RUBY_DEBUG"));
#endif
#ifdef HAVE_LOCALE_H
setlocale(LC_CTYPE, "");
#endif
// MessageBox(0,"","",MB_OK);
ruby_sysinit(&argc, &argv);
{
RUBY_INIT_STACK;
ruby_init();
Init_strscan();
Init_sqlite3_api();
Init_SyncEngine();
Init_System();
//Init_prelude();
rb_define_global_function("__rho_compile", __rho_compile, 1);
nRes = ruby_run_node(ruby_options(argc, argv));
}
return nRes;
}
开发者ID:jayliu,项目名称:rhodes,代码行数:30,代码来源:main.c
示例3: init_rb
static bool init_rb(rb_internal_t*rb)
{
if(rb_reference_count==0) {
ruby_init();
}
rb_reference_count++;
}
开发者ID:JackieXie168,项目名称:mrscake,代码行数:7,代码来源:language_rb.c
示例4: main
int
main(int argc, char **argv, char **envp)
{
#ifdef HAVE_LOCALE_H
setlocale(LC_CTYPE, "");
#endif
ruby_is_miniruby = argc > 0 && strstr(argv[0], "miniruby") != NULL;
try {
ruby_sysinit(&argc, &argv);
ruby_init();
void *node = ruby_options(argc, argv);
rb_vm_init_compiler();
if (ruby_aot_compile) {
rb_vm_aot_compile((NODE *)node);
rb_exit(0);
}
else {
rb_exit(ruby_run_node(node));
}
}
catch (...) {
rb_vm_print_current_exception();
rb_exit(1);
}
}
开发者ID:ferrous26,项目名称:MacRuby,代码行数:27,代码来源:main.cpp
示例5: initrb_start
int initrb_start(int argc, char **argv, initrb_boot_fn_t boot) {
int ret = 0;
{
/* Initialize the stack */
RUBY_INIT_STACK;
/* Initialize the interpreter */
ruby_init();
/* Initialize the loadpath */
ruby_init_loadpath();
/* We're initrb */
ruby_script("initrb");
/* Set the argv */
ruby_set_argv(argc, argv);
/* Boot statics */
initrb_boot_statics();
/* Run */
ret = boot(argc, argv);
/* Finalize the interpreter */
ruby_finalize();
}
return ret;
}
开发者ID:numinit,项目名称:initrb,代码行数:31,代码来源:initrb.c
示例6: main
int main(int argc, char *argv[])
{
int ret;
const char *script = argv[1];
if (script == NULL) {
script =
//"alphadraw.rb";
"alpha.rb";
//"aadraw.rb";
//"test_fib.rb";
}
ruby_debug = Qtrue;
ruby_verbose = Qtrue;
ruby_init();
ruby_init_loadpath();
ruby_script(script);
rb_load_file(script);
ret = ruby_cleanup(ruby_exec());
//exit(ret);
return(ret);
}
开发者ID:weimingtom,项目名称:eriri_lua,代码行数:25,代码来源:main.c
示例7: main
int main(int argc,char *argv[])
{
ruby_init();
ruby_options(argc,argv);
ruby_run();
return 0;
}
开发者ID:godrin,项目名称:pkg_install,代码行数:7,代码来源:rubymain.c
示例8: eruta_ruby_init
int eruta_ruby_init() {
VALUE options = Qnil, sublet = Qnil;
void Init_prelude(void);
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
ruby_script("eruta");
#ifdef HAVE_RB_ENC_SET_DEFAULT_INTERNAL
{
VALUE encoding = Qnil;
/* FIXME: Fix for ruby 1.9.2p429 borrowed from ruby? */
(void)rb_filesystem_encoding();
/* Set encoding */
encoding = rb_enc_from_encoding(rb_locale_encoding());
rb_enc_set_default_external(encoding);
}
#endif /* HAVE_RB_ENC_SET_DEFAULT_INTERNAL */
/* FIXME: Fake ruby_init_gems(Qtrue) */
rb_define_module("Gem");
Init_prelude();
/* Bypassing garbage collection. Why? */
/* shelter = rb_ary_new();
rb_gc_register_address(&shelter);
*/
}
开发者ID:beoran,项目名称:eruta,代码行数:34,代码来源:eruta.c
示例9: shoes_init
shoes_code
shoes_init(SHOES_INIT_ARGS)
{
#ifdef SHOES_GTK
gtk_init(NULL, NULL);
#endif
#ifdef SHOES_WIN32
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrlEx);
#else
signal(SIGINT, shoes_sigint);
signal(SIGQUIT, shoes_sigint);
#endif
ruby_init();
shoes_ruby_init();
shoes_world = shoes_world_alloc();
#ifdef SHOES_QUARTZ
shoes_app_quartz_install();
shoes_slot_quartz_register();
if (PasteboardCreate(kPasteboardClipboard, &shoes_world->os.clip) != noErr) {
INFO("Apple Pasteboard create failed.\n");
}
#endif
#ifdef SHOES_WIN32
shoes_world->os.instance = inst;
shoes_world->os.style = style;
shoes_classex_init();
#endif
return SHOES_OK;
}
开发者ID:danorine,项目名称:shoes,代码行数:32,代码来源:world.c
示例10: main
int
main (
int argc,
char * * argv ) {
ruby_init();
rb_eval_string("print 'Hello World\n'");
return (0);
}
开发者ID:knaka,项目名称:src,代码行数:8,代码来源:libruby_test.c
示例11: InitializeInterpreter
void InitializeInterpreter()
{
ruby_init();
VALUE load_path = rb_gv_get("$LOAD_PATH");
rb_ary_push(load_path, rb_str_new2("."));
Init_armagetronad();
ruby_script("Armagetron Advanced");
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:8,代码来源:tRuby.cpp
示例12: rh_thread_proc
DWORD WINAPI rh_thread_proc(LPVOID lpParam)
{
DWORD dwWaitResult;
int must_exit = 0;
#ifdef DEBUG_THREADS
rh_log("RubyHoldem thread %d starting\n", GetCurrentThreadId());
#endif
ruby_init();
rh_safe_call("rh_load_init_script", (rh_function)rh_init_module, Qnil);
while (!must_exit)
{
#ifdef DEBUG_THREADS
rh_log("RubyHoldem thread %d waiting for event...\n", GetCurrentThreadId());
#endif
dwWaitResult = WaitForSingleObject(rh_event_job, INFINITE);
switch (dwWaitResult)
{
// Event object was signaled
case WAIT_OBJECT_0:
#ifdef DEBUG_THREADS
rh_log("Event occured in RubyHoldem thread %d\n", GetCurrentThreadId());
#endif
switch(rh_event_type)
{
case RH_EXIT:
#ifdef DEBUG_THREADS
rh_log("Event is RH_EXIT\n");
#endif
must_exit = 1;
break;
case RH_PROCESS_MESSAGE:
#ifdef DEBUG_THREADS
rh_log("Event is RH_PROCESS_MESSAGE\n");
#endif
rh_process_message();
break;
}
break;
// An error occurred
default:
rh_log("RubyHoldem thread: Wait error (%d)\n", GetLastError());
return 0;
}
rh_job_done();
}
ruby_finalize();
#ifdef DEBUG_THREADS
rh_log("RubyHoldem thread %d finished\n", GetCurrentThreadId());
#endif
return 1;
}
开发者ID:time,项目名称:rubyholdem,代码行数:58,代码来源:rubyholdem.cpp
示例13: main
int main( void ) {
ruby_init();
rb_Rargs_define_spec();
rb_Rargs_parse_spec();
rb_Rargs_macro_spec();
}
开发者ID:RidiculousPower,项目名称:Rargs,代码行数:9,代码来源:main_spec.c
示例14: main
int main(int argc, char **argv)
{
ruby_sysinit(&argc, &argv);
{
RUBY_INIT_STACK;
ruby_init();
return ruby_run_node(ruby_options(argc, argv));
}
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:9,代码来源:ruby.cpp
示例15: boot_vm
void boot_vm() {
_argc = 0;
_argv = &gorby;
ruby_sysinit(&_argc, &_argv);
{
RUBY_INIT_STACK;
ruby_init();
}
}
开发者ID:burke,项目名称:gorby,代码行数:9,代码来源:gorby.c
示例16: crb_init
void crb_init() {
int argc2 = 0;
char **argv2 = NULL;
ruby_sysinit(&argc2, &argv2);
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
}
开发者ID:windwiny,项目名称:c_embedd_ruby,代码行数:9,代码来源:c_call_rb.c
示例17: init_ruby
RUBY_GLOBAL_SETUP
void init_ruby(void)
{
RUBY_INIT_STACK;
ruby_init();
// FIXME: a Ruby error causes a segfault. This is because we aren't wrapping with rb_protect and re-raising in Node.
// rb_funcall(rb_cObject, rb_intern("puts"), 1, rb_str_new2("Ruby initialized from within node.js"));
}
开发者ID:sinisterchipmunk,项目名称:node.rb,代码行数:9,代码来源:ruby19.cpp
示例18: rpmrubyThread
static void * rpmrubyThread(void * _ruby)
{
rpmruby ruby = _ruby;
rpmzLog zlog = ruby->zlog;
int i;
Trace((zlog, "-- %s: running", __FUNCTION__));
_rpmruby_ruby_to_main(ruby, Qnil);
for (i = 0; i < 2; i++)
_rpmruby_ruby_to_main(ruby, Qnil);
{
VALUE variable_in_this_stack_frame;
uint8_t * b = ruby->stack;
uint8_t * e = b + ruby->nstack;
/* Start up the ruby interpreter. */
Trace((zlog, "-- %s: interpreter starting", __FUNCTION__));
ruby_sysinit(&ruby->ac, (char ***) &ruby->av);
ruby_bind_stack((VALUE *)b, (VALUE *)e);
ruby_init_stack(&variable_in_this_stack_frame);
ruby_init();
ruby_init_loadpath();
/* allow Ruby script to relay */
rb_define_module_function(rb_mKernel, "relay_from_ruby_to_main",
relay_from_ruby_to_main, 0);
Trace((zlog, "-- %s: interpreter started", __FUNCTION__));
/* Run file.rb arguments. */
for (i = 1; i < ruby->ac; i++) {
if (*ruby->av[i] == '-') /* XXX FIXME: skip options. */
continue;
Trace((zlog, "-- %s: require '%s' begin", __FUNCTION__, ruby->av[i]));
rpmrubyRunThreadFile(ruby, ruby->av[i], NULL);
Trace((zlog, "-- %s: require '%s' end", __FUNCTION__, ruby->av[i]));
}
/* Terminate the ruby interpreter. */
Trace((zlog, "-- %s: interpreter terminating", __FUNCTION__));
ruby_finalize();
ruby_cleanup(0);
Trace((zlog, "-- %s: interpreter terminated", __FUNCTION__));
}
/* Report interpreter end to main. */
ruby->more = 0;
/* Permit main thread to run without blocking. */
yarnRelease(ruby->main_coroutine_lock);
Trace((zlog, "-- %s: ended", __FUNCTION__));
return NULL;
}
开发者ID:hahnakane,项目名称:junkcode,代码行数:57,代码来源:rpmruby.c
示例19: main
int
main(int argc, char **argv)
{
int i;
int myargc;
char** myargv;
char script_path[MAXPATHLEN];
char* dump_val;
DWORD attr;
#ifdef HAVE_LOCALE_H
setlocale(LC_CTYPE, "");
#endif
dump_val = getenv("EXEFY_DUMP");
if (GetModuleFileName(NULL, script_path, MAXPATHLEN)) {
for (i = strlen(script_path) - 1; i >= 0; --i) {
if (*(script_path + i) == '.') {
*(script_path + i) = '\0';
break;
}
}
attr = GetFileAttributes(script_path);
if (attr == INVALID_FILE_ATTRIBUTES) {
printf("Script %s is missing!", script_path);
return -1;
}
// Let Ruby initialize program arguments
ruby_sysinit(&argc, &argv);
// Change arguments by inserting path to script file
// as second argument (first argument is always executable
// name) and copying arguments from command line after it.
myargc = argc + 1;
myargv = (char**)xmalloc(sizeof(char*) * (myargc + 1));
memset(myargv, 0, sizeof(char*) * (myargc + 1));
*myargv = *argv;
*(myargv + 1) = &script_path[0];
for (i = 1; i < argc; ++i) {
*(myargv + i + 1) = *(argv + i);
}
if (NULL != dump_val) {
dump_args(myargc, myargv);
}
{
RUBY_INIT_STACK;
ruby_init();
return ruby_run_node(ruby_options(myargc, myargv));
}
}
}
开发者ID:Azolo,项目名称:gem-exefy,代码行数:56,代码来源:gem_exe.c
示例20: init_ruby_parser
/* ---
*/
int init_ruby_parser(void)
{
ruby_init();
rb_define_global_function("get_row", get_row, 0);
rb_define_global_function("get_col", get_col, 0);
return ruby_interpreter = register_interpreter("Ruby",
NULL, execute_ruby);
}
开发者ID:UlricE,项目名称:SiagOffice,代码行数:12,代码来源:rubyi.c
注:本文中的ruby_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论