Archived

This forum has been archived. Please start a new discussion on GitHub.

slice2xml or SliceScript

I'm looking for a way to auto-generate code based on Slice definitions. In our project we currently have about 50 Slice interfaces with associated data types. We also have a few utility libraries which operate on each interface. Examples:
- implementation: "standard" implementations of Slice interfaces
- logging: subscribe to each interface and store the received data type
- debugging: we have a tool which allows to connect to an object and "probe" each method.
- display: a library of toString() functions for each custom data type.

This type of code tends to be very repetitive (boring). Constant changes in the interfaces lead to a sizable workload. This begs for some soft of scriptable code generation based on Slice definitions. There're probably different way of doing it -- I am not a computer scientist. :)

E.g. would it be possible to define an XML descriptor for Slice? A slice2xml parser could convert .ice files to XML. That would be much easier for me to parse and use the contents to do what I want (compared to .ice files themselves). Of course, it would be even better if an XML parser (C++ or python or whatever) was included. :)

cheers, alex

Comments

  • matthew
    matthew NL, Canada
    Why do you think it would be easier to parse & act on the contents of an XML file rather implementing a generator based on the existing slice generators? The generator itself is an implementation of the visitor pattern which is, after all, how any SAX based XML parser works (only with more slice specific context based callbacks).
  • I've done a couple of XML parsers before and it wasn't a big deal. In particular, I recently adapted the IceGrid descriptor parser to my needs and it was a pleasure to work with.

    My only experience with parsers for C-like syntax is the one in Doxygen and it's not something I ever want to look at again. :) To be honest, I haven't looked how slice2* utilities work. I'll give it a go.

    thanks
  • marc
    marc Florida
    Note that the Slice parser API is an internal API, which is not really intended to be used by Ice developers. In other words, this API is neither documented nor supported, and might change without notice. (We might add an "official" API for the Slice parser for some future Ice release.)
  • marc wrote: »
    We might add an "official" API for the Slice parser for some future Ice release.

    This would be great. Thanks.
  • If I many, +1

    Currently our build system generates slice files from an internal XML format. Obviously, if slice had an API it could prove to be far more efficient. Would it be possible to get access to non-standard metadta in such an API?
    module A {
        class B {
            ["ourmetdata"] long id;  
        };
    };
    
  • Yes, if we would add such an API, then it would certainly be possible to access custom metadata.