C stubber was generating incorrect Sequence Pop code for sequences whose elements
were not normally pointers (e.g. longs). Thanks to Robert Wamble!
*** stubbers/c/cheaders.c.orig Thu Sep 25 14:29:54 1997
--- stubbers/c/cheaders.c Wed Oct 1 15:27:45 1997
***************
*** 866,872 ****
fprintf (c->file, "void %s_Every (%s *h, void (*f)(%s%s, void *), void *);\n", tn, tn, st, nr ? "" : "*");
fprintf (c->file, "void %s_Append (%s *h, %s item);\n", tn, tn, st);
fprintf (c->file, "void %s_Push (%s *h, %s item);\n", tn, tn, st);
! fprintf (c->file, "void %s_Pop (%s *h, %s item);\n", tn, tn, st);
fprintf (c->file, "CORBA_unsigned_long %s_Length (%s *);\n", tn, tn);
fprintf (c->file, "%s * %s_Nth (%s *, CORBA_unsigned_long);\n", rtn, tn, tn);
fprintf (c->file, "%s * %s_Create (CORBA_unsigned_long /* size */, %s %s /* init val */);\n", tn, tn, st, (nr) ? "" : "*");
--- 866,872 ----
fprintf (c->file, "void %s_Every (%s *h, void (*f)(%s%s, void *), void *);\n", tn, tn, st, nr ? "" : "*");
fprintf (c->file, "void %s_Append (%s *h, %s item);\n", tn, tn, st);
fprintf (c->file, "void %s_Push (%s *h, %s item);\n", tn, tn, st);
! fprintf (c->file, "void %s_Pop (%s *h, %s %sitem);\n", tn, tn, st, (nr) ? "" : "*");
fprintf (c->file, "CORBA_unsigned_long %s_Length (%s *);\n", tn, tn);
fprintf (c->file, "%s * %s_Nth (%s *, CORBA_unsigned_long);\n", rtn, tn, tn);
fprintf (c->file, "%s * %s_Create (CORBA_unsigned_long /* size */, %s %s /* init val */);\n", tn, tn, st, (nr) ? "" : "*");
*** stubbers/c/code.c.orig Thu Sep 25 14:29:55 1997
--- stubbers/c/code.c Wed Oct 1 15:27:29 1997
***************
*** 1960,1969 ****
rtn);
fprintf(f, "}\n\n");
! fprintf(f, "void %s_Pop (%s *h, %s item)\n{\n", tn, tn, st);
fprintf(f, " _ILU_C_PopGeneric (%s, %s, sizeof(%s));\n}\n\n",
"(ILU_C_Sequence) h",
! (hasReferent) ? "(char *) item" : "(char *) &item",
rtn);
fprintf(f, "CORBA_unsigned_long %s_Length (%s *h)\n{\n", tn, tn);
--- 1960,1969 ----
rtn);
fprintf(f, "}\n\n");
! fprintf(f, "void %s_Pop (%s *h, %s %sitem)\n{\n", tn, tn, st, (hasReferent) ? "" : "*");
fprintf(f, " _ILU_C_PopGeneric (%s, %s, sizeof(%s));\n}\n\n",
"(ILU_C_Sequence) h",
! "(char *) item",
rtn);
fprintf(f, "CORBA_unsigned_long %s_Length (%s *h)\n{\n", tn, tn);
Joachim Achtzehnter was kind enough to identify and fix a number of problems in the ILU implementation of CosNaming. His patch appears below.
*** 1.13 1997/08/30 03:01:31
--- etc/CosNaming/NamingImpl.c 1997/11/07 22:24:57
***************
*** 6,11 ****
--- 6,15 ----
#include
#include
+ #ifdef WIN32
+ #include
+ #endif
+
#include "CosNaming.h"
#include "iluhash.h"
***************
*** 18,23 ****
--- 22,28 ----
/* number of slots in hash table (shrug) */
#define CONTEXT_NBUCKETS 23
+ static ILU_C_Server theServer;
static void UpdateBackingStore (void);
static void AddObject (CosNaming_NamingContext);
static void RemoveObject (CosNaming_NamingContext);
***************
*** 26,35 ****
static ilu_boolean Verbose = ilu_FALSE;
static void *
! MyMalloc (ilu_cardinal size, ILU_C_ENVIRONMENT *env)
{
void *ptr;
- ilu_Error lerr;
if ((ptr = ilu_malloc(size)) == ILU_NIL)
ILU_C_RAISE_SYSTEM(env, NO_MEMORY, size, NO);
--- 31,39 ----
static ilu_boolean Verbose = ilu_FALSE;
static void *
! MyMalloc (ilu_cardinal size, ILU_C_ENVIRONMENT *env)
{
void *ptr;
if ((ptr = ilu_malloc(size)) == ILU_NIL)
ILU_C_RAISE_SYSTEM(env, NO_MEMORY, size, NO);
***************
*** 39,47 ****
}
static char *
! MyStrdup (char *str, ILU_C_ENVIRONMENT *env)
{
- ilu_Error lerr;
unsigned len, fullen, i;
ilu_CString s2;
--- 43,50 ----
}
static char *
! MyStrdup (char *str, ILU_C_ENVIRONMENT *env)
{
unsigned len, fullen, i;
ilu_CString s2;
***************
*** 62,68 ****
}
static CosNaming_Name
! NameFromNameComponent (CosNaming_NameComponent *s, ILU_C_ENVIRONMENT *env)
{
CosNaming_Name newname;
newname._maximum = 1;
--- 65,71 ----
}
static CosNaming_Name
! NameFromNameComponent (CosNaming_NameComponent *s, ILU_C_ENVIRONMENT *env)
{
CosNaming_Name newname;
newname._maximum = 1;
***************
*** 79,85 ****
}
static CosNaming_Name
! CopyName (CosNaming_Name *in, ilu_cardinal offset, ILU_C_ENVIRONMENT *env)
{
CosNaming_Name newname;
CosNaming_NameComponent *new_component, *in_component;
--- 82,88 ----
}
static CosNaming_Name
! CopyName (CosNaming_Name *in, ilu_cardinal offset, ILU_C_ENVIRONMENT *env)
{
CosNaming_Name newname;
CosNaming_NameComponent *new_component, *in_component;
***************
*** 100,106 ****
return newname;
} else {
for (i = 0; i < limit; i++) {
! new_component = CosNaming_Name_Nth(&newname, i);
in_component = CosNaming_Name_Nth(in, i + offset);
new_component->id = MyStrdup(in_component->id, env);
if (! ILU_C_SUCCESSFUL(env)) return newname;
--- 103,109 ----
return newname;
} else {
for (i = 0; i < limit; i++) {
! new_component = newname._buffer + i;
in_component = CosNaming_Name_Nth(in, i + offset);
new_component->id = MyStrdup(in_component->id, env);
if (! ILU_C_SUCCESSFUL(env)) return newname;
***************
*** 118,155 ****
/*************************************************************************/
static void
! RaiseNotFound (ILU_C_ENVIRONMENT *env,
! CosNaming_Name *bad_name, ilu_cardinal bad_segment, CosNaming_NamingContext_NotFoundReason why)
{
CosNaming_NamingContext_NotFound *nf;
! CosNaming_Name *newname;
! ilu_cardinal j;
env->returnCode = ex_CosNaming_NamingContext_NotFound;
env->_major = ILU_C_USER_EXCEPTION;
env->freeRoutine = (ILU_C_FreeFn) CosNaming_NamingContext_NotFound__Free;
! if ((nf = MyMalloc(sizeof(CosNaming_NamingContext_NotFound), env)) == ILU_NIL) {
return;
} else {
nf->why = why;
! nf->rest_of_name = CopyName(bad_name, bad_segment, env);
env->ptr = (ilu_refany) nf;
}
}
static void
! RaiseCannotProceed (ILU_C_ENVIRONMENT *env,
! CosNaming_Name *bad_name, ilu_cardinal bad_segment, CosNaming_NamingContext ctx)
{
CosNaming_NamingContext_CannotProceed *cp;
- CosNaming_Name *newname;
ILU_C_ENVIRONMENT localenv;
- ilu_cardinal j;
env->returnCode = ex_CosNaming_NamingContext_NotFound;
env->_major = ILU_C_USER_EXCEPTION;
env->freeRoutine = (ILU_C_FreeFn) CosNaming_NamingContext_CannotProceed__Free;
! if ((cp = MyMalloc(sizeof(CosNaming_NamingContext_NotFound), env)) == ILU_NIL) {
return;
} else {
cp->cxt = (CosNaming_NamingContext) CORBA_Object_duplicate(ctx, &localenv);
--- 121,161 ----
/*************************************************************************/
static void
! RaiseNotFound (ILU_C_ENVIRONMENT *env,
! CosNaming_Name *bad_name,
! ilu_cardinal bad_segment,
! CosNaming_NamingContext_NotFoundReason why)
{
CosNaming_NamingContext_NotFound *nf;
! CORBA_Environment localenv;
env->returnCode = ex_CosNaming_NamingContext_NotFound;
env->_major = ILU_C_USER_EXCEPTION;
env->freeRoutine = (ILU_C_FreeFn) CosNaming_NamingContext_NotFound__Free;
! nf = MyMalloc(sizeof(CosNaming_NamingContext_NotFound), &localenv);
! if (nf == ILU_NIL) {
return;
} else {
nf->why = why;
! nf->rest_of_name = CopyName(bad_name, bad_segment, &localenv);
env->ptr = (ilu_refany) nf;
}
}
static void
! RaiseCannotProceed (ILU_C_ENVIRONMENT *env,
! CosNaming_Name *bad_name,
! ilu_cardinal bad_segment,
! CosNaming_NamingContext ctx)
{
CosNaming_NamingContext_CannotProceed *cp;
ILU_C_ENVIRONMENT localenv;
env->returnCode = ex_CosNaming_NamingContext_NotFound;
env->_major = ILU_C_USER_EXCEPTION;
env->freeRoutine = (ILU_C_FreeFn) CosNaming_NamingContext_CannotProceed__Free;
! cp = MyMalloc(sizeof(CosNaming_NamingContext_NotFound), &localenv);
! if (cp == ILU_NIL) {
return;
} else {
cp->cxt = (CosNaming_NamingContext) CORBA_Object_duplicate(ctx, &localenv);
***************
*** 158,170 ****
ILU_C_RAISE_SYSTEM(env, INTERNAL, 0, NO);
return;
}
! cp->rest_of_name = CopyName(bad_name, bad_segment, env);
env->ptr = (ilu_refany) cp;
}
}
static void
! RaiseInvalidName (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_InvalidName;
env->_major = ILU_C_USER_EXCEPTION;
--- 164,176 ----
ILU_C_RAISE_SYSTEM(env, INTERNAL, 0, NO);
return;
}
! cp->rest_of_name = CopyName(bad_name, bad_segment, &localenv);
env->ptr = (ilu_refany) cp;
}
}
static void
! RaiseInvalidName (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_InvalidName;
env->_major = ILU_C_USER_EXCEPTION;
***************
*** 173,179 ****
}
static void
! RaiseAlreadyBound (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_AlreadyBound;
env->_major = ILU_C_USER_EXCEPTION;
--- 179,185 ----
}
static void
! RaiseAlreadyBound (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_AlreadyBound;
env->_major = ILU_C_USER_EXCEPTION;
***************
*** 182,188 ****
}
static void
! RaiseNotEmpty (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_NotEmpty;
env->_major = ILU_C_USER_EXCEPTION;
--- 188,194 ----
}
static void
! RaiseNotEmpty (ILU_C_ENVIRONMENT *env)
{
env->returnCode = ex_CosNaming_NamingContext_NotEmpty;
env->_major = ILU_C_USER_EXCEPTION;
***************
*** 201,208 ****
} BIData;
CORBA_boolean
! server_CosNaming_BindingIterator_next_one
! (CosNaming_BindingIterator _handle, CosNaming_Binding** b, ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
CORBA_boolean return_status;
--- 207,215 ----
} BIData;
CORBA_boolean
! server_CosNaming_BindingIterator_next_one(CosNaming_BindingIterator _handle,
! CosNaming_Binding** b,
! ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
CORBA_boolean return_status;
***************
*** 232,242 ****
}
CORBA_boolean
! server_CosNaming_BindingIterator_next_n
! (CosNaming_BindingIterator _handle, CORBA_unsigned_long how_many, CosNaming_BindingList** bl, ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
- CORBA_boolean return_status;
ilu_cardinal n, size, i;
CosNaming_Binding *newbinding, *oldbinding;
CosNaming_BindingList *new_list;
--- 239,250 ----
}
CORBA_boolean
! server_CosNaming_BindingIterator_next_n(CosNaming_BindingIterator _handle,
! CORBA_unsigned_long how_many,
! CosNaming_BindingList** bl,
! ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
ilu_cardinal n, size, i;
CosNaming_Binding *newbinding, *oldbinding;
CosNaming_BindingList *new_list;
***************
*** 262,269 ****
}
void
! server_CosNaming_BindingIterator_destroy
! (CosNaming_BindingIterator _handle, ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
--- 270,277 ----
}
void
! server_CosNaming_BindingIterator_destroy(CosNaming_BindingIterator _handle,
! ILU_C_ENVIRONMENT *_status)
{
BIData *bid = CosNaming_BindingIterator__GetUserData(_handle);
***************
*** 297,303 ****
} NamedValue;
static ilu_HashTable
! NewContextHashTable (ilu_cardinal entries)
{
return (ilu_hash_MakeNewTable ((entries == 0) ? CONTEXT_NBUCKETS : entries,
ilu_hash_HashString, ilu_hash_StringCompare));
--- 305,311 ----
} NamedValue;
static ilu_HashTable
! NewContextHashTable (ilu_cardinal entries)
{
return (ilu_hash_MakeNewTable ((entries == 0) ? CONTEXT_NBUCKETS : entries,
ilu_hash_HashString, ilu_hash_StringCompare));
***************
*** 308,313 ****
--- 316,323 ----
ilu_cardinal entries,
ILU_C_ENVIRONMENT *_status)
{
+ static unsigned long next_def_ih = 1;
+ char idbuf[12];
CosNaming_NamingContext newcontext;
ilu_HashTable ht;
***************
*** 316,321 ****
--- 326,343 ----
ILU_C_RAISE_SYSTEM(_status, NO_MEMORY, 0, NO);
return ILU_NIL;
};
+
+ if (!ih) {
+ /* this dance is necessary to avoid creating an instance with
+ * and instance handle that already exists (read from the
+ * backing file at startup)
+ */
+ do {
+ sprintf(idbuf, "%lu", next_def_ih++);
+ } while (ILU_C_FindObject(ILU_C_IDOfServer(server), idbuf));
+ ih = idbuf;
+ }
+
newcontext = CosNaming_NamingContext__CreateTrue(ih, server, (ilu_refany) ht);
if (newcontext == ILU_NIL) {
ILU_C_RAISE_SYSTEM(_status, INTERNAL, 0, NO);
***************
*** 327,336 ****
}
static CosNaming_NamingContext
! FindOrCreateNamingContext (ilu_string ih,
! ILU_C_Server server,
! ilu_cardinal entries,
! ILU_C_ENVIRONMENT *_status)
{
ILU_C_Object *obj;
--- 349,358 ----
}
static CosNaming_NamingContext
! FindOrCreateNamingContext (ilu_string ih,
! ILU_C_Server server,
! ilu_cardinal entries,
! ILU_C_ENVIRONMENT *_status)
{
ILU_C_Object *obj;
***************
*** 343,354 ****
return obj;
}
! void
! server_CosNaming_NamingContext_bind
! (CosNaming_NamingContext _handle, CosNaming_Name* n, ilu_CORBA_Object obj, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
- CosNaming_NamingContext nc;
CosNaming_Name tempname;
ilu_cardinal size;
NamedValue *nv;
--- 365,378 ----
return obj;
}
! static void
! generic_bind(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ilu_CORBA_Object obj,
! CosNaming_BindingType type,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CosNaming_Name tempname;
ilu_cardinal size;
NamedValue *nv;
***************
*** 369,375 ****
if ((nv = ilu_hash_FindInTable(ht, n->_buffer[0].id)) != ILU_NIL) {
RaiseAlreadyBound(_status);
} else if ((nv = (NamedValue *) MyMalloc(sizeof(*nv), _status)) != ILU_NIL) {
! nv->kind = CosNaming_nobject;
nv->key.id = MyStrdup(n->_buffer[0].id, _status);
if (!ILU_C_SUCCESSFUL(_status))
{ ilu_free(nv); return; };
--- 393,399 ----
if ((nv = ilu_hash_FindInTable(ht, n->_buffer[0].id)) != ILU_NIL) {
RaiseAlreadyBound(_status);
} else if ((nv = (NamedValue *) MyMalloc(sizeof(*nv), _status)) != ILU_NIL) {
! nv->kind = type;
nv->key.id = MyStrdup(n->_buffer[0].id, _status);
if (!ILU_C_SUCCESSFUL(_status))
{ ilu_free(nv); return; };
***************
*** 387,411 ****
} else {
RaiseCannotProceed (_status, n, 1, _handle);
}
- } else if (nv->kind != CosNaming_ncontext) {
- RaiseNotFound (_status, n, 1, CosNaming_not_context);
} else {
! tempname._length = size - 1;
! tempname._maximum = size - 1;
! tempname._buffer = &n->_buffer[1];
! CosNaming_NamingContext_bind (nv->value.context, &tempname, obj, _status);
}
}
void
! server_CosNaming_NamingContext_rebind
! (CosNaming_NamingContext _handle, CosNaming_Name* n, ilu_CORBA_Object obj, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
- NamedValue *nv;
- ilu_cardinal i, size;
- char *eid;
- CosNaming_NameComponent *this_component;
CosNaming_NamingContext_unbind (_handle, n, _status);
if (! ILU_C_SUCCESSFUL(_status)) {
--- 411,447 ----
} else {
RaiseCannotProceed (_status, n, 1, _handle);
}
} else {
! if ((nv = ilu_hash_FindInTable(ht, n->_buffer[0].id)) == ILU_NIL) {
! RaiseNotFound (_status, n, 0, CosNaming_missing_node);
! } else if (nv->kind != CosNaming_ncontext) {
! RaiseNotFound (_status, n, 0, CosNaming_not_context);
! } else {
! tempname._length = size - 1;
! tempname._maximum = size - 1;
! tempname._buffer = &n->_buffer[1];
! generic_bind (nv->value.context, &tempname, obj, type, _status);
! }
}
}
void
! server_CosNaming_NamingContext_bind(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ilu_CORBA_Object obj,
! ILU_C_ENVIRONMENT *_status)
! {
! generic_bind(_handle, n, obj, CosNaming_nobject, _status);
! }
!
! static void
! generic_rebind(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ilu_CORBA_Object obj,
! CosNaming_BindingType type,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CosNaming_NamingContext_unbind (_handle, n, _status);
if (! ILU_C_SUCCESSFUL(_status)) {
***************
*** 418,456 ****
return;
}
};
! CosNaming_NamingContext_bind (_handle, n, obj, _status);
return;
}
void
! server_CosNaming_NamingContext_bind_context
! (CosNaming_NamingContext _handle, CosNaming_Name* n, CosNaming_NamingContext nc, ILU_C_ENVIRONMENT *_status)
{
! CosNaming_NamingContext_bind (_handle, n, (CORBA_Object) nc, _status);
}
void
! server_CosNaming_NamingContext_rebind_context
! (CosNaming_NamingContext _handle, CosNaming_Name* n, CosNaming_NamingContext nc, ILU_C_ENVIRONMENT *_status)
{
! CosNaming_NamingContext_rebind (_handle, n, (CORBA_Object) nc, _status);
}
ilu_CORBA_Object
! server_CosNaming_NamingContext_resolve
! (CosNaming_NamingContext _handle, CosNaming_Name* n, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CosNaming_Name tempname;
NamedValue *nv;
! ilu_cardinal size;
CosNaming_NameComponent *this_component;
! if (ht == ILU_NIL) {
RaiseInvalidName(_status);
return ILU_NIL;
};
- size = CosNaming_Name_Length(n);
this_component = CosNaming_Name_Nth(n, 0);
if ((nv = ilu_hash_FindInTable(ht, this_component->id)) == ILU_NIL) {
RaiseNotFound(_status, n, 0, CosNaming_missing_node);
--- 454,505 ----
return;
}
};
! generic_bind (_handle, n, obj, type, _status);
return;
}
void
! server_CosNaming_NamingContext_rebind(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ilu_CORBA_Object obj,
! ILU_C_ENVIRONMENT *_status)
! {
! generic_rebind(_handle, n, obj, CosNaming_nobject, _status);
! }
!
! void
! server_CosNaming_NamingContext_bind_context(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! CosNaming_NamingContext nc,
! ILU_C_ENVIRONMENT *_status)
{
! generic_bind(_handle, n, (CORBA_Object)nc, CosNaming_ncontext, _status);
}
void
! server_CosNaming_NamingContext_rebind_context(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! CosNaming_NamingContext nc,
! ILU_C_ENVIRONMENT *_status)
{
! generic_rebind (_handle, n, (CORBA_Object) nc, CosNaming_ncontext, _status);
}
ilu_CORBA_Object
! server_CosNaming_NamingContext_resolve(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CosNaming_Name tempname;
NamedValue *nv;
! ilu_cardinal size = CosNaming_Name_Length(n);
CosNaming_NameComponent *this_component;
! if (ht == ILU_NIL || size == 0) {
RaiseInvalidName(_status);
return ILU_NIL;
};
this_component = CosNaming_Name_Nth(n, 0);
if ((nv = ilu_hash_FindInTable(ht, this_component->id)) == ILU_NIL) {
RaiseNotFound(_status, n, 0, CosNaming_missing_node);
***************
*** 474,486 ****
}
void
! server_CosNaming_NamingContext_unbind
! (CosNaming_NamingContext _handle, CosNaming_Name* n, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
NamedValue *nv;
! ilu_cardinal i, size;
! CosNaming_NameComponent *this_component;
CosNaming_Name tempname;
if (ht == ILU_NIL) {
--- 523,535 ----
}
void
! server_CosNaming_NamingContext_unbind(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
NamedValue *nv;
! ilu_cardinal size;
CosNaming_Name tempname;
if (ht == ILU_NIL) {
***************
*** 516,530 ****
}
CosNaming_NamingContext
! server_CosNaming_NamingContext_new_context
! (CosNaming_NamingContext _handle, ILU_C_ENVIRONMENT *_status)
{
! return NewNamingContext(ILU_NIL, ILU_NIL, 0, _status);
}
void
! server_CosNaming_NamingContext_destroy
! (CosNaming_NamingContext _handle, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
if (ilu_hash_PairsInTable(ht) > 0) {
--- 565,579 ----
}
CosNaming_NamingContext
! server_CosNaming_NamingContext_new_context(CosNaming_NamingContext _handle,
! ILU_C_ENVIRONMENT *_status)
{
! return NewNamingContext(ILU_NIL, theServer, 0, _status);
}
void
! server_CosNaming_NamingContext_destroy(CosNaming_NamingContext _handle,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
if (ilu_hash_PairsInTable(ht) > 0) {
***************
*** 539,546 ****
}
CosNaming_NamingContext
! server_CosNaming_NamingContext_bind_new_context
! (CosNaming_NamingContext _handle, CosNaming_Name* n, ILU_C_ENVIRONMENT *_status)
{
CosNaming_NamingContext newcontext;
ILU_C_ENVIRONMENT localstatus;
--- 588,596 ----
}
CosNaming_NamingContext
! server_CosNaming_NamingContext_bind_new_context(CosNaming_NamingContext _handle,
! CosNaming_Name* n,
! ILU_C_ENVIRONMENT *_status)
{
CosNaming_NamingContext newcontext;
ILU_C_ENVIRONMENT localstatus;
***************
*** 563,577 ****
}
void
! server_CosNaming_NamingContext_list
! (CosNaming_NamingContext _handle, CORBA_unsigned_long how_many, CosNaming_BindingList** bl, CosNaming_BindingIterator* bi, ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CORBA_unsigned_long count, i, limit;
CosNaming_BindingList *bindinglist;
CosNaming_BindingList *iteratorlist;
CosNaming_BindingIterator iterator;
- ilu_boolean needs_iterator;
ilu_HashEnumerator_s he;
ilu_string key;
NamedValue *bv;
--- 613,629 ----
}
void
! server_CosNaming_NamingContext_list(CosNaming_NamingContext _handle,
! CORBA_unsigned_long how_many,
! CosNaming_BindingList** bl,
! CosNaming_BindingIterator* bi,
! ILU_C_ENVIRONMENT *_status)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(_handle);
CORBA_unsigned_long count, i, limit;
CosNaming_BindingList *bindinglist;
CosNaming_BindingList *iteratorlist;
CosNaming_BindingIterator iterator;
ilu_HashEnumerator_s he;
ilu_string key;
NamedValue *bv;
***************
*** 642,665 ****
static ilu_boolean LocalObject (CosNaming_NamingContext obj)
{
! int i;
for (i = 0; i < ContextObjectsUsed; i++)
if (obj == ContextObjects[i])
return ilu_TRUE;
return ilu_FALSE;
}
! static void OutputNamingContext (FILE *fp, CosNaming_NamingContext nc, char *local_sid)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(nc);
ilu_HashEnumerator_s he;
char *sid = ILU_NIL;
char *ih = ILU_NIL;
char *sbh = ILU_NIL;
- char *id, *kind;
ilu_cardinal sid_len, ih_len, kind_len, id_len, sbh_len;
ilu_refany key, data;
NamedValue *entry;
ILU_C_IDOfObject (nc, &sid, &ih);
sid_len = strlen(sid);
--- 694,718 ----
static ilu_boolean LocalObject (CosNaming_NamingContext obj)
{
! unsigned int i;
for (i = 0; i < ContextObjectsUsed; i++)
if (obj == ContextObjects[i])
return ilu_TRUE;
return ilu_FALSE;
}
! static void
! OutputNamingContext (FILE *fp, CosNaming_NamingContext nc, char *local_sid)
{
ilu_HashTable ht = CosNaming_NamingContext__GetUserData(nc);
ilu_HashEnumerator_s he;
char *sid = ILU_NIL;
char *ih = ILU_NIL;
char *sbh = ILU_NIL;
ilu_cardinal sid_len, ih_len, kind_len, id_len, sbh_len;
ilu_refany key, data;
NamedValue *entry;
+ CORBA_Object obj;
ILU_C_IDOfObject (nc, &sid, &ih);
sid_len = strlen(sid);
***************
*** 676,695 ****
while(ilu_hash_Next(&he, &key, &data))
{
entry = (NamedValue *) data;
id_len = strlen(entry->key.id);
kind_len = strlen(entry->key.kind);
! if (LocalObject((entry->kind == CosNaming_ncontext) ? entry->value.context : entry->value.obj)) {
! ILU_C_IDOfObject (nc, &sid, &ih);
sid_len = strlen(sid);
ih_len = strlen(ih);
! ht = (ilu_HashTable) CosNaming_NamingContext__GetUserData((CosNaming_NamingContext) (entry->kind == CosNaming_ncontext) ? entry->value.context : entry->value.obj);
fprintf (fp, " %ld %*.*s %ld %*.*s L %ld %*.*s %ld %*.*s %ld\n",
id_len, id_len, id_len, entry->key.id,
kind_len, kind_len, kind_len, entry->key.kind,
sid_len, sid_len, sid_len, sid,
ih_len, ih_len, ih_len, ih, ilu_hash_PairsInTable(ht));
} else {
! sbh = ILU_C_SBHOfObject((entry->kind == CosNaming_ncontext) ? entry->value.context : entry->value.obj);
sbh_len = strlen(sbh);
fprintf (fp, " %ld %*.*s %ld %*.*s %c %ld %*.*s\n",
id_len, id_len, id_len, entry->key.id,
--- 729,751 ----
while(ilu_hash_Next(&he, &key, &data))
{
entry = (NamedValue *) data;
+ obj = ((entry->kind == CosNaming_ncontext)
+ ? entry->value.context
+ : entry->value.obj);
id_len = strlen(entry->key.id);
kind_len = strlen(entry->key.kind);
! if (LocalObject(obj)) {
! ILU_C_IDOfObject (obj, &sid, &ih);
sid_len = strlen(sid);
ih_len = strlen(ih);
! ht = (ilu_HashTable) CosNaming_NamingContext__GetUserData(obj);
fprintf (fp, " %ld %*.*s %ld %*.*s L %ld %*.*s %ld %*.*s %ld\n",
id_len, id_len, id_len, entry->key.id,
kind_len, kind_len, kind_len, entry->key.kind,
sid_len, sid_len, sid_len, sid,
ih_len, ih_len, ih_len, ih, ilu_hash_PairsInTable(ht));
} else {
! sbh = ILU_C_SBHOfObject(obj);
sbh_len = strlen(sbh);
fprintf (fp, " %ld %*.*s %ld %*.*s %c %ld %*.*s\n",
id_len, id_len, id_len, entry->key.id,
***************
*** 753,765 ****
}
}
! static FILE * InitializeRoot (char *filename, char *root_sid, ILU_C_Server server)
{
FILE *fp;
char *sid, *ih, *id, *kind, *sbh, *lp;
ilu_HashTable ht;
! unsigned long entries, sid_len, ih_len, id_len, kind_len, sbh_len, lineno;
! int count, i;
char line[10000];
char kindc;
CosNaming_NamingContext newobj;
--- 809,823 ----
}
}
! static FILE *
! InitializeRoot (char *filename, char *root_sid, ILU_C_Server server)
{
FILE *fp;
char *sid, *ih, *id, *kind, *sbh, *lp;
ilu_HashTable ht;
! unsigned long entries, local_entries;
! unsigned long sid_len, ih_len, id_len, kind_len, sbh_len, lineno, i;
! int count;
char line[10000];
char kindc;
CosNaming_NamingContext newobj;
***************
*** 847,856 ****
memcpy (ih, lp, ih_len);
ih[ih_len] = 0;
lp += ih_len;
! if ((sscanf (lp, " %lu%n", &entries, &count) != 1) ||
(lp[count] != 0)) goto badline;
ILU_C_SET_SUCCESSFUL(&status);
! obj = FindOrCreateNamingContext (ih, server, entries, &status);
if (!ILU_C_SUCCESSFUL(&status)) {
fprintf (stderr, "%s, %d: Can't incarnate object with SBH \"%s\"\n",
filename, lineno, sbh);
--- 905,914 ----
memcpy (ih, lp, ih_len);
ih[ih_len] = 0;
lp += ih_len;
! if ((sscanf (lp, " %lu%n", &local_entries, &count) != 1) ||
(lp[count] != 0)) goto badline;
ILU_C_SET_SUCCESSFUL(&status);
! obj = FindOrCreateNamingContext (ih, server, local_entries, &status);
if (!ILU_C_SUCCESSFUL(&status)) {
fprintf (stderr, "%s, %d: Can't incarnate object with SBH \"%s\"\n",
filename, lineno, sbh);
***************
*** 925,935 ****
{
CosNaming_NamingContext root;
ILU_C_ENVIRONMENT status;
- ILU_C_Server theServer;
int stop;
char *pinfo = "iiop_1_0_1";
char *tinfo[3] = { "tcp_0_0", ILU_NIL, ILU_NIL };
- char realm_name[1024];
char hostname[1024];
char tcpinfo[1100];
char sid[1100];
--- 983,991 ----
***************
*** 947,953 ****
if (i++ < ac) {
(rawport = strtoul(av[i], ILU_NIL, 0)), i++;
if (rawport >= 0 && rawport <= 0xFFFF)
! port = rawport;
else
usage(av[0]);
}
--- 1003,1009 ----
if (i++ < ac) {
(rawport = strtoul(av[i], ILU_NIL, 0)), i++;
if (rawport >= 0 && rawport <= 0xFFFF)
! port = (ilu_shortcardinal)rawport;
else
usage(av[0]);
}
***************
*** 1000,1006 ****
pinfo,
tinfo,
ILU_NIL, /* no identity at present */
! ilu_TRUE /* establish as default server */
);
if (BackingFilename == ILU_NIL)
--- 1056,1062 ----
pinfo,
tinfo,
ILU_NIL, /* no identity at present */
! ilu_TRUE /* create port anyway */
);
if (BackingFilename == ILU_NIL)