/** * ufo_plugin_manager_get_art: * @manager: A #UfoART * @name: Name of the algebraic reconstruction technique. * @error: return location for a GError or %NULL * * Load a #UfoART module and return an instance. The shared object name must * be * constructed as "*****@*****.**". * * Returns: (transfer full): (allow-none): #UfoART or %NULL if module cannot be found */ UfoART * ufo_plugin_manager_get_art(UfoPluginManager *manager, const gchar *name, GError **error) { g_return_val_if_fail (UFO_IS_PLUGIN_MANAGER (manager) && name != NULL, NULL); UfoART *art; gchar *module_name = transform_string ("libufoartsolver%s.so", name, NULL); gchar *func_name = transform_string ("ufo_%s_new", name, "_"); art = ufo_plugin_manager_get_plugin (manager, func_name, module_name, error); g_free (func_name); g_free (module_name); g_message ("UfoPluginManager: Created UfoART's %s-%p", name, (void*)art); return UFO_ART(art); }
/** * ufo_plugin_manager_get_projector: * @manager: A #UfoPluginManager * @name: Name of the projector. * @error: return location for a GError or %NULL * * Load a #UfoProjector module and return an instance. The shared object name must * be * constructed as "*****@*****.**". * * Returns: (transfer full): (allow-none): #UfoProjector or %NULL if module cannot be found */ UfoProjector * ufo_plugin_manager_get_projector(UfoPluginManager *manager, const gchar *name, GError **error) { g_return_val_if_fail (UFO_IS_PLUGIN_MANAGER (manager) && name != NULL, NULL); UfoProjector *projector; gchar *module_name = transform_string ("libufoartprojector%s.so", name, NULL); gchar *func_name = transform_string ("ufo_%s_projector_new", name, "_"); projector = ufo_plugin_manager_get_plugin (manager, func_name, module_name, error); g_free (func_name); g_free (module_name); g_message ("UfoPluginManager: Created UfoART's %s-%p", name, (void*)projector); return UFO_PROJECTOR(projector); }
/** * ufo_plugin_manager_get_regularizer: * @manager: A #UfoRegularizer * @name: Name of the regularizer. * @error: return location for a GError or %NULL * * Load a #UfoRegularizer module and return an instance. The shared object name must * be * constructed as "*****@*****.**". * * Returns: (transfer full): (allow-none): #UfoRegularizer or %NULL if module cannot be found */ UfoRegularizer * ufo_plugin_manager_get_regularizer(UfoPluginManager *manager, const gchar *name, GError **error) { g_return_val_if_fail (UFO_IS_PLUGIN_MANAGER (manager) && name != NULL, NULL); UfoRegularizer *regularizer; gchar *module_name = transform_string ("libufoartregularizer%s.so", name, NULL); gchar *func_name = transform_string ("ufo_%s_new", name, "_"); regularizer = ufo_plugin_manager_get_plugin (manager, func_name, module_name, error); g_free (func_name); g_free (module_name); g_message ("UfoPluginManager: Created UfoART's %s-%p", name, (void*)regularizer); return UFO_REGULARIZER(regularizer); }
/* catread - read a catalogue file */ static _CAT_CATALOG_T * catread (const char *name) { FILE *f; STRING_T *s = DScreate (), *t = DScreate (); _CAT_CATALOG_T *cat = 0; size_t z; _CAT_MESSAGE_T catmsg = { 0, 0, 0 }; int c; /* Open the catfile */ f = fopen (name, "r"); if (f == 0) return 0; /* could not open file */ setvbuf (f, 0, _IOFBF, 16384); while (DSlength (s = append_from_file (f, s)) > 0) { DSresize (s, DSlength (s) - 1, 0); /* We have a full line */ if (DSlength (s) > 0) { z = DSfind_first_not_of (s, " \t\f\v\r", 0, NPOS); DSremove (s, 0, z); z = DSfind_last_not_of (s, " \t\f\v\r", NPOS, NPOS); DSresize (s, z + 1, 0); } if (DSlength (s) > 0 && DSget_at (s, DSlength (s) - 1) == '\\') { /* continuation */ DSresize (s, DSlength (s) - 1, 0); } else { if (DSlength (s) > 0 && isdigit (DSget_at (s, 0))) { /* if it starts with a digit, assume it's a catalog line */ for (z = 0, catmsg.set_id = 0; isdigit (c = DSget_at (s, z)); catmsg.set_id = catmsg.set_id * 10 + (c - '0'), z++); z++; for (catmsg.msg_id = 0; isdigit (c = DSget_at (s, z)); catmsg.msg_id = catmsg.msg_id * 10 + (c - '0'), z++); z++; DSremove (s, 0, z); transform_string (t, s); if (catmsg.msg == 0) catmsg.msg = DScreate (); DSassign (catmsg.msg, t, 0, NPOS); if (cat == 0) { cat = malloc (sizeof (_CAT_CATALOG_T)); if (cat == 0) Nomemory (); cat->is_opened = 0; cat->msgs = _CATMSG_create (); } _CATMSG_append (cat->msgs, &catmsg, 1, 0); } DSresize (s, 0, 0); } } fclose (f); qsort (_CATMSG_base (cat->msgs), _CATMSG_length (cat->msgs), sizeof (_CAT_MESSAGE_T), catmsg_cmp); return cat; }