int main (int argc, char const **argv) { GOErrorInfo *plugin_errs; GOCmdContext *cc; GOptionContext *ocontext; GError *error = NULL; const char *testname; /* No code before here, we need to init threads */ argv = gnm_pre_parse_init (argc, argv); ocontext = g_option_context_new (_("[testname]")); g_option_context_add_main_entries (ocontext, sstest_options, GETTEXT_PACKAGE); g_option_context_add_group (ocontext, gnm_get_option_group ()); g_option_context_parse (ocontext, &argc, (gchar ***)&argv, &error); g_option_context_free (ocontext); if (error) { g_printerr (_("%s\nRun '%s --help' to see a full list of available command line options.\n"), error->message, g_get_prgname ()); g_error_free (error); return 1; } if (sstest_show_version) { g_printerr (_("version '%s'\ndatadir := '%s'\nlibdir := '%s'\n"), GNM_VERSION_FULL, gnm_sys_data_dir (), gnm_sys_lib_dir ()); return 0; } gnm_init (); cc = cmd_context_stderr_new (); gnm_plugins_init (GO_CMD_CONTEXT (cc)); go_plugin_db_activate_plugin_list ( go_plugins_get_available_plugins (), &plugin_errs); if (plugin_errs) { /* FIXME: What do we want to do here? */ go_error_info_free (plugin_errs); } testname = argv[1]; if (!testname) testname = "all"; /* ---------------------------------------- */ MAYBE_DO ("test_insdel_rowcol_names") test_insdel_rowcol_names (); MAYBE_DO ("test_func_help") test_func_help (); MAYBE_DO ("test_go_data_cache_build_cache") test_go_data_cache_build_cache(); MAYBE_DO ("test_go_data_slicer_tuple_compare_to") test_go_data_slicer_tuple_compare_to (); /* ---------------------------------------- */ g_object_unref (cc); gnm_shutdown (); gnm_pre_parse_shutdown (); return 0; }
static gboolean gnumeric_init(GTypeModule *type_module, GList **registered_types, GError **error) { GOErrorInfo *plugin_errors = NULL; const gchar *argv[1]; command_context_register_type(type_module, registered_types); argv[0] = g_get_prgname(); gnm_pre_parse_init(1, argv); gnm_init(); command_context = command_context_new(); gnm_plugins_init(GO_CMD_CONTEXT(command_context)); go_plugin_db_activate_plugin_list(go_plugins_get_available_plugins(), &plugin_errors); if (plugin_errors) { g_set_error(error, CHUPA_DECOMPOSER_ERROR, CHUPA_DECOMPOSER_ERROR_INIT, "[decomposer][excel][init][error]" ": failed to initialize GOffice plugins: %s", go_error_info_peek_message(plugin_errors)); go_error_info_free(plugin_errors); return FALSE; } else { return TRUE; } }
int gnumeric_init() { gnumeric_init_ct++; if (gnumeric_init_ct>1) return 0; int res = 0; int argc = 1; char const *argv[] = { "gnumeric", NULL }; #ifdef OLD_GNUMERIC gchar const **args = go_shell_argv_to_glib_encoding (argc, argv); gnm_pre_parse_init (args[0]); gnm_common_init (FALSE); #else gnm_pre_parse_init (argc, argv); gnm_init (); #endif cc = cmd_context_stderr_new (); gnm_plugins_init (GO_CMD_CONTEXT (cc)); go_plugin_db_activate_plugin_list ( go_plugins_get_available_plugins (), &plugin_errs); atexit(gnumeric_atexit); return 0; }
int main (int argc, char const **argv) { GOErrorInfo *plugin_errs; int res = 0; GOCmdContext *cc; GOptionContext *ocontext; GError *error = NULL; /* No code before here, we need to init threads */ argv = gnm_pre_parse_init (argc, argv); ocontext = g_option_context_new (_("INFILE...")); g_option_context_add_main_entries (ocontext, ssindex_options, GETTEXT_PACKAGE); g_option_context_add_group (ocontext, gnm_get_option_group ()); g_option_context_parse (ocontext, &argc, (gchar ***)&argv, &error); g_option_context_free (ocontext); if (error) { g_printerr (_("%s\nRun '%s --help' to see a full list of available command line options.\n"), error->message, argv[0]); g_error_free (error); return 1; } if (ssindex_show_version) { g_printerr (_("ssindex version '%s'\ndatadir := '%s'\nlibdir := '%s'\n"), GNM_VERSION_FULL, gnm_sys_data_dir (), gnm_sys_lib_dir ()); return 0; } else if (!ssindex_run_indexer && !ssindex_list_mime_types) { g_printerr (_("Usage: %s [OPTION...] %s\n"), g_get_prgname (), _("INFILE...")); return 1; } gnm_init (); cc = gnm_cmd_context_stderr_new (); gnm_plugins_init (GO_CMD_CONTEXT (cc)); go_plugin_db_activate_plugin_list ( go_plugins_get_available_plugins (), &plugin_errs); if (plugin_errs) { /* FIXME: What do we want to do here? */ go_error_info_free (plugin_errs); } go_component_set_default_command_context (cc); if (ssindex_run_indexer) { GOIOContext *ioc = go_io_context_new (cc); int i; go_io_context_set_num_files (ioc, argc - 1); for (i = 1; i < argc; i++) { char const *file = argv[i]; go_io_context_processing_file (ioc, file); res |= ssindex (file, ioc); } g_object_unref (ioc); } else if (ssindex_list_mime_types) { GList *o; for (o = go_get_file_openers (); o != NULL ; o = o->next) { GSList const *mime = go_file_opener_get_mimes (o->data); for (; mime != NULL ; mime = mime->next) g_print ("%s\n", (char const *)mime->data); } } go_component_set_default_command_context (NULL); g_object_unref (cc); gnm_shutdown (); gnm_pre_parse_shutdown (); return res; }