[omniORB] resolving const and enum symbol names in AST

Tim Black timblaktu at gmail.com
Wed Aug 19 18:11:33 BST 2009


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:

// myObject.idl:
module myObject {
    const int arySize = 4;
    const int seqSize = arySize;
    struct myStruct {
        int a[arySize];
    }
    sequence<float, seqSize> mySeq;
}

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:

// myObject.h:
namespace myObject {
    const int arySize = 4;
    const int seqSize = 4;
    struct myStruct {
        int a[4];
    }
    sequence<float, 4> mySeq;
}

This is OK, but it would be more clear if it could use the actual symbol in
the generated code, something like:

// myObject.h:
namespace myObject {
    const int arySize = 4;
    const int seqSize = arySize;
    struct myStruct {
        int a[arySize];
    }
    sequence<float, seqSize> mySeq;
}

I realize this is merely an aesthetic issue, but does anyone know a way to
achieve what I am trying to achieve here?

Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20090819/ea35afc6/attachment.htm


More information about the omniORB-list mailing list