slice2xml or SliceScript

n2503vn2503v Alex MakarenkoOrganization: ACFR, University of SydneyProject: OrcaMember ✭✭✭
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

  • matthewmatthew NL, CanadaMatthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications EngineMember ✭✭✭
    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).
  • n2503vn2503v Alex MakarenkoOrganization: ACFR, University of SydneyProject: OrcaMember ✭✭✭
    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
  • marcmarc FloridaMarc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications EngineAdministrators, ZeroC Staff ZeroC Staff
    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.)
  • n2503vn2503v Alex MakarenkoOrganization: ACFR, University of SydneyProject: OrcaMember ✭✭✭
    marc wrote: »
    We might add an "official" API for the Slice parser for some future Ice release.

    This would be great. Thanks.
  • joshmoorejoshmoore GermanyJosh MooreOrganization: Glencoe Software, Inc.Project: OME, http://openmicroscopy.orgMember
    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;  
        };
    };
    
  • marcmarc FloridaMarc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications EngineAdministrators, ZeroC Staff ZeroC Staff
    Yes, if we would add such an API, then it would certainly be possible to access custom metadata.
Sign In or Register to comment.