home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / TOOLKIT / CREXX / PMREXX / RHDTATYP.H < prev    next >
C/C++ Source or Header  |  1994-11-17  |  12KB  |  224 lines

  1. /*static char *SCCSID = "@(#)rhdtatyp.h    6.4 92/01/15";                       */
  2. /*********************  START OF SPECIFICATIONS  *******************          */
  3. /*                                                                            */
  4. /*  SOURCE FILE NAME:  rhdtatyp.h                                             */
  5. /*  DESCRIPTIVE NAME:  Structure and macro definitions and function           */
  6. /*                     prototypes for pmrexxio.c                              */
  7. /*                                                                            */
  8. /*  COPYRIGHT:         IBM Corporation 1990                                   */
  9. /*  STATUS:            Version 2.00                                           */
  10. /*                                                                            */
  11. /*  DESCRIPTION AND PURPOSE:                                                  */
  12. /*           This module provides the structure and macro                     */
  13. /*      definitions necessary for compilation of the pmrexxio                 */
  14. /*      modules.                                                              */
  15. /*                                                                            */
  16. /*  EXTERNAL DEPENDENCIES:                                                    */
  17. /*          This assumes that OS2.H has already been included to              */
  18. /*      define the types used.                                                */
  19. /*                                                                            */
  20. /***********************  END OF SPECIFICATIONS  *******************          */
  21.  
  22. #include "pmrexxio.h"
  23.  
  24. /* This needs to be defined early, for rxhdlong.h and filedlg.h               */
  25. /* Maximum supported filename sz                                              */
  26.  
  27. #define  FNAME_SIZE     260
  28.  
  29. /* For Dos call errors, post a message to the client window to let            */
  30. /*  put up a message box with the error information                           */
  31.  
  32. #define  doserrorbox(x,y)  SysErrorBox(pWinData->client, x, y);
  33.  
  34. /* This section defines the constants used in the pmrexx program              */
  35.  
  36. #define  ALLOCSIZE      8192           /* This is the initial allocation size */
  37.                                        /* for the _IMPORT structure           */
  38. #define  MLE_TXT_FMT    MLFIE_CFTEXT   /* This is the format used to import   */
  39.                                        /* text to the MLE                     */
  40. #define  MSGQUEUE_SIZE  2000           /* This is the size for the main       */
  41.                                        /* message queues                      */
  42. #define  SMALL_MQ_SIZE  0              /* And the size for the small queues (0*/
  43.                                        /* = default)                          */
  44. #define  MAXWIDTH       200
  45. #define  ANSLEN         128
  46. #define  PIPE_SIZE      8192           /* Size to use for pipes               */
  47. #define  INHERIT        0x0080         /* Inheritance bit for handles         */
  48. #define  TITLE_SIZE     55             /* Maximum title length                */
  49. #define  BORDER_MARGIN  3              /* Border area around MLE              */
  50. #define  SAVE_WIDTH     225            /* Size of save pulldown               */
  51. #define  TIMER_DELAY    100            /* Length of timer delay               */
  52. #define  ONE_K          1024
  53. #define  RXHD_FONT      260            /* Identified for Font Dialog.         */
  54. #define  ENDLINE        '\r'
  55. #define  END_STR        '\0'
  56. #define  KEY_PRESSED    0x8000         /* For WinGetKeyState                  */
  57. #define  RESOURCE_FLAG  0xffff0000
  58. #define  STD_IN         0              /* Index for standard input            */
  59. #define  TRC_IN         1              /* Index for trace input.              */
  60. #define  STDIN          0              /* Handle for standard input           */
  61. #define  STDOUT         1              /* Handle for standard output          */
  62. #define  STDERR         2              /* Handle for standard error           */
  63. #define  QUERYTHREAD    2              /* For DosGetPrty 2 means thread       */
  64. #define  STACK_SIZE     8196           /* thread stack size                   */
  65. #define  IMPORTSIZE     8196           /* size of import buffer               */
  66. #define  ADD_STDOUTWIN  WM_USER+999
  67. #define  INPUT_LINE     WM_USER+998
  68. #define  RXIOB_MSGBOX   WM_USER+997
  69. #define  START_TIMER    WM_USER+996
  70. #define  PMREXXCLASSNAME "PMREXXIO"
  71. #define  IO_EXIT         "PMREXXIO"
  72. #define  MODULE_NAME     "PMREXXIO"
  73.  
  74. /* Next, define the structures and type definitions.                          */
  75. /* These define a simple set of list structures used for dispersing           */
  76. /*   input lines to the appropriate targets.                                  */
  77.  
  78. typedef struct _LIST_ENTRY {           /* This structure defines a list       */
  79.                                        /* element                             */
  80.     struct _LIST_ENTRY *next;          /* Link to next entry                  */
  81.  
  82.     void *ptr;                         /* Pointer to data structure           */
  83.     ULONG len;                         /* Length of data structure            */
  84. } LIST_ENTRY;
  85.  
  86. typedef LIST_ENTRY *PLIST_ENTRY;
  87.  
  88. typedef struct _LIST {                 /* This structure defines a list to be */
  89.                                        /* a pointer to elements and two       */
  90.                                        /* semaphores for access control       */
  91.     HMTX  q_sem;                       /* Queue manipulation semaphore        */
  92.     HEV   q_data;                      /* Queue data semaphore                */
  93.     PLIST_ENTRY q_1st;                 /* List element pointer                */
  94. } LIST;
  95.  
  96. typedef LIST *PLIST;
  97.  
  98. /* The _IMPORT structure is used to collect multiple lines together           */
  99. /*   for import into the Multi-Line Edit Control window all at one            */
  100. /*   time. This is necessary to keep the performance reasonable if            */
  101. /*   significant amounts of output are being generated all at once.           */
  102.  
  103. typedef struct _IMPORT {
  104.     ULONG total_size;                  /* Total size of the data block        */
  105.     ULONG inuse;                       /* Number of bytes currently in use,   */
  106.                                        /* including the header                */
  107.     HMTX sem;                          /* Semaphore for access control        */
  108.     UCHAR data[1];                     /* Start of the data area              */
  109. } IMPORT;
  110.  
  111. typedef IMPORT *PIMPORT;
  112.  
  113. #define  HDRSIZE        (sizeof(ULONG)*2+sizeof(HMTX))/* Number of header    */
  114.                                        /* bytes in the _IMPORT structure      */
  115.  
  116. /* The _RHWINDATA structure defines an area allocated for each                */
  117. /*   main window to hold parametric data about that window. The               */
  118. /*   structure is allocated at window initialization and a pointer            */
  119. /*   to it is stored with the frame window.                                   */
  120.  
  121. typedef struct _RHWINDATA {
  122.     HAB     hab;                       /* anchor block                        */
  123.     HWND    frame;                     /* Window handle for Frame             */
  124.     HWND    client;                    /* Window handle for Client area       */
  125.     HWND    outmle;                    /* Window handle for MLE               */
  126.     HWND    insle;                     /* Window handle for input field       */
  127.     HWND    HelpInst;                  /* window handle for help instance     */
  128.     HMODULE hResource;                 /* module handle                       */
  129.     HFILE   stdin_r;
  130.     HFILE   stdin_w;
  131.     HFILE   stdout_r;
  132.     HFILE   stdout_w;
  133.     HFILE   stderr_w;
  134.     LIST    pipe_in;                   /* Initialize structure for input queue*/
  135.     LIST    trace_in;                  /* Initialize structure for trace input*/
  136.                                        /* queue                               */
  137.     ULONG   in_type;                   /* Specifies where to get input from   */
  138.     ULONG   in_hgt;                    /* Height for input entry field        */
  139.     LONG    wtitle;                    /* Width of input area title           */
  140.     BOOL    visible;                   /* True if PMREXX is visible           */
  141.     BOOL    trace_inp;                 /* True if input is being traced       */
  142.     BOOL    tracebit;                  /* Indicates if tracing is enabled     */
  143.     BOOL    RxHalt;                    /* True if we are to halt the procedure*/
  144.     BOOL    imp_queued;                /* True if we are to get input from the*/
  145.                                        /* queue                               */
  146.     BOOL    infocus;                   /* Input window has focus flag         */
  147.     BOOL    stopoutpipe;               /* shutdown output pipe                */
  148.     PIMPORT imp_ptr;                   /* Pointer to buffer for data waiting  */
  149.                                        /* to be placed into MLE               */
  150.     PUCHAR  pszInputText;              /* Input field title                   */
  151.     PID     proc_id;                   /* process id of caller                */
  152.     TID     in_tid;                    /* input queue thread id               */
  153.     TID     out_tid;                   /* output queue thread id              */
  154.     TID     rexx_tid;                  /* rexx thread id                      */
  155.     COUNTRYINFO  CountryInfo;          /* county information                  */
  156.     COUNTRYCODE  CountryCode;          /* code page info                      */
  157.     FONTDLG MleFontAttrs;              /* MleFontAttributes                   */
  158.     USHORT  timer;                     /* Time-out timer for import           */
  159.     UCHAR   ImportBuffer[ALLOCSIZE];   /* import buffer                       */
  160.     UCHAR   MleFamilyName[MAXWIDTH];   /* font family name                    */
  161. } RHWINDATA;
  162.  
  163. typedef RHWINDATA *PRHWINDATA;
  164.  
  165. typedef struct _SAVEDWINDOWPOS {
  166.     ULONG  flags;
  167.     SHORT cy;
  168.     SHORT cx;
  169.     SHORT y;
  170.     SHORT x;
  171.     SHORT restorecy;
  172.     SHORT restorecx;
  173.     SHORT restorey;
  174.     SHORT restorex;
  175. } SAVEDWINDOWPOS;
  176.  
  177.  
  178. /* Macros                                                                     */
  179.  
  180. #define  addline(w,l)                                                       \
  181.                          {PUCHAR pcht=(l);                                   \
  182.                         while (!WinPostMsg((w),ADD_STDOUTWIN \
  183.                                ,MPFROMLONG((pcht)) \
  184.                                                                               \
  185.                          ,MPFROMSHORT(strlen((pcht))+1)))DosSleep((ULONG)TIMER_DELAY);}
  186. #define  max(a,b) (((a) > (b)) ? (a) : (b))
  187.  
  188. /*                Function prototype section                                  */
  189.  
  190. MRESULT EXPENTRY MainWndProc(HWND,
  191.                                 ULONG,
  192.                                 MPARAM,
  193.                                 MPARAM);
  194. MRESULT EXPENTRY EntryDlgProc(HWND,
  195.                                 ULONG,
  196.                                 MPARAM,
  197.                                 MPARAM);
  198. RexxExitHandler io_routine;
  199. void    SetOptions(HWND, ULONG ,BOOL);
  200. void    SetCheckMark(HWND, ULONG ,BOOL);
  201.  
  202. PLIST_ENTRY Remove_Q_Element(PLIST);
  203. void    Add_Q_Element(PLIST, PLIST_ENTRY);
  204.  
  205. void    makepipe(PHFILE, HFILE, PHFILE, HFILE, ULONG );
  206. void    setinherit(HFILE, BOOL);
  207. void    stdinpipe(PRHWINDATA);
  208. #pragma linkage(stdinpipe, system)
  209. void    stdoutpipe(PRHWINDATA);
  210. #pragma linkage(stdoutpipe, system)
  211. LONG    initialize(PRHWINDATA);
  212. void    SizeWindow(HWND, PRHWINDATA);
  213. void    ClipBoard(HWND, USHORT, ULONG, PRHWINDATA);
  214. ULONG   RHWinErrorBox(HAB, HWND, HMODULE, ULONG, ULONG );
  215. void    Import(PRHWINDATA);
  216. MRESULT RXIOCmds(HWND, MPARAM, PRHWINDATA);
  217. void    getfixedfont(HWND, PFATTRS);
  218. void    SysErrorBox(HWND, ULONG, PUCHAR);
  219. ULONG   SysErrorBoxM(HWND,ULONG, PSZ, ULONG );
  220. PUCHAR  getstring(HAB, HMODULE, ULONG);
  221. void    SaveWindow(PRHWINDATA);
  222. void    RestoreWindow(HWND, PRHWINDATA);
  223. ULONG   SelectFont(PRHWINDATA);
  224.