parameters: (cls, signature)
docstring: Generates a stub function definition for the given signature.
  
      The function definitions are created with __attribute__((weak)) so that
      they may be overridden by a real static link or mock versions to be used
      when testing.
  
      Args:
        signature: A signature hash, as produced by ParseSignatures,
                   representating the function signature.
  
      Returns:
        A string with the stub function definition.
docstring_summary: Generates a stub function definition for the given signature.
docstring_tokens: Generates a stub function definition for the given signature .
function: def StubFunction(cls, signature):
      """Generates a stub function definition for the given signature.
  
      The function definitions are created with __attribute__((weak)) so that
      they may be overridden by a real static link or mock versions to be used
      when testing.
  
      Args:
        signature: A signature hash, as produced by ParseSignatures,
                   representating the function signature.
  
      Returns:
        A string with the stub function definition.
      """
      return_prefix = ''
      if signature['return_type'] != 'void':
        return_prefix = 'return '
  
      # Generate the argument list.
      arguments = [re.split('[\*& ]', arg)[-1].strip() for arg in
                   signature['params']]
      arg_list = ', '.join(arguments)
      if arg_list == 'void':
        arg_list = ''
  
      if arg_list != '' and len(arguments) > 1 and arguments[-1] == '...':
        # If the last argment is ... then this is a variadic function.
        if return_prefix != '':
          return VARIADIC_STUB_FUNCTION_DEFINITION % {
              'return_type': signature['return_type'],
              'name': signature['name'],
              'params': ', '.join(signature['params']),
              'arg_list': ', '.join(arguments[0:-1]),
              'last_named_arg': arguments[-2]}
        else:
          return VOID_VARIADIC_STUB_FUNCTION_DEFINITION % {
              'name': signature['name'],
              'params': ', '.join(signature['params']),
              'arg_list': ', '.join(arguments[0:-1]),
              'last_named_arg': arguments[-2]}
      else:
        # This is a regular function.
        return STUB_FUNCTION_DEFINITION % {
            'return_type': signature['return_type'],
            'name': signature['name'],
            'params': ', '.join(signature['params']),
            'return_prefix': return_prefix,
            'arg_list': arg_list}
function_tokens: def StubFunction ( cls , signature ) : return_prefix = '' if signature [ 'return_type' ] != 'void' : return_prefix = 'return ' # Generate the argument list. arguments = [ re . split ( '[\*& ]' , arg ) [ - 1 ] . strip ( ) for arg in signature [ 'params' ] ] arg_list = ', ' . join ( arguments ) if arg_list == 'void' : arg_list = '' if arg_list != '' and len ( arguments ) > 1 and arguments [ - 1 ] == '...' : # If the last argment is ... then this is a variadic function. if return_prefix != '' : return VARIADIC_STUB_FUNCTION_DEFINITION % { 'return_type' : signature [ 'return_type' ] , 'name' : signature [ 'name' ] , 'params' : ', ' . join ( signature [ 'params' ] ) , 'arg_list' : ', ' . join ( arguments [ 0 : - 1 ] ) , 'last_named_arg' : arguments [ - 2 ] } else : return VOID_VARIADIC_STUB_FUNCTION_DEFINITION % { 'name' : signature [ 'name' ] , 'params' : ', ' . join ( signature [ 'params' ] ) , 'arg_list' : ', ' . join ( arguments [ 0 : - 1 ] ) , 'last_named_arg' : arguments [ - 2 ] } else : # This is a regular function. return STUB_FUNCTION_DEFINITION % { 'return_type' : signature [ 'return_type' ] , 'name' : signature [ 'name' ] , 'params' : ', ' . join ( signature [ 'params' ] ) , 'return_prefix' : return_prefix , 'arg_list' : arg_list }