Annotation of os232sdk/toolkt20/c/samples/hanoi/hanoi.h, revision 1.1

1.1     ! root        1: /* This header file does all the necessary includes and defines all the
        !             2:    structures and constants needed for the hanoi program                 */
        !             3: 
        !             4: #define INCL_WIN
        !             5: #define INCL_WINHEAP
        !             6: #define INCL_WINDIALOGS
        !             7: #define INCL_GPIPRIMITIVES
        !             8: #define INCL_DOSPROCESS
        !             9: 
        !            10: 
        !            11: #include <os2.h>
        !            12: #include <stdio.h>
        !            13: #include <string.h>
        !            14: #include <stdlib.h>
        !            15: 
        !            16: /* This structure is passed into the recursive Hanoi() procedure and contains
        !            17:    the current window handle as well as a flag indicating the current
        !            18:    processing status.  If the fContinueCalc flag becomes FALSE, that
        !            19:    indicates that the user has selected stop from the menu bar and that
        !            20:    the procedure should exit the recursive process and terminate. */
        !            21: 
        !            22: 
        !            23: MRESULT EXPENTRY ClientWndProc  (HWND, USHORT, MPARAM, MPARAM);
        !            24: MRESULT EXPENTRY EntryFldDlgProc(HWND, USHORT, MPARAM, MPARAM);
        !            25: MRESULT EXPENTRY AboutDlgProc(HWND, USHORT, MPARAM, MPARAM);
        !            26: VOID CalcThread(VOID);
        !            27: VOID DrawDisk(HPS,BYTE,BYTE,BYTE);
        !            28: VOID MoveDisk(HPS,BYTE,BYTE);
        !            29: VOID Hanoi(BYTE, BYTE, BYTE, BYTE);
        !            30: VOID EnableMenuItem(HWND hwnd, SHORT sMenuItem, BOOL fEnable);
        !            31: VOID SetupTowers(VOID);
        !            32: 
        !            33: 
        !            34: #define MAXDISKCNT         16    /* Maximum # of disks allowable */
        !            35: #define BASEXOFFSET        10    /* X offset for platform base   */
        !            36: #define BASEYOFFSET        10    /* Y offset for platform base   */
        !            37: #define BASETHICK          10    /* Base thickness               */
        !            38: #define BASELEN           300    /* Base width                   */
        !            39: #define POSTOFFSET         62    /* First post offset from edge  */
        !            40: #define POSTSPACE         100    /* Distance between posts       */
        !            41: #define POSTWIDTH           5    /* Width of each post           */
        !            42: #define POSTHALF            2    /* 1/2 width for centering      */
        !            43: #define POSTEXTRAHT        25    /* Post height above top disk   */
        !            44: #define DISKTHICK           3    /* Thickness of each disk       */
        !            45: #define DISKSPACE         (DISKTHICK+1)     /* Thickness + space */
        !            46: #define MINDISKWIDTH       11    /* Width of the smallest disk   */
        !            47: #define MAXDISKWIDTH       91    /* Width of the thickest disk   */
        !            48: #define BOTDISKYPOS        (BASEYOFFSET+BASETHICK+DISKSPACE-DISKTHICK)
        !            49: #define STACK            8192    /* Stack size for thread        */
        !            50: #define fDRAW               1    /* Indicate draw to DrawDisk()  */
        !            51: #define fERASE              0    /* Indicate erase               */
        !            52: 
        !            53: #define DEFAULTSIZE         5    /* Default number of disks      */
        !            54: #define MSGBUFSIZE         25    /* Space needed for sprintf msg */
        !            55: 
        !            56: /****** Resource IDs *****/
        !            57: 
        !            58: 
        !            59: #define ID_RESOURCE    1
        !            60: #define IDM_START      2
        !            61: #define IDM_STOP       3
        !            62: #define IDM_SET        4
        !            63: #define IDM_ABOUT      5
        !            64: #define ID_SETCOUNT    6
        !            65: #define ID_ENTRYFLD    7
        !            66: #define ID_MSGBOX      8
        !            67: #define IDD_ABOUTBOX   9
        !            68: #define UM_CALC_DONE   (WM_USER+0) /* Message posted when thread terminates */
        !            69: 
        !            70: 
        !            71: 
        !            72: /* Macro for drawing a rectangle.  Assumes hps and ptl structs are defined
        !            73:    in the calling module. */
        !            74: 
        !            75: #define DrawRect(x1,y1,x2,y2,color)  ptl.x = (LONG) (x1);             \
        !            76:                                      ptl.y = (LONG) (y1);             \
        !            77:                                      GpiSetCurrentPosition(hps,&ptl); \
        !            78:                                      ptl.x = (LONG) (x2);             \
        !            79:                                      ptl.y = (LONG) (y2);             \
        !            80:                                      GpiSetColor(hps,color);          \
        !            81:                                      GpiBox(hps,DRO_FILL,&ptl,0L,0L);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.