2 static char *RCSid() { return RCSid("$Id: wgnuplib.c,v 1.6 2004/07/01 17:10:10 broeker Exp $"); }
5 /* GNUPLOT - win/wgnuplib.c */
7 * Copyright 1992, 1993, 1998, 2004 Russell Lang
9 * Permission to use, copy, and distribute this software and its
10 * documentation for any purpose with or without fee is hereby granted,
11 * provided that the above copyright notice appear in all copies and
12 * that both that copyright notice and this permission notice appear
13 * in supporting documentation.
15 * Permission to modify the software is granted, but not the right to
16 * distribute the complete modified source code. Modifications are to
17 * be distributed as patches to the released version. Permission to
18 * distribute binaries produced by compiling modified sources is granted,
20 * 1. distribute the corresponding source modifications from the
21 * released version in the form of a patch file along with the binaries,
22 * 2. add special version identification to distinguish your version
23 * in addition to the base release version number,
24 * 3. provide your name and address as the primary contact for the
25 * support of your modified version, and
26 * 4. retain our contact information in regard to use of the base
28 * Permission to distribute the released version of the source code along
29 * with corresponding source modifications in the form of a patch file is
30 * granted with same provisions 2 through 4 for binary distributions.
32 * This software is provided "as is" without express or implied warranty
33 * to the extent permitted by applicable law.
50 HINSTANCE hdllInstance;
51 LPSTR szParentClass = "wgnuplot_parent";
52 LPSTR szTextClass = "wgnuplot_text";
53 LPSTR szPauseClass = "wgnuplot_pause";
54 LPSTR szGraphClass = "wgnuplot_graph";
62 struct WID *widptr = NULL;
63 unsigned int nwid = 0;
68 LibMain(HINSTANCE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine)
70 hdllInstance = hInstance;
81 CheckWGNUPLOTVersion(LPSTR str)
85 version = WGNUPLOTVERSION;
86 if (lstrcmp(str,version)) {
87 wsprintf(mess,"Incorrect DLL version\nExpected version %s\nThis is version %s",str,version);
88 MessageBox(NULL, mess , "WGNUPLOT.DLL", MB_OK | MB_ICONSTOP | MB_TASKMODAL);
91 return FALSE; /* Correct version */
96 LocalAllocPtr(UINT flags, UINT size)
99 hlocal = LocalAlloc(flags, size+1);
100 return (char *)LocalLock(hlocal);
104 LocalReAllocPtr(void NEAR * ptr, UINT flags, UINT size)
107 hlocal = LocalHandle(ptr);
109 hlocal = LocalReAlloc(hlocal, size+1, flags);
110 return (char *)LocalLock(hlocal);
114 LocalFreePtr(void NEAR *ptr)
117 hlocal = LocalHandle(ptr);
126 * A pointer to character past int if successful,
127 * otherwise NULL on failure.
128 * convert int is stored at pval.
131 GetInt(LPSTR str, LPINT pval)
134 BOOL negative = FALSE;
135 BOOL success = FALSE;
140 while ( (ch = *str)!=0 && isspace(ch) )
147 while ( (ch = *str)!=0 && isdigit(ch) ) {
149 val = val * 10 + (ch - '0');