コード例 #1
0
ファイル: runtime.go プロジェクト: joao-parana/tardisgo
func Callers(skip int, pc []uintptr) int {
	limit := hx.CallInt("", "Scheduler.getNumCallers", 1, hx.GetInt("", "this._goroutine"))
	for i := 0; i < limit; i++ {
		if i > skip {
			pc = append(pc, uintptr(hx.CallInt("", "Scheduler.getCallerX", 2, hx.GetInt("", "this._goroutine"), i)))
		}
	}
	return limit - skip
}
コード例 #2
0
ファイル: haxeinterface.go プロジェクト: henrylee2cn/tardisgo
func createHaxeType(id int) *rtype {
	if id <= 0 || id >= hx.GetInt("", "TypeInfo.nextTypeID") {
		//panic("reflect.createHaxeType() invalid haxe id: " + hx.CallString("", "Std.string", 1, id))
		return nil
	}

	// new version of type infomation:
	return (*rtype)(unsafe.Pointer(haxegoruntime.TypeTable[id]))
}
コード例 #3
0
ファイル: runtime.go プロジェクト: joao-parana/tardisgo
func Caller(skip int) (pc uintptr, file string, line int, ok bool) {
	pc = uintptr(hx.CallInt("", "Scheduler.getCallerX", 2, hx.GetInt("", "this._goroutine"), 1+skip))
	fnc := FuncForPC(pc)
	file, line = fnc.FileLine(pc)
	ok = true
	if file == "" || line == 0 {
		ok = false
	}
	return
}
コード例 #4
0
ファイル: tgotypes.go プロジェクト: henrylee2cn/tardisgo
	fields []structField // sorted by offset
}

func fillStructType(stp *structType, rtype rtype, fields []structField) {
	*stp = structType{rtype, fields}
}

// NOTE end of reflect type clones

//type ErrorInterface interface {
//	Error() string
//}

// TypeTable provides a mapping between used type numbers (the index) to their reflect definitions
// but reflect is not used here in order to avoid pulling it into every build
var TypeTable = make([]*rtype, hx.GetInt("", "TypeInfo.nextTypeID"))

func init() {
	hx.Call("", "Tgotypes.setup", 0) // to set-up the TypeTable above
	//typetest()
	//println("DEBUG sizeof(funcType{}) = ", unsafe.Sizeof(funcType{}))
}

func AddHaxeType(ptr unsafe.Pointer) {
	TypeTable = append(TypeTable, (*rtype)(ptr))
	hx.SetInt("", "TypeInfo.nextTypeID", len(TypeTable))
}

func typetest() {
	for i, tp := range TypeTable {
		if tp != nil {