Beispiel #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
Beispiel #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
def run(tree, backend_args):
    # Process arguments
    dirname, filename = os.path.split(tree.file())
    basename,ext      = os.path.splitext(filename)
    config.state['Basename']  = basename
    config.state['Directory'] = dirname

    process_args(backend_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())


        hh_filename  = config.state['Basename'] + config.state['HH Suffix']
        hpp_filename = config.state['Basename'] + config.state['HPP Suffix']
        hxx_filename = config.state['Basename'] + config.state['HXX Suffix']
        cc_filename  = config.state['Basename'] + config.state['CC Suffix']
        if config.state["Include Prefix"]:
            prefix = config.state['Include Prefix'] + '/'
        else:
            prefix = ""

        idl_filename = tree.file()

        hpp_stream = output.Stream(output.createFile(hpp_filename), 2)
        hxx_stream = output.Stream(output.createFile(hxx_filename), 2)
        cc_stream  = output.Stream(output.createFile( cc_filename), 2)
        main.self = main
        main.__init__(hpp_stream, hxx_stream, cc_stream,
                idl_filename,
                prefix, hh_filename, hpp_filename, hxx_filename)

        main.run(tree)

        hpp_stream .close()
        hxx_stream.close()
        cc_stream .close()

    except AttributeError as 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

    except SystemExit as e:
        # fatalError function throws SystemExit exception
        # delete all possibly partial output files
        for file in output.listAllCreatedFiles():
            os.unlink(file)
        
        raise
Beispiel #4
0
        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

    except SystemExit, e:
        # fatalError function throws SystemExit exception
        # delete all possibly partial output files
        for file in output.listAllCreatedFiles():
            os.unlink(file)
        
        raise
Beispiel #5
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
Beispiel #6
0
        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

    except SystemExit, e:
        # fatalError function throws SystemExit exception
        # delete all possibly partial output files
        for file in output.listAllCreatedFiles():
            os.unlink(file)

        raise
Beispiel #7
0
def run(tree, backend_args):
    # Process arguments
    dirname, filename = os.path.split(tree.file())
    basename, ext = os.path.splitext(filename)
    config.state["Basename"] = basename
    config.state["Directory"] = dirname

    process_args(backend_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())

        hh_filename = config.state["Basename"] + config.state["HH Suffix"]
        hpp_filename = config.state["Basename"] + config.state["HPP Suffix"]
        hxx_filename = config.state["Basename"] + config.state["HXX Suffix"]
        cc_filename = config.state["Basename"] + config.state["CC Suffix"]
        if config.state["Include Prefix"]:
            prefix = config.state["Include Prefix"] + "/"
        else:
            prefix = ""

        idl_filename = tree.file()

        hpp_stream = output.Stream(output.createFile(hpp_filename), 2)
        hxx_stream = output.Stream(output.createFile(hxx_filename), 2)
        cc_stream = output.Stream(output.createFile(cc_filename), 2)
        main.self = main
        main.__init__(
            hpp_stream,
            hxx_stream,
            cc_stream,
            idl_filename,
            prefix,
            hh_filename,
            hpp_filename,
            hxx_filename,
        )

        main.run(tree)

        hpp_stream.close()
        hxx_stream.close()
        cc_stream.close()

    except AttributeError as 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

    except SystemExit:
        # fatalError function throws SystemExit exception
        # delete all possibly partial output files
        for file in output.listAllCreatedFiles():
            os.unlink(file)

        raise