(self, cdll_name)
return "\n".join(lines)
Generates a ctypes function declaration.
Generates a ctypes function declaration.
Generates a ctypes function declaration .
def ctypes_func_decl(self, cdll_name):
    """Generates a ctypes function declaration."""
    indent = codegen_util.Indenter()
    lines = []
    lines.append("{0}.{1}.__doc__ = \"\"\"\n{2}\"\"\"".format(
        cdll_name, self.name, self.docstring))
    if self.arguments:
      lines.append("{0}.{1}.argtypes = [".format(cdll_name, self.name))
      with indent:
        with indent:
          lines.extend(indent(a.arg + ",") for a in self.arguments.values())
      lines.append("]")
    else:
      lines.append("{0}.{1}.argtypes = None".format(cdll_name, self.name))
    if self.return_value:
      lines.append("{0}.{1}.restype = {2}".format(
          cdll_name, self.name, self.return_value.arg))
    else:
      lines.append("{0}.{1}.restype = None".format(cdll_name, self.name))
    lines.append("")  # Force a newline after the declaration.
    return "\n".join(lines)
def ctypes_func_decl ( self , cdll_name ) : indent = codegen_util . Indenter ( ) lines = [ ] lines . append ( "{0}.{1}.__doc__ = \"\"\"\n{2}\"\"\"" . format ( cdll_name , self . name , self . docstring ) ) if self . arguments : lines . append ( "{0}.{1}.argtypes = [" . format ( cdll_name , self . name ) ) with indent : with indent : lines . extend ( indent ( a . arg + "," ) for a in self . arguments . values ( ) ) lines . append ( "]" ) else : lines . append ( "{0}.{1}.argtypes = None" . format ( cdll_name , self . name ) ) if self . return_value : lines . append ( "{0}.{1}.restype = {2}" . format ( cdll_name , self . name , self . return_value . arg ) ) else : lines . append ( "{0}.{1}.restype = None" . format ( cdll_name , self . name ) ) lines . append ( "" ) # Force a newline after the declaration. return "\n" . join ( lines )