From c33ea32e0fd61f6a7b25393004ffface4d14e148 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 8 Aug 2018 19:48:52 -0400 Subject: [PATCH] Started a new hresultwrap in Go. I'll run it locally. --- windows/tools/funclist.textpb | 18 ++++++++++++++++++ windows/tools/hresultwrap.go | 30 ++++++++++++++++++++++++++++++ windows/tools/hresultwrap.proto | 18 ++++++++++++++++++ windows/tools/mk.sh | 3 +++ 4 files changed, 69 insertions(+) create mode 100644 windows/tools/funclist.textpb create mode 100644 windows/tools/hresultwrap.go create mode 100644 windows/tools/hresultwrap.proto create mode 100644 windows/tools/mk.sh diff --git a/windows/tools/funclist.textpb b/windows/tools/funclist.textpb new file mode 100644 index 00000000..62b105fc --- /dev/null +++ b/windows/tools/funclist.textpb @@ -0,0 +1,18 @@ +# 8 august 2018 + +func: { +name: "RegisterClassW" +arg: "_In_ CONST WNDCLASSW *lpWndClass" +ret: "ATOM" +failval: "0" +save: true +} + +func: { +name: "UnregisterClassW" +arg: "_In_ LPCWSTR lpClassName" +arg: "_In_opt_ HINSTANCE hInstance" +ret: "BOOL" +failval: "0" +cleanup: true +} diff --git a/windows/tools/hresultwrap.go b/windows/tools/hresultwrap.go new file mode 100644 index 00000000..b806cd9f --- /dev/null +++ b/windows/tools/hresultwrap.go @@ -0,0 +1,30 @@ +// 8 august 2018 +// usage: hresultwrap funclist template out +package main + +import ( + "fmt" + "os" + "io/ioutil" + + "github.com/golang/protobuf/proto" +) + +func main() { + if len(os.Args) != 2 { + fmt.Fprintf(os.Stderr, "usage: %s funclist\n", os.Args[0]) + os.Exit(1) + } + b, err := ioutil.ReadFile(os.Args[1]) + if err != nil { + fmt.Fprintf(os.Stderr, "error reading %s: %v\n", os.Args[1], err) + os.Exit(1) + } + var f File + err = proto.UnmarshalText(string(b), &f) + if err != nil { + fmt.Fprintf(os.Stderr, "error parsing %s: %v\n", os.Args[1], err) + os.Exit(1) + } + fmt.Println(f) +} diff --git a/windows/tools/hresultwrap.proto b/windows/tools/hresultwrap.proto new file mode 100644 index 00000000..07801212 --- /dev/null +++ b/windows/tools/hresultwrap.proto @@ -0,0 +1,18 @@ +// 8 august 2018 +syntax = "proto3"; + +option go_package = "main"; + +message File { + repeated Function func = 1; +} + +message Function { + string name = 1; + string calling_convention = 2; // defaults to WINAPI + repeated string arg = 3; + string ret = 4; + string failval = 5; + bool save = 6; + bool cleanup = 7; +} diff --git a/windows/tools/mk.sh b/windows/tools/mk.sh new file mode 100644 index 00000000..5a2c95cd --- /dev/null +++ b/windows/tools/mk.sh @@ -0,0 +1,3 @@ +rm -f hresultwrap.pb.go hresultwrap +protoc --go_out=. hresultwrap.proto +go build hresultwrap.go hresultwrap.pb.go