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