bindings/python/ns3modulegen-modular.py
author Tom Henderson <tomh@tomh.org>
Tue, 15 Sep 2015 11:21:53 -0700
changeset 11667 3dac5b408933
parent 10969 99f95535826f
permissions -rw-r--r--
Added tag ns-3.24 for changeset e8634b0101f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10642
2a4d3f9d09fd Fixes to support Python >= 3.3 in ns3 python bindings
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10640
diff changeset
     1
from __future__ import print_function
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     2
import warnings
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     3
import sys
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     4
import os
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     5
import pybindgen.settings
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     6
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
     7
from pybindgen.module import MultiSectionFactory
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     8
import ns3modulegen_core_customizations
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     9
10640
4275dcaa1337 Enable more pybindgen logging
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 7722
diff changeset
    10
import logging
4275dcaa1337 Enable more pybindgen logging
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 7722
diff changeset
    11
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    12
pybindgen.settings.wrapper_registry = pybindgen.settings.StdMapWrapperRegistry
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    13
7722
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    14
import traceback
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    15
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    16
class ErrorHandler(pybindgen.settings.ErrorHandler):
7722
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    17
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    18
    def __init__(self, apidefs_file):
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    19
        self.apidefs_file = apidefs_file
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    20
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    21
    def handle_error(self, wrapper, exception, traceback_):
7722
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    22
        stack = getattr(wrapper, 'stack_where_defined', [])
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    23
        stack.reverse()
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    24
        for l in stack:
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    25
            if l[0] == self.apidefs_file:
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    26
                warnings.warn_explicit("exception %r in wrapper %s" % (exception, wrapper),
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    27
                                       Warning, l[0], l[1])
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    28
                break
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    29
        else:
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    30
            warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    31
        return True
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    33
7408
4f1f961b6cdc Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6984
diff changeset
    34
#print >> sys.stderr, ">>>>>>>>>>>>>>>>>>>>>>>>>>>> ", bool(eval(os.environ["GCC_RTTI_ABI_COMPLETE"]))
4f1f961b6cdc Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6984
diff changeset
    35
pybindgen.settings.gcc_rtti_abi_complete = bool(eval(os.environ["GCC_RTTI_ABI_COMPLETE"]))
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    36
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    37
class MyMultiSectionFactory(MultiSectionFactory):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    38
    def __init__(self, main_file_name):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    39
        super(MyMultiSectionFactory, self).__init__()
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    40
        self.main_file_name = main_file_name
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    41
        self.main_sink = FileCodeSink(open(main_file_name, "wt"))
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    42
        self.header_name = "ns3module.h"
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    43
        header_file_name = os.path.join(os.path.dirname(self.main_file_name), self.header_name)
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    44
        #print >> sys.stderr, ">>>>>>>>>>>>>>>>>", header_file_name, main_file_name
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    45
        self.header_sink = FileCodeSink(open(header_file_name, "wt"))
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    46
    def get_section_code_sink(self, section_name):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    47
        return self.main_sink
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    48
    def get_main_code_sink(self):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    49
        return self.main_sink
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    50
    def get_common_header_code_sink(self):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    51
        return self.header_sink
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    52
    def get_common_header_include(self):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    53
        return '"%s"' % self.header_name
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    54
    def close(self):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    55
        self.header_sink.file.close()
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    56
        self.main_sink.file.close()
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    57
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    58
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    59
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    60
def main(argv):
10640
4275dcaa1337 Enable more pybindgen logging
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 7722
diff changeset
    61
    logging.basicConfig()
4275dcaa1337 Enable more pybindgen logging
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 7722
diff changeset
    62
    logging.getLogger("pybindgen.typehandlers").setLevel(logging.DEBUG)
4275dcaa1337 Enable more pybindgen logging
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 7722
diff changeset
    63
6957
5f49d23b4a74 Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6896
diff changeset
    64
    module_abs_src_path, target, extension_name, output_cc_file_name = argv[1:]
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    65
    module_name = os.path.basename(module_abs_src_path)
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    66
    out = MyMultiSectionFactory(output_cc_file_name)
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    67
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    68
    sys.path.insert(0, os.path.join(module_abs_src_path, "bindings"))
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    69
    try:
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    70
        module_apidefs = __import__("modulegen__%s" % target)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    71
        del sys.modules["modulegen__%s" % target]
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    72
        try:
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    73
            module_customization = __import__("modulegen_customizations")
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    74
            del sys.modules["modulegen_customizations"]
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    75
        except ImportError:
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    76
            module_customization = object()
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    77
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    78
        try:
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    79
            from callbacks_list import callback_classes
10642
2a4d3f9d09fd Fixes to support Python >= 3.3 in ns3 python bindings
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10640
diff changeset
    80
        except ImportError as ex:
2a4d3f9d09fd Fixes to support Python >= 3.3 in ns3 python bindings
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10640
diff changeset
    81
            print("***************", repr(ex), file=sys.stderr)
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    82
            callback_classes = []
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    83
        else:
10642
2a4d3f9d09fd Fixes to support Python >= 3.3 in ns3 python bindings
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10640
diff changeset
    84
            print(">>>>>>>>>>>>>>>>", repr(callback_classes), file=sys.stderr)
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    85
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    86
    finally:
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    87
        sys.path.pop(0)
7722
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    88
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    89
    apidefs_file, dummy = os.path.splitext(module_apidefs.__file__)
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    90
    apidefs_file += '.py'
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    91
    pybindgen.settings.error_handler = ErrorHandler(apidefs_file)
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    92
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    93
    root_module = module_apidefs.module_init()
6957
5f49d23b4a74 Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6896
diff changeset
    94
    root_module.set_name(extension_name)
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    95
    root_module.add_include('"ns3/%s-module.h"' % module_name)
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    96
6984
15c619b2ca1d Modular bindings: add the std::ios::openmode constants
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6957
diff changeset
    97
    ns3modulegen_core_customizations.add_std_ios_openmode(root_module)
15c619b2ca1d Modular bindings: add the std::ios::openmode constants
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6957
diff changeset
    98
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    99
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   100
    module_apidefs.register_types(root_module)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   101
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   102
    if hasattr(module_customization, 'post_register_types'):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   103
        module_customization.post_register_types(root_module)
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   104
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   105
    # register Callback<...> type handlers
10969
99f95535826f Python bindings: fix generation of callback wrappers with the newest pybindgen
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10642
diff changeset
   106
    ns3modulegen_core_customizations.register_callback_classes(root_module.after_forward_declarations,
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   107
                                                               callback_classes)
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   108
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   109
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   110
    module_apidefs.register_methods(root_module)
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   111
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   112
    if hasattr(module_customization, 'post_register_methods'):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   113
        module_customization.post_register_methods(root_module)
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   114
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   115
    ns3modulegen_core_customizations.Object_customizations(root_module)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   116
    ns3modulegen_core_customizations.Attribute_customizations(root_module)
10969
99f95535826f Python bindings: fix generation of callback wrappers with the newest pybindgen
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10642
diff changeset
   117
    ns3modulegen_core_customizations.generate_callback_classes(root_module,
99f95535826f Python bindings: fix generation of callback wrappers with the newest pybindgen
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10642
diff changeset
   118
                                                               callback_classes)
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   119
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   120
    # -----------
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   121
    module_apidefs.register_functions(root_module)
10969
99f95535826f Python bindings: fix generation of callback wrappers with the newest pybindgen
Gustavo Carneiro <gjcarneiro@gmail.com>
parents: 10642
diff changeset
   122
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   123
    if hasattr(module_customization, 'post_register_functions'):
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   124
        module_customization.post_register_functions(root_module)
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   125
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   126
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   127
    root_module.generate(out)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   128
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   129
if __name__ == '__main__':
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   130
    import sys
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   131
    main(sys.argv)