void
GeneratorPersistenceH::doComposition(CIDL::CompositionDef_ptr composition)
{
	//
	// determine the componentDef and HomeDef
	//
	composition_ = composition;
	IR__::ComponentDef_var component = composition->ccm_component();
	IR__::HomeDef_var home = composition->ccm_home();

	//
	// determine lifecycle
	//
	CIDL::LifecycleCategory lc = composition->lifecycle();
	
	//
	// generate persistence for home
	//
	out << "\n\n";
	open_module(out, component, "");
	out << "\n\n";
	genHomePersistence(home, lc);
	close_module(out, component);
	out << "\n\n";

	//
	// generate persistence for component
	//
	open_module(out, component, "");
	out << "\n\n";
	genComponentPersistence(component, lc);
	close_module(out, component);
}
void 
GeneratorServantH::doComposition(CIDL::CompositionDef_ptr composition)
{
	//
	// determine the componentDef and HomeDef
	//
	component_ = composition->ccm_component();
	IR__::HomeDef_var home = composition->ccm_home();

	//
	// determine lifecycle
	//
	CIDL::LifecycleCategory lc = composition->lifecycle();

	//
	// generate home
	//

	// achtung: wenn kein modul, sollte vielleicht Servant_ der prefix für alle servants sein?
	open_module(out, component_, "SERVANT_");
	out << "\n\n";

	genHomeServantBegin(home, lc);
	genHomeServant(home, lc);
	out.unindent();
	out << "};\n\n\n";

	close_module(out, component_);

	//
	// entry point
	//
	out << "\n//\n// entry point\n//\n";
	out << "extern \"C\" {\n";
	out << "#ifdef _WIN32\n";
	out << "__declspec(dllexport)\n";
	out << "#else\n";
	out << "#endif\n";
	out << "Qedo::HomeServantBase* create_" << home->name() << "S(void);\n";
	out << "}\n\n";

	//
	// generate component
	//
	open_module(out, component_, "SERVANT_");
	out << "\n\n";

	genContextServant(component_, lc);
	genComponentServant(component_, lc);

	close_module(out, component_);

}
Beispiel #3
0
static void
load_dxe (void)
{
  libdm = open_module (djimport_path);

  dm_get_version_ptr = get_symbol (libdm, "dm_get_version");
  dm_get_version_s_ptr = get_symbol (libdm, "dm_get_version_s");
  dm_set_gauge_ptr = get_symbol (libdm, "dm_set_gauge");

  dm_open_ptr = get_symbol (libdm, "dm_open");
  dm_fdopen_ptr = get_symbol (libdm, "dm_fdopen");
  dm_reopen_ptr = get_symbol (libdm, "dm_reopen");
  dm_close_ptr = get_symbol (libdm, "dm_close");
  dm_nfo_ptr = get_symbol (libdm, "dm_nfo");

  dm_disc_read_ptr = get_symbol (libdm, "dm_disc_read");
  dm_disc_write_ptr = get_symbol (libdm, "dm_disc_write");

  dm_read_ptr = get_symbol (libdm, "dm_read");
  dm_write_ptr = get_symbol (libdm, "dm_write");

  dm_toc_read_ptr = get_symbol (libdm, "dm_toc_read");
  dm_toc_write_ptr = get_symbol (libdm, "dm_toc_write");

  dm_cue_read_ptr = get_symbol (libdm, "dm_cue_read");
  dm_cue_write_ptr = get_symbol (libdm, "dm_cue_write");

  dm_rip_ptr = get_symbol (libdm, "dm_rip");
}
Beispiel #4
0
	bool iat_manager::hook(const wchar_t* module_name, const char* dll_name, const char* api_name, uintptr_t* old_function_ptr, uintptr_t new_function)
	{
		if (!open_module(module_name))
			return false;

		return hook(dll_name, api_name, old_function_ptr, new_function);
	}
Beispiel #5
0
static void open_modules_for_path (const char * path)
{
    DIR * folder = opendir (path);
    if (! folder)
    {
        fprintf (stderr, "ladspa: Failed to read folder %s: %s\n", path, strerror (errno));
        return;
    }

    struct dirent * entry;
    while ((entry = readdir (folder)))
    {
        if (entry->d_name[0] == '.' || ! str_has_suffix_nocase (entry->d_name, G_MODULE_SUFFIX))
            continue;

        char filename[strlen (path) + strlen (entry->d_name) + 2];
        snprintf (filename, sizeof filename, "%s" G_DIR_SEPARATOR_S "%s", path, entry->d_name);

        void * handle = open_module (filename);
        if (handle)
            index_append (modules, handle);
    }

    closedir (folder);
}
Beispiel #6
0
static void open_modules_for_path (const char * path)
{
    GDir * folder = g_dir_open (path, 0, NULL);
    if (! folder)
    {
        fprintf (stderr, "ladspa: Failed to read folder %s: %s\n", path, strerror (errno));
        return;
    }

    const char * name;
    while ((name = g_dir_read_name (folder)))
    {
        if (! str_has_suffix_nocase (name, G_MODULE_SUFFIX))
            continue;

        char * filename = filename_build (path, name);
        void * handle = open_module (filename);

        if (handle)
            index_insert (modules, -1, handle);

        str_unref (filename);
    }

    g_dir_close (folder);
}
void 
GeneratorPersistenceH::doAbstractStorageHome(IR__::AbstractStorageHomeDef_ptr abs_storagehome)
{
	IR__::AbstractStorageTypeDef_var abs_storagetype = abs_storagehome->managed_abstract_storagetype();

	// achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein?
	out << "\n\n";
	open_module(out, abs_storagetype, "");
	out << "\n\n";

	out << "class " << std::string(abs_storagetype->name()) << ";\n";
	out << "class " << std::string(abs_storagetype->name()) << "Ref;\n\n";

	std::string strClassName = std::string(abs_storagehome->name());
	strActBasename_ = strClassName;

	out << "class " << strClassName << "\n";
	out.indent();
	
	IR__::InterfaceDefSeq_var abs_storagehome_seq = abs_storagehome->base_abstract_storagehomes();
	if(abs_storagehome_seq->length()==0)
		out << ": public virtual CosPersistentState::StorageHomeBase\n";
	else
		for(CORBA::ULong i=0; i<abs_storagehome_seq->length(); i++)
		{
			i==0 ? out << ": " : out << ", ";
			out << "public virtual " << ((*abs_storagehome_seq)[i])->name() << "\n";
		};

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    //out << strClassName << "();\n";
	//out << "~" << strClassName << "();\n";

	bAbstract_ = true;
	handleAttribute(abs_storagehome);
	handleOperation(abs_storagehome);
	handleFactory(abs_storagehome);
	handleKey(abs_storagehome);
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();
	out << "};\n\n";
	out << "#ifdef ORBACUS_ORB\n";
	out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_var;\n";
	out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_out;\n";
	out << "#endif\n";
    out << "#ifdef MICO_ORB\n";
	out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_var;\n";
	out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_out;\n";
	out << "#endif\n";
	out << "\n\n";

	close_module(out, abs_storagetype);
}
Beispiel #8
0
    Module* open_module(STATE, CallFrame* call_frame, Symbol* name) {
      Module* under = G(object);

      if(!call_frame->static_scope()->nil_p()) {
        under = call_frame->static_scope()->module();
      }

      return open_module(state, call_frame, under, name);
    }
Beispiel #9
0
    Module* open_module(STATE, GCToken gct, CallFrame* call_frame, Symbol* name) {
      Module* under = G(object);

      call_frame = call_frame->top_ruby_frame();

      if(!call_frame->constant_scope()->nil_p()) {
        under = call_frame->constant_scope()->module();
      }

      return open_module(state, gct, call_frame, under, name);
    }
Beispiel #10
0
    Module* open_module(STATE, Symbol* name) {
      Module* under = G(object);

      CallFrame* call_frame = state->vm()->get_ruby_frame();

      if(!call_frame->lexical_scope()->nil_p()) {
        under = call_frame->lexical_scope()->module();
      }

      return open_module(state, under, name);
    }
void
GeneratorLIDL::doComposition(CIDL::CompositionDef_ptr composition)
{
	//
	// determin the lifecycle
	//
	CIDL::LifecycleCategory lc = composition->lifecycle();

	//
	// detemine the component
	//
	component_ = composition->ccm_component();

	//
	// generate
	//

	open_module(component_);
	//
	// container specific context interface 
	//
	out << "//\n// container interface for the context for " << component_->id() << "\n//\n";
	out << "local interface CCM_" << component_->name() << "_ContextImpl : ";
	out << "CCM_" << component_->name() << "_Context,\n";

	switch(lc) {
	case (CIDL::lc_Session) : 
		{
			out << "::Components::SessionContext";
			break;
		}
	case (CIDL::lc_Entity) :
	case (CIDL::lc_Process) :
		{
			out << "::Components::EntityContext";
			break;
		}
	case (CIDL::lc_Extension) :
		{
			out << "::Components::ExtensionContext";
			break;
		}
	default:
		{
			//unsupported lifecycle category
			std::cerr << "unsupported lifecycle category" << std::endl;
		}
	}

	out << "\n{ };\n\n";

	close_module(component_);
}
Beispiel #12
0
void
kernel_mod_init2(void)
{
    struct module *shell;

    fs = (struct fs_module *)open_module("fs", SYS_VER);

    /* Open the shell; this should be enough for it to get a toe-hold
       in the system :) */
    shell = open_module("shell", SYS_VER);
    if(shell == NULL)
    {
	kprintf("Can't open shell.module; stopping\n");
	/* No point going any further. */
	while(1) ;
    }
#if 0
    /* Don't ever close the shell. */
    close_module(shell);
#endif
    collect_shell_cmds();
}
Beispiel #13
0
/** Get plugin description.
 * @param plugin_name name of the plugin
 * @return plugin description tring
 * @throw PluginLoadException thrown if opening the plugin fails
 */
std::string
PluginLoader::get_description(const char *plugin_name)
{
  Module *module = open_module(plugin_name);

  if ( ! module->has_symbol("plugin_description") ) {
    throw PluginLoadException(plugin_name, "Symbol 'plugin_description' not found. Forgot PLUGIN_DESCRIPTION?");
  }

  PluginDescriptionFunc pdf = (PluginDescriptionFunc)module->get_symbol("plugin_description");
  std::string rv = pdf();
  d->mm->close_module(module);

  return rv;
}
void 
GeneratorPersistenceH::doAbstractStorageType(IR__::AbstractStorageTypeDef_ptr abs_storagetype)
{
	out << "\n\n";
	open_module(out, abs_storagetype, "");
	out << "\n\n";

	// generate normal class
	genAbstractStorageTypeBody(abs_storagetype/*, false*/);
	// generate ref class
	// Don't known how to build a Ref-class :-(
	//genAbstractStorageTypeBody(abs_storagetype, true);
	genAbstractRefBody(abs_storagetype); // Hopefully it's right!

	close_module(out, abs_storagetype);
}
void 
GeneratorPersistenceH::doStorageType(IR__::StorageTypeDef_ptr storagetype)
{
	// achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein?
	out << "\n\n";	
	open_module(out, storagetype, "");
	out << "\n\n";

	// generate normal class
	genStorageTypeBody(storagetype/*, false*/);
	// generate ref class
	// Don't known how to build a Ref-class :-(
	//genStorageTypeBody(storagetype, true);
	genRefBody(storagetype); // Hopefully it's right!

	close_module(out, storagetype);
}
void 
GeneratorLIDL::generate_component(IR__::ComponentDef* a_component, CIDL::LifecycleCategory lc)
 {
	// base component
	IR__::ComponentDef_var base_component = a_component->base_component();
	if ( ! CORBA::is_nil(base_component)) {
		this->generate_component(base_component, lc);

	}
	//
	// generate
	//

	open_module(a_component);
	//
	// container specific context interface 
	//
	out << "//\n// container interface for the context for " << a_component->id() << "\n//\n";
	out << "local interface CCM_" << a_component->name() << "_ContextImpl : ";
	out << "CCM_" << a_component->name() << "_Context,\n";

	switch(lc) {
	case (CIDL::lc_Session) : 
		{
			out << "::Components::SessionContext";
			break;
		}
	case (CIDL::lc_Extension) :
		{
			out << "::Components::ExtensionContext";
			break;
		}
	default:
		{
			//unsupported lifecycle category
			std::cerr << "unsupported lifecycle category" << std::endl;
		}
	}

	out << "\n{ };\n\n";

	close_module(a_component);

}
void 
GeneratorServantH::generate_component(IR__::ComponentDef* a_component, CIDL::LifecycleCategory lc ) {

	// base component
	IR__::ComponentDef_var base_component = a_component->base_component();
	if ( ! CORBA::is_nil(base_component)) {
		this->generate_component(base_component, lc);
	}

	//
	// generate component
	//
	open_module(out, a_component, "SERVANT_");
	out << "\n\n";

	genContextServant(a_component, lc);
	genComponentServant(a_component, lc);

	close_module(out, a_component);

}
void
GeneratorServantC::doComposition(CIDL::CompositionDef_ptr composition)
{
	composition_ = CIDL::CompositionDef::_duplicate(composition);
	filename_ = mapAbsoluteName(composition->ccm_component(), "_");
	filename_.append("_SERVANT");
	string header_name = filename_ + ".h";
	filename_.append(".cpp");
	out.open(filename_.c_str());


	out << "//\n";
	out << "// generated by Qedo\n";
	out << "//\n\n";
	out << "#include \"" << header_name << "\"\n";
	out << "#include \"Output.h\"\n\n\n";

	// achtung: wenn kein modul, sollte vielleicht Servant_ der prefix für alle servants sein?
	open_module(out, composition->ccm_component(), "Servants_");
	out << "\n\n";

	doComponent(composition->ccm_component());
	doHome(composition->ccm_home());

	close_module(out, composition->ccm_component());


	//
	// entry point
	//
	out << "\n\n//\n// entry point\n//\n";
	out << "Qedo::HomeServantBase*\n";
	out << "create_" << composition->ccm_home()->name() << "S(void)\n{\n";
	out.indent();
	out << "return new " << mapFullNameServant(composition->ccm_home()) << "_servant();\n";
	out.unindent();
	out << "}\n\n";

	out.close();
}
Beispiel #19
0
/** Load a specific plugin
 * The plugin loader is clever and guarantees that every plugin is only
 * loaded once (as long as you use only one instance of the PluginLoader,
 * using multiple instances is discouraged. If you try to open a plugin
 * a second time it will return the
 * very same instance that it returned on previous load()s.
 * @param plugin_name The name of the plugin to be loaded, the plugin name has to
 * correspond to a plugin name and the name of the shared object that will
 * be opened for this plugin (for instance on Linux systems opening the
 * plugin test_plugin will look for plugin_base_dir/test_plugin.so)
 * @return Returns a pointer to the opened plugin.  Do not under any
 * circumstances delete this object, use unload() instead! Since the delete
 * operator could be overloaded this would result in memory chaos.
 * @exception PluginLoadException thrown if plugin could not be loaded
 * @exception ModuleOpenException passed along from module manager
 */
Plugin *
PluginLoader::load(const char *plugin_name)
{
  std::string pn = plugin_name;

  if ( d->name_plugin_map.find(pn) != d->name_plugin_map.end() ) {
    return d->name_plugin_map[pn];
  }

  try {
    Module *module = open_module(plugin_name);
    Plugin *p = create_instance(plugin_name, module);

    d->plugin_module_map[p] = module;
    d->name_plugin_map[pn]  = p;
    d->plugin_name_map[p]   = pn;

    return p;
  } catch (PluginLoadException &e) {
    throw;
  }
}
Beispiel #20
0
IMPLEMENT FIASCO_INIT
char const *
Loader::copy_module (const char * const path,
		     Multiboot_module *module,
                     Address *load_addr,
		     bool quiet)
{
  FILE *fp;
  struct stat s;

  if ((fp = open_module (path)) == NULL)
    return errors[0];

  if (fstat (fileno (fp), &s) == -1)
    {
      fclose (fp);
      return errors[0];
    }

  *load_addr -= s.st_size;
  *load_addr &= Config::PAGE_MASK;	// this may not be necessary

  if (fread ((void *)(phys_base + *load_addr), s.st_size, 1, fp) != 1)
    {
      fclose (fp);
      return errors[7];
    }

  module->mod_start = *load_addr;
  module->mod_end   = *load_addr + s.st_size;

  if (! quiet)
    printf ("Copying Module 0x" L4_PTR_FMT "-0x" L4_PTR_FMT " [%s]\n",
	    (Address)module->mod_start, (Address)module->mod_end, path);

  fclose (fp);
  return 0;
}
Beispiel #21
0
static value loader_loadmodule( value mname, value vthis ) {
	value o = val_this();
	value cache;
	val_check(o,object);
	val_check(mname,string);
	val_check(vthis,object);
	cache = val_field(o,id_cache);
	val_check(cache,object);
	{
		reader r;
		readp p;
		neko_module *m;
		neko_vm *vm = NEKO_VM();
		field mid = val_id(val_string(mname));
		value mv = val_field(cache,mid);
		if( val_is_kind(mv,neko_kind_module) ) {
			m = (neko_module*)val_data(mv);
			return m->exports;
		}
		open_module(val_field(o,id_path),val_string(mname),&r,&p);
		if( vm->fstats ) vm->fstats(vm,"neko_read_module",1);
		m = neko_read_module(r,p,vthis);
		if( vm->fstats ) vm->fstats(vm,"neko_read_module",0);
		close_module(p);
		if( m == NULL ) {
			buffer b = alloc_buffer("Invalid module : ");
			val_buffer(b,mname);
			bfailure(b);
		}
		m->name = alloc_string(val_string(mname));
		mv = alloc_abstract(neko_kind_module,m);
		alloc_field(cache,mid,mv);
		if( vm->fstats ) vm->fstats(vm,val_string(mname),1);
		neko_vm_execute(neko_vm_current(),m);
		if( vm->fstats ) vm->fstats(vm,val_string(mname),0);
		return m->exports;
	}
}
void
GeneratorBusinessH::doComposition(CIDL::CompositionDef_ptr composition)
{
	CORBA::ULong i ;
	composition_ = CIDL::CompositionDef::_duplicate(composition);
	filename_ = "";

	//
	// determine whether defined in module (needed for namespace opening and closing)
	//
	IR__::Contained_ptr module_def = 0;
	string id = composition->id();
	string::size_type pos = id.find_last_of("/");
	if(pos != string::npos)
	{
		id.replace(pos, string::npos, ":1.0");
		module_def = repository_->lookup_id(id.c_str());
		filename_ = getAbsoluteName(module_def, "_");
		filename_.append("_");
	}
	filename_.append(composition->name());
	string header_name = filename_;
	filename_.append(".h");
	
	//
	// parse for user sections and write header in the output file
	//
	out.initUserSections(filename_.c_str());
	out.open(filename_.c_str());
	out << "//\n";
	out << "// generated by Qedo\n";
	out << "//\n\n";
	out << "#ifndef _" << header_name << "_H_\n";
	out << "#define _" << header_name << "_H_\n\n\n"; 
	out.insertUserSection("file_pre", 2);
	out << "#include <CORBA.h>\n";
	out << "#include \"" << file_prefix_ << "_BUSINESS.h\"\n";
	if(composition->lifecycle()==CIDL::lc_Entity || composition->lifecycle()==CIDL::lc_Process)
	    out << "#include \"" << file_prefix_ << "_PSS.h\"\n";
	out << "#include \"valuetypes.h\"\n";
	out << "#include \"RefCountBase.h\"\n";
	if(composition->lifecycle()==CIDL::lc_Entity)
		out << "#include \"CCMContext.h\"\n";
	out << "#include <string>\n\n\n";
	out.insertUserSection("file_post", 2);

	if(module_def)
	{
		open_module(out, module_def);
		out << "namespace " << mapName(module_def) << "\n{\n";
		out.indent();
	}

	CIDL::SegmentDefSeq_var segment_seq = composition->executor_def()->segments();
	std::string executor_name = composition->executor_def()->name();
	std::string executor_class_name = mapName(executor_name);
	std::string executor_locator_name = composition->name();
	std::string executor_locator_class_name = mapName(executor_locator_name);
	std::string home_name = composition->home_executor()->name();
	std::string home_class_name = mapName(home_name);

	//
	// executor
	//
	out << "\n//\n// executor\n//\n";
	out << "class " << executor_class_name << "\n";
	out.indent();
	out << ": public virtual CORBA::LocalObject\n";
	out << ", public virtual " << mapScopeName(composition) << "::CCM_" << executor_name << "\n";
	out.unindent(); out.unindent();
	out << "#ifndef MICO_ORB\n";
	out.indent(); out.indent();
	out << ", public virtual Qedo::RefCountLocalObject\n";
	out.unindent(); out.unindent();
	out << "#endif\n";
	out.indent(); out.indent();
	out.insertUserSection(string("INHERITANCE_") + executor_name, 0);
	out.unindent();
	out << "{\n\n";
	out << "private:\n\n";
	out.indent();
    out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n";
	out.unindent();
	out << "public:\n\n";
	out.indent();
	switch(composition->lifecycle())
	{
	case CIDL::lc_Session :
		out << executor_class_name << "();\n";
		break;
	case CIDL::lc_Entity :
		out << executor_class_name << "(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey);\n";
		break;
	default :
		out << "// not supported lifecycle\n";
	}
	out << "virtual ~" << executor_class_name << "();\n\n";
	out << "void set_context(" << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_ptr context)\n";
	out << "    throw (CORBA::SystemException, Components::CCMException);\n\n";
    out << "void configuration_complete()\n";
	out << "    throw (CORBA::SystemException, Components::InvalidConfiguration);\n\n";
    out << "void remove()\n";
	out << "    throw (CORBA::SystemException);\n\n";
	if(composition->lifecycle() == CIDL::lc_Service)
	{
		out << "void preinvoke(const char* comp_id, const char* operation)\n";
		out << "    throw (CORBA::SystemException);\n\n";
		out << "void postinvoke(const char* comp_id, const char* operation)\n";
		out << "    throw (CORBA::SystemException);\n\n";
	}
	need_push_ = true;
	doComponent(composition->ccm_component());
	out.unindent();
	out << "\n";
	out.insertUserSection(executor_name);
	out << "};\n\n";

	//
	// segment
	//
	for (i = 0; i < segment_seq->length(); i++)
	{
		std::string segment_name = segment_seq[i]->name();
		std::string segment_class_name = mapName(segment_name);
		out << "\n//\n// segment\n//\n";
		out << "class " << segment_class_name << "\n";
		out.indent();
		out << ": public virtual CORBA::LocalObject\n";
		out << ", public virtual " << mapScopeName(composition) << "::CCM_" << segment_name << "\n";
		out.unindent(); out.unindent();
		out << "#ifndef MICO_ORB\n";
		out.indent(); out.indent();
		out << ", public virtual Qedo::RefCountLocalObject\n";
		out.unindent(); out.unindent();
		out << "#endif\n";
		out.indent(); out.indent();
		out.insertUserSection(string("INHERITANCE_") + segment_name, 0);
		out.unindent();
		out << "{\n\n";
		out << "private:\n\n";
		out.indent();
		out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n";
		out.unindent();
		out << "public:\n\n";
		out.indent();
		out << segment_class_name << "();\n";
		out << "virtual ~" << segment_class_name << "();\n\n";
		out << "void set_context(" << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_ptr context)\n";
		out << "    throw (CORBA::SystemException, Components::CCMException);\n\n";
		out << "void configuration_complete()\n";
		out << "    throw (CORBA::SystemException, Components::InvalidConfiguration);\n\n";
		
		//
		// for each implemented facet
		//
		IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets();
		handled_interfaces_.clear();
		for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++)
		{
			IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provided_seq[ii]->interface_type());
			if( !CORBA::is_nil(intf) )
			{
				doInterface(intf);
			}
		}
		out.unindent();
		out << "\n";
		out.insertUserSection(segment_name);
		out << "};\n\n";
	}

	//
	// executor locator
	//
	out << "\n//\n// executor locator\n//\n";
	out << "class " << executor_locator_class_name << "\n";
	out.indent();
	out << ": public virtual CORBA::LocalObject\n";
	//
	// determin the lifecycle
	//
	CIDL::LifecycleCategory lc = composition->lifecycle();
	switch(lc) {
		case (CIDL::lc_Service) :
			{
				// this is a prelimenary version of container service
				out << ", public virtual Components::CCMService\n";

			}
		case (CIDL::lc_Session) : 
			{
				out << ", public virtual Components::SessionExecutorLocator\n";
				break;
			}
        case (CIDL::lc_Entity) :
            {
		        out << ", public virtual Components::EntityExecutorLocator\n";
		        break;
            }
		case (CIDL::lc_Extension) :
			{
				out << ", public virtual Components::ExtensionExecutorLocator\n";
				break;
			}
		default:
			{
				//unsupported lifecycle category
			}
		}

	out.unindent(); out.unindent();
	out << "#ifndef MICO_ORB\n";
	out.indent(); out.indent();
	out << ", public virtual Qedo::RefCountLocalObject\n";
	out.unindent(); out.unindent();
	out << "#endif\n";
	out.indent(); out.indent();

	out.insertUserSection(string("INHERITANCE_") + executor_locator_name, 0);
	out.unindent();
	out << "{\n\n";
	out << "private:\n\n";
	out.indent();
    out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n";
	out << mapName(composition->executor_def()) << "* component_;\n\n";
	for (i = 0; i < segment_seq->length(); i++)	{
		out << mapName(segment_seq[i]) << "* " << segment_seq[i]->name() << "_;\n\n";
	}
	out.unindent();
	out << "public:\n\n";
	out.indent();
	switch(composition->lifecycle())
	{
	case CIDL::lc_Session :
		out << executor_locator_class_name << "();\n";
		break;
	case CIDL::lc_Entity :
		out << executor_locator_class_name << "(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey);\n";
		break;
	default :
		out << "// not supported lifecycle\n";
	}
    out << "virtual ~" << executor_locator_class_name << "();\n\n";
	IR__::InterfaceDef_ptr executor_locator;
	switch(lc) {
		case (CIDL::lc_Service) :
			{
				//prelimenary version of container services
				executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/CCMService:1.0"));
				break;
			}
		case (CIDL::lc_Session) : 
			{
				executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/SessionExecutorLocator:1.0"));
				break;
			}
        case (CIDL::lc_Entity) : 
			{
				executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/EntityExecutorLocator:1.0"));
		        break;
			}
		case (CIDL::lc_Extension) :
			{
				executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/ExtensionExecutorLocator:1.0"));
				break;
			}
		default:
			{
				//unsupported lifecycle category
			}
	}

	doInterface(executor_locator);
	out.unindent();
	out << "\n";
	out.insertUserSection(executor_locator_name);
	out << "};\n\n";

	//
	// home executor
	//
	out << "\n//\n// home executor\n//\n";
	out << "class " << home_class_name << "\n";
	out.indent();
	out << ": public virtual CORBA::LocalObject\n";
	out << ", public virtual " << getLocalName(composition->ccm_home()) << "\n";
	out.unindent(); out.unindent();
	out << "#ifndef MICO_ORB\n";
	out.indent(); out.indent();
	out << ", public virtual Qedo::RefCountLocalObject\n";
	out.unindent(); out.unindent();
	out << "#endif\n";
	out.indent(); out.indent();
	out.insertUserSection(std::string("INHERITANCE_") + home_name, 0);
	out.unindent();
	out << "{\n\n";
	out << "private:\n\n";
	out.indent();
    out << "Components::HomeContext_var context_;\n\n";
	out.unindent();
	out << "public:\n";
	out.indent();
    out << home_class_name << "();\n";
    out << "virtual ~" << home_class_name << "();\n\n";
	out << "//\n// IDL:Components/HomeExecutorBase/set_context:1.0\n//\n";
	out << "virtual void set_context (Components::HomeContext_ptr ctx)\n";
	out << "    throw (CORBA::SystemException, Components::CCMException);\n\n";
	out << "//\n// IDL:Components/HomeExecutorBase/set_storagehome_in_context:1.0\n//\n";
	out << "virtual void set_storagehome_in_context (::CosPersistentState::StorageHomeBase_ptr storHomeBase)\n";
	out << "    throw (CORBA::SystemException, Components::CCMException);\n\n";
	out << "//\n// IDL:Components/HomeExecutorBase/get_storagehome_from_context:1.0\n//\n";
	out << "virtual ::CosPersistentState::StorageHomeBase_ptr get_storagehome_from_context ()\n";
	out << "    throw (CORBA::SystemException, Components::CCMException);\n\n";
    out << "//\n// IDL:.../create:1.0\n//\n";
	switch(composition->lifecycle())
	{
	case CIDL::lc_Session :
		out << "virtual ::Components::EnterpriseComponent_ptr create()\n";
		out << "    throw (CORBA::SystemException, Components::CreateFailure);\n";
		break;
	case CIDL::lc_Entity :
		out << "virtual ::Components::EnterpriseComponent_ptr create(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n";
		out << "    throw(CORBA::SystemException, Components::CreateFailure, Components::DuplicateKeyValue, Components::InvalidKey);\n\n";
/*
		out << "virtual ::Components::EnterpriseComponent_ptr find_by_primary_key(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n"; 
		out << "	throw(CORBA::SystemException, Components::FinderFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n";

		out << "void remove(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n"; 
		out << "	throw(CORBA::SystemException, Components::RemoveFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n";
*/
		//get_primary_key(...)??? !!!

		break;
	default :
		out << "// not supported lifecycle\n";
	}
	doHome(composition->ccm_home());
	out.unindent();
	out << "\n";
	out.insertUserSection(home_name);
	out << "};\n\n";


	// close namespace
	if(module_def)
	{
		out.unindent();
		out << "};\n";
		close_module(out, module_def);
	}

	//
	// entry point
	//
	out << "\n//\n// entry point\n//\n";
	out << "extern \"C\" {\n";
	out << "#ifdef _WIN32\n";
	out << "__declspec(dllexport)\n";
	out << "#else\n";
	out << "#endif\n";
	out << "::Components::HomeExecutorBase_ptr create_" << composition->ccm_home()->name() << "E(void);\n";
	out << "}\n\n";

	out << "#endif\n";
	out.close();
}
void 
GeneratorPersistenceH::doStorageHome(IR__::StorageHomeDef_ptr storagehome)
{
	IR__::StorageTypeDef_var storagetype = storagehome->managed_storagetype();

	// achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein?
	out << "\n\n";
	open_module(out, storagetype, "");
	out << "\n\n";
	
	out << "class " << std::string(storagetype->name()) << ";\n";
	out << "class " << std::string(storagetype->name()) << "Ref;\n\n";

	std::string strClassName = std::string(storagehome->name());
	strActBasename_ = strClassName;

	out << "class " << strClassName << "\n";
	out.indent();
	
	IR__::StorageHomeDef_var base_storagehome = storagehome->base_storagehome();
	if(base_storagehome)
		out << ": public virtual " << base_storagehome->name() << "\n";
	else
		out << ": public virtual StorageHomeBaseImpl\n";

	IR__::InterfaceDefSeq_var supported_infs = storagehome->supported_interfaces();
	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
		out << ", public virtual " << ((*supported_infs)[i])->name() << "\n";

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    out << strClassName << "();\n";
	out << "~" << strClassName << "();\n\n";

	genCreateOperation(storagehome, false);
	genCreateOperation(storagehome, true);

	//
	//generate find_(ref)_by_primary_key, which is appropriate to find_by_primary_key from home
	//
	if( composition_->lifecycle()==CIDL::lc_Entity )
	{
		IR__::HomeDef_var home = composition_->ccm_home();
		IR__::PrimaryKeyDef_var pkey = IR__::PrimaryKeyDef::_duplicate(home->primary_key());
		if( !CORBA::is_nil(pkey) )
		{
			out << map_psdl_return_type(storagetype, false) << " find_by_primary_key(" << mapFullNamePK(pkey) << "* pkey)\n"; 
			out.indent();
			out << "throw(CosPersistentState::NotFound);\n";
			out.unindent();
		}
	}

	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
	{
		IR__::AbstractStorageHomeDef_var abs_storagehome_inh;
		abs_storagehome_inh = IR__::AbstractStorageHomeDef::_narrow((*supported_infs)[i]);
		genAbstractObjsForConcreteHome(abs_storagehome_inh);
	};

	bAbstract_ = false;
	bASHKey_ = false;
	handleAttribute(storagehome);
	handleOperation(storagehome);
	handleFactory(storagehome);
	handleKey(storagehome);

	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();

	out << "};\n\n\n";

	out << "typedef HomeFactoryTemplate<" << storagehome->name() << "> " << storagehome->name() << "Factory;\n\n";
	
	close_module(out, storagetype);
}
void
GeneratorEIDL::generate(std::string target, std::string fileprefix)
{
	try { initialize(target, fileprefix); }
	catch (InitializeError) { return; }
	
	//
	// open temp file without includes
	//
	filename_ = file_prefix_ + "_EQUIVALENT.idl";
	string temp_filename = filename_ + ".temp";
	out.open(temp_filename.c_str());

	//
	// forward declarations
	//
	out << "//\n// forward declarations\n//\n"; 
	CORBA::ULong len = m_to_generate_interface_seq->length();
	CORBA::ULong i;
	for(i = 0; i < len; i++)
	{
		if ((*m_to_generate_interface_seq)[i]->describe()->kind == CORBA__::dk_Interface) {
			open_module((*m_to_generate_interface_seq)[i]);
			out << "interface " << (*m_to_generate_interface_seq)[i]->name() << ";\n";
			close_module((*m_to_generate_interface_seq)[i]);
		}
		if ((*m_to_generate_interface_seq)[i]->describe()->kind == CORBA__::dk_Component) {
			open_module((*m_to_generate_interface_seq)[i]);
			out << "interface " << (*m_to_generate_interface_seq)[i]->name() << ";\n";
			close_module((*m_to_generate_interface_seq)[i]);
		};
		if ((*m_to_generate_interface_seq)[i]->describe()->kind == CORBA__::dk_Home) {
			open_module((*m_to_generate_interface_seq)[i]);
			out << "interface " << (*m_to_generate_interface_seq)[i]->name() << ";\n";
			close_module((*m_to_generate_interface_seq)[i]);
		};

	}
	out << "\n";

	//
	// generate
	//
	doGenerate();
	out.close();

	//
	// insert includes
	//
	std::ifstream temp_file;
	temp_file.open(temp_filename.c_str());
	out.open(filename_.c_str());
	out << "#ifndef __" << file_prefix_ << "_EQUIVALENT_IDL\n";
	out << "#define __" << file_prefix_ << "_EQUIVALENT_IDL\n\n";
	out << "#include \"Components.idl\"\n";
	out << "#include \"orb.idl\"\n";
	
	std::map < std::string, bool > ::iterator it;
	for(it = includes_.begin(); it != includes_.end(); it++)
	{
		out << "#include \"" << it->first << "\"\n";
	}
	out << "\n";

	out << temp_file;
	out << "\n#endif\n";
	out.close();
	temp_file.close();
	unlink(temp_filename.c_str());
}
Beispiel #25
0
int
ls (int argc, char **argv)
{
    int c;
    int err = 0;

    is_rls = strcmp (cvs_cmd_name, "rls") == 0;

    if (argc == -1)
	usage (ls_usage);

    entries_format = false;
    long_format = false;
    show_tag = NULL;
    show_date = NULL;
    tag_validated = false;
    recurse = false;
    ls_prune_dirs = false;
    show_dead_revs = false;

    getoptreset ();

    while ((c = getopt (argc, argv,
#ifdef SERVER_SUPPORT
           server_active ? "qdelr:D:PR" :
#endif /* SERVER_SUPPORT */
           "delr:D:RP"
           )) != -1)
    {
	switch (c)
	{
#ifdef SERVER_SUPPORT
	    case 'q':
		if (server_active)
		{
		    error (0, 0,
"`%s ls -q' is deprecated.  Please use the global `-q' option instead.",
                           program_name);
		    quiet = true;
		}
		else
		    usage (ls_usage);
		break;
#endif /* SERVER_SUPPORT */
	    case 'd':
		show_dead_revs = true;
		break;
	    case 'e':
		entries_format = true;
		break;
	    case 'l':
		long_format = true;
		break;
	    case 'r':
		parse_tagdate (&show_tag, &show_date, optarg);
		break;
	    case 'D':
		if (show_date) free (show_date);
		show_date = Make_Date (optarg);
		break;
	    case 'P':
		ls_prune_dirs = true;
		break;
	    case 'R':
		recurse = true;
		break;
	    case '?':
	    default:
		usage (ls_usage);
		break;
	}
    }
    argc -= optind;
    argv += optind;

    if (entries_format && long_format)
    {
        error (0, 0, "`-e' & `-l' are mutually exclusive.");
        usage (ls_usage);
    }

    wrap_setup ();

#ifdef CLIENT_SUPPORT
    if (current_parsed_root->isremote)
    {
	/* We're the local client.  Fire up the remote server.	*/
	start_server ();

	ign_setup ();

	if (is_rls ? !(supported_request ("rlist") || supported_request ("ls"))
                   : !supported_request ("list"))
	    error (1, 0, "server does not support %s", cvs_cmd_name);

	if (quiet && !supported_request ("global-list-quiet"))
	    send_arg ("-q");
	if (entries_format)
	    send_arg ("-e");
	if (long_format)
	    send_arg ("-l");
	if (ls_prune_dirs)
	    send_arg ("-P");
	if (recurse)
	    send_arg ("-R");
	if (show_dead_revs)
	    send_arg ("-d");
	if (show_tag)
	    option_with_arg ("-r", show_tag);
	if (show_date)
	    client_senddate (show_date);

	send_arg ("--");

	if (is_rls)
	{
	    int i;
	    for (i = 0; i < argc; i++)
		send_arg (argv[i]);
            if (supported_request ("rlist"))
		send_to_server ("rlist\012", 0);
	    else
		/* For backwards compatibility with CVSNT...  */
		send_to_server ("ls\012", 0);
	}
	else
	{
	    /* Setting this means, I think, that any empty directories created
	     * by the server will be deleted by the client.  Since any dirs
	     * created at all by ls should remain empty, this should cause any
	     * dirs created by the server for the ls command to be deleted.
	     */
	    client_prune_dirs = 1;

	    /* I explicitly decide not to send contents here.  We *could* let
	     * the user pull status information with this command, but why
	     * don't they just use update or status?
	     */
	    send_files (argc, argv, !recurse, 0, SEND_NO_CONTENTS);
	    send_file_names (argc, argv, SEND_EXPAND_WILD);
	    send_to_server ("list\012", 0);
	}

	err = get_responses_and_close ();
	return err;
    }
#endif

    if (is_rls)
    {
	DBM *db;
	int i;
	db = open_module ();
	if (argc)
	{
	    for (i = 0; i < argc; i++)
	    {
		char *mod = xstrdup (argv[i]);
		char *p;

		for (p=strchr (mod,'\\'); p; p=strchr (p,'\\'))
		    *p='/';

		p = strrchr (mod,'/');
		if (p && (strchr (p,'?') || strchr (p,'*')))
		{
		    *p='\0';
		    regexp_match = p+1;
		}
		else
		    regexp_match = NULL;

		/* Frontends like to do 'ls -q /', so we support it explicitly.
                 */
		if (!strcmp (mod,"/"))
		{
		    *mod='\0';
		}

		err += do_module (db, mod, MISC, "Listing",
				  ls_proc, NULL, 0, 0, 0, 0, NULL);

		free (mod);
	    }
	}
	else
	{
	    /* should be ".", but do_recursion() 
	       fails this: assert ( strstr ( repository, "/./" ) == NULL ); */
	    char *topmod = xstrdup ("");
	    err += do_module (db, topmod, MISC, "Listing",
			      ls_proc, NULL, 0, 0, 0, 0, NULL);
	    free (topmod);
	}
	close_module (db);
    }
    else
	ls_proc (argc + 1, argv - 1, NULL, NULL, NULL, 0, 0, NULL, NULL);

    return err;
}
void
GeneratorValuetypesC::doValue(IR__::ValueDef_ptr value)
{
	open_module(out, value);
	class_name_ = mapName(value) + "Impl";
	
	out << "void\n";
	out << class_name_ << "::operator= (const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::operator=", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::" << class_name_ << "(const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::" + class_name_ + "1", 0);
	out.unindent();
	out << "}\n\n\n";

	// check whether this value(eventtype) has members.
	IR__::ContainedSeq_var contained_seq = value->contents(CORBA__::dk_ValueMember, false);
	if( contained_seq->length() > 0 ) // if has some, generate the constructor with parameters
	{
		out << class_name_ << "::" << class_name_ << "(";
		generateMemberParam( value, false );
		out << ")\n: " << mapFullNameWithPrefix(value, "OBV_") << "(";
		generateMemberInit( value, false );
		out << ")\n{\n";
		out.indent();
		out.insertUserSection(class_name_ + "::" + class_name_ + "2", 0);
		out.unindent();
		out << "}\n\n\n";
	}

	out << class_name_ << "::" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::" + class_name_ + "3", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::~" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::~" + class_name_, 0);
	out.unindent();
	out << "}\n\n\n";

	out << "CORBA::ValueBase*\n";
	out << class_name_ << "::_copy_value()\n{\n";
	out.indent();
	out << class_name_ << " *val = new " << class_name_ << "(* this);\n";
	out.insertUserSection(class_name_ + "::_copy_value", 0);
	out << "return val;\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// supported interfaces
	//
	CORBA::ULong i;
	handled_interfaces_.clear();
	IR__::InterfaceDefSeq_var supp_intfs = value->supported_interfaces();
	for(i = 0; i < supp_intfs->length(); i++)
	{
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};
	//
	// base value
	//
	IR__::ValueDef_var base = value->base_value();
	if(! CORBA::is_nil(base))
	{
		// todo
	}
	//
	// abstract base values
	//
	IR__::ValueDefSeq_var abstr = value->abstract_base_values();
	for(i = 0; i < abstr->length(); i++)
	{
		// todo
	};

	//
	// value type factory
	//
	out << "CORBA::ValueBase *\n";
	out << value->name() << "FactoryImpl::create_for_unmarshal ()\n{\n";
	out.indent();
	out << "return new " << mapFullName( value ) << "Impl();\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// initializers
	//
	IR__::InitializerSeq_var ini = value->initializers();
	for(i = 0; i < ini->length(); i++)
	{
		// todo
	};

	//
	// static factory cleaner
	//
	out << "static Qedo::ValueFactoryCleaner " << value->name() << "Factory_cleaner( new ";
	out << value->name() << "FactoryImpl(), \"" << value->id() << "\" );\n";

	close_module(out, value);
}
Beispiel #27
0
/* Open an audio output module, trying modules in list (comma-separated). */
audio_output_t* open_output_module( const char* names )
{
	mpg123_module_t *module = NULL;
	audio_output_t *ao = NULL;
	int result = 0;
	char *curname, *modnames;

	if(param.usebuffer || names==NULL) return NULL;

	/* Use internal code. */
	if(param.outmode != DECODE_AUDIO) return open_fake_module();

	modnames = strdup(names);
	if(modnames == NULL)
	{
		error("Error allocating memory for module names.");
		return NULL;
	}
	/* Now loop over the list of possible modules to find one that works. */
	curname = strtok(modnames, ",");
	while(curname != NULL)
	{
		char* name = curname;
		curname = strtok(NULL, ",");
		if(param.verbose > 1) fprintf(stderr, "Trying output module %s.\n", name);
		/* Open the module, initial check for availability+libraries. */
		module = open_module( "output", name );
		if(module == NULL) continue;
		/* Check if module supports output */
		if(module->init_output == NULL)
		{
			error1("Module '%s' does not support audio output.", name);
			close_module(module);
			continue; /* Try next one. */
		}
		/* Allocation+initialization of memory for audio output type. */
		ao = alloc_audio_output();
		if(ao==NULL)
		{
			error("Failed to allocate audio output structure.");
			close_module(module);
			break; /* This is fatal. */
		}

		/* Call the init function */
		ao->device = param.output_device;
		ao->flags  = param.output_flags;
		/* Should I do funny stuff with stderr file descriptor instead? */
		if(curname == NULL)
		{
			if(param.verbose > 1)
			fprintf(stderr, "Note: %s is the last output option... showing you any error messages now.\n", name);
		}
		else ao->auxflags |= MPG123_OUT_QUIET; /* Probing, so don't spill stderr with errors. */
		ao->is_open = FALSE;
		ao->module = module; /* Need that to close module later. */
		result = module->init_output(ao);
		if(result == 0)
		{ /* Try to open the device. I'm only interested in actually working modules. */
			result = open_output(ao);
			close_output(ao);
		}
		else error2("Module '%s' init failed: %i", name, result);

		if(result!=0)
		{ /* Try next one... */
			close_module(module);
			free(ao);
			ao = NULL;
		}
		else 
		{ /* All good, leave the loop. */
			if(param.verbose > 1) fprintf(stderr, "Output module '%s' chosen.\n", name);

			ao->auxflags &= ~MPG123_OUT_QUIET;
			break;
		}
	}

	free(modnames);
	if(ao==NULL) error1("Unable to find a working output module in this list: %s", names);

	return ao;
}
void
GeneratorBIDL::doComposition(CIDL::CompositionDef_ptr composition)
{
	//
	// get the module where the composition is defined in and open it
	//
	string id = composition->id();
	IR__::Contained_ptr module_def = 0;
	string::size_type pos = id.find_last_of("/");
	if(pos != string::npos)
	{
		id.replace(pos, string::npos, ":1.0");
		module_def = repository_->lookup_id(id.c_str());
		open_module(module_def);
		out << "\nmodule " << module_def->name() << "\n{\n";
		out.indent();
	}


	string facet_type;
	map < string, bool > facet_types;
	map < string, bool > implemented_facets;
	

	//
	// local interface for each segment
	//
	CIDL::SegmentDefSeq_var segment_seq = composition->executor()->segments();
	CORBA::ULong len = segment_seq->length();
	for (CORBA::ULong i = 0; i < len; i++)
	{
		facet_types.clear();
		out << "//\n// " << segment_seq[i]->id() << "\n//\n";
		out << "local interface CCM_" << segment_seq[i]->name() << " : ::Components::EnterpriseComponent";

		// inherit from each implemented facet type
		IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets();
		for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++)
		{
			implemented_facets[provided_seq[ii]->name()] = true;
			facet_type = provided_seq[ii]->interface_type()->id();
			
			// if type already inherited, skip it
			if(facet_types.find(facet_type) == facet_types.end())
			{
				out << ", " << mapLocalName(provided_seq[ii]->interface_type());
				facet_types[facet_type] = true;
			}
		}
		out << "\n{\n};\n\n";
	}


	//
	// local interface for the executor
	//
	facet_types.clear();
	out << "//\n// " << composition->executor()->id() << "\n//\n";
	out << "local interface CCM_" << composition->executor()->name() << " : ";
	out << mapLocalName(composition->ccm_component()) << "_Executor";
	

	// inherit from each implemented facet type
	IR__::ProvidesDefSeq_var provides_seq = composition->ccm_component()->provides_interfaces();
	len = provides_seq->length();
	for (i = 0; i < len; i++)
	{
		// facet already implemented by segment?
		if(implemented_facets.find(provides_seq[i]->name()) == implemented_facets.end())
		{
			facet_type = provides_seq[i]->interface_type()->id();
			
			// if type already inherited, skip it
			if(facet_types.find(facet_type) == facet_types.end())
			{
				facet_types[facet_type] = true;
				if(!facet_types.empty())
				{
					out << ", ";
				}
				out << map_absolute_name(provides_seq[i]->interface_type());
			}
		}
	}
	out << "\n{\n};\n\n";


	if(module_def)
	{
		out.unindent();
		out << "};\n";
		close_module(module_def);
	}
}
Beispiel #29
0
int lsacl (int argc, char **argv)
{
	int c;
	int err = 0;
	int local = 1;
	int directories_only = 0;

	is_rlsacl = !strcmp(command_name,"rlsacl");

	if (argc == -1)
		usage (is_rlsacl?rlsacl_usage:lsacl_usage);

	optind = 0;
	while ((c = getopt(argc, argv, "+dR")) != -1)
	{
		switch (c)
		{
		case 'd':
			directories_only = 1;
			break;
		case 'R':
			local = 0;
			break;
		case '?':
		default:
		usage (lsacl_usage);
		break;
		}
	}
	argc -= optind;
	argv += optind;

	if (argc < 0)
		usage (is_rlsacl?rlsacl_usage:lsacl_usage);

	if (current_parsed_root->isremote)
	{
		if(is_rlsacl)
		{
			if (!supported_request ("rlsacl"))
				error (1, 0, "server does not support rlsacl");
		}
		else
		{
			if (!supported_request ("lsacl"))
				error (1, 0, "server does not support lsacl");
		}

		if(!local)
			send_arg("-R");

		if(directories_only)
			send_arg("-d");

		send_arg("--");
		if (is_rlsacl)
		{
			int i;
			for (i = 0; i < argc; i++)
			send_arg (argv[i]);
			send_to_server ("rlsacl\n", 0);
		}
		else
		{
			send_file_names (argc, argv, SEND_EXPAND_WILD);
			send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
			send_to_server ("lsacl\n", 0);
		}
		return get_responses_and_close ();
   }

	if(!acl_mode)
		error(1,0,"Access control is disabled on this repository.");
    
	if (is_rlsacl)
	{
		DBM *db;
		int i;
		db = open_module ();
		if(!argc)
		{
				err += do_module (db, ".", MISC, "Listing", rlsacl_proc,
						(char *) NULL, 0, local, 0, 0, (char *) NULL);
		}
		else
		{
			for (i = 0; i < argc; i++)
			{
				err += do_module (db, argv[i], MISC, "Listing", rlsacl_proc,
						(char *) NULL, 0, local, 0, 0, (char *) NULL);
			}
		}
		close_module (db);
	}
	else
	{
		/* start the recursion processor */
		err = start_recursion (directories_only?NULL:lsacl_fileproc, (FILESDONEPROC) NULL,
					(PREDIRENTPROC) NULL, lsacl_dirproc, (DIRLEAVEPROC) NULL, NULL,
					argc, argv, local,
					W_LOCAL, 0, 1, (char *) NULL, NULL, 1, NULL);
	}

    return (err);

}
//
// composition
//
void
GeneratorBIDL::doComposition(CIDL::CompositionDef_ptr composition)
{
	//
	// get the module where the composition is defined in and open it
	//
	string id = composition->id();
	IR__::Contained_ptr module_def = 0;
	string::size_type pos = id.find_last_of("/");
	if(pos != string::npos)
	{
		id.replace(pos, string::npos, ":1.0");
		module_def = repository_->lookup_id(id.c_str());
		open_module(module_def);
		out << "\nmodule " << module_def->name() << "\n{\n";
		out.indent();
	}

	string facet_type;
	t_string_map facet_types;
	t_string_map implemented_facets;
	CORBA::ULong i;

	//
	// local interface for each segment
	//
	CIDL::SegmentDefSeq_var segment_seq = composition->executor_def()->segments();
	CORBA::ULong len = segment_seq->length();
	for (i = 0; i < len; i++)
	{
		facet_types.clear();
		out << "//\n// " << segment_seq[i]->id() << "\n//\n";
		out << "local interface CCM_" << segment_seq[i]->name() << " : ::Components::EnterpriseComponent";

		// inherit from each implemented facet type
		IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets();
		for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++)
		{
			implemented_facets[provided_seq[ii]->name()] = true;
			IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provided_seq[ii]->interface_type());
			if( !CORBA::is_nil(intf) )
			{
				facet_type = intf->id();
			}
			else
			{
				facet_type = "IDL:omg.org/CORBA/Object:1.0";
			}
			
			// if type already inherited, skip it
			if(facet_types.find(facet_type) == facet_types.end())
			{
				out << ", " << getLocalName(provided_seq[ii]->interface_type());
				facet_types[facet_type] = true;
			}
		}
		out << "\n{\n};\n\n";
	}


	//
	// local interface for the executor
	//
	facet_types.clear();
	out << "//\n// " << composition->executor_def()->id() << "\n//\n";
	out << "local interface CCM_" << composition->executor_def()->name() << " : ";
	out << getLocalName(composition->ccm_component()) << "_Executor";
	
	this -> gen_facet(composition->ccm_component(), implemented_facets, facet_types);
	/*
	//
	// inherit from each implemented facet type
	//
	IR__::ProvidesDefSeq_var provides_seq = composition->ccm_component()->provides_interfaces();
	len = provides_seq->length();
	for (i = 0; i < len; i++)
	{
		IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provides_seq[i]->interface_type());
		if( CORBA::is_nil(intf) )
		{
			continue;
		}

		//
		// facet not already implemented by segment
		//
		if(implemented_facets.find(provides_seq[i]->name()) == implemented_facets.end())
		{
			// if type already inherited, skip it
			facet_type = intf->id();
			if(facet_types.find(facet_type) == facet_types.end())
			{
				facet_types[facet_type] = true;
				if(!facet_types.empty()) {
					out << ", ";
				}
				out << getLocalName(intf);
			}
		}
	}
	*/
	/*
	// inherit from consumer for each event
	facet_types.clear();
	IR__::ConsumesDefSeq_var consumes_seq = composition->ccm_component()->consumes_events();
	len = consumes_seq->length();
	for (i = 0; i < len; i++)
	{
		facet_type = consumes_seq[i]->event()->id();
			
		// if type already inherited, skip it
		if(facet_types.find(facet_type) == facet_types.end())
		{
			facet_types[facet_type] = true;
			out << ", " << getLocalName(consumes_seq[i]->event()) << "Consumer";
		}
	}
*/
	out << "\n{\n};\n\n";


	if(module_def)
	{
		out.unindent();
		out << "};\n";
		close_module(module_def);
	}
}