func cBool(goBool bool) C.BOOL { if goBool { return C.BOOL(1) } else { return C.BOOL(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) }
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 }
// 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 }
// 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 }
// 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") } }
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)} }
// 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") } }
//export webfreerdp_client_global_init func webfreerdp_client_global_init() C.BOOL { log.Println("webfreerdp_client_global_init") return C.BOOL(C.TRUE) }
func boolToCInt(b bool) C.BOOL { return C.BOOL(hge.BoolToCInt(b)) }