github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/cgo/testdata/types.out.go (about)

     1  package main
     2  
     3  import "unsafe"
     4  
     5  var _ unsafe.Pointer
     6  
     7  //go:linkname C.CString runtime.cgo_CString
     8  func C.CString(string) *C.char
     9  
    10  //go:linkname C.GoString runtime.cgo_GoString
    11  func C.GoString(*C.char) string
    12  
    13  //go:linkname C.__GoStringN runtime.cgo_GoStringN
    14  func C.__GoStringN(*C.char, uintptr) string
    15  
    16  func C.GoStringN(cstr *C.char, length C.int) string {
    17  	return C.__GoStringN(cstr, uintptr(length))
    18  }
    19  
    20  //go:linkname C.__GoBytes runtime.cgo_GoBytes
    21  func C.__GoBytes(unsafe.Pointer, uintptr) []byte
    22  
    23  func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
    24  	return C.__GoBytes(ptr, uintptr(length))
    25  }
    26  
    27  type (
    28  	C.char      uint8
    29  	C.schar     int8
    30  	C.uchar     uint8
    31  	C.short     int16
    32  	C.ushort    uint16
    33  	C.int       int32
    34  	C.uint      uint32
    35  	C.long      int32
    36  	C.ulong     uint32
    37  	C.longlong  int64
    38  	C.ulonglong uint64
    39  )
    40  type C.myint = C.int
    41  type C.struct_point2d_t struct {
    42  	x C.int
    43  	y C.int
    44  }
    45  type C.point2d_t = C.struct_point2d_t
    46  type C.struct_point3d struct {
    47  	x C.int
    48  	y C.int
    49  	z C.int
    50  }
    51  type C.point3d_t = C.struct_point3d
    52  type C.struct_type1 struct {
    53  	_type   C.int
    54  	__type  C.int
    55  	___type C.int
    56  }
    57  type C.struct_type2 struct{ _type C.int }
    58  type C.union_union1_t struct{ i C.int }
    59  type C.union1_t = C.union_union1_t
    60  type C.union_union3_t struct{ $union uint64 }
    61  
    62  func (union *C.union_union3_t) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
    63  func (union *C.union_union3_t) unionfield_d() *float64 {
    64  	return (*float64)(unsafe.Pointer(&union.$union))
    65  }
    66  func (union *C.union_union3_t) unionfield_s() *C.short {
    67  	return (*C.short)(unsafe.Pointer(&union.$union))
    68  }
    69  
    70  type C.union3_t = C.union_union3_t
    71  type C.union_union2d struct{ $union [2]uint64 }
    72  
    73  func (union *C.union_union2d) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
    74  func (union *C.union_union2d) unionfield_d() *[2]float64 {
    75  	return (*[2]float64)(unsafe.Pointer(&union.$union))
    76  }
    77  
    78  type C.union2d_t = C.union_union2d
    79  type C.union_unionarray_t struct{ arr [10]C.uchar }
    80  type C.unionarray_t = C.union_unionarray_t
    81  type C._Ctype_union___0 struct{ $union [3]uint32 }
    82  
    83  func (union *C._Ctype_union___0) unionfield_area() *C.point2d_t {
    84  	return (*C.point2d_t)(unsafe.Pointer(&union.$union))
    85  }
    86  func (union *C._Ctype_union___0) unionfield_solid() *C.point3d_t {
    87  	return (*C.point3d_t)(unsafe.Pointer(&union.$union))
    88  }
    89  
    90  type C.struct_struct_nested_t struct {
    91  	begin C.point2d_t
    92  	end   C.point2d_t
    93  	tag   C.int
    94  
    95  	coord C._Ctype_union___0
    96  }
    97  type C.struct_nested_t = C.struct_struct_nested_t
    98  type C.union_union_nested_t struct{ $union [2]uint64 }
    99  
   100  func (union *C.union_union_nested_t) unionfield_point() *C.point3d_t {
   101  	return (*C.point3d_t)(unsafe.Pointer(&union.$union))
   102  }
   103  func (union *C.union_union_nested_t) unionfield_array() *C.unionarray_t {
   104  	return (*C.unionarray_t)(unsafe.Pointer(&union.$union))
   105  }
   106  func (union *C.union_union_nested_t) unionfield_thing() *C.union3_t {
   107  	return (*C.union3_t)(unsafe.Pointer(&union.$union))
   108  }
   109  
   110  type C.union_nested_t = C.union_union_nested_t
   111  type C.enum_option = C.int
   112  type C.option_t = C.enum_option
   113  type C.enum_option2_t = C.uint
   114  type C.option2_t = C.enum_option2_t
   115  type C.struct_types_t struct {
   116  	f   float32
   117  	d   float64
   118  	ptr *C.int
   119  }
   120  type C.types_t = C.struct_types_t
   121  type C.myIntArray = [10]C.int
   122  type C.struct_bitfield_t struct {
   123  	start        C.uchar
   124  	__bitfield_1 C.uchar
   125  
   126  	d C.uchar
   127  	e C.uchar
   128  }
   129  
   130  func (s *C.struct_bitfield_t) bitfield_a() C.uchar { return s.__bitfield_1 & 0x1f }
   131  func (s *C.struct_bitfield_t) set_bitfield_a(value C.uchar) {
   132  	s.__bitfield_1 = s.__bitfield_1&^0x1f | value&0x1f<<0
   133  }
   134  func (s *C.struct_bitfield_t) bitfield_b() C.uchar {
   135  	return s.__bitfield_1 >> 5 & 0x1
   136  }
   137  func (s *C.struct_bitfield_t) set_bitfield_b(value C.uchar) {
   138  	s.__bitfield_1 = s.__bitfield_1&^0x20 | value&0x1<<5
   139  }
   140  func (s *C.struct_bitfield_t) bitfield_c() C.uchar {
   141  	return s.__bitfield_1 >> 6
   142  }
   143  func (s *C.struct_bitfield_t) set_bitfield_c(value C.uchar,
   144  
   145  ) { s.__bitfield_1 = s.__bitfield_1&0x3f | value<<6 }
   146  
   147  type C.bitfield_t = C.struct_bitfield_t