[BACK]Return to wgnuplib.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / win

Annotation of OpenXM_contrib/gnuplot/win/wgnuplib.c, Revision 1.1

1.1     ! maekawa     1: #ifndef lint
        !             2: static char *RCSid = "$Id: wgnuplib.c,v 1.5 1998/03/22 22:35:27 drd Exp $";
        !             3: #endif
        !             4:
        !             5: /* GNUPLOT - win/wgnuplib.c */
        !             6: /*[
        !             7:  * Copyright 1992, 1993, 1998   Russell Lang
        !             8:  *
        !             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.
        !            14:  *
        !            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,
        !            19:  * provided you
        !            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
        !            27:  *    software.
        !            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.
        !            31:  *
        !            32:  * This software is provided "as is" without express or implied warranty
        !            33:  * to the extent permitted by applicable law.
        !            34: ]*/
        !            35:
        !            36: /*
        !            37:  * AUTHORS
        !            38:  *
        !            39:  *   Russell Lang
        !            40:  *
        !            41:  * Send your comments or suggestions to
        !            42:  *  info-gnuplot@dartmouth.edu.
        !            43:  * This is a mailing list; to join it send a note to
        !            44:  *  majordomo@dartmouth.edu.
        !            45:  * Send bug reports to
        !            46:  *  bug-gnuplot@dartmouth.edu.
        !            47:  */
        !            48:
        !            49: #define STRICT
        !            50: #include <ctype.h>
        !            51: #include <windows.h>
        !            52: #include <windowsx.h>
        !            53: #include "wgnuplib.h"
        !            54: #include "wresourc.h"
        !            55: #include "wcommon.h"
        !            56:
        !            57: HINSTANCE hdllInstance;
        !            58: LPSTR szParentClass = "wgnuplot_parent";
        !            59: LPSTR szTextClass = "wgnuplot_text";
        !            60: LPSTR szPauseClass = "wgnuplot_pause";
        !            61: LPSTR szGraphClass = "wgnuplot_graph";
        !            62:
        !            63: /* Window ID */
        !            64: struct WID {
        !            65:        BOOL       used;
        !            66:        HWND       hwnd;
        !            67:        void FAR * ptr;
        !            68: };
        !            69: struct WID *widptr = NULL;
        !            70: unsigned int nwid = 0;
        !            71: HLOCAL hwid = 0;
        !            72:
        !            73: #ifdef __DLL__
        !            74: int WDPROC
        !            75: LibMain(HINSTANCE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine)
        !            76: {
        !            77:        hdllInstance = hInstance;
        !            78:        return 1;
        !            79: }
        !            80:
        !            81: int WDPROC
        !            82: WEP(int nParam)
        !            83: {
        !            84:        return 1;
        !            85: }
        !            86:
        !            87: BOOL WDPROC
        !            88: CheckWGNUPLOTVersion(LPSTR str)
        !            89: {
        !            90: char mess[256];
        !            91: LPSTR version;
        !            92:        version = WGNUPLOTVERSION;
        !            93:        if (lstrcmp(str,version)) {
        !            94:                wsprintf(mess,"Incorrect DLL version\nExpected version   %s\nThis is version   %s",str,version);
        !            95:                MessageBox(NULL, mess , "WGNUPLOT.DLL", MB_OK | MB_ICONSTOP | MB_TASKMODAL);
        !            96:                return TRUE;
        !            97:        }
        !            98:        return FALSE;   /* Correct version */
        !            99: }
        !           100: #endif /* __DLL__ */
        !           101:
        !           102: void NEAR *
        !           103: LocalAllocPtr(UINT flags, UINT size)
        !           104: {
        !           105: HLOCAL hlocal;
        !           106:        hlocal = LocalAlloc(flags, size+1);
        !           107:        return (char *)LocalLock(hlocal);
        !           108: }
        !           109:
        !           110: void
        !           111: LocalFreePtr(void NEAR *ptr)
        !           112: {
        !           113: HLOCAL hlocal;
        !           114:        hlocal = LocalHandle(ptr);
        !           115:        LocalUnlock(hlocal);
        !           116:        LocalFree(hlocal);
        !           117:        return;
        !           118: }
        !           119:
        !           120:
        !           121: /* ascii to int */
        !           122: /* returns:
        !           123:  *  A pointer to character past int if successful,
        !           124:  *  otherwise NULL on failure.
        !           125:  *  convert int is stored at pval.
        !           126:  */
        !           127: LPSTR
        !           128: GetInt(LPSTR str, LPINT pval)
        !           129: {
        !           130: int val = 0;
        !           131: BOOL negative = FALSE;
        !           132: BOOL success = FALSE;
        !           133: int ch;
        !           134:        if (!str)
        !           135:                return NULL;
        !           136:        while ( (ch = *str)!=0 && isspace(ch) )
        !           137:                str++;
        !           138:        if (ch == '-') {
        !           139:                negative = TRUE;
        !           140:                str++;
        !           141:        }
        !           142:        while ( (ch = *str)!=0 && isdigit(ch) ) {
        !           143:                success = TRUE;
        !           144:                val = val * 10 + (ch - '0');
        !           145:                str++;
        !           146:        }
        !           147:        if (success) {
        !           148:                if (negative)
        !           149:                        val = -val;
        !           150:                *pval = val;
        !           151:                return str;
        !           152:        }
        !           153:        return NULL;
        !           154: }
        !           155:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>