Exemple #1
0
def run(tree, args):
    """Entrypoint to the C++ backend"""

    global run_before

    if run_before:
        util.fatalError("Sorry, the C++ backend cannot process more " "than one IDL file at a time.")
    run_before = 1

    dirname, filename = os.path.split(tree.file())
    basename, ext = os.path.splitext(filename)
    config.state["Basename"] = basename
    config.state["Directory"] = dirname

    process_args(args)

    try:
        # Check the input tree only contains stuff we understand
        support.checkIDL(tree)

        # initialise the handy ast module
        ast.__init__(tree)

        # Initialise the descriptor generating code
        descriptor.__init__(tree)

        # Build the map of AST nodes to Environments
        tree.accept(id.WalkTree())

        # AMI code hooks into existing infrastructure (ie doesn't need to
        # be driven explicitly here)
        # if config.state['AMI']:
        #    tree = ami.__init__(tree)
        #    tree.accept(id.WalkTree())
        # Not ported yet.

        header.run(tree)

        skel.run(tree)

        # if we're generating code for Typecodes and Any then
        # we need to create the DynSK.cc file
        if config.state["Typecode"]:
            dynskel.run(tree)

        if config.state["Example Code"]:
            impl.run(tree)

    except AttributeError, e:
        name = e[0]
        unsupported_visitors = map(lambda x: "visit" + x, AST_unsupported_nodes[:])
        if name in unsupported_visitors:
            # delete all possibly partial output files
            for file in output.listAllCreatedFiles():
                os.unlink(file)

            util.unsupportedIDL()

        raise
Exemple #2
0
def run(tree, args):
    """Entrypoint to the C++ backend"""

    global run_before

    if run_before:
        util.fatalError("Sorry, the C++ backend cannot process more "
                        "than one IDL file at a time.")
    run_before = 1

    # Initialise modules that would otherwise contain circular imports
    call.init()
    iface.init()

    dirname, filename = os.path.split(tree.file())
    basename,ext      = os.path.splitext(filename)
    config.state['Basename']  = basename
    config.state['Directory'] = dirname

    process_args(args)

    try:
        # Check the input tree only contains stuff we understand
        support.checkIDL(tree)

        # Add AMI implied IDL if required
        if config.state['AMI']:
            from omniidl_be import ami
            tree.accept(ami.AMIVisitor())
        
        # initialise the handy ast module
        ast.__init__(tree)

        # Initialise the descriptor generating code
        descriptor.__init__(tree)

        # Build the map of AST nodes to Environments
        tree.accept(id.WalkTree())

        header.run(tree)
        
        skel.run(tree)
        
        # if we're generating code for Typecodes and Any then
        # we need to create the DynSK.cc file
        if config.state['Typecode']:
            dynskel.run(tree)

        if config.state['Example Code']:
            impl.run(tree)

    except SystemExit:
        # fatalError function throws SystemExit exception
        # delete all possibly partial output files
        for file in output.listAllCreatedFiles():
            os.unlink(file)
        
        raise
Exemple #3
0
def run(tree, args):
    """Entrypoint to the C++ backend"""

    global run_before

    if run_before:
        util.fatalError("Sorry, the C++ backend cannot process more "
                        "than one IDL file at a time.")
    run_before = 1

    dirname, filename = os.path.split(tree.file())
    basename, ext = os.path.splitext(filename)
    config.state['Basename'] = basename
    config.state['Directory'] = dirname

    process_args(args)

    try:
        # Check the input tree only contains stuff we understand
        support.checkIDL(tree)

        # initialise the handy ast module
        ast.__init__(tree)

        # Initialise the descriptor generating code
        descriptor.__init__(tree)

        # Build the map of AST nodes to Environments
        tree.accept(id.WalkTree())

        # AMI code hooks into existing infrastructure (ie doesn't need to
        # be driven explicitly here)
        #if config.state['AMI']:
        #    tree = ami.__init__(tree)
        #    tree.accept(id.WalkTree())
        # Not ported yet.

        header.run(tree)

        skel.run(tree)

        # if we're generating code for Typecodes and Any then
        # we need to create the DynSK.cc file
        if config.state['Typecode']:
            dynskel.run(tree)

        if config.state['Example Code']:
            impl.run(tree)

    except AttributeError, e:
        name = e.args[0]
        unsupported_visitors = map(lambda x: "visit" + x,
                                   AST_unsupported_nodes[:])
        if name in unsupported_visitors:
            # delete all possibly partial output files
            for file in output.listAllCreatedFiles():
                os.unlink(file)

            util.unsupportedIDL()

        raise