void plugin_factory_collection::load_module(const filesystem::path& Path, const load_proxy_t LoadProxies)
{
	// K-3D modules now have the same extension on all platforms ...
	if(filesystem::extension(Path).lowercase().raw() != ".module")
		return;

	// If the module can be proxied for fast startup, do that and return ...
	if(LoadProxies == LOAD_PROXIES)
	{
		filesystem::path proxy_path = Path + ".proxy";
		if(filesystem::exists(proxy_path) && m_implementation->proxy_module(Path, proxy_path))
			return;
	}

	// OK, just load the module ...
	m_implementation->m_message_signal.emit(string_cast(boost::format(_("Loading plugin module %1%")) % Path.native_utf8_string().raw()));

	register_plugins_entry_point register_plugins = 0;
	os_load_module(Path, register_plugins);
	if(!register_plugins)
		return;

	// It's a K-3D module, all-right - give it a chance to register its plugins
	detail::plugin_registry registry(m_implementation->m_message_signal, m_implementation->m_factories);
	register_plugins(registry);
}
int main(int argc,char *argv[]){
   Network nw=Network();
   nw.addCompartment(0,"unknown");
   nw.addCompartment(1,"ex");
   nw.addCompartment(2,"pm");
   nw.addCompartment(3,"cy");
   nw.addNode(0, reaction , "R", 100 , 100 , 00, 00 ,0,2);     
   nw.addNode(1, compound , "c1", 100 , 100 , 300, 00 , 00,1);     
   nw.addNode(2, compound , "c2", 100 , 100 , 300, 300 , 00,1);     
   nw.addNode(3, compound , "c3", 100 , 100 , 00, 300 , 00,2);     
   nw.addNode(4, compound , "c4", 100 , 100 , 200, 300 , 00,2);     
   nw.addNode(5, compound , "c5", 100 , 100 , 400, 300 , 00,3);     
   nw.addEdge(0,1,substrate);
   nw.addEdge(0,2,substrate);
   nw.addEdge(0,3,product);
   nw.addEdge(0,4,inhibitor);
   nw.addEdge(0,5,catalyst);
   nw.dump();
   Plugins& pgs=register_plugins();
   Layouter l(nw,pgs);
   l.stepAddPlugins(0,P_force_adj,  P_torque_adj, P_distribute_edges, P_adjust_compartments, P_force_compartments);
   l.stepAddEndCondition(0,C_relForceDiff,0.0005);
   l.stepAddEndCondition(0,C_temp,10);
   l.stepAddPlugins(1,P_fix_compartments);
   l.stepAddEndCondition(1,C_iterations,1);
   l.stepAddPlugins(2,P_force_adj,  P_torque_adj,P_force_nadj, P_distribute_edges, P_adjust_compartments_fixed, P_force_compartments);
   l.stepAddEndCondition(2,C_relForceDiff,0.0005);
   l.stepAddEndCondition(2,C_temp,10);
   l.execute();
   printf("finished. [press key]\n");
   getc(stdin);
   return 0;
}
Example #3
0
static gboolean
register_plugins (GstPlugin * plugin, const gchar * path)
{
  GDir *dir;
  gchar *filename;
  const gchar *entry_name;
  gboolean ret = FALSE;

  GST_DEBUG ("Scanning director '%s' for frei0r plugins", path);

  dir = g_dir_open (path, 0, NULL);
  if (!dir)
    return FALSE;

  while ((entry_name = g_dir_read_name (dir))) {
    filename = g_build_filename (path, entry_name, NULL);
    if ((g_str_has_suffix (filename, G_MODULE_SUFFIX)
#ifdef GST_EXTRA_MODULE_SUFFIX
            || g_str_has_suffix (filename, GST_EXTRA_MODULE_SUFFIX)
#endif
        ) && g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
      ret |= register_plugin (plugin, filename);
    } else if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
      ret |= register_plugins (plugin, filename);
    }
    g_free (filename);
  }
  g_dir_close (dir);

  return ret;
}
static gboolean
register_plugins (GstPlugin * plugin, GHashTable * plugin_names,
    const gchar * path, const gchar * base_path)
{
  GDir *dir;
  gchar *filename;
  const gchar *entry_name;
  gboolean ret = TRUE;

  GST_DEBUG ("Scanning directory '%s' for frei0r plugins", path);

  dir = g_dir_open (path, 0, NULL);
  if (!dir)
    return FALSE;

  while ((entry_name = g_dir_read_name (dir))) {
    gchar *tmp, *vendor = NULL;
    gchar *hashtable_name;

    tmp = g_strdup (path + strlen (base_path));
    if (*tmp == G_DIR_SEPARATOR && *(tmp + 1))
      vendor = tmp + 1;
    else if (*tmp)
      vendor = tmp;

    if (vendor)
      hashtable_name = g_strconcat (vendor, "-", entry_name, NULL);
    else
      hashtable_name = g_strdup (entry_name);

    if (g_hash_table_lookup_extended (plugin_names, hashtable_name, NULL, NULL)) {
      g_free (hashtable_name);
      continue;
    }

    filename = g_build_filename (path, entry_name, NULL);
    if ((g_str_has_suffix (filename, G_MODULE_SUFFIX)
#ifdef GST_EXTRA_MODULE_SUFFIX
            || g_str_has_suffix (filename, GST_EXTRA_MODULE_SUFFIX)
#endif
        ) && g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
      gboolean this_ret;

      this_ret = register_plugin (plugin, vendor, filename);
      if (this_ret)
        g_hash_table_insert (plugin_names, g_strdup (hashtable_name), NULL);

      ret = ret && this_ret;
    } else if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
      ret = ret && register_plugins (plugin, plugin_names, filename, base_path);
    }
    g_free (filename);
    g_free (hashtable_name);
    g_free (tmp);
  }
  g_dir_close (dir);

  return ret;
}
Example #5
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  const gchar *homedir;
  gchar *path, *libdir_path;
  GHashTable *plugin_names;
  const gchar *frei0r_path;

  GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");

  gst_plugin_add_dependency_simple (plugin,
      "FREI0R_PATH:HOME/.frei0r-1/lib",
      LIBDIR "/frei0r-1:"
      "/usr/lib/frei0r-1:/usr/local/lib/frei0r-1:"
      "/usr/lib32/frei0r-1:/usr/local/lib32/frei0r-1:"
      "/usr/lib64/frei0r-1:/usr/local/lib64/frei0r-1",
      NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);

  plugin_names =
      g_hash_table_new_full ((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal,
      (GDestroyNotify) g_free, NULL);

  frei0r_path = g_getenv ("FREI0R_PATH");
  if (frei0r_path && *frei0r_path) {
    gchar **p, **paths = g_strsplit (frei0r_path, ":", -1);

    for (p = paths; *p; p++) {
      register_plugins (plugin, plugin_names, *p, *p);
    }

    g_strfreev (paths);
  } else {
#define register_plugins2(plugin, pn, p) register_plugins(plugin, pn, p, p)
    homedir = g_get_home_dir ();
    path = g_build_filename (homedir, ".frei0r-1", "lib", NULL);
    libdir_path = g_build_filename (LIBDIR, "frei0r-1", NULL);
    register_plugins2 (plugin, plugin_names, path);
    g_free (path);
    register_plugins2 (plugin, plugin_names, libdir_path);
    g_free (libdir_path);
    register_plugins2 (plugin, plugin_names, "/usr/local/lib/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/local/lib32/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib32/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/local/lib64/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib64/frei0r-1");
#undef register_plugins2
  }

  g_hash_table_unref (plugin_names);

  return TRUE;
}
Example #6
0
static gboolean
module_register(void)
{
    gchar *plugin_path, *libpath;
    gchar *dir;

    dir = gwy_find_self_dir("modules");
    g_return_val_if_fail(dir, FALSE);
    libpath = g_path_get_dirname(dir);
    g_free(dir);
    gwy_debug("plug-in library path is: %s", libpath);
    g_setenv("GWYPLUGINLIB", libpath, TRUE);
    /* Don't g_free(libpath), some systems don't like it. */

    plugin_path = gwy_find_self_dir("plugins");
    g_return_val_if_fail(plugin_path, FALSE);
    gwy_debug("plug-in path is: %s", plugin_path);

    dir = g_build_filename(plugin_path, "process", NULL);
    proc_plugins = register_plugins(NULL, dir, proc_register_plugins);
    g_free(dir);

    dir = g_build_filename(plugin_path, "file", NULL);
    file_plugins = register_plugins(NULL, dir, file_register_plugins);
    g_free(dir);

    create_user_plugin_dirs();

    dir = g_build_filename(gwy_get_user_dir(), "plugins", "process", NULL);
    proc_plugins = register_plugins(proc_plugins, dir, proc_register_plugins);
    g_free(dir);

    dir = g_build_filename(gwy_get_user_dir(), "plugins", "file", NULL);
    file_plugins = register_plugins(file_plugins, dir, file_register_plugins);
    g_free(dir);

    g_free(plugin_path);

    return TRUE;
}
Example #7
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  const gchar *homedir;
  gchar *path;

  GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");

  gst_plugin_add_dependency_simple (plugin,
      "HOME/.frei0r-1/lib",
      "/usr/lib/frei0r-1:/usr/local/lib/frei0r-1",
      NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);

  register_plugins (plugin, "/usr/lib/frei0r-1");
  register_plugins (plugin, "/usr/local/lib/frei0r-1");

  homedir = g_get_home_dir ();
  path = g_build_filename (homedir, ".frei0r-1", NULL);
  register_plugins (plugin, path);
  g_free (path);

  return TRUE;
}
Example #8
0
int main(int argc,char *argv[]){
   Network nw=Network();
   nw.addCompartment(0,"unknown");
   nw.addNode(0, reaction , "R1", 100 , 100 , 00, 00 , 00,00);     
   nw.addNode(1, compound , "c1", 100 , 100 , 300, 00 , 00,00);     
   nw.addNode(2, compound , "c2", 100 , 100 , 300, 300 , 00,00);     
   nw.addNode(3, compound , "c3", 100 , 100 , 00, 300 , 00,00);     
   nw.addNode(4, compound , "c4", 100 , 100 , 200, 300 , 00,00);     
   nw.addNode(5, compound , "c5", 100 , 100 , 400, 300 , 00,00);     
   nw.addNode(6, reaction , "R2", 100 , 100 , 300, -300 , 00,00);     
   nw.addNode(7, compound , "c6", 100 , 100 , 500, -300 , 00,00);     
   nw.addNode(8, compound , "c7", 100 , 100 , 500, 00 , 00,00);     
   nw.addNode(9, compound , "c8", 100 , 100 , 500, 200 , 00,00);     
   nw.addNode(10, compound , "c9", 100 , 100 , 300, 200 , 00,00);     
   
   nw.addEdge(0,1,substrate);
   nw.addEdge(0,2,substrate);
   nw.addEdge(0,3,product);
   nw.addEdge(0,4,inhibitor);
   nw.addEdge(0,5,catalyst);
   nw.addEdge(6,1,product);
   nw.addEdge(6,7,substrate);
   
   nw.addEdge(8,9,directed);
   nw.addEdge(9,10,directed);
   
   nw.dump();
   Plugins& pgs=register_plugins();
   Layouter l(nw,pgs);
   l.stepAddPlugins(0,P_force_adj,  P_torque_adj, P_distribute_edges, P_force_nadj, P_limit_mov);
   l.stepAddEndCondition(0,C_relForceDiff,0.0005);
   l.execute();
   printf("finished. [press key]\n");
   getc(stdin);
   return 0;
}
Example #9
0
/// Creates plugin factories at runtime
void register_plugins(k3d::iplugin_registry& Registry)
{
	register_plugins(k3d::share_path() / k3d::filesystem::generic_path("scripts/scripted_plugins"), Registry);
	register_plugins(k3d::share_path() / k3d::filesystem::generic_path("qtui/scripted_modes"), Registry);
	register_plugins(k3d::system::get_home_directory() / k3d::filesystem::generic_path(".k3d/scripted_plugins"), Registry);
}