original_docstring: Writes a structure that matches the arguments to a function.
docstring: Writes a structure that matches the arguments to a function.
docstring_tokens: Writes a structure that matches the arguments to a function .
code: def WriteStruct(self, func, file):
      """Writes a structure that matches the arguments to a function."""
      comment = func.GetInfo('cmd_comment')
      if not comment == None:
        file.Write(comment)
      file.Write("struct %s {\n" % func.name)
      file.Write("  typedef %s ValueType;\n" % func.name)
      file.Write("  static const CommandId kCmdId = k%s;\n" % func.name)
      func.WriteCmdArgFlag(file)
      func.WriteCmdFlag(file)
      file.Write("\n")
      result = func.GetInfo('result')
      if not result == None:
        if len(result) == 1:
          file.Write("  typedef %s Result;\n\n" % result[0])
        else:
          file.Write("  struct Result {\n")
          for line in result:
            file.Write("    %s;\n" % line)
          file.Write("  };\n\n")
  
      func.WriteCmdComputeSize(file)
      func.WriteCmdSetHeader(file)
      func.WriteCmdInit(file)
      func.WriteCmdSet(file)
  
      file.Write("  gpu::CommandHeader header;\n")
      args = func.GetCmdArgs()
      for arg in args:
        file.Write("  %s %s;\n" % (arg.cmd_type, arg.name))
  
      consts = func.GetCmdConstants()
      for const in consts:
        file.Write("  static const %s %s = %s;\n" %
                   (const.cmd_type, const.name, const.GetConstantValue()))
  
      file.Write("};\n")
      file.Write("\n")
  
      size = len(args) * _SIZE_OF_UINT32 + _SIZE_OF_COMMAND_HEADER
      file.Write("COMPILE_ASSERT(sizeof(%s) == %d,\n" % (func.name, size))
      file.Write("               Sizeof_%s_is_not_%d);\n" % (func.name, size))
      file.Write("COMPILE_ASSERT(offsetof(%s, header) == 0,\n" % func.name)
      file.Write("               OffsetOf_%s_header_not_0);\n" % func.name)
      offset = _SIZE_OF_COMMAND_HEADER
      for arg in args:
        file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" %
                   (func.name, arg.name, offset))
        file.Write("               OffsetOf_%s_%s_not_%d);\n" %
                   (func.name, arg.name, offset))
        offset += _SIZE_OF_UINT32
      if not result == None and len(result) > 1:
        offset = 0;
        for line in result:
          parts = line.split()
          name = parts[-1]
          check = """
  COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
                 OffsetOf_%(cmd_name)s_Result_%(field_name)s_not_%(offset)d);
  """
          file.Write((check.strip() + "\n") % {
                'cmd_name': func.name,
                'field_name': name,
                'offset': offset,
              })
          offset += _SIZE_OF_UINT32
      file.Write("\n")
code_tokens: def WriteStruct ( self , func , file ) : comment = func . GetInfo ( 'cmd_comment' ) if not comment == None : file . Write ( comment ) file . Write ( "struct %s {\n" % func . name ) file . Write ( "  typedef %s ValueType;\n" % func . name ) file . Write ( "  static const CommandId kCmdId = k%s;\n" % func . name ) func . WriteCmdArgFlag ( file ) func . WriteCmdFlag ( file ) file . Write ( "\n" ) result = func . GetInfo ( 'result' ) if not result == None : if len ( result ) == 1 : file . Write ( "  typedef %s Result;\n\n" % result [ 0 ] ) else : file . Write ( "  struct Result {\n" ) for line in result : file . Write ( "    %s;\n" % line ) file . Write ( "  };\n\n" ) func . WriteCmdComputeSize ( file ) func . WriteCmdSetHeader ( file ) func . WriteCmdInit ( file ) func . WriteCmdSet ( file ) file . Write ( "  gpu::CommandHeader header;\n" ) args = func . GetCmdArgs ( ) for arg in args : file . Write ( "  %s %s;\n" % ( arg . cmd_type , arg . name ) ) consts = func . GetCmdConstants ( ) for const in consts : file . Write ( "  static const %s %s = %s;\n" % ( const . cmd_type , const . name , const . GetConstantValue ( ) ) ) file . Write ( "};\n" ) file . Write ( "\n" ) size = len ( args ) * _SIZE_OF_UINT32 + _SIZE_OF_COMMAND_HEADER file . Write ( "COMPILE_ASSERT(sizeof(%s) == %d,\n" % ( func . name , size ) ) file . Write ( "               Sizeof_%s_is_not_%d);\n" % ( func . name , size ) ) file . Write ( "COMPILE_ASSERT(offsetof(%s, header) == 0,\n" % func . name ) file . Write ( "               OffsetOf_%s_header_not_0);\n" % func . name ) offset = _SIZE_OF_COMMAND_HEADER for arg in args : file . Write ( "COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" % ( func . name , arg . name , offset ) ) file . Write ( "               OffsetOf_%s_%s_not_%d);\n" % ( func . name , arg . name , offset ) ) offset += _SIZE_OF_UINT32 if not result == None and len ( result ) > 1 : offset = 0 ; for line in result : parts = line . split ( ) name = parts [ - 1 ] check = """
  COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
                 OffsetOf_%(cmd_name)s_Result_%(field_name)s_not_%(offset)d);
  """ file . Write ( ( check . strip ( ) + "\n" ) % { 'cmd_name' : func . name , 'field_name' : name , 'offset' : offset , } ) offset += _SIZE_OF_UINT32 file . Write ( "\n" )
short_docstring: Writes a structure that matches the arguments to a function.
short_docstring_tokens: Writes a structure that matches the arguments to a function .
comment: """Writes a structure that matches the arguments to a function."""