home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / util / os.h < prev    next >
C/C++ Source or Header  |  1995-01-14  |  4KB  |  121 lines

  1. /* os.h : machine and OS specific stuff
  2.  * Craig Durland    Public Domain
  3.  * Notes:
  4.  *   This file is self configuring on HP-UX, Apollo Domain OS, IBM AIX, IBM
  5.  *     PCs (at least for Borland C++, hopefully others).
  6.  *   This file does need configuring for Suns, OS/2, Atari.
  7.  */
  8.  
  9. #ifndef __OS_H_INCLUDED
  10. #define __OS_H_INCLUDED
  11.  
  12. /* ******************************************************************** */
  13. /* ***************************** OS Types ***************************** */
  14. /* ******************************************************************** */
  15.  
  16. /* Notes:
  17.  *   Set ONE of the OS types to 1 (unless the instructions indicate
  18.  *   otherwise).
  19.  */
  20.  
  21. #ifdef __MSDOS__
  22. #define MSDOZ        1    /* MS-DOS */
  23. #endif
  24.  
  25. #define ATARI        0    /* AtariST/TT TOS or MiNT */
  26.  
  27.  
  28. #define OS2             0    /* OS/2 */
  29. #if OS2
  30. #undef  MSDOZ
  31. #define MSDOZ 1
  32. #endif
  33.  
  34. #define AMIGA        0    /* AmigaDOS !NOT SUPPORTED! */
  35.  
  36.     /* ******************** Unix ************************ */
  37.  
  38.     /* ******************** HP-UX ************************ */
  39. #ifdef __hpux            /* HP-UX */
  40. #define SYSV_OS        1
  41. #endif    /* __hpux */
  42.  
  43.  
  44.     /* ************** Apollo Domain OS (BSD) ************** */
  45. #ifdef __apollo
  46. #define DOMAIN_OS    1
  47. #define BSD_OS        1
  48. #else
  49. #define DOMAIN_OS    0
  50. #endif    /* __apollo */
  51.  
  52.  
  53.     /* ******************** IBM AIX ************************ */
  54. #ifdef _AIX            /* IBM AIX */
  55. #define AIX_OS        1
  56. #define SYSV_OS        1
  57. #else
  58. #define AIX_OS        0
  59. #endif    /* _AIX */
  60.  
  61.  
  62.     /* ************** Unknown (to me) Unix **************** */
  63.    /* If your Unix is not one of the above, you'll need to set one of these
  64.     *   constants manually.
  65.     * Notes:
  66.     *   Some systems are mixes.  HP-UX is a mix of BSD and SysV.  Newer DEC
  67.     *     systems have Posix stuff in them.  This can make writing portable
  68.     *     code a real pain in the butt.  Pick the best match(es) and hope.
  69.     *   Sun:  Older Suns are BSD, the newer ones (with the SysV file system)
  70.     *     are SysV or Posix (you can set either).
  71.     */
  72. #if 0    /* set to 1 if you need to set one of these */
  73. #define V7_OS        0 /* V7 UN*X or Coherent */
  74. #define BSD_OS        0 /* Sun, DEC, Apollo bsd4.3, ... */
  75. #define SYSV_OS        0 /* Newer Suns, HP-UX, IBM, Apollo SysV, ... */
  76. #define POSIX_OS    0 /* Posix compliant: osf */    
  77. #endif
  78.  
  79.  
  80.     /* ********** Some Universal Unix Macros ************** */
  81.  
  82. #define UX_OS    (V7_OS || BSD_OS || SYSV_OS || POSIX_OS)
  83.  
  84.     /* ************** End Unix **************** */
  85.  
  86. /* ******************************************************************** */
  87. /* ************************** Machine & CPU *************************** */
  88. /* ******************************************************************** */
  89.  
  90. typedef unsigned char      uint8;    /* byte */
  91. typedef unsigned short int uint16;    /* 2 bytes */
  92. typedef short int        int16;    /* 16 bit int */
  93. typedef long  int        int32;    /* 32 bit int */
  94.  
  95. /* ******************************************************************** */
  96. /* ********************** Directry Related Stuff ********************** */
  97. /* ******************************************************************** */
  98.  
  99. #define M_SLASH '\\'    /* file seperator for MS-DOS */
  100. #define U_SLASH '/'    /* file seperator for UN*X */
  101.  
  102. #if MSDOZ || ATARI
  103. #define ISSLASH(c) ((c) == U_SLASH || (c) == M_SLASH)
  104. #else
  105. #define ISSLASH(c) ((c) == U_SLASH)
  106. #endif /* MSDOZ || ATARI */
  107.  
  108. #if MSDOZ
  109.     /* File attributes */
  110.     /* Note: attribute == 0 => normal file */
  111. #define FA_RD_ONLY   0x01    /* read only */
  112. #define FA_HIDDEN    0x02    /* hidden */
  113. #define FA_SYSTEM    0x04    /* system */
  114. #define FA_VOLUME    0x08    /* volume */
  115. #define FA_DIRECTORY 0x10    /* directory */
  116. #define FA_ARCHIVE   0x20    /* archive */
  117. #define FA_Z         0x80    /* my fake bit to match attr == 0 */
  118. #endif /* MSDOZ */
  119.  
  120. #endif /* __OS_H_INCLUDED */
  121.