static PyObject * pyorbit_poa_deactivate_object(PyCORBA_Object *self, PyObject *args) { CORBA_Environment ev; PortableServer_ObjectId *id; Py_ssize_t id_length; id = (PortableServer_ObjectId *)CORBA_sequence_CORBA_octet__alloc(); id->_release = CORBA_FALSE; if (!PyArg_ParseTuple(args, "s#:POA.deactivate_object", &id->_buffer, &id_length)) { CORBA_free(id); return NULL; } id->_length = id_length; id->_length++; /* account for nul termination */ CORBA_exception_init(&ev); PortableServer_POA_deactivate_object((PortableServer_POA)self->objref, id, &ev); CORBA_free(id); if (pyorbit_check_ex(&ev)) return NULL; Py_INCREF(Py_None); return Py_None; }
static gboolean dasher_action_speech_activate(DasherAction *pSelf) { DasherActionSpeechPrivate *pDasherActionSpeechPrivate = DASHER_ACTION_SPEECH_GET_PRIVATE(pSelf); pDasherActionSpeechPrivate->rv = 0; Bonobo_ServerInfoList *servers; Bonobo_ServerInfo *info; servers = bonobo_activation_query("repo_ids.has_one(['IDL:GNOME/Speech/SynthesisDriver:0.2','IDL:GNOME/Speech/SynthesisDriver:0.3'])", NULL, &(pDasherActionSpeechPrivate->ev)); if(servers->_length == 0) { pDasherActionSpeechPrivate->speaker = NULL; printf(_("Unable to initialize speech support\n")); fflush(stdout); return false; } for(unsigned int i = 0; i < servers->_length; i++) { CORBA_exception_init(&(pDasherActionSpeechPrivate->ev)); info = &servers->_buffer[i]; pDasherActionSpeechPrivate->rv = bonobo_activation_activate_from_id((const Bonobo_ActivationID)info->iid, 0, NULL, &(pDasherActionSpeechPrivate->ev)); if(!BONOBO_EX(&(pDasherActionSpeechPrivate->ev))) { break; } } CORBA_free(servers); GNOME_Speech_SynthesisDriver_driverInit(pDasherActionSpeechPrivate->rv, &(pDasherActionSpeechPrivate->ev)); pDasherActionSpeechPrivate->voices = GNOME_Speech_SynthesisDriver_getAllVoices(pDasherActionSpeechPrivate->rv, &(pDasherActionSpeechPrivate->ev)); if(pDasherActionSpeechPrivate->voices == NULL || BONOBO_EX(&(pDasherActionSpeechPrivate->ev)) || pDasherActionSpeechPrivate->voices->_length == 0) { g_warning(_("Unable to initialize voices\n")); pDasherActionSpeechPrivate->speaker = NULL; return false; } pDasherActionSpeechPrivate->speaker = GNOME_Speech_SynthesisDriver_createSpeaker(pDasherActionSpeechPrivate->rv, &pDasherActionSpeechPrivate->voices->_buffer[0], &(pDasherActionSpeechPrivate->ev)); GNOME_Speech_ParameterList *list; list = GNOME_Speech_Speaker_getSupportedParameters(pDasherActionSpeechPrivate->speaker, &(pDasherActionSpeechPrivate->ev)); if(BONOBO_EX(&(pDasherActionSpeechPrivate->ev)) || list->_length == 0) { if(!BONOBO_EX(&(pDasherActionSpeechPrivate->ev))) CORBA_free(list); g_warning(_("Warning: unable to set speech parameters\n")); return false; } for(unsigned i = 0; i < list->_length; i++) { GNOME_Speech_Parameter *p = &(list->_buffer[i]); if(!strcmp(p->name, "rate")) { GNOME_Speech_Speaker_setParameterValue(pDasherActionSpeechPrivate->speaker, p->name, 200.0, &(pDasherActionSpeechPrivate->ev)); } } CORBA_free(list); return true; }
static int term_sequence_test(IC_Env *env) { ETERM* et_array[4] = { erl_format("[{apa, 1, 23}, \"string\", {1.23, 45}]"), erl_format("[{banan, 1, 23}, \"string\", {1.23, 45}]"), erl_format("[{apelsin, 1, 23}, \"string\", {1.23, 45}]"), erl_format("[{mango, 1, 23}, \"string\", {1.23, 45}]")}; m_etseq etsi = {4, 4, et_array}, *etso, *etsr; fprintf(stdout, "\n======== m_i_term_sequence test ======\n\n"); etsr = m_i_term_sequence_test(NULL, &etsi, &etso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_etseq(&etsi, etso) && cmp_etseq(&etsi, etsr)); if (!cmp_etseq(&etsi, etso)) { fprintf(stdout, " out parameter error, sent:\n"); print_etseq(&etsi); fprintf(stdout, "got:\n"); print_etseq(etso); } if (!cmp_etseq(&etsi, etsr)) { fprintf(stdout, " result error, sent:\n"); print_etseq(&etsi); fprintf(stdout, "got:\n"); print_etseq(etsr); } free_etseq_buf(&etsi); free_etseq_buf(etso); free_etseq_buf(etsr); CORBA_free(etso); CORBA_free(etsr); return -1; }
static int seq1_test(IC_Env *env) { m_bseq bs, *bso, *bsr; m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; bs._length = 3; bs._buffer = ba; fprintf(stdout, "\n======== m_i_seq1 test ======\n\n"); bsr = m_i_seq1_test(NULL, &bs, &bso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_bseq(&bs, bso) && cmp_bseq(&bs, bsr)); if (!cmp_bseq(&bs, bso)) { fprintf(stdout, " out parameter error, sent:\n"); print_bseq(&bs); fprintf(stdout, " got:\n"); print_bseq(bso); fprintf(stdout, "\n"); } if (!cmp_bseq(&bs, bsr)) { fprintf(stdout, " result error, sent:\n"); print_bseq(&bs); fprintf(stdout, " got:\n"); print_bseq(bsr); fprintf(stdout, "\n"); } CORBA_free(bso); CORBA_free(bsr); return -1; }
static PyObject * pyorbit_poa_activate_object_with_id(PyCORBA_Object *self, PyObject *args) { CORBA_Environment ev; PyPortableServer_Servant *pyservant; PortableServer_ServantBase *servant; PortableServer_ObjectId *id; Py_ssize_t id_length; id = (PortableServer_ObjectId *)CORBA_sequence_CORBA_octet__alloc(); id->_release = CORBA_FALSE; if (!PyArg_ParseTuple(args, "s#O!:POA.activate_object_with_id", &id->_buffer, &id_length, &PyPortableServer_Servant_Type, &pyservant)) { CORBA_free(id); return NULL; } id->_length = id_length; id->_length++; /* account for nul termination */ servant = PYSERVANT_TO_SERVANT(pyservant); CORBA_exception_init(&ev); PortableServer_POA_activate_object_with_id((PortableServer_POA)self->objref, id, servant, &ev); CORBA_free(id); if (pyorbit_check_ex(&ev)) return NULL; Py_INCREF(Py_None); return Py_None; }
static int seq4_test(IC_Env *env) { char *stra0[3] = {"a", "long", "time"}; char *stra1[3] = {"ago", "there", "was"}; char *stra2[3] = {"a", "buggy", "compiler"}; m_sstr3 str3s[3] = {{3, 3, stra0}, {3, 3, stra1}, {3, 3, stra2}}; m_ssstr3 str3ssi = {3, 3, str3s}; m_ssstr3 *str3sso, *str3ssr; fprintf(stdout, "\n======== m_i_seq4 test ======\n\n"); str3ssr = m_i_seq4_test(NULL, &str3ssi, &str3sso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_ssstr3(&str3ssi, str3sso) && cmp_ssstr3(&str3ssi, str3ssr)); if (!cmp_ssstr3(&str3ssi, str3sso)){ fprintf(stdout, " out parameter error, sent:\n"); print_ssstr3(&str3ssi); fprintf(stdout, " got:\n"); print_ssstr3(str3sso); fprintf(stdout, "\n"); } if (!cmp_ssstr3(&str3ssi, str3ssr)) { fprintf(stdout, " result error, sent:\n"); print_ssstr3(&str3ssi); fprintf(stdout, " got:\n"); print_ssstr3(str3ssr); fprintf(stdout, "\n"); } CORBA_free(str3sso); CORBA_free(str3ssr); return -1; }
static int seq3_test(IC_Env *env) { m_lseq lsi, *lso, *lsr; long al[500]; int i=0; for (i = 0; i < 500; i++) al[i]=i; lsi._length = 500; lsi._buffer = al; fprintf(stdout, "\n======== m_i_seq3 test ======\n\n"); lsr = m_i_seq3_test(NULL, &lsi, &lso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_lseq(&lsi, lso) && cmp_lseq(&lsi, lsr)); if (!cmp_lseq(&lsi, lso)) { fprintf(stdout, " out parameter error, sent:\n"); print_lseq(&lsi); fprintf(stdout, " got:\n"); print_lseq(lso); fprintf(stdout, "\n"); } if (!cmp_lseq(&lsi, lsr)) { fprintf(stdout, " result error, sent:\n"); print_lseq(&lsi); fprintf(stdout, " got:\n"); print_lseq(lsr); fprintf(stdout, "\n"); } CORBA_free(lso); CORBA_free(lsr); return -1; }
static int inline_sequence_test(IC_Env *env) { int i; long al[500]; m_s isi = {4711, {500, 10, al}}, *iso, *isr; for (i = 0; i < 500; i++) al[i]=i; fprintf(stdout, "\n======== m_i_inline_sequence test ======\n\n"); isr = m_i_inline_sequence_test(NULL, &isi, &iso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_s(&isi, iso) && cmp_s(&isi, isr)); if (!cmp_s(&isi, iso)) { fprintf(stdout, " out parameter error, sent:\n"); print_s(&isi); fprintf(stdout, "got:\n"); print_s(iso); } if (!cmp_s(&isi, isr)) { fprintf(stdout, " result error, sent:\n"); print_s(&isi); fprintf(stdout, "got:\n"); print_s(isr); } CORBA_free(iso); CORBA_free(isr); return -1; }
static int seq5_test(IC_Env *env) { m_arr3 arr3a[3] = { {4711, 18931947, 3}, {4711, 18931947, 3}, {4711, 18931947, 3}}; m_sarr3 arr3sa[3] = {{3, 3, arr3a}, {3, 3, arr3a}, {3, 3, arr3a}}; m_ssarr3 arr3ssi = {3, 3, arr3sa}; m_ssarr3 *arr3sso; m_ssarr3 *arr3ssr; fprintf(stdout, "\n======== m_i_seq5 test ======\n\n"); arr3ssr = m_i_seq5_test(NULL, &arr3ssi, &arr3sso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_ssarr3(&arr3ssi, arr3sso) && cmp_ssarr3(&arr3ssi, arr3ssr)); if (!cmp_ssarr3(&arr3ssi, arr3sso)) { fprintf(stdout, " out parameter error, sent:\n"); print_ssarr3(&arr3ssi); fprintf(stdout, " got:\n"); print_ssarr3(arr3sso); fprintf(stdout, "\n"); } if (!cmp_ssarr3(&arr3ssi, arr3ssr)) { fprintf(stdout, " result error, sent:\n"); print_ssarr3(&arr3ssi); fprintf(stdout, " got:\n"); print_ssarr3(arr3ssr); fprintf(stdout, "\n"); } CORBA_free(arr3sso); CORBA_free(arr3ssr); return -1; }
static int string2_test(IC_Env *env) { char* sa[3] = {"hello", "foo", "bar"}; m_sseq ssi = {3, 3, sa}; m_sseq *sso, *ssr; fprintf(stdout, "\n======== m_i_string2 test ======\n\n"); ssr = m_i_string2_test(NULL, &ssi, &sso, env); CHECK_EXCEPTION(env); RETURN_IF_OK(cmp_sseq(&ssi, sso) && cmp_sseq(&ssi, sso)); if (!cmp_sseq(&ssi, sso)) { fprintf(stdout, " out parameter error, sent:\n"); print_sseq(&ssi); fprintf(stdout, "got:\n"); print_sseq(sso); } if (!cmp_sseq(&ssi, ssr)) { fprintf(stdout, " result error, sent:\n"); print_sseq(&ssi); fprintf(stdout, "got:\n"); print_sseq(ssr); } CORBA_free(sso); CORBA_free(ssr); return -1; }
static PyObject * pyorbit_load_file(PyObject *self, PyObject *args) { #ifdef HAVE_ORBIT2_IMODULE gchar *path, *cpp_args = ""; CORBA_sequence_ORBit_IInterface *ifaces; CORBA_sequence_CORBA_TypeCode *types; if (!PyArg_ParseTuple(args, "s|s", &path, &cpp_args)) return NULL; ifaces = ORBit_iinterfaces_from_file(path, cpp_args, &types); if (!ifaces) { PyErr_Format(PyExc_RuntimeError, "could not load '%s'", path); return NULL; } pyorbit_handle_types_and_interfaces(ifaces, types, path); #if 0 CORBA_free(ifaces); CORBA_free(types); #endif Py_INCREF(Py_None); return Py_None; #else PyErr_SetString(PyExc_RuntimeError, "pyorbit was not configured with support for the " "imodule service"); return NULL; #endif }
static void test_ORBit_alloc (void) { gpointer p; int i; p = ORBit_alloc_string (100); g_assert ((gulong)p & 0x1); for (i = 0; i < 100; i++) ((guchar *)p) [i] = i; CORBA_free (p); p = CORBA_string_dup ("Foo"); g_assert (((gulong)p & 0x1)); CORBA_free (p); p = ORBit_alloc_simple (100); g_assert (!((gulong)p & 0x1)); for (i = 0; i < 100; i++) ((guchar *)p) [i] = i; CORBA_free (p); p = ORBit_alloc_tcval (TC_CORBA_sequence_CORBA_octet, 1); g_assert (!((gulong)p & 0x1)); CORBA_free (p); p = ORBit_alloc_tcval (TC_ORBit_IInterface, 8); g_assert (!((gulong)p & 0x1)); CORBA_free (p); }
/* NOT EXPORTED SO FAR */ void CORBA_Environment_free(CORBA_Environment *env) { CORBA_free(env->_inbuf); CORBA_free(env->_outbuf); CORBA_exception_free(env); CORBA_free(env); }
/* Stopping node */ void client_exit(CORBA_Environment *env) { /* Free env & buffers */ CORBA_free(env->_inbuf); CORBA_free(env->_outbuf); CORBA_free(env); close(env->_fd); exit(1); }
void CORBA_exception_free(CORBA_Environment *env) { /* Setting major value */ env->_major=CORBA_NO_EXCEPTION; /* Freeing storage */ CORBA_free(env->_exc_id); CORBA_free(env->_exc_value); env->_exc_id = env->_exc_value = NULL; }
static void test_copy (void) { int i, j; #define ELEMS (sizeof (tc) / sizeof (tc[0])) CORBA_TypeCode tc[] = { TC_CORBA_octet, TC_CORBA_sequence_CORBA_octet, TC_CORBA_double, TC_CORBA_string, TC_CORBA_sequence_CORBA_string, TC_GIOP_TargetAddress }; gpointer data [ELEMS]; const char *test_string = "This is a sample string, for dupping"; fprintf (stderr, "Testing copy...\n"); for (i = 0; i < ELEMS; i++) { data [i] = ORBit_dynany_new_default (tc [i]); g_timer_reset (timer); for (j = 0; j < 1000; j++) { gpointer foo = ORBit_copy_value (data [i], tc [i]); CORBA_free (foo); } elapsed_time = g_timer_elapsed (timer, NULL); bogomark += elapsed_time; fprintf (stderr, " copy %20s : %g(ms)\n", tc[i]->repo_id == NULL ? "(null)" : tc[i]->repo_id, elapsed_time); } fprintf (stderr, "Testing strdup ...\n"); g_timer_reset (timer); for (i = 0; i < 10000; i++) { char *str = g_strdup (test_string); g_free (str); } elapsed_time = g_timer_elapsed (timer, NULL) / 10.0; bogomark += elapsed_time; fprintf (stderr, " g_strdup : %g(ns)\n", elapsed_time * 1000.0); g_timer_reset (timer); for (i = 0; i < 10000; i++) { char *str = CORBA_string_dup (test_string); CORBA_free (str); } elapsed_time = g_timer_elapsed (timer, NULL) / 10.0; bogomark += elapsed_time; fprintf (stderr, " CORBA_strdup : %g(ns)\n", elapsed_time * 1000.0); }
/* * Creates the components needed to edit the extra properties of this widget. */ static void gb_bonobo_control_create_properties (GtkWidget * widget, GbWidgetCreateArgData * data) { Bonobo_PropertyBag pb = control_get_pb (widget); char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker); GList *key_list, *names; g_assert (moniker); if (!pb) return; key_list = bonobo_pbclient_get_keys (pb, NULL); for (names = key_list; names; names = names->next) { CORBA_TypeCode tc; char *title, *doc; char *prop = create_prop_name (moniker, names->data); tc = bonobo_pbclient_get_type (pb, names->data, NULL); title = bonobo_pbclient_get_doc_title (pb, names->data, NULL); doc = bonobo_pbclient_get_doc (pb, names->data, NULL); switch (tc->kind) { case CORBA_tk_boolean: property_add_bool (prop, title, doc); break; case CORBA_tk_string: property_add_string (prop, title, doc); break; case CORBA_tk_short: case CORBA_tk_ushort: /* FIXME: _int_range() ? */ property_add_int (prop, title, doc); break; case CORBA_tk_double: case CORBA_tk_float: property_add_float (prop, title, doc); break; case CORBA_tk_ulong: case CORBA_tk_long: property_add_int (prop, title, doc); break; default: g_warning ("Unhandled type %d", tc->kind); break; } g_free (prop); CORBA_free (title); CORBA_free (doc); } bonobo_pbclient_free_keys (key_list); }
PortableServer_POA server_create_multi_threaded_poa (CORBA_ORB orb, PortableServer_POA poa, PortableServer_POAManager poa_mgr, CORBA_Environment *ev) { const static MAX_POLICIES = 1; PortableServer_POA child_poa = CORBA_OBJECT_NIL; CORBA_PolicyList *poa_policies; poa_policies = CORBA_PolicyList__alloc (); poa_policies->_maximum = MAX_POLICIES; poa_policies->_length = MAX_POLICIES; poa_policies->_buffer = CORBA_PolicyList_allocbuf (MAX_POLICIES); CORBA_sequence_set_release (poa_policies, CORBA_TRUE); poa_policies->_buffer[0] = (CORBA_Policy) PortableServer_POA_create_thread_policy ( poa, PortableServer_ORB_CTRL_MODEL, ev); child_poa = PortableServer_POA_create_POA (poa, "Thread Per Request POA", poa_mgr, poa_policies, ev); if (etk_raised_exception(ev)) goto failed_create_poa; ORBit_ObjectAdaptor_set_thread_hint ((ORBit_ObjectAdaptor) child_poa, ORBIT_THREAD_HINT_PER_REQUEST); CORBA_Policy_destroy (poa_policies->_buffer[0], ev); if (etk_raised_exception(ev)) goto failed; CORBA_free (poa_policies); return child_poa; failed_create_poa: /* FIXME, in case of error, ev is set, but destructor should not * return except anyway */ CORBA_Policy_destroy (poa_policies->_buffer[0], ev); CORBA_free (poa_policies); failed: return CORBA_OBJECT_NIL; }
static Examples_BadCall impl_Examples_BadCall__create(PortableServer_POA poa, CORBA_Environment * ev) { Examples_BadCall retval; impl_POA_Examples_BadCall *newservant; PortableServer_ObjectId *objid; newservant = g_new0(impl_POA_Examples_BadCall, 1); newservant->servant.vepv = &impl_Examples_BadCall_vepv; newservant->poa = (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev); POA_Examples_BadCall__init((PortableServer_Servant) newservant, ev); /* Before servant is going to be activated all * private attributes must be initialized. */ /* ------ init private attributes here ------ */ newservant->counter=0; /* init */ /* ------ ---------- end ------------- ------ */ objid = PortableServer_POA_activate_object(poa, newservant, ev); CORBA_free(objid); retval = PortableServer_POA_servant_to_reference(poa, newservant, ev); return retval; }
static void test_ORBit_sequence (void) { gpointer seq = ORBit_sequence_alloc (TC_CORBA_sequence_CORBA_octet, 1000); CORBA_free (seq); }
/*dumb marshalling hack */ static void matecomponent_activation_registration_iterate (const MateComponentActivationBaseService *base_service, CORBA_Object obj, CORBA_Environment *ev, gulong offset, int nargs) { GSList *link; char *ior = NULL; if (nargs == 4) ior = CORBA_ORB_object_to_string (matecomponent_activation_orb_get (), obj, ev); for (link = registries; link; link = link->next) { RegistryInfo *ri; void (*func_ptr) (); ri = link->data; func_ptr = *(gpointer *) ((guchar *) ri->registry + offset); if (!func_ptr) continue; switch (nargs) { case 4: func_ptr (ri->registry, ior, base_service, ri->user_data); break; case 2: func_ptr (ri->registry, ri->user_data); break; } } if (nargs == 4) CORBA_free (ior); }
GList * matecomponent_zoomable_frame_get_preferred_zoom_level_names (MateComponentZoomableFrame *zoomable_frame) { CORBA_Environment ev; MateComponent_ZoomLevelNameList *zoom_level_names; GList *list = NULL; int i; g_return_val_if_fail (MATECOMPONENT_IS_ZOOMABLE_FRAME (zoomable_frame), NULL); CORBA_exception_init (&ev); zoom_level_names = MateComponent_Zoomable__get_preferredLevelNames ( zoomable_frame->priv->zoomable, &ev); if (MATECOMPONENT_EX (&ev)) { matecomponent_object_check_env (MATECOMPONENT_OBJECT (zoomable_frame), zoomable_frame->priv->zoomable, &ev); CORBA_exception_free (&ev); return NULL; } CORBA_exception_free (&ev); if (zoom_level_names == CORBA_OBJECT_NIL) return NULL; for (i = 0; i < zoom_level_names->_length; i++) list = g_list_prepend (list, g_strdup (zoom_level_names->_buffer [i])); CORBA_free (zoom_level_names); return g_list_reverse (list); }
static PyObject * get_iinterface_stub_from_objref(CORBA_Object objref, const gchar *repo_id, CORBA_Environment *ev) { PyObject *stub; MateCORBA_IInterface *iface; gint i; stub = pymatecorba_get_stub_from_repo_id(repo_id); if (stub) return stub; iface = MateCORBA_small_get_iinterface(objref, repo_id, ev); if (ev->_major != CORBA_NO_EXCEPTION) return NULL; /* make sure all base classes have stubs ... */ for (i = 0; i < iface->base_interfaces._length; i++) { const gchar *base_repo_id = iface->base_interfaces._buffer[i]; PyObject *base_stub; if (!base_repo_id) continue; base_stub = get_iinterface_stub_from_objref(objref, base_repo_id, ev); if (ev->_major != CORBA_NO_EXCEPTION) { CORBA_free(iface); return NULL; } } /* finally, generate stub */ pymatecorba_generate_iinterface_stubs(iface); stub = pymatecorba_get_stub_from_repo_id(repo_id); return stub; }
static void server_cleanup (CORBA_ORB orb, PortableServer_POA poa, CORBA_Object ref, CORBA_Environment *ev) { PortableServer_ObjectId *objid = NULL; objid = PortableServer_POA_reference_to_id (poa, ref, ev); if (etk_raised_exception(ev)) return; PortableServer_POA_deactivate_object (poa, objid, ev); if (etk_raised_exception(ev)) return; PortableServer_POA_destroy (poa, TRUE, FALSE, ev); if (etk_raised_exception(ev)) return; CORBA_free (objid); CORBA_Object_release ((CORBA_Object) poa, ev); if (etk_raised_exception(ev)) return; CORBA_Object_release (ref, ev); if (etk_raised_exception(ev)) return; if (orb != CORBA_OBJECT_NIL) { CORBA_ORB_destroy(orb, ev); if (etk_raised_exception(ev)) return; } }
/* Releases @servant object and finally destroys @orb. If error * occures @ev points to exception object on return. */ static void server_cleanup (CORBA_ORB orb, PortableServer_POA poa, CORBA_Object ref, CORBA_Environment *ev) { PortableServer_ObjectId *objid = NULL; objid = PortableServer_POA_reference_to_id (poa, ref, ev); if (etk_raised_exception(ev)) return; /* Servant: deactivatoin - will invoke __fini destructor */ PortableServer_POA_deactivate_object (poa, objid, ev); if (etk_raised_exception(ev)) return; PortableServer_POA_destroy (poa, TRUE, FALSE, ev); if (etk_raised_exception(ev)) return; CORBA_free (objid); CORBA_Object_release ((CORBA_Object) poa, ev); if (etk_raised_exception(ev)) return; CORBA_Object_release (ref, ev); if (etk_raised_exception(ev)) return; /* ORB: tear down the ORB */ if (orb != CORBA_OBJECT_NIL) { /* going to destroy orb.. */ CORBA_ORB_destroy(orb, ev); if (etk_raised_exception(ev)) return; } }
GList * bonobo_zoomable_frame_get_preferred_zoom_level_names (BonoboZoomableFrame *zoomable_frame) { CORBA_Environment ev; Bonobo_ZoomLevelNameList *zoom_level_names; GList *list = NULL; int i; g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), NULL); CORBA_exception_init (&ev); zoom_level_names = Bonobo_Zoomable__get_preferredLevelNames ( zoomable_frame->priv->zoomable, &ev); if (BONOBO_EX (&ev)) { bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), zoomable_frame->priv->zoomable, &ev); CORBA_exception_free (&ev); return NULL; } CORBA_exception_free (&ev); if (zoom_level_names == CORBA_OBJECT_NIL) return NULL; for (i = 0; i < zoom_level_names->_length; i++) list = g_list_prepend (list, g_strdup (zoom_level_names->_buffer [i])); CORBA_free (zoom_level_names); return g_list_reverse (list); }
/* * make exception typecode */ static CORBA_TypeCode orbit_idl_tree_type_to_typecode_exception(IDL_tree type) { CORBA_TypeCode type_code = NULL; CORBA_StructMemberSeq * p_members = NULL; #if 0 if (IDL_EXCEPT_DCL(type).members == NULL) { printf("no members\n"); goto error; } #endif p_members = orbit_create_member_sequence(IDL_EXCEPT_DCL(type).members); if (p_members == NULL) goto error; type_code = CORBA_ORB_create_exception_tc( orbit_get_orb(), IDL_IDENT(IDL_EXCEPT_DCL(type).ident).repo_id, IDL_IDENT(IDL_EXCEPT_DCL(type).ident).str, p_members, orbit_get_environment()); goto exit; error: satellite_release_typecode(type_code); exit: CORBA_free(p_members); return type_code; }
/* * Encodes an ArtUta */ static MateComponent_Canvas_ArtUTA * CORBA_UTA (ArtUta *uta) { MateComponent_Canvas_ArtUTA *cuta; cuta = MateComponent_Canvas_ArtUTA__alloc (); if (!cuta) return NULL; if (!uta) { cuta->width = 0; cuta->height = 0; cuta->utiles._length = 0; cuta->utiles._maximum = 0; return cuta; } cuta->utiles._buffer = CORBA_sequence_MateComponent_Canvas_int32_allocbuf (uta->width * uta->height); cuta->utiles._length = uta->width * uta->height; cuta->utiles._maximum = uta->width * uta->height; if (!cuta->utiles._buffer) { CORBA_free (cuta); return NULL; } cuta->x0 = uta->x0; cuta->y0 = uta->y0; cuta->width = uta->width; cuta->height = uta->height; memcpy (cuta->utiles._buffer, uta->utiles, uta->width * uta->height * sizeof (ArtUtaBbox)); return cuta; }
static Examples_ByteSeq_Storage impl_Examples_ByteSeq_Storage__create(PortableServer_POA poa, CORBA_Environment * ev) { Examples_ByteSeq_Storage retval; impl_POA_Examples_ByteSeq_Storage *newservant; PortableServer_ObjectId *objid; newservant = g_new0(impl_POA_Examples_ByteSeq_Storage, 1); newservant->servant.vepv = &impl_Examples_ByteSeq_Storage_vepv; newservant->poa = (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev); POA_Examples_ByteSeq_Storage__init((PortableServer_Servant) newservant, ev); /* Before servant is going to be activated all * private attributes must be initialized. */ /* ------ init private attributes here ------ */ newservant->chunk = ORBit_sequence_alloc (TC_CORBA_sequence_CORBA_octet, 64); /* ------ ---------- end ------------- ------ */ objid = PortableServer_POA_activate_object(poa, newservant, ev); CORBA_free(objid); retval = PortableServer_POA_servant_to_reference(poa, newservant, ev); return retval; }
CORBA_long onewaytest_longstring(onewaytest _obj, CORBA_char **x, CORBA_Environment *_ev) { printf("onewaytest_longstring Received InOut %s: Onewaytest",*x); CORBA_free(*x); alloc_strcpy(*x, "Fabulous!", _ev); return 21; }