diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-12 01:31:45 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-12 01:31:45 +0000 |
commit | 26ae0101ebafafea33beadccea3056f4b5e135e8 (patch) | |
tree | 86a3b8019380d5fad53258c4baba3dd9e1e7c736 /libgo/go/exp/wingui/zwinapi.go | |
parent | c8142b20a95ae9c6bd0bac8c5a545b27402836fe (diff) | |
download | gcc-26ae0101ebafafea33beadccea3056f4b5e135e8.tar.gz |
libgo: Update to weekly.2011-12-14.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/exp/wingui/zwinapi.go')
-rw-r--r-- | libgo/go/exp/wingui/zwinapi.go | 80 |
1 files changed, 30 insertions, 50 deletions
diff --git a/libgo/go/exp/wingui/zwinapi.go b/libgo/go/exp/wingui/zwinapi.go index 38e93eea717..b062ca3372e 100644 --- a/libgo/go/exp/wingui/zwinapi.go +++ b/libgo/go/exp/wingui/zwinapi.go @@ -28,47 +28,41 @@ var ( procPostMessageW = moduser32.NewProc("PostMessageW") ) -func GetModuleHandle(modname *uint16) (handle syscall.Handle, errno int) { +func GetModuleHandle(modname *uint16) (handle syscall.Handle, err error) { r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(unsafe.Pointer(modname)), 0, 0) handle = syscall.Handle(r0) if handle == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } -func RegisterClassEx(wndclass *Wndclassex) (atom uint16, errno int) { +func RegisterClassEx(wndclass *Wndclassex) (atom uint16, err error) { r0, _, e1 := syscall.Syscall(procRegisterClassExW.Addr(), 1, uintptr(unsafe.Pointer(wndclass)), 0, 0) atom = uint16(r0) if atom == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } -func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style uint32, x int32, y int32, width int32, height int32, wndparent syscall.Handle, menu syscall.Handle, instance syscall.Handle, param uintptr) (hwnd syscall.Handle, errno int) { +func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style uint32, x int32, y int32, width int32, height int32, wndparent syscall.Handle, menu syscall.Handle, instance syscall.Handle, param uintptr) (hwnd syscall.Handle, err error) { r0, _, e1 := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(exstyle), uintptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname)), uintptr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(wndparent), uintptr(menu), uintptr(instance), uintptr(param)) hwnd = syscall.Handle(r0) if hwnd == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } @@ -79,16 +73,14 @@ func DefWindowProc(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintp return } -func DestroyWindow(hwnd syscall.Handle) (errno int) { +func DestroyWindow(hwnd syscall.Handle) (err error) { r1, _, e1 := syscall.Syscall(procDestroyWindow.Addr(), 1, uintptr(hwnd), 0, 0) if int(r1) == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } @@ -104,31 +96,27 @@ func ShowWindow(hwnd syscall.Handle, cmdshow int32) (wasvisible bool) { return } -func UpdateWindow(hwnd syscall.Handle) (errno int) { +func UpdateWindow(hwnd syscall.Handle) (err error) { r1, _, e1 := syscall.Syscall(procUpdateWindow.Addr(), 1, uintptr(hwnd), 0, 0) if int(r1) == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } -func GetMessage(msg *Msg, hwnd syscall.Handle, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, errno int) { +func GetMessage(msg *Msg, hwnd syscall.Handle, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error) { r0, _, e1 := syscall.Syscall6(procGetMessageW.Addr(), 4, uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax), 0, 0) ret = int32(r0) if ret == -1 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } @@ -145,47 +133,41 @@ func DispatchMessage(msg *Msg) (ret int32) { return } -func LoadIcon(instance syscall.Handle, iconname *uint16) (icon syscall.Handle, errno int) { +func LoadIcon(instance syscall.Handle, iconname *uint16) (icon syscall.Handle, err error) { r0, _, e1 := syscall.Syscall(procLoadIconW.Addr(), 2, uintptr(instance), uintptr(unsafe.Pointer(iconname)), 0) icon = syscall.Handle(r0) if icon == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } -func LoadCursor(instance syscall.Handle, cursorname *uint16) (cursor syscall.Handle, errno int) { +func LoadCursor(instance syscall.Handle, cursorname *uint16) (cursor syscall.Handle, err error) { r0, _, e1 := syscall.Syscall(procLoadCursorW.Addr(), 2, uintptr(instance), uintptr(unsafe.Pointer(cursorname)), 0) cursor = syscall.Handle(r0) if cursor == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } -func SetCursor(cursor syscall.Handle) (precursor syscall.Handle, errno int) { +func SetCursor(cursor syscall.Handle) (precursor syscall.Handle, err error) { r0, _, e1 := syscall.Syscall(procSetCursor.Addr(), 1, uintptr(cursor), 0, 0) precursor = syscall.Handle(r0) if precursor == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } @@ -196,16 +178,14 @@ func SendMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr return } -func PostMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr) (errno int) { +func PostMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr) (err error) { r1, _, e1 := syscall.Syscall6(procPostMessageW.Addr(), 4, uintptr(hwnd), uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0) if int(r1) == 0 { if e1 != 0 { - errno = int(e1) + err = error(e1) } else { - errno = syscall.EINVAL + err = syscall.EINVAL } - } else { - errno = 0 } return } |