home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tvos200.zip / CPL / ICCSTUB.H < prev    next >
C/C++ Source or Header  |  1994-10-27  |  6KB  |  247 lines

  1. /*
  2.  *    MSC to TURBOC stub header file.
  3.  *    ===============================
  4.  *    (C)1989 by F. Jalvingh; All rights reserved.
  5.  *
  6.  *    This header file contains defines, function prototypes etc. to allow
  7.  *    the IBM C Set++ compiler to compile TurboC programs..
  8.  *
  9.  *    Update history:
  10.  *    ===============
  11.  *    14-Jun-89: File created.  (FJJ)
  12.  *
  13.  *    $Header: s:/prj/bpl/ICCSTUB.H_V 1.1 94/09/14 11:02:43 JAL Exp Locker: JAL $
  14.  *
  15.  *    Revision log:
  16.  *    -------------
  17.  *    $Log:    ICCSTUB.H_V $
  18.  *    Revision 1.1  94/09/14    11:02:43  JAL
  19.  *    Initial revision
  20.  *
  21.  *    Revision 1.4  93/05/10    13:38:41  JAL
  22.  *    Small changes.
  23.  *
  24.  *    Revision 1.3  92/10/09    17:52:56  JAL
  25.  *    Duplicate definition of MAXPATH deleted.
  26.  *
  27.  *    Revision 1.2  92/09/25    13:48:54  JAL
  28.  *    Miscellaneous 32-bits changes made, new functions added.
  29.  *
  30.  *    Revision 1.1  92/08/24    14:41:02  JAL
  31.  *    Initial revision
  32.  *
  33.  *    Revision 1.3  91/10/21    18:55:56  JAL
  34.  *    And missing ; after prototype added...
  35.  *
  36.  *    Revision 1.2  91/10/21    18:50:34  JAL
  37.  *    Prototype for getftime() added.
  38.  *
  39.  *    Revision 1.1  91/10/21    14:36:10  JAL
  40.  *    Initial revision
  41.  *
  42.  *
  43.  *
  44.  */
  45. #ifndef APL_ICCSTUB_H
  46. #define APL_ICCSTUB_H
  47.  
  48. #define INCL_OS2
  49. #define INCL_BASE
  50.  
  51. static char msc_rcsid[] = "$Header: s:/prj/bpl/ICCSTUB.H_V 1.1 94/09/14 11:02:43 JAL Exp Locker: JAL $";
  52.  
  53. /**** Defines ****/
  54. // #define MAXPATH           256                /* Max size of a path name */
  55. #define NO_SIZE         2                /* For arrays allocated later (zero elements) */
  56. /*    #define __DATE__        "?MSCDATE?"     */  /* MSC has no DATE */
  57. /*    #define __TIME__        "?MSCTI?"       */
  58.  
  59.  
  60. /**** Translated constants: defined in dos.h (both compilers) ****/
  61. #define FA_RDONLY        FILE_READONLY
  62. #define FA_HIDDEN        FILE_HIDDEN
  63. #define FA_SYSTEM        FILE_SYSTEM
  64. #define FA_DIREC        FILE_DIRECTORY
  65. #define FA_ARCH         FILE_ARCHIVED
  66.  
  67. #define O_DENYNONE    0
  68. #define O_DENYWRITE 0
  69. #define O_DENYALL    0
  70.  
  71. /**** dfree structure (DiskFree) ****/
  72. #define dfree            diskfree_t
  73. #define df_avail        avail_clusters
  74. #define df_total        total_clusters
  75. #define df_bsec         bytes_per_sector
  76. #define df_sclus        sectors_per_cluster
  77. #define getdfree(dv, dfr)         _dos_getdiskfree(dv, dfr)
  78.  
  79. #define getvect(x)        _dos_getvect(x)
  80.  
  81.  
  82. /**** ffblk structure (FindFirst and FindNext) ****/
  83. #ifdef    __MSDOS__
  84. #define ffblk            find_t
  85. #define ff_reserved     reserved
  86. #define ff_attrib        attrib
  87. #define ff_ftime        wr_time
  88. #define ff_fdate        wr_date
  89. #define ff_fsize        size
  90. #define ff_name         name
  91. #define findfirst(path, fb, at)     _dos_findfirst(path, at, fb)
  92. #define findnext(fb)                _dos_findnext(fb)
  93. #endif
  94.  
  95. #ifdef    __OS2__
  96. struct    ffblk
  97. {
  98.     char        ff_reserved[21];
  99.     char        ff_attrib;
  100.     unsigned    ff_ftime;
  101.     unsigned    ff_fdate;
  102.     long        ff_fsize;
  103.     char        ff_name[13];
  104. };
  105. int  findfirst     (const char *path, struct ffblk *ffblk,
  106.                  int attrib);
  107. int  findnext     (struct ffblk *ffblk);
  108.  
  109. #endif
  110.  
  111.  
  112. /**** ftime structure ****/
  113. struct    ftime    {
  114.     unsigned    ft_tsec  : 5;    /* Two second interval */
  115.     unsigned    ft_min     : 6;    /* Minutes */
  116.     unsigned    ft_hour  : 5;    /* Hours */
  117.     unsigned    ft_day     : 5;    /* Days */
  118.     unsigned    ft_month : 4;    /* Months */
  119.     unsigned    ft_year  : 7;    /* Year */
  120. };
  121.  
  122. #ifndef __OS2__
  123. #define getftime(ha,ft)    _dos_getftime((ha), &((unsigned *)(ft))[1], ((unsigned *)(ft)))
  124. #else
  125. int getftime(int ha, struct ftime *ft);
  126. int setftime(int ha, struct ftime *ft);
  127. #endif
  128.  
  129. /**** date & getdate stubs ****/
  130. #define date                dosdate_t
  131. #define da_year             year
  132. #define da_day                day
  133. #define da_mon                month
  134.  
  135. // #define time                dostime_t
  136. #define ti_min                minute
  137. #define ti_sec                second
  138. #define ti_hour             hour
  139. #define ti_hund             hsecond
  140.  
  141. #define gettime(t)            _dos_gettime(t)
  142. #define getdate(t)            _dos_getdate(t)
  143. #define settime(t)            _dos_settime(t)
  144. #define setdate(t)            _dos_setdate(t)
  145.  
  146.  
  147. /**** errno conversions.. ****/
  148. #define ENOPATH     ENOENT
  149. #define ENOFILE     ENOENT
  150. #define EINVDAT     EINVAL
  151. #define EINVFMT     EBADF
  152. #define EINVFNC     EBADF
  153. #define ENMFILE     EMFILE
  154. /*    #define EFAULT        EINVAL    */
  155.  
  156.  
  157. /**** missing functions ****/
  158. #define gotoxy(y, x)    (void)_settextposition(y, x)
  159.  
  160. extern void SDSound(unsigned short freq);
  161. extern void SDNoSound(void);
  162. extern void TIPause(unsigned short ticks);
  163. #define sound(x)        SDSound(x)
  164. #define nosound         SDNoSound
  165.  
  166. #define biosequip            _bios_equiplist
  167. #define biosprint(s,p,d)    _bios_printer(s,p,d)
  168. #define clrscr()            _clearscreen(0)
  169.  
  170. extern char *searchpath(char *name);
  171. extern unsigned long    coreleft(void);
  172. extern unsigned long    farcoreleft(void);
  173.  
  174. #define delay(x)                TIPause((x) * 18 / 1000)
  175.  
  176.  
  177. /**** Getvect and setvect    ****/
  178. #define getvect(x)                _dos_getvect(x)
  179. #define setvect(x, n)            _dos_setvect(x, n)
  180.  
  181.  
  182. /**** Definition of MK_FP (Not available with MSC, definition stolen from TC) ****/
  183. #define MK_FP(seg,ofs)    ((void far *) \
  184.                (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  185.  
  186. #undef    FP_OFF
  187. #undef    FP_SEG
  188.  
  189. #define FP_OFF(fp)    ((unsigned)(fp))
  190. #define FP_SEG(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  191.  
  192.  
  193. /**** disable and enable macro's    ****/
  194. #define disable _disable
  195. #define enable    _enable
  196.  
  197. #define WILDCARDS 0x01
  198. #define EXTENSION 0x02
  199. #define FILENAME  0x04
  200. #define DIRECTORY 0x08
  201. #define DRIVE      0x10
  202.  
  203. #define MAXDRIVE  3
  204. #define MAXDIR        (MAXPATH-MAXDRIVE)
  205. #define MAXFILE   9
  206. #define MAXEXT      5
  207.  
  208. int fnsplit(const char *pathp, char *drivep, char *dirp, char *namep, char *extp);
  209. void fnmerge(char *out, char *drive, char *dir, char *name, char *ext);
  210. int getdisk(void);
  211. int setdisk(int drive);
  212. int getcurdir(int drive, char *dir);
  213.  
  214. void    *farmalloc(unsigned long size);
  215. void        farfree(void *s);
  216. char        *getpass(char *s);
  217.  
  218. #define random(x)    ((int)((long)rand() * (x) / 65536ul))
  219. #define chdir(x)    _chdir(x)
  220.  
  221. #ifdef    __OS2__
  222.  
  223.  
  224.  
  225. #define OPEN_ACCESS_READONLY    0x0000
  226. #define OPEN_ACCESS_READWRITE    0x0002
  227. #define OPEN_ACCESS_WRITEONLY    0x0001
  228.  
  229. #define OPEN_SHARE_DENYNONE         0x0040
  230. #define OPEN_SHARE_DENYREAD         0x0030
  231. #define OPEN_SHARE_DENYREADWRITE    0x0010
  232. #define OPEN_SHARE_DENYWRITE        0x0020
  233.  
  234.  
  235. int locking(int h, int mode, long bytes);
  236. #define LK_UNLCK    0    /* unlock the file region */
  237. #define LK_LOCK     1    /* lock the file region */
  238. #define LK_NBLCK    2    /* non-blocking lock */
  239. #define LK_RLCK     3    /* lock for writing */
  240. #define LK_NBRLCK    4    /* non-blocking lock for writing */
  241.  
  242.  
  243. #endif
  244.  
  245. #endif
  246.  
  247.