diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2018-12-29 12:23:43 +0100 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2018-12-29 12:23:43 +0100 |
| commit | 388c42454ad593f8c201a0bc7c2b1bd18f21b1fe (patch) | |
| tree | 263717f8292ad5161969cb4fd584c6564283ebcb | |
| parent | 8ead043a524ffedc634663779a49730cc5da8d97 (diff) | |
make it build with ansi
it now actually works on Win95. WOHOO!
| -rw-r--r-- | Makefile.vc6-ansi | 33 | ||||
| -rw-r--r-- | alf/alf.cpp | 7 | ||||
| -rw-r--r-- | alf/alf.h | 6 | ||||
| -rw-r--r-- | alf/alfbutton.cpp | 4 | ||||
| -rw-r--r-- | alf/alfedit.cpp | 4 | ||||
| -rw-r--r-- | alf/alflabel.cpp | 4 | ||||
| -rwxr-xr-x | makemakefile.sh | 26 | ||||
| -rw-r--r-- | widgetfactory.cpp | 21 |
8 files changed, 85 insertions, 20 deletions
diff --git a/Makefile.vc6-ansi b/Makefile.vc6-ansi new file mode 100644 index 0000000..4e64419 --- /dev/null +++ b/Makefile.vc6-ansi @@ -0,0 +1,33 @@ +# automatically created by makemakefile.sh. DO NOT EDIT! + +CXX = cl.exe +CFLAGS = -O2 -GA -W3 -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo +LDFLAGS = /link kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib rpcrt4.lib + +out/widgetfactory.exe: out/widgetfactory.obj out/alfbutton.obj out/alfcompat.obj out/alf.obj out/alfdpiaware.obj out/alfedit.obj out/alflabel.obj + $(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS) + +out/alfbutton.obj: alf/alfbutton.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alfbutton.cpp + +out/alfcompat.obj: alf/alfcompat.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alfcompat.cpp + +out/alf.obj: alf/alf.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alf.cpp + +out/alfdpiaware.obj: alf/alfdpiaware.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alfdpiaware.cpp + +out/alfedit.obj: alf/alfedit.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alfedit.cpp + +out/alflabel.obj: alf/alflabel.cpp alf/alfcompat.h alf/alf.h alf/alflist.h alf/alfpriv.h + $(CXX) $(CFLAGS) -c -Fo$@ alf/alflabel.cpp + +out/widgetfactory.obj: widgetfactory.cpp alf/alf.h + $(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp + +clean: + del /f out\*.obj out\*.exe + diff --git a/alf/alf.cpp b/alf/alf.cpp index fbc7822..ae6c8f9 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -70,7 +70,7 @@ ALF_UpdateFontsPriv(HWND win, ALFWindowPriv *priv) ZeroMemory(&priv->fonts.lfMessageFont, sizeof(priv->fonts.lfMessageFont)); priv->fonts.lfMessageFont.lfHeight = -MulDiv(8, priv->fonts.dpi, 72); - lstrcpyW(priv->fonts.lfMessageFont.lfFaceName, L"MS Shell Dlg"); + lstrcpy(priv->fonts.lfMessageFont.lfFaceName, TEXT("MS Shell Dlg")); } if (priv->fonts.hMessageFont) { @@ -567,7 +567,8 @@ ALF_RegisterWindowClass(ALFAPP app, const ALFWindowClassParams *params) ALFWindowVTable *pvtbl = (ALFWindowVTable*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY|HEAP_GENERATE_EXCEPTIONS, sizeof(ALFWindowVTable)); *pvtbl = params->vtbl; - HWND tmp = CreateWindowEx(0, MAKEINTATOM(classatom), TEXT("dummy"), 0, 0, 0, 0, 0, HWND_MESSAGE, 0, app->hInstance, 0); + // XXX: This could have been a HWND_MESSAGE window, but Win95 doesn't support these + HWND tmp = CreateWindowEx(0, MAKEINTATOM(classatom), TEXT("dummy"), 0, 0, 0, 0, 0, NULL, 0, app->hInstance, 0); SetClassLongPtr(tmp, 0, (LONG_PTR)pvtbl); SetClassLongPtr(tmp, sizeof(void*), (LONG_PTR)app); SetClassLongPtr(tmp, GCLP_WNDPROC, (LONG_PTR)ALF_WindowProc); @@ -580,7 +581,7 @@ HWND ALF_InstantiateWindow(ALFAPP app, LPCTSTR className, HWND hwndParent, void { return CreateWindowEx(0, className, - L"Window", + TEXT("Window"), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, 300, 100, //FIXME @@ -98,13 +98,13 @@ LRESULT ALF_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); HWND -ALF_AddLabel(HWND win, WORD id, UINT x, UINT y, const WCHAR *text); +ALF_AddLabel(HWND win, WORD id, UINT x, UINT y, const TCHAR *text); HWND -ALF_AddEdit(HWND win, WORD id, UINT x, UINT y, const WCHAR *text); +ALF_AddEdit(HWND win, WORD id, UINT x, UINT y, const TCHAR *text); HWND -ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const WCHAR *text); +ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const TCHAR *text); void ALF_SetDefaultButton(HWND win, WORD id); diff --git a/alf/alfbutton.cpp b/alf/alfbutton.cpp index 0723563..c46693e 100644 --- a/alf/alfbutton.cpp +++ b/alf/alfbutton.cpp @@ -71,10 +71,10 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT } HWND -ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const WCHAR *text) +ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const TCHAR *text) { HWND hwndButton = CreateWindowEx(0, - L"BUTTON", + TEXT("BUTTON"), text, WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE, 0, 0, 100, 100, diff --git a/alf/alfedit.cpp b/alf/alfedit.cpp index df902e9..7c247b1 100644 --- a/alf/alfedit.cpp +++ b/alf/alfedit.cpp @@ -52,10 +52,10 @@ ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_P } HWND -ALF_AddEdit(HWND win, WORD id, UINT x, UINT y, const WCHAR *text) +ALF_AddEdit(HWND win, WORD id, UINT x, UINT y, const TCHAR *text) { HWND hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, - L"EDIT", + TEXT("EDIT"), text, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 100, 100, diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp index 7402ecd..283b99a 100644 --- a/alf/alflabel.cpp +++ b/alf/alflabel.cpp @@ -74,9 +74,9 @@ ALF__LabelSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_ } HWND -ALF_AddLabel(HWND win, WORD id, UINT x, UINT y, const WCHAR *text) +ALF_AddLabel(HWND win, WORD id, UINT x, UINT y, const TCHAR *text) { - HWND hwndLabel = CreateWindow(L"STATIC", + HWND hwndLabel = CreateWindow(TEXT("STATIC"), text, WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, 0, 0, 100, 100, diff --git a/makemakefile.sh b/makemakefile.sh index cfeb0b1..f042c89 100755 --- a/makemakefile.sh +++ b/makemakefile.sh @@ -55,3 +55,29 @@ ALF_VC6_OBJECTS=$(for i in $ALF_SOURCES; do printf ' out/%s.obj' "$(basename "$i printf 'clean:\n' printf '\tdel /f out\\*.obj out\\*.exe\n\n' ) > Makefile.vc6 + +# vc6 ANSI makefile +( + printf '# automatically created by makemakefile.sh. DO NOT EDIT!\n' + printf '\n' + printf 'CXX = cl.exe\n' + printf 'CFLAGS = -O2 -GA -W3 -D_WIN32=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -nologo\n' + printf 'LDFLAGS = /link kernel32.lib user32.lib comctl32.lib shell32.lib gdi32.lib version.lib rpcrt4.lib\n' + + printf '\n' + printf 'out/widgetfactory.exe: out/widgetfactory.obj %s\n' "$ALF_VC6_OBJECTS" + printf '\t$(CXX) $(CFLAGS) -Fe$@ $** $(LDFLAGS)\n' + printf '\n' + for i in $ALF_SOURCES; do + printf 'out/%s: %s %s\n' "$(basename "$i" .cpp).obj" "alf/$i" "$(for k in $ALF_HEADERS; do printf ' alf/%s' "$k"; done)" + printf '\t$(CXX) $(CFLAGS) -c -Fo$@ %s\n\n' "alf/$i" + done + + printf 'out/widgetfactory.obj: widgetfactory.cpp alf/alf.h\n' + printf '\t$(CXX) $(CFLAGS) -c -Fo$@ widgetfactory.cpp\n\n' + + + printf 'clean:\n' + printf '\tdel /f out\\*.obj out\\*.exe\n\n' +) > Makefile.vc6-ansi + diff --git a/widgetfactory.cpp b/widgetfactory.cpp index 631326c..6259f17 100644 --- a/widgetfactory.cpp +++ b/widgetfactory.cpp @@ -46,7 +46,12 @@ handleMessage(void *closure, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) } int CALLBACK -wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) +#ifdef UNICODE +wWinMain +#else +WinMain +#endif +(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { (void)hPrevInstance; (void)lpCmdLine; @@ -71,11 +76,11 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCm HWND win = ALF_InstantiateWindow(app, clazz, NULL, NULL); - ALF_AddLabel(win, ID_LBL2, 1, 0, L"Hello, 2!\nblub"); + ALF_AddLabel(win, ID_LBL2, 1, 0, TEXT("Hello, 2!\nblub")); HWND hwndLabel = CreateWindow( - L"STATIC", - L"Hello World!", + TEXT("STATIC"), + TEXT("Hello World!"), WS_CHILD | WS_VISIBLE | SS_LEFT, 0, 0, 50, 25, win, @@ -84,12 +89,12 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCm NULL); ALF_AddWidget(win, 0, 0, hwndLabel, 5000, 1000, ALF_MESSAGEFONT); - ALF_AddLabel(win, ID_LBL3, 0, 1, L"Good Morning my &Angel!"); + ALF_AddLabel(win, ID_LBL3, 0, 1, TEXT("Good Morning my &Angel!")); - ALF_AddEdit(win, ID_ED1, 1, 1, L"Happy Birthday!"); + ALF_AddEdit(win, ID_ED1, 1, 1, TEXT("Happy Birthday!")); - ALF_AddButton(win, ID_B1, 2, 1, L"&Go!"); - ALF_AddButton(win, ID_B2, 0, 2, L"Oh m&y god,\r\nwho the hell cares?"); + ALF_AddButton(win, ID_B1, 2, 1, TEXT("&Go!")); + ALF_AddButton(win, ID_B2, 0, 2, TEXT("Oh m&y god,\r\nwho the hell cares?")); ALF_RecalculateLayout(win); ALF_SetDefaultButton(win, ID_B1); |
