Exemplo n.º 1
0
func (sv *StringVar) Set(s string) {
	if sv.data != nil {
		C.Tcl_Free(sv.data)
	}
	sv.data = C.Tcl_Alloc(C.uint(len(s) + 1))
	svslice := (*((*[alot]byte)(unsafe.Pointer(sv.data))))[:]
	copy(svslice, s)
	svslice[len(s)] = 0

	cname := C.CString(sv.name)
	C.Tcl_UpdateLinkedVar(sv.ir.C, cname)
	C.free_string(cname)
}
Exemplo n.º 2
0
func (iv *IntVar) Set(i int) {
	iv.data = C.Tcl_WideInt(i)
	cname := C.CString(iv.name)
	C.Tcl_UpdateLinkedVar(iv.ir.C, cname)
	C.free_string(cname)
}
Exemplo n.º 3
0
func (fv *FloatVar) Set(f float64) {
	fv.data = C.double(f)
	cname := C.CString(fv.name)
	C.Tcl_UpdateLinkedVar(fv.ir.C, cname)
	C.free_string(cname)
}