home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / snados.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  4.6 KB  |  178 lines

  1. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  2. /****************************** Module Header ******************************\
  3. *
  4. * Module Name: SNADOS.H
  5. *
  6. * Description: Microsoft SNA Server MSDOS specific 3270 Emulator Interface
  7. *              definitions.
  8. *
  9. * Copyright (c) 1994, Microsoft Corporation.  All rights reserved.
  10. *
  11. \***************************************************************************/
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. /* Common definitions */
  18.  
  19. #define PASCAL    pascal
  20. #define FAR        far
  21. #define NEAR    near
  22. #define VOID    void
  23.  
  24. #define APIENTRY far pascal
  25. #ifndef WINAPI
  26. #define WINAPI APIENTRY
  27. #endif
  28.  
  29. #define CHAR    char        /* ch  */
  30. #define SHORT    short        /* s   */
  31. #define LONG    long        /* l   */
  32. #define INT        int            /* i   */
  33.  
  34. typedef unsigned char UCHAR;    /* uch */
  35. typedef unsigned short USHORT;    /* us  */
  36. typedef unsigned long ULONG;    /* ul  */
  37. typedef unsigned int  UINT;        /* ui  */
  38. typedef unsigned char BYTE;        /* b   */
  39.  
  40. typedef unsigned short SHANDLE;
  41.  
  42.  
  43. /* define NULL pointer value */
  44. /* Echo the format of the ifdefs that stdio.h uses */
  45.  
  46. #if (_MSC_VER >= 600)
  47. #define NULL    ((void *)0)
  48. #else
  49. #if (defined(M_I86L) || defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  50. #define  NULL     0L
  51. #else
  52. #define  NULL     0
  53. #endif
  54. #endif
  55.  
  56. typedef SHANDLE HFILE;        /* hf */
  57. typedef HFILE far *PHFILE;
  58.  
  59. typedef unsigned char far  *PSZ;
  60. typedef unsigned char near *NPSZ;
  61. typedef char far *LPSTR;
  62.  
  63. typedef unsigned char far  *PCH;
  64. typedef unsigned char near *NPCH;
  65.  
  66. typedef int   (pascal far  *PFN)();
  67. typedef int   (pascal near *NPFN)();
  68. typedef PFN far *PPFN;
  69.  
  70. typedef BYTE   FAR  *PBYTE;
  71. typedef BYTE   near *NPBYTE;
  72.  
  73. typedef CHAR   FAR *PCHAR;
  74. typedef SHORT  FAR *PSHORT;
  75. typedef LONG   FAR *PLONG;
  76. typedef INT    FAR *PINT;
  77.  
  78. typedef UCHAR  FAR *PUCHAR;
  79. typedef USHORT FAR *PUSHORT;
  80. typedef ULONG  FAR *PULONG;
  81. typedef UINT   FAR *PUINT;
  82. typedef VOID   FAR *PVOID;
  83.  
  84. typedef unsigned short BOOL;    /* f   */
  85. typedef BOOL FAR *PBOOL;
  86.  
  87. #ifndef TRUE
  88. #define TRUE    1
  89. #endif
  90.  
  91. #ifndef FALSE
  92. #define FALSE   0
  93. #endif
  94.  
  95. typedef unsigned short SEL;        /* sel */
  96. typedef SEL FAR *PSEL;
  97.  
  98. /*** Useful Helper Macros */
  99.  
  100. /* Create untyped far pointer from selector and offset */
  101. #define MAKEP(sel, off)     ((PVOID)MAKEULONG(off, sel))
  102.  
  103. /* Extract selector or offset from far pointer */
  104. #define SELECTOROF(p)        (((PUSHORT)&(p))[1])
  105. #define OFFSETOF(p)        (((PUSHORT)&(p))[0])
  106.  
  107.  
  108. /* Cast any variable to an instance of the specified type. */
  109. #define MAKETYPE(v, type)    (*((type far *)&v))
  110.  
  111. /* Calculate the byte offset of a field in a structure of type type. */
  112. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  113.  
  114. /* Combine l & h to form a 32 bit quantity. */
  115. #define MAKEULONG(l, h) ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  116. #define MAKELONG(l, h)    ((LONG)MAKEULONG(l, h))
  117.  
  118. /* Combine l & h to form a 16 bit quantity. */
  119. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  120. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  121.  
  122. /* Extract high and low order parts of 16 and 32 bit quantity */
  123. #define LOBYTE(w)    LOUCHAR(w)
  124. #define HIBYTE(w)    HIUCHAR(w)
  125. #define LOUCHAR(w)    ((UCHAR)(USHORT)(w))
  126. #define HIUCHAR(w)    ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  127. #define LOUSHORT(l)    ((USHORT)(ULONG)(l))
  128. #define HIUSHORT(l)    ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  129.  
  130. #define SWAPUSHORT(x) (x=(((x<<8)&0xFF00)|((x>>8)&0x00FF)))
  131.  
  132. /*** Common DOS types */
  133.  
  134. typedef USHORT      HMODULE;    /* hmod */
  135. typedef HMODULE FAR *PHMODULE;
  136.  
  137. typedef USHORT      PID;        /* pid    */
  138. typedef PID FAR *PPID;
  139.  
  140. typedef USHORT      TID;        /* tid    */
  141. typedef TID FAR *PTID;
  142.  
  143. typedef VOID FAR *HSEM;         /* hsem */
  144. typedef HSEM FAR *PHSEM;
  145.  
  146. /**** DOS FMI Error codes */
  147.  
  148. #define ERROR_SEM_TIMEOUT  0xfffc /* Time out happened from the     */
  149.                                   /* semaphore api functions.       */
  150. #define ERROR_SEM_OWNED    0xfffd /* Semaphore is already owned     */
  151.  
  152. /**** DOS FMI Semaphore functions */
  153.  
  154. extern USHORT  APIENTRY CMDSemClear(HSEM);
  155. extern USHORT  APIENTRY CMDSemRequest(HSEM, USHORT);
  156. extern USHORT  APIENTRY CMDSemSet(HSEM);
  157. extern USHORT  APIENTRY CMDSemWait(HSEM, USHORT);
  158.  
  159. /*** DOS FMI TSR functions */
  160.  
  161. extern USHORT  APIENTRY CMDGoTSR(ULONG, UCHAR FAR *, UCHAR FAR *);
  162.  
  163. extern USHORT  APIENTRY CMDStartFG(void);
  164. extern USHORT  APIENTRY CMDStopFG(USHORT);
  165.  
  166. /*** DOS FMI Task switching functions */
  167. extern USHORT  APIENTRY RegisterSwitchProc(ULONG);
  168.  
  169. /*** Other DOS FMI functions */
  170. extern USHORT APIENTRY SNAGetVersion(VOID);
  171.  
  172. #ifdef __cplusplus
  173. }
  174. #endif
  175.  
  176.  
  177. #pragma option pop /*P_O_Pop*/
  178.