[omniORB] omniidl2 question - TC representation of recursive struct reference inside doubly nested sequence

James Riden jamesr@harlequin.co.uk
03 Jul 2000 09:37:32 +0100


(resend of earlier message to omniorb@uk.research.att.com)

Dear omniORBers,
  We've got a problem compiling some IDL using omniidl2 from a CVS
checkout from last week. We've had a look at the spec. and from a
brief reading the IDL looks well formed. Any advice much appreciated.

thanks,
 James

=============
Jason writes:

Here's the description of the problem:

The following IDL:

struct tree {
  any value;
  sequence< tree > children;
};

produces the following DynSK.cpp code for building the typecode using a
recursive TC reference:

static CORBA::PR_structMember _0RL_structmember_tree[] = {
  {"value", CORBA::TypeCode::PR_any_tc()},
  {"children", CORBA::TypeCode::PR_recursive_sequence_tc(0, 1)}
};
static CORBA::TypeCode_ptr _0RL_tc_tree =
CORBA::TypeCode::PR_struct_tc("IDL:tree:1.0", "tree", _0RL_structmember_tree,
2);

However, the following IDL with one extra layer of "sequence":

struct tree {
  any value;
  sequence< sequence< tree > > children;
};

produces the following DynSK.cpp code for the typecode naively, without using a
recursive TC reference:

static CORBA::PR_structMember _0RL_structmember_tree[] = {
  {"value", CORBA::TypeCode::PR_any_tc()},
  {"children", CORBA::TypeCode::PR_sequence_tc(0,
CORBA::TypeCode::PR_sequence_tc(0, _0RL_tc_tree))}
};
static CORBA::TypeCode_ptr _0RL_tc_tree =
CORBA::TypeCode::PR_struct_tc("IDL:tree:1.0", "tree", _0RL_structmember_tree,
2);

This latter code fails to compile due to the forward reference of
"_0RL_tc_tree".

__Jason