bindings/python/ns3modulegen-modular.py
author Tom Henderson <tomh@tomh.org>
Tue, 15 May 2012 21:59:45 -0700
changeset 8760 8ccb0c2badc1
parent 7722 d8dd0ac41fbb
child 10640 4275dcaa1337
permissions -rw-r--r--
portable types for loop variables
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     1
import warnings
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     2
import sys
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     3
import os
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     4
import pybindgen.settings
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     5
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
     6
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
     7
import ns3modulegen_core_customizations
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     8
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
     9
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
    10
7722
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    11
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
    12
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    13
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
    14
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    15
    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
    16
        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
    17
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    18
    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
    19
        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
    20
        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
    21
        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
    22
            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
    23
                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
    24
                                       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
    25
                break
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    26
        else:
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    27
            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
    28
        return True
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    29
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    30
7408
4f1f961b6cdc Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6984
diff changeset
    31
#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
    32
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
    33
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    34
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
    35
    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
    36
        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
    37
        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
    38
        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
    39
        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
    40
        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
    41
        #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
    42
        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
    43
    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
    44
        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
    45
    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
    46
        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
    47
    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
    48
        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
    49
    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
    50
        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
    51
    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
    52
        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
    53
        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
    54
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    55
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    56
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    57
def main(argv):
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
    58
    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
    59
    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
    60
    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
    61
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    62
    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
    63
    try:
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    64
        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
    65
        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
    66
        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
    67
            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
    68
            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
    69
        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
    70
            module_customization = object()
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    71
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    72
        try:
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    73
            from callbacks_list import callback_classes
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    74
        except ImportError, ex:
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    75
            print >> sys.stderr, "***************", repr(ex)
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    76
            callback_classes = []
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    77
        else:
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    78
            print >> sys.stderr, ">>>>>>>>>>>>>>>>", repr(callback_classes)
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    79
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    80
    finally:
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    81
        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
    82
d8dd0ac41fbb Log the correct source file/number, in python module generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7408
diff changeset
    83
    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
    84
    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
    85
    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
    86
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    87
    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
    88
    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
    89
    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
    90
6984
15c619b2ca1d Modular bindings: add the std::ios::openmode constants
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6957
diff changeset
    91
    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
    92
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
    93
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    94
    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
    95
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
    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
    97
        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
    98
6896
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
    99
    # register Callback<...> type handlers
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   100
    ns3modulegen_core_customizations.generate_callback_classes(root_module.after_forward_declarations,
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   101
                                                               callback_classes)
fb47685b1dad Modular bindings: add the Callback<...> type handlers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6893
diff changeset
   102
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   103
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   104
    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
   105
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   106
    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
   107
        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
   108
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   109
    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
   110
    ns3modulegen_core_customizations.Attribute_customizations(root_module)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   111
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   112
6893
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   113
    # -----------
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   114
    module_apidefs.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
   115
    
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   116
    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
   117
        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
   118
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   119
5dccd86f90cf Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6874
diff changeset
   120
    # -----------
6874
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   121
    root_module.generate(out)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   122
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   123
if __name__ == '__main__':
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   124
    import sys
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   125
    main(sys.argv)
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   126
c7537e62f2fa Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   127