int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { weechat_guile_plugin = plugin; guile_stdout = NULL; scm_init_guile (); guile_module_weechat = scm_c_define_module ("weechat", &weechat_guile_api_module_init, NULL); scm_c_use_module ("weechat"); weechat_guile_catch (scm_gc_protect_object, (void *)guile_module_weechat); guile_quiet = 1; script_init (weechat_guile_plugin, argc, argv, &weechat_guile_command_cb, &weechat_guile_completion_cb, &weechat_guile_infolist_cb, &weechat_guile_signal_debug_dump_cb, &weechat_guile_signal_buffer_closed_cb, &weechat_guile_signal_script_action_cb, &weechat_guile_load_cb); guile_quiet = 0; script_display_short_list (weechat_guile_plugin, guile_scripts); /* init ok */ return WEECHAT_RC_OK; }
static void test_scm_local_eval () { SCM result; scm_c_use_module ("ice-9 local-eval"); result = scm_local_eval (scm_list_3 (scm_from_latin1_symbol ("+"), scm_from_latin1_symbol ("x"), scm_from_latin1_symbol ("y")), scm_c_eval_string ("(let ((x 1) (y 2)) (the-environment))")); assert (scm_is_true (scm_equal_p (result, scm_from_signed_integer (3)))); }
int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) { struct t_plugin_script_init init; weechat_guile_plugin = plugin; guile_stdout = NULL; #ifdef HAVE_GUILE_GMP_MEMORY_FUNCTIONS /* * prevent guile to use its own gmp allocator, because it can conflict * with other plugins using GnuTLS like relay, which can crash WeeChat * on unload (or exit) */ scm_install_gmp_memory_functions = 0; #endif /* HAVE_GUILE_GMP_MEMORY_FUNCTIONS */ scm_init_guile (); guile_module_weechat = scm_c_define_module ("weechat", &weechat_guile_api_module_init, NULL); scm_c_use_module ("weechat"); weechat_guile_catch (scm_gc_protect_object, (void *)guile_module_weechat); init.callback_command = &weechat_guile_command_cb; init.callback_completion = &weechat_guile_completion_cb; init.callback_hdata = &weechat_guile_hdata_cb; init.callback_infolist = &weechat_guile_infolist_cb; init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb; init.callback_signal_debug_libs = &weechat_guile_signal_debug_libs_cb; init.callback_signal_buffer_closed = &weechat_guile_signal_buffer_closed_cb; init.callback_signal_script_action = &weechat_guile_signal_script_action_cb; init.callback_load_file = &weechat_guile_load_cb; guile_quiet = 1; plugin_script_init (weechat_guile_plugin, argc, argv, &init); guile_quiet = 0; plugin_script_display_short_list (weechat_guile_plugin, guile_scripts); /* init OK */ return WEECHAT_RC_OK; }
void init_guile(void) { guile_current_session = NULL; // Set up the hooks. scm_c_define_gsubr("write-to-stderr", 1, 0, 0, &scheme_write_to_stderr); scm_c_define("send-command-hook", scm_make_hook(scm_from_int(1))); scm_c_define_gsubr("send-command", 1, 0, 0, &scheme_send_command); scm_c_define("config-filename", scm_from_locale_string("mud.scm")); // TODO: Make this configurable. scm_c_define_gsubr("reload-config", 0, 0, 0, &scheme_load_config_file); scm_c_define_gsubr("search-backwards", 1, 0, 0, &scheme_search_backwards); // Load up regex support. scm_c_use_module("ice-9 regex"); // Load the config file. scheme_load_config_file(); }
static void inner_main (void *closure, int argc, char **argv) { SCM main_mod; char* fn; GError *error = NULL; scm_c_eval_string("(debug-set! stack 200000)"); main_mod = scm_c_resolve_module("gnucash main"); scm_set_current_module(main_mod); load_gnucash_modules(); /* Load the config before starting up the gui. This insures that * custom reports have been read into memory before the Reports * menu is created. */ load_system_config(); load_user_config(); /* Setting-up the report menu must come after the module loading but before the gui initialization. */ scm_c_use_module("gnucash report report-gnome"); scm_c_eval_string("(gnc:report-menu-setup)"); /* TODO: After some more guile-extraction, this should happen even before booting guile. */ gnc_main_gui_init(); gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL); scm_c_eval_string("(gnc:main)"); /* Install Price Quote Sources */ gnc_update_splash_screen(_("Checking Finance::Quote..."), GNC_SPLASH_PERCENTAGE_UNKNOWN); scm_c_use_module("gnucash price-quotes"); scm_c_eval_string("(gnc:price-quotes-install-sources)"); gnc_hook_run(HOOK_STARTUP, NULL); if (!nofile && (fn = get_file_to_load())) { gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN); gnc_file_open_file(fn); g_free(fn); } else if (gnc_gconf_get_bool("dialogs/new_user", "first_startup", &error) && !error) { gnc_destroy_splash_screen(); gnc_ui_new_user_dialog(); } gnc_destroy_splash_screen(); gnc_main_window_show_all_windows(); gnc_hook_run(HOOK_UI_POST_STARTUP, NULL); gnc_ui_start_event_loop(); gnc_hook_remove_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit); gnc_shutdown(0); return; }