--- mstools/samples/rpc/mandel/mandel.h 2018/08/09 18:20:01 1.1 +++ mstools/samples/rpc/mandel/mandel.h 2018/08/09 18:24:15 1.1.1.4 @@ -2,59 +2,75 @@ MANDEL.H -- Constants and function definitions for MANDEL.C - Copyright (C) 1990 Microsoft Corporation. + Copyright (C) 1990, 1992 Microsoft Corporation ****************************************************************************/ -#define IDM_ABOUT 100 -#define IDM_ZOOMIN 101 -#define IDM_ZOOMOUT 105 -#define IDM_TOP 106 -#define IDM_REDRAW 107 -#define IDM_EXIT 108 -#define IDM_CONTINUOUS 109 +/* Constants */ +#ifdef WIN16 +#define APIENTRY PASCAL +#define UNREFERENCED_PARAMETER +#endif + +#define IDM_ABOUT 100 +#define IDM_ZOOMIN 101 +#define IDM_ZOOMOUT 105 +#define IDM_TOP 106 +#define IDM_REDRAW 107 +#define IDM_EXIT 108 +#define IDM_CONTINUOUS 109 +#define IDM_SERVER 110 +#define IDD_SERVERNAME 111 +#define IDD_ENDPOINT 112 +#define IDM_BIND 113 #define IDM_1LINE 200 #define IDM_2LINES 201 #define IDM_4LINES 202 -#define IDM_8LINES 203 -#define IDM_16LINES 204 -#define IDM_32LINES 205 - -#define ID_OK 304 - -#define WM_DOSOMEWORK (WM_USER+0) -#define WM_PAINTLINE (WM_USER+1) - -#define LBID_SERVERS 102 #define WIDTH 300 #define HEIGHT 300 +#define LINES 4 +#define BUFSIZE 1200 // (HEIGHT * LINES) +#define MAX_BUFSIZE 4800 // (BUFSIZE * sizeof(short)) -#define MAXLINES 32 +#define POLL_TIME 100 -#ifndef MAXPATHLEN -#define MAXPATHLEN 260 -#endif +#define CNLEN 15 // computer name length +#define UNCLEN CNLEN+2 // \\computername +#define MSGLEN 256 -#define MAXID 64 // saved zoomin operations +#define NCOLORS 11 -#define MAX_BUFSIZE (HEIGHT * sizeof(long) * MAXLINES) +#define SVR_TABLE_SZ 20 + +// Status of connection to server +#define SS_DISCONN 0 +#define SS_IDLE 1 +#define SS_READPENDING 2 +#define SS_PAINTING 3 +#define SS_LOCAL 4 + +#define MINPREC 5.0E-9 +#define MAXPREC 5.0E-3 + +#define WM_DOSOMEWORK (WM_USER+0) +#define WM_PAINTLINE (WM_USER+1) +#define WM_EXCEPTION (WM_USER+2) -extern int iLines; +/* Data Structures */ -// A table of servers we know about typedef struct _svr_table { - char name[16+1]; // name of remote server - int hfPipe; // RPC handle - int iStatus; // status of connection - int cPicture; // picture id for this line - DWORD dwLine; // line we're drawing - int cLines; // lines in this chunk + char name[UNCLEN]; // name of remote server + int hfPipe; // RPC handle + int iStatus; // status of connection + int cPicture; // picture id for this line + DWORD dwLine; // line we're drawing + int cLines; // lines in this chunk } svr_table; -// if RPC, this data is defined within the IDL file -#ifndef RPC +#ifndef RPC // If RPC, the following data would be + // defined in the IDL file typedef struct _cpoint { double real; double imag; @@ -62,7 +78,7 @@ typedef struct _cpoint { typedef CPOINT * PCPOINT; -typedef struct _LONGRECT { /* rcl */ +typedef struct _LONGRECT { long xLeft; long yBottom; long xRight; @@ -71,104 +87,59 @@ typedef struct _LONGRECT { /* rcl */ typedef LONGRECT *PLONGRECT; -typedef struct _LINEBUF { - WORD adw[MAX_BUFSIZE]; -} LINEBUF; +typedef unsigned short LINEBUF[BUFSIZE]; -typedef LINEBUF * PLINEBUF; #endif -extern svr_table SvrTable[]; // the table -extern int SvrTableSz; // # of objects in it -extern int cPictureID; // current picture; index to table +typedef struct _calcbuf { + LONGRECT rclDraw; + double dblPrecision; + DWORD dwThreshold; + CPOINT cptLL; +} CALCBUF; + + +/* Function Prototypes */ -extern RECT rcHistory[]; -int APIENTRY WinMain(HANDLE, HANDLE, LPSTR, int); +int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int); BOOL InitApplication(HANDLE); BOOL InitInstance(HANDLE, int); + LONG APIENTRY MainWndProc(HWND, UINT, UINT, LONG); BOOL APIENTRY About(HWND, UINT, UINT, LONG); -BOOL APIENTRY SaveAsDlgProc(HWND, UINT, UINT, LONG); -void DoSomeWork(HWND, BOOL); -void IncPictureID(void); - -void InitHistogram(void); -void CountHistogram(void); -void CalcHistogram(int x, - int y, - DWORD dwIter, - DWORD dwThreshold); -#define NCOLORS 11 - -extern int fContinueZoom; -extern int fZoomIn; -extern int iHistMaxI; -extern int iHistMaxJ; -extern int Histogram[4][4][NCOLORS+1]; -extern int ColorCount[4][4]; -extern BOOL fRectDefined; - -extern char pszFail[]; - -BOOL InitRemote( HWND ); -void PollForServers( void ); -void CheckPoll( void ); -BOOL CheckDrawStatus( HWND); -void RetryConnections( void ); -void SetNewCalc( CPOINT cptUL, double dPrecision, RECT rcl); -BOOL CheckDrawingID( int ); - -extern BOOL fLocalWork; -extern BOOL fRemoteWork; +BOOL APIENTRY Server(HWND, UINT, UINT, LONG); +BOOL APIENTRY Exception(HWND, UINT, UINT, LONG); +#ifdef RPC +RPC_STATUS Bind(HWND); +#endif -// Status of connection to server +void CountHistogram(void); -#define SS_DISCONN 0 -#define SS_IDLE 1 -#define SS_READPENDING 2 -#define SS_PAINTING 3 -#define SS_LOCAL 4 - - -// Buffer routines - -BOOL TakeDrawBuffer( void ); -PDWORD GetDrawBuffer( void ); -void FreeDrawBuffer( void ); -void ReturnDrawBuffer( void ); -DWORD QueryThreshold( void ); - -int GetServerCount( void ); -void GetServerName( int, char *); - - -extern RECT rcZoom; -extern double dPrec; - -#define MINPREC 5.0E-9 -#define MAXPREC 5.0E-3 - -// if RPC version, this routine is defined within the IDL file -#ifndef RPC -void MandelCalc( PCPOINT pcptLL, - PLONGRECT prcDraw, - double precision, - DWORD ulThreshold, - PLINEBUF pbBuf); +BOOL InitRemote(HWND); +BOOL CheckDrawStatus(HWND); +void SetNewCalc(CPOINT, double, RECT); +void IncPictureID(void); +void ResetPictureID(void); +BOOL CheckDrawingID(int); +DWORD QueryThreshold(void); + +// buffer routines +BOOL TakeDrawBuffer(void); +LPVOID LockDrawBuffer(void); +void UnlockDrawBuffer(void); +void ReturnDrawBuffer(void); +void FreeDrawBuffer(void); + + +#ifndef RPC // If RPC, MandelCalc() would be + // defined in the IDL file +void MandelCalc(PCPOINT pcptLL, + PLONGRECT prcDraw, + double precision, + DWORD ulThreshold, + LINEBUF * pbBuf); #endif -typedef struct _calcbuf { - LONGRECT rclDraw; - double dblPrecision; - DWORD dwThreshold; - CPOINT cptLL; -} CALCBUF; -short calcmand(double dreal, double dimag, short maxit); -typedef struct _mults { - double rs; /* real squared */ - double is; /* imag squared */ - double ri; /* real * imaginary */ -} mults;