Esempio n. 1
0
func cBool(goBool bool) C.BOOL {
	if goBool {
		return C.BOOL(1)
	} else {
		return C.BOOL(0)
	}
}
Esempio n. 2
0
func (e *Element) OuterHtml() string {
	var data *C.char
	if ret := C.HTMLayoutGetElementHtml(e.handle, (*C.LPBYTE)(unsafe.Pointer(&data)), C.BOOL(1)); ret != HLDOM_OK {
		domPanic(ret, "Failed to get outer html")
	}
	return C.GoString(data)
}
Esempio n. 3
0
func (m Msg) update(buf []byte, n int, lastCall bool) bool {
	var lc C.BOOL
	if lastCall {
		lc = C.BOOL(1)
	}
	return C.CryptMsgUpdate(m.hMsg, (*C.BYTE)(unsafe.Pointer(&buf[0])), C.DWORD(n), lc) != 0
}
Esempio n. 4
0
// LoadModuleFromSlice attempts to load a MikMod module from the
// supplied byte slice.
func LoadModuleFromSlice(b []byte) (*Module, error) {
	module := C.Player_LoadMem((*C.char)(unsafe.Pointer(&b[0])), C.int(len(b)), 128, C.BOOL(0))
	if module == nil {
		return nil, mikmodError()
	}
	return &Module{module}, nil
}
Esempio n. 5
0
// LoadModuleFromFile attempts to load a MikMod module from the file
// designated by filename.
func LoadModuleFromFile(filename string) (*Module, error) {
	fn := mikmodString(filename)
	defer C.free(unsafe.Pointer(fn))
	module := C.Player_Load(fn, 128, C.BOOL(0))
	if module == nil {
		return nil, mikmodError()
	}
	return &Module{module}, nil
}
Esempio n. 6
0
// Sets the specified flag to "on" or "off" according to the value of the provided boolean
func (e *Element) SetState(flag uint32, on bool) {
	addBits := uint32(0)
	clearBits := uint32(0)
	if on {
		addBits = flag
	} else {
		clearBits = flag
	}
	shouldUpdate := C.BOOL(1)
	if ret := C.HTMLayoutSetElementState(e.handle, C.UINT(addBits), C.UINT(clearBits), shouldUpdate); ret != HLDOM_OK {
		domPanic(ret, "Failed to set element state flag")
	}
}
Esempio n. 7
0
func GetWord(ri *C.struct_TessResultIterator) TessWord {
	cWord := C.TessResultIteratorGetUTF8Text(ri, C.RIL_WORD)
	// TESS_API const char* TESS_CALL
	// TessResultIteratorWordFontAttributes(const TessResultIterator* handle,
	// BOOL* is_bold, BOOL* is_italic, BOOL* is_underlined,
	// BOOL* is_monospace, BOOL* is_serif, BOOL* is_smallcaps, int* pointsize, int* font_id);
	is_bold := C.BOOL(0)
	is_italic := C.BOOL(0)
	is_underlined := C.BOOL(0)
	is_monospace := C.BOOL(0)
	is_serif := C.BOOL(0)
	is_smallcaps := C.BOOL(0)
	pointsize := C.int(0)
	font_id := C.int(0)

	font_name := C.TessResultIteratorWordFontAttributes(ri, &is_bold, &is_italic, &is_underlined, &is_monospace, &is_serif, &is_smallcaps, &pointsize, &font_id)
	conf := C.TessResultIteratorConfidence(ri, C.RIL_WORD)

	return TessWord{C.GoString(cWord), float32(conf), B(is_bold), B(is_italic), B(is_underlined), B(is_monospace), B(is_serif), B(is_smallcaps), int(pointsize), int(font_id), C.GoString(font_name)}
}
Esempio n. 8
0
// Replaces the whole set of state flags with the specified value
func (e *Element) SetStateFlags(flags uint32) {
	shouldUpdate := C.BOOL(1)
	if ret := C.HTMLayoutSetElementState(e.handle, C.UINT(flags), C.UINT(^flags), shouldUpdate); ret != HLDOM_OK {
		domPanic(ret, "Failed to set element state flags")
	}
}
Esempio n. 9
0
//export webfreerdp_client_global_init
func webfreerdp_client_global_init() C.BOOL {
	log.Println("webfreerdp_client_global_init")
	return C.BOOL(C.TRUE)
}
Esempio n. 10
0
func boolToCInt(b bool) C.BOOL {
	return C.BOOL(hge.BoolToCInt(b))
}