(self, fname)
Write wrapper classes for ctypes structs.
Write wrapper classes for ctypes structs.
Write wrapper classes for ctypes structs .
def write_wrappers(self, fname):
    """Write wrapper classes for ctypes structs."""
    with open(fname, "w") as f:
      imports = [
          "import ctypes",
          "# pylint: disable=undefined-variable",
          "# pylint: disable=wildcard-import",
          "from {} import util".format(_MODULE),
          "from {}.mjbindings.types import *".format(_MODULE),
      ]
      f.write(self.make_header(imports))
      f.write(codegen_util.comment_line("Low-level wrapper classes"))
      for type_decl in self.types_dict.values():
        if isinstance(type_decl, c_declarations.Struct):
          f.write("\n" + type_decl.wrapper_class)
      f.write("\n" + codegen_util.comment_line("End of generated code"))
def write_wrappers ( self , fname ) : with open ( fname , "w" ) as f : imports = [ "import ctypes" , "# pylint: disable=undefined-variable" , "# pylint: disable=wildcard-import" , "from {} import util" . format ( _MODULE ) , "from {}.mjbindings.types import *" . format ( _MODULE ) , ] f . write ( self . make_header ( imports ) ) f . write ( codegen_util . comment_line ( "Low-level wrapper classes" ) ) for type_decl in self . types_dict . values ( ) : if isinstance ( type_decl , c_declarations . Struct ) : f . write ( "\n" + type_decl . wrapper_class ) f . write ( "\n" + codegen_util . comment_line ( "End of generated code" ) )