// Copyright 2013-2014 Fuzamei tech Ltd. All rights reserved. package gocctp /* #include #include */ import "C" import ( "unsafe" ) //export GoOnMdRspUserLogin func GoOnMdRspUserLogin(pRspUserLogin *C.CThostFtdcRspUserLoginField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } mdApi := (*MdApi)(ctx) mdApi.OnRspUserLogin(errMsg) } //export GoOnMdRspUserLogout func GoOnMdRspUserLogout(pUserLogout *C.CThostFtdcUserLogoutField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } mdApi := (*MdApi)(ctx) mdApi.OnRspUserLogout(errMsg) } //export GoOnMdRspError func GoOnMdRspError(pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } mdApi := (*MdApi)(ctx) mdApi.OnRspError(errMsg) } //export GoOnTdRspUserLogin func GoOnTdRspUserLogin(pRspUserLogin *C.CThostFtdcRspUserLoginField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } tdApi := (*TdApi)(ctx) tdApi.OnRspUserLogin(errMsg) } //export GoOnTdRspUserLogout func GoOnTdRspUserLogout(pUserLogout *C.CThostFtdcUserLogoutField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } tdApi := (*TdApi)(ctx) tdApi.OnRspUserLogout(errMsg) } //export GoOnTdRspError func GoOnTdRspError(pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } tdApi := (*TdApi)(ctx) tdApi.OnRspError(errMsg) } //export GoOnRtnDepthMarketData func GoOnRtnDepthMarketData(pDepthMarketData *C.CThostFtdcDepthMarketDataField, ctx unsafe.Pointer) { field := &CThostFtdcDepthMarketDataField{} size := unsafe.Sizeof(*field) C.memcpy(unsafe.Pointer(field), unsafe.Pointer(pDepthMarketData), C.size_t(size)) mdApi := (*MdApi)(ctx) mdApi.OnRtnDepthMarketData(field) } //export GoOnRspQryExchange func GoOnRspQryExchange(pExchange *C.CThostFtdcExchangeField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { field := &CThostFtdcExchangeField{} size := unsafe.Sizeof(*field) C.memcpy(unsafe.Pointer(field), unsafe.Pointer(pExchange), C.size_t(size)) errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } tdApi := (*TdApi)(ctx) tdApi.OnRspQryExchange(field, errMsg, bIsLast) } //export GoOnRspQryInstrument func GoOnRspQryInstrument(pInstrument *C.CThostFtdcInstrumentField, pRspInfo *C.CThostFtdcRspInfoField, nRequestID int, bIsLast bool, ctx unsafe.Pointer) { field := &CThostFtdcInstrumentField{} size := unsafe.Sizeof(*field) C.memcpy(unsafe.Pointer(field), unsafe.Pointer(pInstrument), C.size_t(size)) errMsg := "" if unsafe.Pointer(pRspInfo) != nil { errNo := pRspInfo.ErrorID if errNo != 0 { errMsg = C.GoString(&pRspInfo.ErrorMsg[0]) } } tdApi := (*TdApi)(ctx) tdApi.OnRspQryInstrument(field, errMsg, bIsLast) }