Made adjustments to the output of windowsconstgen to please go fmt.
This commit is contained in:
parent
e432e6fecf
commit
7b2e6b7fa3
|
@ -104,7 +104,7 @@ func hacknamesPreamble() string {
|
||||||
|
|
||||||
func preamble(pkg string) string {
|
func preamble(pkg string) string {
|
||||||
return "// autogenerated by windowsconstgen; do not edit\n" +
|
return "// autogenerated by windowsconstgen; do not edit\n" +
|
||||||
"package " + pkg + "\n"
|
"package " + pkg + "\n\n" // two newlines to please go fmt
|
||||||
}
|
}
|
||||||
|
|
||||||
// for backwards compatibiilty reasons, Windows defines GetWindowLongPtr()/SetWindowLongPtr() as a macro which expands to GetWindowLong()/SetWindowLong() on 32-bit systems
|
// for backwards compatibiilty reasons, Windows defines GetWindowLongPtr()/SetWindowLongPtr() as a macro which expands to GetWindowLong()/SetWindowLong() on 32-bit systems
|
||||||
|
@ -118,6 +118,10 @@ func printConst(f *os.File, goconst string, winconst string) {
|
||||||
fmt.Fprintf(f, " fmt.Println(\"const %s =\", C.%s)\n", goconst, winconst)
|
fmt.Fprintf(f, " fmt.Println(\"const %s =\", C.%s)\n", goconst, winconst)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printBlankLine(f *os.File) {
|
||||||
|
fmt.Fprintf(f, " fmt.Println()\n")
|
||||||
|
}
|
||||||
|
|
||||||
func printGWLPName(f *os.File, which string, char string, targetarch string) {
|
func printGWLPName(f *os.File, which string, char string, targetarch string) {
|
||||||
fmt.Fprintf(f, " fmt.Println(\"var %s = user32.NewProc(\\\"%s\\\")\")\n",
|
fmt.Fprintf(f, " fmt.Println(\"var %s = user32.NewProc(\\\"%s\\\")\")\n",
|
||||||
which, char + gwlpNames[targetarch])
|
which, char + gwlpNames[targetarch])
|
||||||
|
@ -188,6 +192,7 @@ func main() {
|
||||||
// not a hack name; strip the leading _ from the value name but keep the constant name unchanged
|
// not a hack name; strip the leading _ from the value name but keep the constant name unchanged
|
||||||
printConst(f, ident, ident[1:])
|
printConst(f, ident, ident[1:])
|
||||||
}
|
}
|
||||||
|
printBlankLine(f) // to please go fmt
|
||||||
// and now for _getWindowLongPtr/_setWindowLongPtr
|
// and now for _getWindowLongPtr/_setWindowLongPtr
|
||||||
printGWLPName(f, "_getWindowLongPtr", "G", targetarch)
|
printGWLPName(f, "_getWindowLongPtr", "G", targetarch)
|
||||||
printGWLPName(f, "_setWindowLongPtr", "S", targetarch)
|
printGWLPName(f, "_setWindowLongPtr", "S", targetarch)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// autogenerated by windowsconstgen; do not edit
|
// autogenerated by windowsconstgen; do not edit
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
|
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
|
||||||
const _AC_SRC_ALPHA = 1
|
const _AC_SRC_ALPHA = 1
|
||||||
const _AC_SRC_OVER = 0
|
const _AC_SRC_OVER = 0
|
||||||
|
@ -172,5 +173,6 @@ const _IDC_ARROW = 32512
|
||||||
const _IDI_APPLICATION = 32512
|
const _IDI_APPLICATION = 32512
|
||||||
const _INVALID_HANDLE_VALUE = 4294967295
|
const _INVALID_HANDLE_VALUE = 4294967295
|
||||||
const _NULL = 0
|
const _NULL = 0
|
||||||
|
|
||||||
var _getWindowLongPtr = user32.NewProc("GetWindowLongW")
|
var _getWindowLongPtr = user32.NewProc("GetWindowLongW")
|
||||||
var _setWindowLongPtr = user32.NewProc("SetWindowLongW")
|
var _setWindowLongPtr = user32.NewProc("SetWindowLongW")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// autogenerated by windowsconstgen; do not edit
|
// autogenerated by windowsconstgen; do not edit
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
|
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
|
||||||
const _AC_SRC_ALPHA = 1
|
const _AC_SRC_ALPHA = 1
|
||||||
const _AC_SRC_OVER = 0
|
const _AC_SRC_OVER = 0
|
||||||
|
@ -172,5 +173,6 @@ const _IDC_ARROW = 32512
|
||||||
const _IDI_APPLICATION = 32512
|
const _IDI_APPLICATION = 32512
|
||||||
const _INVALID_HANDLE_VALUE = 18446744073709551615
|
const _INVALID_HANDLE_VALUE = 18446744073709551615
|
||||||
const _NULL = 0
|
const _NULL = 0
|
||||||
|
|
||||||
var _getWindowLongPtr = user32.NewProc("GetWindowLongPtrW")
|
var _getWindowLongPtr = user32.NewProc("GetWindowLongPtrW")
|
||||||
var _setWindowLongPtr = user32.NewProc("SetWindowLongPtrW")
|
var _setWindowLongPtr = user32.NewProc("SetWindowLongPtrW")
|
||||||
|
|
Loading…
Reference in New Issue