CORBA-omniORB

 view release on metacpan or  search on metacpan

omniORB.xs  view on Meta::CPAN

      break;
    }
  croak("Policy key should be one of \"id_uniqueness\", \"id_assignment\",  \"implicit_activation\",  \"lifespan\",  \"request_processing\",  \"servant_retention\" or \"thread\"");
}

MODULE = CORBA::omniORB           PACKAGE = CORBA::omniORB

PROTOTYPES: DISABLE

BOOT:
    pomni_init_entry_lock(aTHX);
    pomni_init_exceptions(aTHX);
    pomni_init_typecodes(aTHX);

void
CLONE(...)
    CODE:
    pomni_clone_entry_lock(aTHX);
    pomni_clone_orb(aTHX);
    pomni_clone_pins(aTHX);
    pomni_clone_typecodes(aTHX);
    
char *
find_interface (repoid)
    char *repoid
    CODE:
    {
	CM_DEBUG(("find_interface %s\n", repoid));
	POmniIfaceInfo *info = pomni_find_interface_description (aTHX_ repoid);
	RETVAL = info ? (char *)info->pkg.c_str() : NULL;
    }
    OUTPUT:
    RETVAL

void
clear_interface (repoid)
    char *repoid
    CODE:
    {
#ifdef MEMCHECK
	pomni_clear_interface(aTHX_ repoid);
#endif
    }

char *
load_interface (interface)
    CORBA::Object interface
    CODE:
    {
	CORBA::InterfaceDef_var iface
	    = CORBA::InterfaceDef::_narrow (interface);
	POmniIfaceInfo *info
	    = pomni_load_contained (aTHX_ iface, CORBA::ORB::_nil(), NULL);
	RETVAL = info ? (char *)info->pkg.c_str() : NULL;
    }
    OUTPUT:
    RETVAL

void
_entry_lock_hooks ()
    PPCODE:
    EXTEND(SP, 2);
    PUSHs(sv_2mortal(newSVuv(PTR2UV(pomni_unlock))));
    PUSHs(sv_2mortal(newSVuv(PTR2UV(pomni_relock))));


MODULE = CORBA::omniORB           PACKAGE = CORBA

SV *
ORB_init (id)
    char *id
    CODE:
    {
	SV *weakref = get_sv("CORBA::omniORB::_the_orb", TRUE);
	if (SvROK(weakref)) {
	    RETVAL = newSV(0);
	    sv_setsv(RETVAL, weakref);
	}
	else {
	    if (CORBA::is_nil(pomni_orb)) {
		int i;
		AV *ARGV = get_av("ARGV", FALSE);
		SV *ARGV0 = get_sv("0", FALSE);
		
		AV *ARGV_copy = newAV();
		sv_2mortal((SV*)ARGV_copy);
		for (i = 0; i <= av_len(ARGV); i++)
		    av_store(ARGV_copy, i, newSVsv(*av_fetch(ARGV, i, 0)));
		
		int argc = av_len(ARGV_copy) + 2;
		char **argv = (char **) malloc (sizeof(char *) * argc);
		argv[0] = SvPV (ARGV0, PL_na);
		for (i = 0; i <= av_len(ARGV_copy); i++ )
		    argv[i+1] = SvPV( *av_fetch(ARGV_copy, i, 0), PL_na );
		
		try {
		    pomni_orb = CORBA::ORB_init (argc, argv, id);
		} catch (CORBA::SystemException &ex) {
		    if (argv)
			free (argv);
		    pomni_throw (aTHX_
				 pomni_system_except (aTHX_
						      ex._rep_id(),
						      ex.minor(),
						      ex.completed()));
		}
	    
		av_clear (ARGV);
	    
		for (i = 1; i < argc; i++)
		    av_store (ARGV, i - 1, newSVpv(argv[i], 0));
	
		if (argv)
		    free (argv);
	    }

	    RETVAL = newSV(0);
	    sv_setref_pv(RETVAL, "CORBA::ORB",
			 (void *) CORBA::ORB::_duplicate(pomni_orb));

	    sv_setsv(weakref, RETVAL);



( run in 0.762 second using v1.01-cache-2.11-cpan-71847e10f99 )