home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tvos200.zip
/
CPL
/
ICCSTUB.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-27
|
6KB
|
247 lines
/*
* MSC to TURBOC stub header file.
* ===============================
* (C)1989 by F. Jalvingh; All rights reserved.
*
* This header file contains defines, function prototypes etc. to allow
* the IBM C Set++ compiler to compile TurboC programs..
*
* Update history:
* ===============
* 14-Jun-89: File created. (FJJ)
*
* $Header: s:/prj/bpl/ICCSTUB.H_V 1.1 94/09/14 11:02:43 JAL Exp Locker: JAL $
*
* Revision log:
* -------------
* $Log: ICCSTUB.H_V $
* Revision 1.1 94/09/14 11:02:43 JAL
* Initial revision
*
* Revision 1.4 93/05/10 13:38:41 JAL
* Small changes.
*
* Revision 1.3 92/10/09 17:52:56 JAL
* Duplicate definition of MAXPATH deleted.
*
* Revision 1.2 92/09/25 13:48:54 JAL
* Miscellaneous 32-bits changes made, new functions added.
*
* Revision 1.1 92/08/24 14:41:02 JAL
* Initial revision
*
* Revision 1.3 91/10/21 18:55:56 JAL
* And missing ; after prototype added...
*
* Revision 1.2 91/10/21 18:50:34 JAL
* Prototype for getftime() added.
*
* Revision 1.1 91/10/21 14:36:10 JAL
* Initial revision
*
*
*
*/
#ifndef APL_ICCSTUB_H
#define APL_ICCSTUB_H
#define INCL_OS2
#define INCL_BASE
static char msc_rcsid[] = "$Header: s:/prj/bpl/ICCSTUB.H_V 1.1 94/09/14 11:02:43 JAL Exp Locker: JAL $";
/**** Defines ****/
// #define MAXPATH 256 /* Max size of a path name */
#define NO_SIZE 2 /* For arrays allocated later (zero elements) */
/* #define __DATE__ "?MSCDATE?" */ /* MSC has no DATE */
/* #define __TIME__ "?MSCTI?" */
/**** Translated constants: defined in dos.h (both compilers) ****/
#define FA_RDONLY FILE_READONLY
#define FA_HIDDEN FILE_HIDDEN
#define FA_SYSTEM FILE_SYSTEM
#define FA_DIREC FILE_DIRECTORY
#define FA_ARCH FILE_ARCHIVED
#define O_DENYNONE 0
#define O_DENYWRITE 0
#define O_DENYALL 0
/**** dfree structure (DiskFree) ****/
#define dfree diskfree_t
#define df_avail avail_clusters
#define df_total total_clusters
#define df_bsec bytes_per_sector
#define df_sclus sectors_per_cluster
#define getdfree(dv, dfr) _dos_getdiskfree(dv, dfr)
#define getvect(x) _dos_getvect(x)
/**** ffblk structure (FindFirst and FindNext) ****/
#ifdef __MSDOS__
#define ffblk find_t
#define ff_reserved reserved
#define ff_attrib attrib
#define ff_ftime wr_time
#define ff_fdate wr_date
#define ff_fsize size
#define ff_name name
#define findfirst(path, fb, at) _dos_findfirst(path, at, fb)
#define findnext(fb) _dos_findnext(fb)
#endif
#ifdef __OS2__
struct ffblk
{
char ff_reserved[21];
char ff_attrib;
unsigned ff_ftime;
unsigned ff_fdate;
long ff_fsize;
char ff_name[13];
};
int findfirst (const char *path, struct ffblk *ffblk,
int attrib);
int findnext (struct ffblk *ffblk);
#endif
/**** ftime structure ****/
struct ftime {
unsigned ft_tsec : 5; /* Two second interval */
unsigned ft_min : 6; /* Minutes */
unsigned ft_hour : 5; /* Hours */
unsigned ft_day : 5; /* Days */
unsigned ft_month : 4; /* Months */
unsigned ft_year : 7; /* Year */
};
#ifndef __OS2__
#define getftime(ha,ft) _dos_getftime((ha), &((unsigned *)(ft))[1], ((unsigned *)(ft)))
#else
int getftime(int ha, struct ftime *ft);
int setftime(int ha, struct ftime *ft);
#endif
/**** date & getdate stubs ****/
#define date dosdate_t
#define da_year year
#define da_day day
#define da_mon month
// #define time dostime_t
#define ti_min minute
#define ti_sec second
#define ti_hour hour
#define ti_hund hsecond
#define gettime(t) _dos_gettime(t)
#define getdate(t) _dos_getdate(t)
#define settime(t) _dos_settime(t)
#define setdate(t) _dos_setdate(t)
/**** errno conversions.. ****/
#define ENOPATH ENOENT
#define ENOFILE ENOENT
#define EINVDAT EINVAL
#define EINVFMT EBADF
#define EINVFNC EBADF
#define ENMFILE EMFILE
/* #define EFAULT EINVAL */
/**** missing functions ****/
#define gotoxy(y, x) (void)_settextposition(y, x)
extern void SDSound(unsigned short freq);
extern void SDNoSound(void);
extern void TIPause(unsigned short ticks);
#define sound(x) SDSound(x)
#define nosound SDNoSound
#define biosequip _bios_equiplist
#define biosprint(s,p,d) _bios_printer(s,p,d)
#define clrscr() _clearscreen(0)
extern char *searchpath(char *name);
extern unsigned long coreleft(void);
extern unsigned long farcoreleft(void);
#define delay(x) TIPause((x) * 18 / 1000)
/**** Getvect and setvect ****/
#define getvect(x) _dos_getvect(x)
#define setvect(x, n) _dos_setvect(x, n)
/**** Definition of MK_FP (Not available with MSC, definition stolen from TC) ****/
#define MK_FP(seg,ofs) ((void far *) \
(((unsigned long)(seg) << 16) | (unsigned)(ofs)))
#undef FP_OFF
#undef FP_SEG
#define FP_OFF(fp) ((unsigned)(fp))
#define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16))
/**** disable and enable macro's ****/
#define disable _disable
#define enable _enable
#define WILDCARDS 0x01
#define EXTENSION 0x02
#define FILENAME 0x04
#define DIRECTORY 0x08
#define DRIVE 0x10
#define MAXDRIVE 3
#define MAXDIR (MAXPATH-MAXDRIVE)
#define MAXFILE 9
#define MAXEXT 5
int fnsplit(const char *pathp, char *drivep, char *dirp, char *namep, char *extp);
void fnmerge(char *out, char *drive, char *dir, char *name, char *ext);
int getdisk(void);
int setdisk(int drive);
int getcurdir(int drive, char *dir);
void *farmalloc(unsigned long size);
void farfree(void *s);
char *getpass(char *s);
#define random(x) ((int)((long)rand() * (x) / 65536ul))
#define chdir(x) _chdir(x)
#ifdef __OS2__
#define OPEN_ACCESS_READONLY 0x0000
#define OPEN_ACCESS_READWRITE 0x0002
#define OPEN_ACCESS_WRITEONLY 0x0001
#define OPEN_SHARE_DENYNONE 0x0040
#define OPEN_SHARE_DENYREAD 0x0030
#define OPEN_SHARE_DENYREADWRITE 0x0010
#define OPEN_SHARE_DENYWRITE 0x0020
int locking(int h, int mode, long bytes);
#define LK_UNLCK 0 /* unlock the file region */
#define LK_LOCK 1 /* lock the file region */
#define LK_NBLCK 2 /* non-blocking lock */
#define LK_RLCK 3 /* lock for writing */
#define LK_NBRLCK 4 /* non-blocking lock for writing */
#endif
#endif