=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/win/Attic/winmain.c,v retrieving revision 1.1 retrieving revision 1.1.1.3 diff -u -p -r1.1 -r1.1.1.3 --- OpenXM_contrib/gnuplot/win/Attic/winmain.c 2000/01/09 17:01:19 1.1 +++ OpenXM_contrib/gnuplot/win/Attic/winmain.c 2003/09/15 07:09:40 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: winmain.c,v 1.1 2000/01/09 17:01:19 maekawa Exp $"; +static char *RCSid = "$Id: winmain.c,v 1.1.1.3 2003/09/15 07:09:40 ohara Exp $"; #endif /* GNUPLOT - win/winmain.c */ @@ -95,9 +95,9 @@ LPSTR szMenuName; #define HELPFILE "wgnuplot.hlp" #endif -extern char version[]; -extern char patchlevel[]; -extern char date[]; +extern char gnuplot_version[]; +extern char gnuplot_patchlevel[]; +extern char gnuplot_date[]; /*extern char *authors[];*/ char *authors[]={ "Colin Kelly", @@ -146,7 +146,13 @@ WinExit(void) int CALLBACK WINEXPORT ShutDown(void) { +#if 0 /* HBB 19990505: try to avoid crash on clicking 'close' */ + /* Problem was that WinExit was called *twice*, once directly, + * and again via 'atexit'. This caused problems by double-freeing + * of GlobalAlloc-ed memory inside TextClose() */ + /* Caveat: relies on atexit() working properly */ WinExit(); +#endif exit(0); return 0; } @@ -158,13 +164,18 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPre LPSTR tail; #ifdef __MSC__ /* MSC doesn't give us _argc and _argv[] so ... */ -#define MAXCMDTOKENS 128 +# ifdef WIN32 /* WIN32 has __argc and __argv */ +# define _argv __argv +# define _argc __argc +# else +# define MAXCMDTOKENS 128 int _argc=0; LPSTR _argv[MAXCMDTOKENS]; _argv[_argc] = "wgnuplot.exe"; _argv[++_argc] = _fstrtok( lpszCmdLine, " "); while (_argv[_argc] != NULL) _argv[++_argc] = _fstrtok( NULL, " "); +# endif /* WIN32 */ #endif /* __MSC__ */ szModuleName = (LPSTR)farmalloc(MAXSTR+1); @@ -213,7 +224,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPre textwin.AboutText = (LPSTR)farmalloc(1024); CheckMemory(textwin.AboutText); sprintf(textwin.AboutText,"Version %s\nPatchlevel %s\nLast Modified %s\n%s\n%s, %s and many others", - version, patchlevel, date, gnuplot_copyright, authors[1], authors[0]); + gnuplot_version, gnuplot_patchlevel, gnuplot_date, + gnuplot_copyright, authors[1], authors[0]); textwin.AboutText = (LPSTR)farrealloc(textwin.AboutText, _fstrlen(textwin.AboutText)+1); CheckMemory(textwin.AboutText); @@ -448,8 +460,6 @@ size_t MyFRead(void *ptr, size_t size, size_t n, FILE #define MAX_PRT_LEN 256 static char win_prntmp[MAX_PRT_LEN+1]; -extern GW graphwin; - FILE * open_printer() {