github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/pkg/runtime/type.h (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  /*
     6   * Runtime type representation; master is type.go
     7   *
     8   * The Type*s here correspond 1-1 to type.go's *rtype.
     9   */
    10  
    11  typedef struct Type Type;
    12  typedef struct UncommonType UncommonType;
    13  typedef struct InterfaceType InterfaceType;
    14  typedef struct Method Method;
    15  typedef struct IMethod IMethod;
    16  typedef struct SliceType SliceType;
    17  typedef struct FuncType FuncType;
    18  typedef struct PtrType PtrType;
    19  
    20  // Needs to be in sync with typekind.h/CommonSize
    21  struct Type
    22  {
    23  	uintptr size;
    24  	uint32 hash;
    25  	uint8 _unused;
    26  	uint8 align;
    27  	uint8 fieldAlign;
    28  	uint8 kind;
    29  	Alg *alg;
    30  	void *gc;
    31  	String *string;
    32  	UncommonType *x;
    33  	Type *ptrto;
    34  };
    35  
    36  struct Method
    37  {
    38  	String *name;
    39  	String *pkgPath;
    40  	Type	*mtyp;
    41  	Type *typ;
    42  	void (*ifn)(void);
    43  	void (*tfn)(void);
    44  };
    45  
    46  struct UncommonType
    47  {
    48  	String *name;
    49  	String *pkgPath;
    50  	Slice mhdr;
    51  	Method m[];
    52  };
    53  
    54  struct IMethod
    55  {
    56  	String *name;
    57  	String *pkgPath;
    58  	Type *type;
    59  };
    60  
    61  struct InterfaceType
    62  {
    63  	Type;
    64  	Slice mhdr;
    65  	IMethod m[];
    66  };
    67  
    68  struct MapType
    69  {
    70  	Type;
    71  	Type *key;
    72  	Type *elem;
    73  };
    74  
    75  struct ChanType
    76  {
    77  	Type;
    78  	Type *elem;
    79  	uintptr dir;
    80  };
    81  
    82  struct SliceType
    83  {
    84  	Type;
    85  	Type *elem;
    86  };
    87  
    88  struct FuncType
    89  {
    90  	Type;
    91  	bool dotdotdot;
    92  	Slice in;
    93  	Slice out;
    94  };
    95  
    96  struct PtrType
    97  {
    98  	Type;
    99  	Type *elem;
   100  };