github.com/hsfzxjy/dgo/go@v0.2.0/preserved.go (about)

     1  package dgo
     2  
     3  import (
     4  	"unsafe"
     5  
     6  	_ "github.com/hsfzxjy/dgo/go/pin"
     7  )
     8  
     9  type _PreservedGoCall struct {
    10  	kind uint64
    11  	port *Port
    12  }
    13  
    14  const (
    15  	pgcTokenDispose uint64 = iota + 1
    16  	pgcChanListen
    17  	pgcChanCancelListen
    18  )
    19  
    20  func parseUntypedToken(objs []*Dart_CObject) (version uint16, lid uint8, data uintptr) {
    21  	version = uint16(cobjectParseInt(objs[0]))
    22  	lid = uint8(cobjectParseInt(objs[1]))
    23  	data = uintptr(cobjectParseInt(objs[2]))
    24  	return
    25  }
    26  
    27  func (c _PreservedGoCall) specialInt() {}
    28  func (c _PreservedGoCall) handleCObjects(objs []*Dart_CObject) {
    29  	switch c.kind {
    30  	case pgcTokenDispose:
    31  		version, lid, data := parseUntypedToken(objs)
    32  		pin_TokenDispose(version, lid, data)
    33  	case pgcChanListen:
    34  		version, lid, data := parseUntypedToken(objs)
    35  		chid := uint8(cobjectParseInt(objs[3]))
    36  		dcb := uint32(cobjectParseInt(objs[4]))
    37  		pin_ChanListen(version, lid, data, chid, dcb, unsafe.Pointer(c.port))
    38  	case pgcChanCancelListen:
    39  		version, lid, data := parseUntypedToken(objs)
    40  		chid := uint8(cobjectParseInt(objs[3]))
    41  		pin_ChanCancelListen(version, lid, data, chid)
    42  	}
    43  }
    44  
    45  func pin_TokenDispose(version uint16, lid uint8, data uintptr)
    46  func pin_ChanListen(version uint16, lid uint8, data uintptr, chid uint8, dcb uint32, port unsafe.Pointer)
    47  func pin_ChanCancelListen(version uint16, lid uint8, data uintptr, chid uint8)