home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / smart21b.zip / SAMPLES / SLINK / LINK.H < prev    next >
C/C++ Source or Header  |  1991-11-30  |  7KB  |  195 lines

  1. /* This header file does all the necessary includes and defines all the
  2.    structures and constants needed for the link program                 */
  3.  
  4. #define INCL_WIN
  5. #define INCL_WINHXRP
  6. #define INCL_WINDIALOGS
  7. #define INCL_GPIPRIMITIVES
  8.  
  9. #include <os2.h>
  10. #include <dos.h>
  11. #include <malloc.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14.  
  15. struct _HoldFXR
  16. {
  17.    BYTE       fXR;       /* Flag byte */
  18.    BYTE       cbName;
  19.    USHORT     cbValue;
  20.    CHAR      *szName;
  21.    CHAR      *aValue;
  22.    struct _HoldFXR *next;
  23. };
  24. typedef struct _HoldFXR HOLDFXR;
  25.  
  26. struct _DeleteList
  27. {
  28.    CHAR *XRName;
  29.    struct _DeleteList *next;
  30. };
  31. typedef struct _DeleteList DELETELIST;
  32.  
  33. struct _PassData
  34. {
  35.    CHAR   *Point;
  36.    USHORT cbMulti;
  37.    USHORT usMultiOffset;
  38.    USHORT usIndex;
  39.    BYTE   fFlag;
  40. };
  41. typedef struct _PassData PASSDATA;
  42.  
  43.  
  44. struct _ReEnter
  45. {
  46.    HOLDFXR *pFXR;
  47.    PASSDATA FAR *pPDat;
  48.    struct _ReEnter *next;
  49. };
  50. typedef struct _ReEnter REENTER;
  51.  
  52. struct _XRDATA
  53. {
  54.    USHORT usPrefix;
  55.    CHAR   szFormat[36];
  56.    USHORT usFldType;
  57. };
  58. typedef struct _XRDATA XRDATA;
  59.  
  60. BOOL OpenFile(HWND,USHORT);
  61. BOOL AddXR(HWND);
  62. BOOL QueryXRs(HWND,CHAR *);
  63. BOOL EditXRValue(HWND, PASSDATA *);
  64. BOOL XRExists(CHAR *);
  65. BOOL EditXR(HWND);
  66. BOOL CheckXRIntegrity(CHAR *,USHORT);
  67. MRESULT EXPENTRY OpenFileProc  (HWND, USHORT, MPARAM, MPARAM);
  68. MRESULT EXPENTRY MainDlgProc   (HWND, USHORT, MPARAM, MPARAM);
  69. MRESULT EXPENTRY AddXRProc     (HWND, USHORT, MPARAM, MPARAM);
  70. MRESULT EXPENTRY AsciiEditProc (HWND, USHORT, MPARAM, MPARAM);
  71. MRESULT EXPENTRY IconDlgProc   (HWND, USHORT, MPARAM, MPARAM);
  72. MRESULT EXPENTRY MultiTypeProc (HWND, USHORT, MPARAM, MPARAM);
  73. VOID  FillDirListBox  (HWND,CHAR *);
  74. VOID  FillFileListBox (HWND);
  75. VOID  Free_FXRList(HOLDFXR *,DELETELIST *);
  76. VOID  ShowXRType(HWND);
  77. VOID  DeleteCurXR(HWND);
  78. VOID  WriteXRs(HWND);
  79. VOID  ChangeName(HWND,HOLDFXR *,CHAR *);
  80. VOID  MultiAdd(HWND, HOLDFXR *, PASSDATA FAR *);
  81. SHORT ParseFileName (CHAR *, CHAR *);
  82. USHORT LookupXRType(USHORT);
  83. USHORT CurXRType(HOLDFXR *);
  84. USHORT GetUSHORT(HOLDFXR *,USHORT);
  85. HOLDFXR *GetCurFXR(HWND, HOLDFXR *);
  86. CHAR *MultiTypeIndex(CHAR *, USHORT);
  87. CHAR *XRValueString(HWND, CHAR *);
  88.  
  89. #define ARGFILE             1
  90. #define MAX_GXR             500L /* Max size for a GXR List              */
  91. #define Ref_ASCIIZ          1    /* Reference type for DosEnumAttribute  */
  92. #define MAXXRNAME           255  /* Maximum length an XR Name can be     */
  93. #define MAXXRVALUE         2048  /* Arbitrary max edit fld len of XR Val */
  94. #define XRTABLESIZE          12  /* Number of entries in ConvTable       */
  95. #define GROWSIZE            512  /* Minimum size to increase the heap by */
  96. #define FILE_ALL         0x0007  /* Read-only, sys, hidden, & normal     */
  97. #define MAXSHOWSIZE          34  /* Number of chars to place in desc lbox*/
  98. #define LENUSHORTBUF          6  /* Buf size needed to for ascii USHORT  */
  99.  
  100. /* Return values from ParseFileName */
  101. #define FILE_INVALID          0  /* The filename was invalid */
  102. #define FILE_PATH             1  /* The filename was a path  */
  103. #define FILE_VALID            2  /* The filename was valid   */
  104.  
  105. /* definition of level specifiers. required for File Info */
  106.  
  107. #define GetInfoLevel1   1                   /* Get info from SFT */
  108. #define GetInfoLevel2   2                   /* Get size of FXRlist */
  109. #define GetInfoLevel3   3                   /* Get FXRlist given the GXRlist */
  110. #define GetInfoLevel4   4                   /* Get whole FXRlist */
  111. #define GetInfoLevel5   5                   /* Get FSDname */
  112.  
  113. #define SetInfoLevel1   1                   /* Set info in SFT */
  114. #define SetInfoLevel2   2                   /* Set FXRlist */
  115.  
  116. #define     OPENMODE    OM_DENY_NONE+OM_RXRD_WRITE
  117. #define     OPENFLAG    OF_OPEN_FILE
  118. #define     CRXRTFLAG   OF_CRXRTE_FILE+OF_FAIL
  119. #define     REPLFLG     OF_REPLACE_FILE
  120.  
  121. #define XR_LPBINARY     0xfffe /* Length preceeded binary            */
  122. #define XR_LPASCII      0xfffd /* Length preceeded ascii             */
  123. #define XR_ASCIIZ       0xfffc /* Asciiz                             */
  124. #define XR_LPBITMAP     0xfffb /* Length preceeded bitmap            */
  125. #define XR_LPMETAFILE   0xfffa /* metafile                           */
  126. #define XR_LPICON       0xfff9 /* Length preceeded icon              */
  127. #define XR_ASCIIZFN     0xffef /* Asciiz file name of associated dat */
  128. #define XR_ASCIIZXR     0xffee /* Asciiz XR of associated data       */
  129. #define XR_MVMT         0xffdf /* Multi-value multi-typed field      */
  130. #define XR_MVST         0xffde /* Multy value single type field      */
  131. #define XR_ASN1         0xffdd /* ASN.1 field                        */
  132.  
  133. #define  HM_VALIDFLAGS  0x0003
  134.  
  135. /****** Resource IDs *****/
  136.  
  137. #define IDR_XRD             1
  138. #define IDD_MULTILIST       2
  139. #define IDD_BITMAP          3
  140. #define IDD_ASCIIZ          4
  141. #define ID_MENU_MAIN        5
  142. #define IDD_OPENBOX         6
  143. #define IDD_PATH            7
  144. #define IDD_FILEEDIT        8
  145. #define IDD_DIRLIST         9
  146. #define IDD_FILELIST       10
  147. #define IDD_MAIN           11
  148. #define IDD_FNAME          12
  149. #define IDD_LBOX           13
  150. #define IDD_XRTYPE         14
  151. #define IDD_ADD            15
  152. #define IDD_DELETE         16
  153. #define IDD_COPY           17
  154. #define IDD_EDIT           18
  155. #define IDD_PASTE          19
  156. #define IDD_NEWFILE        20
  157. #define IDD_WRITE          21
  158. #define IDD_QUIT           22
  159. #define IDD_ADDXR          23
  160. #define IDD_XRNAME         24
  161. #define IDD_NEW            25
  162. #define IDD_EXISTING       26
  163. #define IDD_ASCIIEDIT      27
  164. #define IDD_XRVALUE        28
  165. #define IDD_ICONWIN        29
  166. #define BMP_EMPTY          30
  167. #define IDD_ICON           31
  168. #define IDD_MULTIBOX       32
  169. #define DID_DONE           33
  170. #define IDD_TITLE          34
  171. #define IDD_LPDATA         35
  172. #define IDD_NEEDBIT        36
  173. #define IDD_CODEPAGE       37
  174.  
  175.  
  176. /* Macros for allocating and deallocating memory from the heap.  They
  177.    include a crude memory check and assume that the variable hwnd is
  178.    defined in the environment the macro is executed in.               */
  179.  
  180. #define GetMem(x,y) x=(VOID *) WinAllocMem(hhp,y);       \
  181.                     if(!x)                               \
  182.                        WinMessageBox(HWND_DESKTOP, hwnd, \
  183.                        "Sorry, Not enough memory",       \
  184.                        NULL, 0, MB_OK);
  185.  
  186. #define ResizeMem(x,y,z) x=(VOID *) WinReallocMem(hhp,x,y,z); \
  187.                          if(!x)                               \
  188.                             WinMessageBox(HWND_DESKTOP, hwnd, \
  189.                             "Sorry, Not enough memory",       \
  190.                             NULL, 0, MB_OK);
  191.  
  192.  
  193. #define FreeMem(x,y) WinFreeMem(hhp,(NPBYTE) x,(USHORT) y);
  194.  
  195.