summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl E. Thompson <devel-fltk@carlthompson.net>1999-03-29 17:39:46 +0000
committerCarl E. Thompson <devel-fltk@carlthompson.net>1999-03-29 17:39:46 +0000
commit81c7d9b2156da7495668132a96e63e994be0d19d (patch)
tree7e1c3dc9dbc0fd7cde40759301bb7bf99483a10c /src
parent617a7ee619493a1b07df49058509922bae48f559 (diff)
Changes needed to get FLTK to compile on Borland C++ 5 under Windows. I
compiled this on BC++ 5.0 upgraded to 5.0B via the two monster patches. I didn't turn on optimization because my version of BC++ doesn't seem to do much in the way of optimization (FLUID was only 1k smaller when optimized for size). VC++ generates smaller code. The examples that use OpenGL don't work because Borland's linker can't find "wglShareLists". I'm sure this is a simple problem, but I don't know how to fix it. Borland's C++ compiler won't allow you to call main() from C++, so I had to add a c function in "fl_call_main.c" to call it so that you don't have to do that WinMain crap. However, when I added this file to the Visual C++ project it converted the whole thing from 5.0 format to 6.0 format. The files look the nearly identical so I don't think this should be a problem for 5.0 users, but if it is then you can revert them back to the previous version and just add this one source file. Borland really doesn't suck that bad. It doesn't look as polished as VC++ and it refused to supress some warnings for no reason, but I forgot how much I liked the feel of Borlands compilers... Much more intuitive then MS VC++. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@475 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx40
-rw-r--r--src/Makefile6
-rw-r--r--src/fl_call_main.c40
-rw-r--r--src/vsnprintf.c19
4 files changed, 67 insertions, 38 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index bb7e1b415..81d57c0ba 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_win32.cxx,v 1.33.2.2 1999/03/25 13:32:52 mike Exp $"
+// "$Id: Fl_win32.cxx,v 1.33.2.3 1999/03/29 17:39:28 carl Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -335,7 +335,7 @@ extern HPALETTE fl_select_palette(void); // in fl_color_win32.C
static Fl_Window* resize_bug_fix;
-static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static char buffer[2];
static int cnt=0;
@@ -344,7 +344,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
if(cnt) {
InvalidateRect(fl_window,0,FALSE);
cnt = 0;
- } else cnt = 1;
+ } else cnt = 1;
} else if (uMsg == WM_PAINT) cnt = 0;
fl_msg.message = uMsg;
@@ -362,12 +362,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
return 0;
case WM_PAINT: {
-
+
// This might be a better alternative, where we fully ignore NT's
// "facilities" for painting. MS expects applications to paint according
// to a very restrictive paradigm, and this is the way I found of
// working around it. In a sense, we are using WM_PAINT simply as an
- // "exposure alert", like the X event.
+ // "exposure alert", like the X event.
Fl_X *i = Fl_X::i(window);
i->wait_for_expose = 0;
@@ -501,7 +501,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
fl_GetDC(hWnd);
if (fl_select_palette()) InvalidateRect(hWnd, NULL, FALSE);
break;
-
+
case WM_PALETTECHANGED:
fl_GetDC(hWnd);
if ((HWND)wParam != hWnd && fl_select_palette()) UpdateColors(fl_gc);
@@ -526,7 +526,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
////////////////////////////////////////////////////////////////
// This function gets the dimensions of the top/left borders and
// the title bar, if there is one, based on the FL_BORDER, FL_MODAL
-// and FL_NONMODAL flags, and on the window's size range.
+// and FL_NONMODAL flags, and on the window's size range.
// It returns the following values:
//
// value | border | title bar
@@ -547,7 +547,7 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by)
bx = GetSystemMetrics(SM_CXFIXEDFRAME);
by = GetSystemMetrics(SM_CYFIXEDFRAME);
}
- bt = GetSystemMetrics(SM_CYCAPTION);
+ bt = GetSystemMetrics(SM_CYCAPTION);
}
//The coordinates of the whole window, including non-client area
xoff = bx;
@@ -626,7 +626,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
WNDCLASSEX wc;
// Documentation states a device context consumes about 800 bytes
- // of memory... so who cares? If 800 bytes per window is what it
+ // of memory... so who cares? If 800 bytes per window is what it
// takes to speed things up, I'm game.
//wc.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC | CS_DBLCLKS;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
@@ -730,7 +730,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
w->redraw(); // force draw to happen
// If we've captured the mouse, we dont want do activate any
// other windows from the code, or we loose the capture.
- ShowWindow(x->xid, fl_show_iconic ? SW_SHOWMINNOACTIVE :
+ ShowWindow(x->xid, fl_show_iconic ? SW_SHOWMINNOACTIVE :
fl_capture? SW_SHOWNOACTIVATE : SW_SHOWNORMAL);
fl_show_iconic = 0;
fl_fix_focus();
@@ -763,17 +763,7 @@ HINSTANCE fl_display = 0;
#ifndef FL_DLL
-extern "C" {
-#ifdef BORLAND
-extern int _argc;
-extern char **_argv;
-extern FL_EXPORT int OwlMain(int, char *[]);
-#else
-extern int __argc;
-extern char **__argv;
-extern FL_EXPORT int main(int, char *[]);
-#endif
-};
+extern "C" int fl_call_main();
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
@@ -796,11 +786,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#endif // _DEBUG
// Run the standard main entry point function...
-#ifdef BORLAND
- return OwlMain(_argc, _argv);
-#else
- return main(__argc, __argv);
-#endif
+ return fl_call_main();
}
#endif /* !FL_DLL */
@@ -919,5 +905,5 @@ void Fl_Window::make_current() {
}
//
-// End of "$Id: Fl_win32.cxx,v 1.33.2.2 1999/03/25 13:32:52 mike Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.33.2.3 1999/03/29 17:39:28 carl Exp $".
//
diff --git a/src/Makefile b/src/Makefile
index 800211dba..df005933c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile,v 1.18.2.6 1999/03/26 12:46:25 mike Exp $"
+# "$Id: Makefile,v 1.18.2.7 1999/03/29 17:39:28 carl Exp $"
#
# Library makefile for the Fast Light Tool Kit (FLTK).
#
@@ -138,7 +138,7 @@ CPPFILES = \
glut_compatability.cxx \
glut_font.cxx
-CFILES = scandir.c numericsort.c vsnprintf.c
+CFILES = fl_call_main.c scandir.c numericsort.c vsnprintf.c
CLEAN =
@@ -209,5 +209,5 @@ install: $(LIBRARY) $(DSONAME)
@-ln -s FL $(includedir)/Fl
#
-# End of "$Id: Makefile,v 1.18.2.6 1999/03/26 12:46:25 mike Exp $".
+# End of "$Id: Makefile,v 1.18.2.7 1999/03/29 17:39:28 carl Exp $".
#
diff --git a/src/fl_call_main.c b/src/fl_call_main.c
new file mode 100644
index 000000000..ee4c8c73d
--- /dev/null
+++ b/src/fl_call_main.c
@@ -0,0 +1,40 @@
+/*
+ * "$Id: fl_call_main.c,v 1.1.2.1 1999/03/29 17:39:29 carl Exp $"
+ *
+ * Copyright 1998-1999 by Bill Spitzak and others.
+ *
+ * fl_call_main() calls main() for you Windows people. Needs to be done in C
+ * because Borland C++ won't let you call main() from C++.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems to "fltk-bugs@easysw.com".
+ */
+
+#if defined(WIN32) && !defined(FL_DLL)
+extern int main(int, char *[]);
+extern int __argc;
+extern char **__argv;
+
+int fl_call_main() {
+ return main(__argc, __argv);
+}
+#endif
+
+/*
+ * End of "$Id: fl_call_main.c,v 1.1.2.1 1999/03/29 17:39:29 carl Exp $".
+ */
+
diff --git a/src/vsnprintf.c b/src/vsnprintf.c
index d3a89c040..b2996dcd9 100644
--- a/src/vsnprintf.c
+++ b/src/vsnprintf.c
@@ -1,5 +1,5 @@
/*
- * "$Id: vsnprintf.c,v 1.3 1999/01/07 19:17:47 mike Exp $"
+ * "$Id: vsnprintf.c,v 1.3.2.1 1999/03/29 17:39:29 carl Exp $"
*
* vsnprintf() function for the Fast Light Tool Kit (FLTK).
*
@@ -43,9 +43,10 @@
#if !HAVE_VSNPRINTF
-# ifdef __cplusplus
-extern "C"
-# endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
const char* e = str+size-1;
char* p = str;
@@ -114,9 +115,6 @@ int vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
#if !HAVE_SNPRINTF
-# ifdef __cplusplus
-extern "C"
-# endif
int snprintf(char* str, size_t size, const char* fmt, ...) {
int ret;
va_list ap;
@@ -126,8 +124,13 @@ int snprintf(char* str, size_t size, const char* fmt, ...) {
return ret;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
/*
- * End of "$Id: vsnprintf.c,v 1.3 1999/01/07 19:17:47 mike Exp $".
+ * End of "$Id: vsnprintf.c,v 1.3.2.1 1999/03/29 17:39:29 carl Exp $".
*/
+