[omniORB] omniidl compiler problem? (omniorbpy 2.1)

Rene Jager renej.frog at yucom.be
Thu Aug 28 16:41:46 BST 2003


On Thu, 2003-08-28 at 10:09, enrico.sirola at riskmap.it wrote:
> Hello,
> omniidl refuses to compile the following IDL file:
> 
> ----------> cut here (tree.idl) <----------
> 
> module tree {
>     enum NodeKind {IsLeaf, IsNotLeaf};
> 
>     struct Node;
>     union NodeContent;
>     typedef sequence<Node> NodeSeq;
>     typedef sequence<string> StringSeq;
>     
>     union NodeContent switch (NodeKind) {
>     case IsLeaf:
> 	StringSeq itemCodes;
>     case IsNotLeaf:
> 	NodeSeq childNodes;
>     };
> 
>     struct Node {
> 	string tag;
> 	NodeContent nc;
>     };
> 
> };
> 
> ----------> end of file <----------
> 
> omniidl -bpython tree.idl fails as follow
> 
> $ omniidl.exe -bpython tree.idl
> tree.idl:13: Cannot use sequence of forward-declared struct 'tree::Node' before it is fully defined
> tree.idl:4:  ('Node' forward-declared here)
> omniidl: 1 error.
> 
> Any clue?

the following would probably work:

---------------------------

module tree {
    enum NodeKind {IsLeaf, IsNotLeaf};
                                                                                                                                                        
    struct Node;
    typedef sequence<string> StringSeq;
                                                                                                                                                        
    struct Node {
        string tag;
        union NodeContent switch (NodeKind) {
        case IsLeaf:
            StringSeq itemCodes;
        case IsNotLeaf:
            sequence<Node> childNodes;
        } nc;
    };
                                                                                                                                                        
};

---------------------------

although omniidl gives:

   tree.idl:13: Warning: Anonymous sequences for recursive structures
                   are deprecated. Use a forward declaration instead.

but I can't think of another solution right now if the forward declared
stuff doesn't work...

renej

> Thanks, 
> enrico




More information about the omniORB-list mailing list