Пример #1
0
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
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
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
	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 {