int main (int argc, char *argv[]) { int res; char *progname = argv[0]; if (argc >= 2 && argv[1] != NULL && 0 == strcmp (argv[1], "--hex")) { dump_as_hex = TRUE; argv++; argc--; } if (argc < 2) { fprintf (stderr, "Usage: %s [--hex] file stream stream ...\n\n", progname); fprintf (stderr, "For example, \"%s X A B C\" dumps the streem C " "from directory A/B from file X.\n", progname); return 1; } gsf_init (); res = test (argc, argv); gsf_shutdown (); return res; }
int main(int argc, char *argv[]) { char *uri = argv[1]; GsfDocMetaData *meta_data; GsfDocProp *prop; const GValue *value; const char *tmp; gsf_init(); meta_data = props_data_read(uri, NULL); prop = gsf_doc_meta_data_lookup(meta_data, GSF_META_NAME_TITLE); if (prop) { value = gsf_doc_prop_get_val(prop); tmp = g_value_get_string(value); fprintf(stderr, "str: %s\n", tmp); } g_object_unref(meta_data); gsf_shutdown(); exit(0); }
/* Decompress the iwb file; it is a zip file. */ static void decompress_iwb (gchar *iwbfile, gchar *project_tmp_dir) { GError *err = (GError *) NULL; GsfInput *input = (GsfInput *) NULL; GsfInfile *infile = (GsfInfile *) NULL; gsf_init (); input = gsf_input_stdio_new (iwbfile, &err); infile = gsf_infile_zip_new (input, &err); g_object_unref (G_OBJECT (input)); if (infile == NULL) { g_warning ("Error decompressing iwb file %s: %s", iwbfile, err->message); g_error_free (err); return; } decompress_infile (infile, project_tmp_dir); g_object_unref (G_OBJECT (infile)); gsf_shutdown (); }
void OMGSFInitialize(void) { if (!_GSFIsInitialized) { gsf_init(); _GSFIsInitialized = 1; } }
int main (int argc, char *argv[]) { int res; gsf_init (); res = test (argc, argv); gsf_shutdown (); return res; }
int main (int argc, char *argv[]) { int res; (void)argc; (void)argv; gsf_init (); res = test_xml_indent (); gsf_shutdown (); return res; }
int main (int argc, char *argv[]) { int res; if (argc != 3) { fprintf (stderr, "%s : inputdir outfile\n", argv [0]); return 1; } gsf_init (); res = test (argv); gsf_shutdown (); return res; }
int main (int argc, char **argv) { GOptionContext *option_ctx; set_resource_limits (); option_ctx = g_option_context_new ("Options"); g_option_context_add_main_entries (option_ctx, option_entries, NULL); /* FIXME: no translation domain */ if (!g_option_context_parse (option_ctx, &argc, &argv, NULL) || option_size == -1 || option_input_filename == NULL || option_output_filename == NULL) { g_printerr ("Invalid usage; type \"%s --help\" for instructions. All the options must be used.\n", argv[0]); exit (EXIT_FAILURE); } gsf_init (); read_thumbnail_and_write (option_input_filename, option_output_filename, option_size); return 0; }
/* Create the iwb file. */ static void create_iwb (gchar *zip_filename, gchar *working_dir, gchar *images_folder, gchar *content_filename) { GError *err = (GError *) NULL; GsfOutfile *gst_outfile = (GsfOutfile *) NULL; GsfOutput *gst_output = (GsfOutput *) NULL; gsf_init (); gst_output = gsf_output_stdio_new (zip_filename, &err); if (gst_output == NULL) { g_warning ("Error saving iwb: %s\n", err->message); g_error_free (err); return; } gst_outfile = gsf_outfile_zip_new (gst_output, &err); if (gst_outfile == NULL) { g_warning ("Error in gsf_outfile_zip_new: %s\n", err->message); g_error_free (err); return; } g_object_unref (G_OBJECT (gst_output)); add_folder_to_gst_outfile (gst_outfile, working_dir, images_folder); add_file_to_gst_outfile (gst_outfile, working_dir, content_filename); gsf_output_close ((GsfOutput *) gst_outfile); g_object_unref (G_OBJECT (gst_outfile)); gsf_shutdown (); }
bool XAP_App::initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue) { gsf_init(); // create application-wide resources that // are shared by everything. // init keyboard language (cannot be in the constructor as it // requires the platform code already initialised setKbdLanguage(_getKbdLanguage()); // HACK: for now, this works from XAP code // TODO: where should this really go? char * szPathname = g_build_filename(getUserPrivateDirectory(), "custom.dic", NULL); UT_ASSERT(szPathname); m_pDict = new XAP_Dictionary(szPathname); FREEP(szPathname); UT_return_val_if_fail(m_pDict,false); m_pDict->load(); clearIdTable(); // // Set Smooth Scrolling // bool bEnableSmooth = true; getPrefsValueBool(XAP_PREF_KEY_EnableSmoothScrolling, &bEnableSmooth); if(bEnableSmooth) setEnableSmoothScrolling(true); else setEnableSmoothScrolling(false); // // Need to initialize the random number generator. // UT_uint32 t = static_cast<UT_uint32>(time(NULL)); UT_srandom(t); // Input mode initilization, taken out of the XAP_Frame const char * szBindings = NULL; EV_EditBindingMap * pBindingMap = NULL; if ((getPrefsValue(szKeyBindingsKey, static_cast<const gchar**>(&szBindings))) && (szBindings) && (*szBindings)) pBindingMap = m_pApp->getBindingMap(szBindings); if (!pBindingMap) pBindingMap = m_pApp->getBindingMap(szKeyBindingsDefaultValue); UT_ASSERT(pBindingMap); if (!m_pInputModes) { m_pInputModes = new XAP_InputModes(); UT_ASSERT(m_pInputModes); } bool bResult; bResult = m_pInputModes->createInputMode(szBindings,pBindingMap); UT_ASSERT(bResult); bool bResult2; bResult2 = m_pInputModes->setCurrentMap(szBindings); UT_ASSERT(bResult2); // check if the prefs are set to use specific graphics class const char * pszGraphics = NULL; if(getPrefsValue(XAP_PREF_KEY_DefaultGraphics, &pszGraphics)) { UT_uint32 iID = 0; // please leave this in hex format (the constants are defined in gr_Graphics.h as hex) sscanf(pszGraphics,"%x", &iID); if(iID != 0) { UT_DEBUGMSG(("Graphics %d requested as default\n", iID)); // first of all, check that it is registered GR_GraphicsFactory * pGF = getGraphicsFactory(); UT_return_val_if_fail(pGF,false); if(pGF->isRegistered(iID)) { pGF->registerAsDefault(iID, true); pGF->registerAsDefault(iID, false); } else { UT_DEBUGMSG(("Graphics not loaded\n")); } } } m_pScriptLibrary = new UT_ScriptLibrary(); return true; }
int main (int argc, char **argv) { GOptionContext *ocontext; GError *error = NULL; char const *usage; char const *cmd; char const *me = (argv[0] ? argv[0] : "gsf"); g_set_prgname (me); gsf_init (); #if 0 bindtextdomain (GETTEXT_PACKAGE, gnm_locale_dir ()); textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); #endif usage = _("SUBCOMMAND ARCHIVE..."); ocontext = g_option_context_new (usage); g_option_context_add_main_entries (ocontext, gsf_options, GETTEXT_PACKAGE); g_option_context_parse (ocontext, &argc, &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, me); g_error_free (error); return 1; } if (show_version) { g_print (_("gsf version %d.%d.%d\n"), libgsf_major_version, libgsf_minor_version, libgsf_micro_version); return 0; } if (argc <= 1) { g_printerr (_("Usage: %s %s\n"), me, usage); return 1; } cmd = argv[1]; if (strcmp (cmd, "help") == 0) return gsf_help (argc - 2, argv + 2); if (strcmp (cmd, "list") == 0 || strcmp (cmd, "l") == 0) return gsf_list (argc - 2, argv + 2); if (strcmp (cmd, "cat") == 0) return gsf_dump (argc - 2, argv + 2, FALSE); if (strcmp (cmd, "dump") == 0) return gsf_dump (argc - 2, argv + 2, TRUE); if (strcmp (cmd, "props") == 0) return gsf_dump_props (argc - 2, argv + 2); if (strcmp (cmd, "listprops") == 0) return gsf_list_props (argc - 2, argv + 2); g_printerr (_("Run '%s help' to see a list subcommands.\n"), me); return 1; }
void libgoffice_init (void) { if (initialized++) return; #ifdef G_OS_WIN32 { gchar *dir; #define S(s) #s char const *module_name = "libgoffice-" S(GO_VERSION_EPOCH) "-" S(GO_VERSION_MAJOR) ".dll"; #undef S wchar_t *wc_module_name = g_utf8_to_utf16 (module_name, -1, NULL, NULL, NULL); HMODULE hmodule = GetModuleHandleW (wc_module_name); g_free (wc_module_name); dir = g_win32_get_package_installation_directory_of_module (hmodule); libgoffice_data_dir = g_build_filename (dir, "share", "goffice", GOFFICE_VERSION, NULL); libgoffice_icon_dir = g_build_filename (dir, "share", "pixmaps", "goffice", GOFFICE_VERSION, NULL); libgoffice_locale_dir = g_build_filename (dir, "share", "locale", NULL); libgoffice_lib_dir = g_build_filename (dir, "lib", "goffice", GOFFICE_VERSION, NULL); g_free (dir); } #else #ifdef GTKOSXAPPLICATION if (quartz_application_get_bundle_id ()) { gchar *dir; dir = quartz_application_get_resource_path (); libgoffice_data_dir = g_build_filename (dir, "share", "goffice", GOFFICE_VERSION, NULL); libgoffice_icon_dir = g_build_filename (dir, "share", "pixmaps", "goffice", GOFFICE_VERSION, NULL); libgoffice_locale_dir = g_build_filename (dir, "share", "locale", NULL); libgoffice_lib_dir = g_build_filename (dir, "lib", "goffice", GOFFICE_VERSION, NULL); g_free (dir); } #endif /* GTKOSXAPPLICATION */ #endif bindtextdomain (GETTEXT_PACKAGE, libgoffice_locale_dir); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); gsf_init (); _go_string_init (); _go_conf_init (); _go_fonts_init (); _go_math_init (); _go_rsm_init (); go_register_ui_files (); /* keep trigger happy linkers from leaving things out */ _go_plugin_services_init (); _gog_plugin_services_init (); #ifdef GOFFICE_WITH_GTK _goc_plugin_services_init (); install_icons (); #endif g_type_ensure (GO_TYPE_PLUGIN_LOADER_MODULE); g_type_ensure (GOG_TYPE_GRAPH); g_type_ensure (GOG_TYPE_CHART); g_type_ensure (GOG_TYPE_PLOT); g_type_ensure (GOG_TYPE_SERIES); g_type_ensure (GOG_TYPE_SERIES_ELEMENT); g_type_ensure (GOG_TYPE_LEGEND); g_type_ensure (GOG_TYPE_AXIS); g_type_ensure (GOG_TYPE_AXIS_LINE); g_type_ensure (GOG_TYPE_COLOR_SCALE); g_type_ensure (GOG_TYPE_LABEL); g_type_ensure (GOG_TYPE_GRID); g_type_ensure (GOG_TYPE_GRID_LINE); #ifdef GOFFICE_WITH_LASEM g_type_ensure (GOG_TYPE_EQUATION); #endif g_type_ensure (GOG_TYPE_ERROR_BAR); g_type_ensure (GOG_TYPE_REG_EQN); g_type_ensure (GOG_TYPE_SERIES_LABELS); g_type_ensure (GOG_TYPE_DATA_LABEL); g_type_ensure (GOG_TYPE_SERIES_LINES); g_type_ensure (GO_TYPE_DATA_SCALAR_VAL); g_type_ensure (GO_TYPE_DATA_SCALAR_STR); g_type_ensure (GOG_3D_BOX_TYPE); g_type_ensure (GO_TYPE_EMF); g_type_ensure (GO_TYPE_PIXBUF); g_type_ensure (GO_TYPE_SPECTRE); g_type_ensure (GO_TYPE_SVG); _gog_themes_init (); _go_number_format_init (); _go_currency_date_format_init (); _go_distributions_init (); initialized = TRUE; }
int vips_init( const char *argv0 ) { extern GType vips_system_get_type( void ); static gboolean started = FALSE; static gboolean done = FALSE; char *prgname; const char *prefix; const char *libdir; char name[256]; /* Two stage done handling: 'done' means we've completed, 'started' * means we're currently initialising. Use this to prevent recursive * invocation. */ if( done ) /* Called more than once, we succeeded, just return OK. */ return( 0 ); if( started ) /* Recursive invocation, something has broken horribly. * Hopefully the first init will handle it. */ return( 0 ); started = TRUE; #ifdef HAVE_TYPE_INIT /* Before glib 2.36 you have to call this on startup. */ g_type_init(); #endif /*HAVE_TYPE_INIT*/ /* Older glibs need this. */ #ifndef HAVE_THREAD_NEW if( !g_thread_supported() ) g_thread_init( NULL ); #endif /* This does an unsynchronised static hash table init on first call -- * we have to make sure we do this single-threaded. See: * https://github.com/openslide/openslide/issues/161 */ (void) g_get_language_names(); if( !vips__global_lock ) vips__global_lock = vips_g_mutex_new(); VIPS_SETSTR( vips__argv0, argv0 ); prgname = g_path_get_basename( argv0 ); g_set_prgname( prgname ); g_free( prgname ); vips__thread_profile_attach( "main" ); /* We can't do VIPS_GATE_START() until command-line processing * happens, since vips__thread_profile may not be set yet. Call * directly. */ vips__thread_gate_start( "init: main" ); vips__thread_gate_start( "init: startup" ); /* Try to discover our prefix. */ if( !(prefix = vips_guess_prefix( argv0, "VIPSHOME" )) || !(libdir = vips_guess_libdir( argv0, "VIPSHOME" )) ) return( -1 ); /* Get i18n .mo files from $VIPSHOME/share/locale/. */ vips_snprintf( name, 256, "%s" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S "locale", prefix ); bindtextdomain( GETTEXT_PACKAGE, name ); bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ); /* Default various settings from env. */ if( g_getenv( "VIPS_INFO" ) || g_getenv( "IM_INFO" ) ) vips_info_set( TRUE ); if( g_getenv( "VIPS_TRACE" ) ) vips_cache_set_trace( TRUE ); /* Register base vips types. */ (void) vips_image_get_type(); (void) vips_region_get_type(); vips__meta_init_types(); vips__interpolate_init(); im__format_init(); /* Start up operator cache. */ vips__cache_init(); /* Start up packages. */ (void) vips_system_get_type(); vips_arithmetic_operation_init(); vips_conversion_operation_init(); vips_create_operation_init(); vips_foreign_operation_init(); vips_resample_operation_init(); vips_colour_operation_init(); vips_histogram_operation_init(); vips_convolution_operation_init(); vips_freqfilt_operation_init(); vips_morphology_operation_init(); vips_draw_operation_init(); vips_mosaicing_operation_init(); /* Load any vips8 plugins from the vips libdir. Keep going, even if * some plugins fail to load. */ (void) vips_load_plugins( "%s/vips-plugins-%d.%d", libdir, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ); /* Load up any vips7 plugins in the vips libdir. We don't error on * failure, it's too annoying to have VIPS refuse to start because of * a broken plugin. */ if( im_load_plugins( "%s/vips-%d.%d", libdir, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ) ) { vips_warn( "vips_init", "%s", vips_error_buffer() ); vips_error_clear(); } /* Also load from libdir. This is old and slightly broken behaviour * :-( kept for back compat convenience. */ if( im_load_plugins( "%s", libdir ) ) { vips_warn( "vips_init", "%s", vips_error_buffer() ); vips_error_clear(); } /* Start up the buffer cache. */ vips__buffer_init(); /* Get the run-time compiler going. */ vips_vector_init(); #ifdef HAVE_GSF /* Use this for structured file write. */ gsf_init(); #endif /*HAVE_GSF*/ /* Register vips_shutdown(). This may well not get called and many * platforms don't support it anyway. */ #ifdef HAVE_ATEXIT atexit( vips_shutdown ); #endif /*HAVE_ATEXIT*/ #ifdef DEBUG_LEAK vips__image_pixels_quark = g_quark_from_static_string( "vips-image-pixels" ); #endif /*DEBUG_LEAK*/ done = TRUE; vips__thread_gate_stop( "init: startup" ); return( 0 ); }