[omniORB] resolving const and enum symbol names in AST

Duncan Grisby duncan at grisby.org
Fri Aug 28 11:53:58 BST 2009


On Wednesday 19 August, Tim Black wrote:

> I am using omniIDL for generating some non-CORBA application-specific code.
> The problem I'm having is that when const or enum symbols are used in .idl,
> the resulting AST passed to my back-end seems to always have pre-substituted
> the values of these symbols. This will give the desired machine code when
> compiled, but is not always optimal in terms of clarity of the generated code.
> To illustrate, consider the following .idl:

[...]
> In the back end, when parsing the AST nodes that are defined using one of
> these const symbols (seqSize, myStruct.a, or mySeq), there appears to be no
> reference to the name of the symbol. Only the value. So my back end has no
> choice but to generate a corresponding C++ class something like:

You're right. Where constants are used in array sizes, etc., omniidl
just gives the back-end the value, not the symbolic expression that
leads to it. It's not as simple as just including the name, because
you're allowed to do arithmetic. This is valid IDL, for example:

  const long one   = 1;
  const long two   = 2;
  const long three = 3;

  typedef string StringArray[one + two * three];

To allow symbolic expressions in arrays etc., omniidl would have to pass
the whole expression through, not just a name. Clearly that could be
done, but there has never been a compelling reason to do it.

Feel free to tinker with the front-end code...

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list