diff --git a/windows/tools/a b/windows/tools/a deleted file mode 100644 index 5be22d75..00000000 --- a/windows/tools/a +++ /dev/null @@ -1,55 +0,0 @@ -@BOOL GetWindowPlacement HWND hwnd uiprivLPWWINDOWPLACEMENT wp == 0 -$typedef const WINDOWPLACEMENT *uiprivLPCWINDOWPLACEMENT; -@BOOL SetWindowPlacement HWND hwnd uiprivLPCWINDOWPLACEMENT wp == 0 -@HWND SetParent HWND hwnd HWND newParent == NULL -@BOOL GetClientRect HWND hwnd LPRECT r == 0 -@BOOL GetWindowRect HWND hwnd LPRECT r == 0 -@int GetClassNameW HWND hwnd LPWSTR name int n == 0 - -@BOOL SetWindowSubclass HWND hwnd SUBCLASSPROC proc UINT_PTR id DWORD_PTR dwRefData == FALSE -@BOOL RemoveWindowSubclass HWND hwnd SUBCLASSPROC proc UINT_PTR id == FALSE - -@*HWND CreateDialogIndirectParamW HINSTANCE hInstance LPCDLGTEMPLATE dialog HWND parent DLGPROC proc LPARAM param == NULL -// note: this gives dialogs in libui the condition that they must NOT call uiprivTODOEndDialog() with a negative result code -@*INT_PTR DialogBoxIndirectParamW HINSTANCE hInstance LPCDLGTEMPLATE dialog HWND parent DLGPROC proc LPARAM param < 0 -@BOOL EndDialog HWND hdlg INT_PTR result == 0 -@*HWND GetDlgItem HWND hdlg int id == NULL - -@*HMENU CreateMenu == NULL -@*HMENU CreatePopupMenu == NULL -@BOOL AppendMenuW HMENU menu UINT flags UINT_PTR id LPCWSTR text == 0 -@BOOL SetMenu HWND hwnd HMENU menu == 0 -@BOOL GetMenuItemInfoW HMENU menu UINT item BOOL byPosition LPMENUITEMINFO info == 0 -@BOOL SetMenuItemInfoW HMENU menu UINT item BOOL byPosition LPMENUITEMINFO info == 0 - -@*HDC BeginPaint HWND hwnd LPPAINTSTRUCT ps == NULL -@*HDC GetDC HWND hwnd == NULL -@int ReleaseDC HWND hwnd HDC dc == 0 -@*HDC CreateCompatibleDC HDC dc == NULL -@BOOL DeleteDC HDC dc == 0 -$typedef const RECT *uiprivLPCRECT; -@BOOL InvalidateRect HWND hwnd uiprivLPCRECT r BOOL erase == 0 -@BOOL ValidateRect HWND hwnd uiprivLPCRECT r == 0 - -@*HBITMAP CreateCompatibleBitmap HDC dc int width int height == NULL -@*HBRUSH CreatePatternBrush HBITMAP bitmap == NULL -@BOOL DeleteObject HGDIOBJ obj == 0 - -@BOOL SetBrushOrgEx HDC dc int x int y LPPOINT prev == 0 -@int SetBkMode HDC dc int mode == 0 -@BOOL BitBlt HDC dest int destX int destY int destWidth int destHeight HDC src int srcX int srcY DWORD op == 0 - -@BOOL GetTextMetricsW HDC dc LPTEXTMETRIC tm == 0 -@BOOL APIENTRY GetTextExtentPoint32W HDC dc LPCWSTR str int n LPSIZE size == 0 - -@BOOL ReleaseCapture == 0 -@BOOL _TrackMouseEvent LPTRACKMOUSEEVENT tme == 0 - -@BOOL GetScrollInfo HWND hwnd int bar LPSCROLLINFO si == 0 - -@BOOL SystemParametersInfoW UINT action UINT param PVOID v UINT winini == 0 -@BOOL GetMonitorInfoW HMONITOR monitor LPMONITORINFO info == 0 - -@*int GetLocaleInfoEx LPCWSTR name LCTYPE type LPWSTR buf int n == 0 - -@BOOL UnhookWindowsHookEx HHOOK hook == 0 diff --git a/windows/tools/cpp.template b/windows/tools/cpp.template deleted file mode 100644 index a9627093..00000000 --- a/windows/tools/cpp.template +++ /dev/null @@ -1,29 +0,0 @@ -{{/* 8 august 2018 */}}// this file is generated by tools/hresultwrap and should NOT be modified directly -#include "uipriv_windows.hpp" - -static inline HRESULT lastErrorToHRESULT(DWORD lasterr, const char *funcname) -{ - HRESULT hr; - - hr = E_FAIL; - if (lasterr != 0) - hr = HRESULT_FROM_WIN32(lasterr); - uiprivImplBug("error calling %s: last error %I32d\n", funcname, lasterr); - return hr; -}{{range .}} - -{{$narg := len .Arg}}HRESULT {{if .CallingConvention}}{{.CallingConvention}}{{else}}WINAPI{{end}} uiprivHR{{.Name}}({{range $i, $a := .Arg}}{{$a}}{{argcomma $i $narg}}{{end}}{{if .Save}}, _Out_ {{.Ret}} *outRet{{end}}) -{ - {{.Ret}} xyzret; - DWORD xyzlasterr; - -{{if .Save}} if (outRet == NULL) - return E_POINTER; -{{end}} SetLastError(0); - xyzret = {{.Name}}({{range $i, $a := .Arg}}{{argname $a}}{{argcomma $i $narg}}{{end}}); - xyzlasterr = GetLastError(); -{{if .Save}} *outRet = xyzret; -{{end}} if (xyzret != {{.Failval}}) - return S_OK; - return lastErrToHRESULT(xyzlasterr, "{{.Name}}()"); -}{{/*TODO cleanup*/}}{{end}} diff --git a/windows/tools/funclist.textpb b/windows/tools/funclist.textpb deleted file mode 100644 index c876732a..00000000 --- a/windows/tools/funclist.textpb +++ /dev/null @@ -1,134 +0,0 @@ -# 8 august 2018 - -# TODO preserve lpRect on failure -func: { -name: "AdjustWindowRectEx" -arg: "_Inout_ LPRECT lpRect" -arg: "_In_ DWORD dwStyle" -arg: "_In_ BOOL bMenu" -arg: "_In_ DWORD dwExStyle" -ret: "BOOL" -failval: "0" -} - -func: { -name: "CreateWindowExW" -arg: "_In_ DWORD dwExStyle" -arg: "_In_opt_ LPCWSTR lpClassName" -arg: "_In_opt_ LPCWSTR lpWindowName" -arg: "_In_ DWORD dwStyle" -arg: "_In_ int X" -arg: "_In_ int Y" -arg: "_In_ int nWidth" -arg: "_In_ int nHeight" -arg: "_In_opt_ HWND hWndParent" -arg: "_In_opt_ HMENU hMenu" -arg: "_In_opt_ HINSTANCE hInstance" -arg: "_In_opt_ LPVOID lpParam" -ret: "HWND" -failval: "NULL" -save: true -} - -func: { -name: "DestroyWindow" -arg: "_In_ HWND hWnd" -ret: "BOOL" -failval: "0" -cleanup: true -} - -# TODO failexpr is < 0 -func: { -name: "GetMessageW" -arg: "_Out_ LPMSG lpMsg" -arg: "_In_opt_ HWND hWnd" -arg: "_In_ UINT wMsgFilterMin" -arg: "_In_ UINT wMsgFilterMax" -ret: "BOOL" -failval: "-1" -} - -# TODO write a L'\0' to lpString[0] on failure -# TODO also add extra checks to make sure lpString is not NULL -func: { -name: "GetWindowTextW" -arg: "_In_ HWND hWnd" -arg: "_Out_writes_(nMaxCount) LPWSTR lpString" -arg: "_In_ int nMaxCount" -ret: "int" -failval: "0" -} - -func: { -name: "KillTimer" -arg: "_In_opt_ HWND hWnd" -arg: "_In_ UINT_PTR uIDEvent" -ret: "BOOL" -failval: "0" -} - -func: { -name: "PostMessageW" -arg: "_In_opt_ HWND hWnd" -arg: "_In_ UINT Msg" -arg: "_In_ WPARAM wParam" -arg: "_In_ LPARAM lParam" -ret: "BOOL" -failval: "0" -} - -func: { -name: "RegisterClassW" -arg: "_In_ CONST WNDCLASSW *lpWndClass" -ret: "ATOM" -failval: "0" -save: true -} - -func: { -name: "SetTimer" -arg: "_In_opt_ HWND hWnd" -arg: "_In_ UINT_PTR nIDEvent" -arg: "_In_ UINT uElapse" -arg: "_In_opt_ TIMERPROC lpTimerFunc" -ret: "UINT_PTR" -failval: "0" -} - -func: { -name: "SetWindowPos" -arg: "_In_ HWND hWnd" -arg: "_In_opt_ HWND hWndInsertAfter" -arg: "_In_ int X" -arg: "_In_ int Y" -arg: "_In_ int cx" -arg: "_In_ int cy" -arg: "_In_ UINT uFlags" -ret: "BOOL" -failval: "0" -} - -func: { -name: "SetWindowTextW" -arg: "_In_ HWND hWnd" -arg: "_In_opt_ LPCWSTR lpString" -ret: "BOOL" -failval: "0" -} - -func: { -name: "UnregisterClassW" -arg: "_In_ LPCWSTR lpClassName" -arg: "_In_opt_ HINSTANCE hInstance" -ret: "BOOL" -failval: "0" -cleanup: true -} - -func: { -name: "UpdateWindow" -arg: "_In_ HWND hWnd" -ret: "BOOL" -failval: "0" -} diff --git a/windows/tools/gen.sh b/windows/tools/gen.sh deleted file mode 100755 index 168df8fa..00000000 --- a/windows/tools/gen.sh +++ /dev/null @@ -1 +0,0 @@ -./hresultwrap funclist.textpb cpp.template diff --git a/windows/tools/hresultwrap.go b/windows/tools/hresultwrap.go deleted file mode 100644 index edf9e6b2..00000000 --- a/windows/tools/hresultwrap.go +++ /dev/null @@ -1,70 +0,0 @@ -// 8 august 2018 -// usage: hresultwrap funclist template out -package main - -import ( - "fmt" - "os" - "io/ioutil" - "text/template" - "strings" - - "github.com/golang/protobuf/proto" -) - -func argname(arg string) string { - fields := strings.Fields(arg) - last := fields[len(fields) - 1] - start := strings.LastIndexFunc(last, func(r rune) bool { - return !(r >= 'A' && r <= 'Z') && - !(r >= 'a' && r <= 'z') && - !(r >= '0' && r <= '9') && - r != '_' - }) - if start == -1 { - return last - } - // TODO replace + 1 with + len of that last rune - return last[start + 1:] -} - -func argcomma(n, len int) string { - if n == len - 1 { - return "" - } - return ", " -} - -var templateFuncs = template.FuncMap{ - "argname": argname, - "argcomma": argcomma, -} - -func main() { - if len(os.Args) != 3 { - fmt.Fprintf(os.Stderr, "usage: %s funclist template\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) - } - - tmpl, err := template.New(os.Args[2]).Funcs(templateFuncs).ParseFiles(os.Args[2]) - if err != nil { - fmt.Fprintf(os.Stderr, "error parsing %s: %v\n", os.Args[2], err) - os.Exit(1) - } - err = tmpl.Execute(os.Stdout, f.Func) - if err != nil { - fmt.Fprintf(os.Stderr, "error executing template: %v\n", err) - os.Exit(1) - } -} diff --git a/windows/tools/hresultwrap.proto b/windows/tools/hresultwrap.proto deleted file mode 100644 index 07801212..00000000 --- a/windows/tools/hresultwrap.proto +++ /dev/null @@ -1,18 +0,0 @@ -// 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 deleted file mode 100755 index 276c3aae..00000000 --- a/windows/tools/mk.sh +++ /dev/null @@ -1,3 +0,0 @@ -rm -f hresultwrap.pb.go hresultwrap && -protoc --go_out=. hresultwrap.proto && -go build hresultwrap.go hresultwrap.pb.go