Made adjustments to the output of windowsconstgen to please go fmt.

This commit is contained in:
Pietro Gagliardi 2014-06-10 09:46:00 -04:00
parent e432e6fecf
commit 7b2e6b7fa3
3 changed files with 10 additions and 1 deletions

View File

@ -104,7 +104,7 @@ func hacknamesPreamble() string {
func preamble(pkg string) string {
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
@ -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)
}
func printBlankLine(f *os.File) {
fmt.Fprintf(f, " fmt.Println()\n")
}
func printGWLPName(f *os.File, which string, char string, targetarch string) {
fmt.Fprintf(f, " fmt.Println(\"var %s = user32.NewProc(\\\"%s\\\")\")\n",
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
printConst(f, ident, ident[1:])
}
printBlankLine(f) // to please go fmt
// and now for _getWindowLongPtr/_setWindowLongPtr
printGWLPName(f, "_getWindowLongPtr", "G", targetarch)
printGWLPName(f, "_setWindowLongPtr", "S", targetarch)

View File

@ -1,5 +1,6 @@
// autogenerated by windowsconstgen; do not edit
package ui
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
const _AC_SRC_ALPHA = 1
const _AC_SRC_OVER = 0
@ -172,5 +173,6 @@ const _IDC_ARROW = 32512
const _IDI_APPLICATION = 32512
const _INVALID_HANDLE_VALUE = 4294967295
const _NULL = 0
var _getWindowLongPtr = user32.NewProc("GetWindowLongW")
var _setWindowLongPtr = user32.NewProc("SetWindowLongW")

View File

@ -1,5 +1,6 @@
// autogenerated by windowsconstgen; do not edit
package ui
const _ACTCTX_FLAG_SET_PROCESS_DEFAULT = 16
const _AC_SRC_ALPHA = 1
const _AC_SRC_OVER = 0
@ -172,5 +173,6 @@ const _IDC_ARROW = 32512
const _IDI_APPLICATION = 32512
const _INVALID_HANDLE_VALUE = 18446744073709551615
const _NULL = 0
var _getWindowLongPtr = user32.NewProc("GetWindowLongPtrW")
var _setWindowLongPtr = user32.NewProc("SetWindowLongPtrW")