1 /* Copyright (C) 2001-2019 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, 8 modified or distributed except as expressly authorized under the terms 9 of the license contained in the file LICENSE in this distribution. 10 11 Refer to licensing information at http://www.artifex.com or contact 12 Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, 13 CA 94945, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 /* Generic MS-DOS interface */ 18 19 #ifndef dos__INCLUDED 20 # define dos__INCLUDED 21 22 /* This file is needed because the various DOS compilers */ 23 /* provide slightly different procedures for interfacing to DOS and */ 24 /* the I/O hardware, and because the Watcom compiler is 32-bit. */ 25 #include <dos.h> 26 #if defined(__WATCOMC__) || defined(_MSC_VER) 27 28 /* ---------------- Microsoft C/C++, all models; */ 29 /* ---------------- Watcom compiler, 32-bit flat model. */ 30 /* ---------------- inp/outp prototypes are in conio.h, not dos.h. */ 31 32 # include <conio.h> 33 # define inport(px) inpw(px) 34 # define inportb(px) inp(px) 35 # define outport(px,w) outpw(px,w) 36 # define outportb(px,b) outp(px,b) 37 # define enable() _enable() 38 # define disable() _disable() 39 # define PTR_OFF(ptr) ((ushort)(uint)(ptr)) 40 /* Define the structure and procedures for file enumeration. */ 41 #define ff_name name 42 #define dos_findfirst(n,b) _dos_findfirst(n, _A_NORMAL | _A_RDONLY, b) 43 #define dos_findnext(b) _dos_findnext(b) 44 45 /* Define things that differ between Watcom and Microsoft. */ 46 # ifdef __WATCOMC__ 47 # define MK_PTR(seg,off) (((seg) << 4) + (off)) 48 # define int86 int386 49 # define int86x int386x 50 # define rshort w 51 # define ff_struct_t struct find_t 52 # else 53 # define MK_PTR(seg,off) (((ulong)(seg) << 16) + (off)) 54 # define cputs _cputs 55 # define fdopen _fdopen 56 # define O_BINARY _O_BINARY 57 # define REGS _REGS 58 # define rshort x 59 # define ff_struct_t struct _find_t 60 # define stdprn _stdprn 61 # endif 62 63 #else /* not Watcom or Microsoft */ 64 65 /* ---------------- Borland compiler, 16:16 pseudo-segmented model. */ 66 /* ---------------- ffblk is in dir.h, not dos.h. */ 67 #include <dir.h> 68 # define MK_PTR(seg,off) MK_FP(seg,off) 69 # define PTR_OFF(ptr) FP_OFF(ptr) 70 /* Define the regs union tag for short registers. */ 71 # define rshort x 72 /* Define the structure and procedures for file enumeration. */ 73 #define ff_struct_t struct ffblk 74 #define dos_findfirst(n,b) findfirst(n, b, 0) 75 #define dos_findnext(b) findnext(b) 76 77 #endif 78 79 #endif /* dos__INCLUDED */ 80