dos_.h 2.7 KB

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