tools/generate_stubs/generate_stubs.py
def WriteHeaderContents(cls, module_names, namespace, header_guard, outfile):
    """Writes a header file for the stub file generated for module_names.

    The header file exposes the following:
       1) An enum, StubModules, listing with an entry for each enum.
       2) A typedef for a StubPathMap allowing for specification of paths to
          search for each module.
       3) The IsInitialized/Initialize/Uninitialize functions for each module.
       4) An umbrella initialize function for all modules.

    Args:
      module_names: A list with the names of each module in this stub file.
      namespace: The namespace these functions should be in.
      header_guard: The macro to use as our header guard.
      outfile: The output handle to populate.
      logging_include: Header file where the logging function is defined.
    """
    outfile.write(STUB_HEADER_PREAMBLE % {
        'guard_name': header_guard,
        'namespace': namespace
    })

    # Generate the Initializer prototypes for each module.
    outfile.write('// Individual module initializer functions.\n')
    for name in module_names:
      outfile.write(
          MODULE_FUNCTION_PROTOTYPES % {
              'is_initialized': PosixStubWriter.IsInitializedName(name),
              'initialize': PosixStubWriter.InitializeModuleName(name),
              'uninitialize': PosixStubWriter.UninitializeModuleName(name)
          })

    # Generate the enum for umbrella initializer.
    outfile.write(UMBRELLA_ENUM_START)
    outfile.write('  %s = 0,\n' % PosixStubWriter.EnumName(module_names[0]))
    for name in module_names[1:]:
      outfile.write('  %s,\n' % PosixStubWriter.EnumName(name))
    outfile.write(UMBRELLA_ENUM_END)

    outfile.write(UMBRELLA_INITIALIZER_PROTOTYPE)
    outfile.write(STUB_HEADER_CLOSER % {
        'namespace': namespace,
        'guard_name': header_guard
    })
Writes a header file for the stub file generated for module_names.

    The header file exposes the following:
       1) An enum, StubModules, listing with an entry for each enum.
       2) A typedef for a StubPathMap allowing for specification of paths to
          search for each module.
       3) The IsInitialized/Initialize/Uninitialize functions for each module.
       4) An umbrella initialize function for all modules.

    Args:
      module_names: A list with the names of each module in this stub file.
      namespace: The namespace these functions should be in.
      header_guard: The macro to use as our header guard.
      outfile: The output handle to populate.
      logging_include: Header file where the logging function is defined.
    
Writes a header file for the stub file generated for module_names.
The header file exposes the following:
1) An enum, StubModules, listing with an entry for each enum.
2) A typedef for a StubPathMap allowing for specification of paths to
search for each module.
3) The IsInitialized/Initialize/Uninitialize functions for each module.
4) An umbrella initialize function for all modules.
Writes a header file for the stub file generated for module_names . The header file exposes the following : 1 ) An enum StubModules listing with an entry for each enum . 2 ) A typedef for a StubPathMap allowing for specification of paths to search for each module . 3 ) The IsInitialized / Initialize / Uninitialize functions for each module . 4 ) An umbrella initialize function for all modules .
def WriteHeaderContents(cls, module_names, namespace, header_guard, outfile):
    outfile.write(STUB_HEADER_PREAMBLE % {
        'guard_name': header_guard,
        'namespace': namespace
    })
    outfile.write('// Individual module initializer functions.\n')
    for name in module_names:
      outfile.write(
          MODULE_FUNCTION_PROTOTYPES % {
              'is_initialized': PosixStubWriter.IsInitializedName(name),
              'initialize': PosixStubWriter.InitializeModuleName(name),
              'uninitialize': PosixStubWriter.UninitializeModuleName(name)
          })
    outfile.write(UMBRELLA_ENUM_START)
    outfile.write('  %s = 0,\n' % PosixStubWriter.EnumName(module_names[0]))
    for name in module_names[1:]:
      outfile.write('  %s,\n' % PosixStubWriter.EnumName(name))
    outfile.write(UMBRELLA_ENUM_END)
    outfile.write(UMBRELLA_INITIALIZER_PROTOTYPE)
    outfile.write(STUB_HEADER_CLOSER % {
        'namespace': namespace,
        'guard_name': header_guard
    })
def WriteHeaderContents ( cls , module_names , namespace , header_guard , outfile ) : outfile . write ( STUB_HEADER_PREAMBLE % { 'guard_name' : header_guard , 'namespace' : namespace } ) outfile . write ( '// Individual module initializer functions.\n' ) for name in module_names : outfile . write ( MODULE_FUNCTION_PROTOTYPES % { 'is_initialized' : PosixStubWriter . IsInitializedName ( name ) , 'initialize' : PosixStubWriter . InitializeModuleName ( name ) , 'uninitialize' : PosixStubWriter . UninitializeModuleName ( name ) } ) outfile . write ( UMBRELLA_ENUM_START ) outfile . write ( '  %s = 0,\n' % PosixStubWriter . EnumName ( module_names [ 0 ] ) ) for name in module_names [ 1 : ] : outfile . write ( '  %s,\n' % PosixStubWriter . EnumName ( name ) ) outfile . write ( UMBRELLA_ENUM_END ) outfile . write ( UMBRELLA_INITIALIZER_PROTOTYPE ) outfile . write ( STUB_HEADER_CLOSER % { 'namespace' : namespace , 'guard_name' : header_guard } )
Writes a header file for the stub file generated for module_names.
Writes a header file for the stub file generated for module_names .
"""Writes a header file for the stub file generated for module_names.

    The header file exposes the following:
       1) An enum, StubModules, listing with an entry for each enum.
       2) A typedef for a StubPathMap allowing for specification of paths to
          search for each module.
       3) The IsInitialized/Initialize/Uninitialize functions for each module.
       4) An umbrella initialize function for all modules.

    Args:
      module_names: A list with the names of each module in this stub file.
      namespace: The namespace these functions should be in.
      header_guard: The macro to use as our header guard.
      outfile: The output handle to populate.
      logging_include: Header file where the logging function is defined.
    """ # Generate the Initializer prototypes for each module. # Generate the enum for umbrella initializer.
cls
module_names
A list with the names of each module in this stub file.
A list with the names of each module in this stub file .
namespace
The namespace these functions should be in.
The namespace these functions should be in .
header_guard
The macro to use as our header guard.
The macro to use as our header guard .
outfile
The output handle to populate.
The output handle to populate .
logging_include
Header file where the logging function is defined.
Header file where the logging function is defined .