From 4cdc8d522a8d6c42c0b8f18bbb8948bb0af921e0 Mon Sep 17 00:00:00 2001 From: Guy Sherman Date: Sun, 30 Oct 2016 18:12:12 +0000 Subject: [PATCH] Necessary modifications for windows xpile --- utils/generate-ttl.bat | 18 +++++++++++ utils/lv2-ttl-generator/lv2_ttl_generator.c | 33 +++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 utils/generate-ttl.bat diff --git a/utils/generate-ttl.bat b/utils/generate-ttl.bat new file mode 100644 index 00000000..1e07acc8 --- /dev/null +++ b/utils/generate-ttl.bat @@ -0,0 +1,18 @@ +@echo off +IF NOT EXIST bin GOTO NOBINDIR +CD bin +SET GEN=%~dp0\lv2_ttl_generator.exe +SET EXT=dll +for /D %%s in (.\*) do (call :generatettls "%%s") + + +goto :eof +:NOBINDIR +echo "Please run this script from the surface root" +goto :eof + +:generatettls +pushd %1 +for %%i in (*_dsp.dll) do %~dp0\lv2_ttl_generator.exe %%i +popd +goto :eof diff --git a/utils/lv2-ttl-generator/lv2_ttl_generator.c b/utils/lv2-ttl-generator/lv2_ttl_generator.c index 5ef2b142..c24dbb30 100644 --- a/utils/lv2-ttl-generator/lv2_ttl_generator.c +++ b/utils/lv2-ttl-generator/lv2_ttl_generator.c @@ -18,6 +18,39 @@ typedef void (*TTL_Generator_Function)(const char* basename); +void ErrorExit(LPTSTR lpszFunction) +{ + // Retrieve the system error message for the last-error code + + LPVOID lpMsgBuf; + LPVOID lpDisplayBuf; + DWORD dw = GetLastError(); + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + // Display the error message and exit the process + + lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, + (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR)); + sprintf((LPTSTR)lpDisplayBuf, + TEXT("%s failed with error %d: %s"), + lpszFunction, dw, lpMsgBuf); + MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK); + + LocalFree(lpMsgBuf); + LocalFree(lpDisplayBuf); + ExitProcess(dw); +} +#endif + int main(int argc, char* argv[]) { if (argc != 2)