def make_compound_ctype(self, varname):
<EOL>compoundname = self.get_var_type(varname)<EOL>nfields = self.inq_compound(compoundname)<EOL>fields = []<EOL>for i in range(nfields):<EOL><INDENT>(fieldname, fieldtype,<EOL>fieldrank, fieldshape) = self.inq_compound_field(compoundname, i)<EOL>assert fieldrank <= <NUM_LIT:1><EOL>fieldctype = CTYPESMAP[fieldtype]<EOL>if fieldrank == <NUM_LIT:1>:<EOL><INDENT>fieldctype = fieldctype * fieldshape[<NUM_LIT:0>]<EOL><DEDENT>fields.append((fieldname, fieldctype))<EOL><DEDENT>class COMPOUND(Structure):<EOL><INDENT>_fields_ = fields<EOL><DEDENT>rank = self.get_var_rank(varname)<EOL>assert rank <= <NUM_LIT:1>, "<STR_LIT>"<EOL>if rank == <NUM_LIT:1>:<EOL><INDENT>shape = self.get_var_shape(varname)<EOL>valtype = POINTER(ARRAY(COMPOUND, shape[<NUM_LIT:0>]))<EOL><DEDENT>else:<EOL><INDENT>valtype = POINTER(COMPOUND)<EOL><DEDENT>return valtype<EOL>
Create a ctypes type that corresponds to a compound type in memory.