home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / src / baseline / jove-4.14.6.lha / jove-4.14.6 / sysdep.h < prev    next >
C/C++ Source or Header  |  1992-01-10  |  8KB  |  290 lines

  1. /***************************************************************************
  2.  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  3.  * is provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is    *
  5.  * included in all the files.                                              *
  6.  ***************************************************************************/
  7.  
  8.  
  9. /* Determine if really ANSI C */
  10. #ifdef    __STDC__
  11. # if    __STDC__ >= 0
  12. #  define REALSTDC 1
  13. # endif
  14. #endif
  15.  
  16. #ifdef    THINK_C
  17. # define MAC 1
  18. /* Think C does not have a "defined" preprocessor operator.
  19.  * This kludge is intended to avoid the problem.
  20.  * ??? Perhaps Think C has been fixed by now. -- DHR
  21.  */
  22. # define defined(x) (x)
  23.   typedef int size_t;
  24. #endif
  25.  
  26. /* The operating system (MSDOS or MAC) must be defined by this point.
  27.    IBMPC is defined in the Makefile. */
  28.  
  29. #ifndef    MSDOS
  30. # ifndef    MAC
  31. #   define UNIX    1    /* default to UNIX */
  32. # endif
  33. #endif
  34.  
  35. #ifdef    MAC
  36. # define byte_zero(s,n) setmem((s),(n),0)
  37. # define NBUF 64
  38. # define JBUFSIZ 1024
  39. #endif
  40.  
  41. #ifdef    MSDOS
  42. # ifdef    M_I86LM        /* large memory model */
  43. #  define NBUF         64
  44. # else
  45. #  define NBUF         3
  46. #  define SMALL        1
  47. # endif
  48. # define JBUFSIZ        512        /* or 1024 */
  49. #endif
  50.  
  51. #ifdef    UNIX
  52. # ifdef    pdp11
  53. #  define SMALL    1
  54. #  define JBUFSIZ    512    /* or 1024 */
  55. #  define NBUF        3
  56. # else
  57. #  define VMUNIX    1    /* Virtual Memory UNIX */
  58. #  define JBUFSIZ    1024
  59. #  ifdef    iAPX286
  60. #   define NBUF        48    /* NBUF*JBUFSIZ must be less than 64 kB */
  61. #  else
  62. #   define NBUF    64    /* number of disk buffers */
  63. #  endif    /* iAPX286 */
  64. # endif
  65. #endif
  66.  
  67. #ifdef    SVR3
  68. # define SYSVR3        1    /* system 5, rel. 3 */
  69. #endif
  70.  
  71. #ifdef    SVR2
  72. # define SYSVR2        1    /* system 5, rel. 2 */
  73. #endif
  74.  
  75. #ifdef    BSD
  76. # define BSD4_2        1    /* Berkeley 4.2 BSD or later */
  77. #endif
  78.  
  79. #if    defined(sun) || defined(__sun__)
  80. # define BSD4_2    1    /* True enough for Jove's purposes */
  81. /* # define YP_PASSWD    1    /* if you are a sun running the yellow pages */
  82. # ifdef    SUNOS4    /* gone to void */
  83. #  define TERMIOS    1    /* uses termio struct for terminal modes */
  84. #  define DIRENT    1    /* Posix style dirent.h */
  85. #  define SIGRESULT    void
  86. #  define SIGRETURN    { return; }
  87. #ifdef GCC
  88. #  define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  89. #endif
  90. # endif
  91. #endif
  92.  
  93. #if    defined(BSD386)
  94. # define BSD4_2    1    /* True enough for Jove's purposes */
  95. #  define TERMIOS    1    /* uses termio struct for terminal modes */
  96. #  define DIRENT    1    /* Posix style dirent.h */
  97. #  define SIGRESULT    void
  98. #  define SIGRETURN    { return; }
  99. #  define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  100. #endif
  101.  
  102. #define KILL0        1    /* kill(pid, 0) returns 0 if proc exists */
  103.  
  104. #if    defined(ultrix) || defined(__ultrix__)
  105. # define ULTRIX    1
  106. # define BSD4_2        1    /* True enough for Jove's purposes */
  107. # define SIGRESULT  void
  108. # define SIGRETURN  {return;}
  109. #endif
  110.  
  111. /* M_XENIX is defined by the Compiler */
  112. /* SYSV should be defined for (System III/System V) UNIX systems */
  113.  
  114. #ifdef SYSVR4
  115. # define SYSVR3        1
  116. # define DIRENT        1    /* Posix style dirent.h */
  117. # define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  118. #endif
  119.  
  120. #ifdef    SYSVR3
  121. # ifndef    SYSVR2
  122. #  define SYSVR2    1    /* SYSVR2 is a subset of SYSVR3 */
  123. # endif
  124. # define    SIGRESULT    void
  125. # define    SIGRETURN    { return; }
  126. # ifndef    SYSVR4
  127. #  define    SIGCHLD        SIGCLD
  128. # endif
  129. #endif
  130.  
  131. #ifdef    SYSVR2
  132. # ifndef    SYSV
  133. #  define SYSV    1    /* SYSV is a subset of SYSVR2 */
  134. # endif
  135. #endif
  136.  
  137. #ifdef    M_XENIX
  138. # define iAPX286 1    /* we have segments */
  139. # define BSD_DIR    1
  140. #endif
  141.  
  142. #if defined(SYSTYPE_BSD43) || defined(__SYSTYPE_BSD43)
  143. # define BSD4_2        1    /* RISCOS4.x on MIPS */
  144. #endif
  145.  
  146. #ifdef    BSD4_2
  147. # define byte_copy(from, to, len)    bcopy((UnivConstPtr)(from), (UnivPtr)(to), (size_t)(len))
  148. # define byte_zero(s, n)    bzero((UnivPtr)(s), (size_t)(n))
  149. # define strchr    index
  150. # define strrchr    rindex
  151. # define BSD_SIGS    1    /* Berkeley style signals */
  152. # define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  153. # define WAIT3        1    /* Berkeley style wait3() */
  154. # define BSD_DIR    1    /* Berkeley style dirent routines */
  155. # define VFORK        1    /* if you have vfork(2) */
  156. # define JOB_CONTROL    1    /* if you have job stopping */
  157. # define MENLO_JCL    1
  158. # define HAVE_GETWD    1    /* have the getwd() routine */
  159. # ifndef TERMIOS
  160. # define SGTTY        1    /* uses SGTTY for terminal modes */
  161. #endif
  162. #endif
  163.  
  164. #ifdef    A_UX        /* A/UX on a MacII (Do *not* define "MAC") */
  165. /* It might be better to define POSIX compatibility and try that. Oh well! */
  166. # define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  167. # define BSD_DIR    1    /* Berkeley style dirent routines */
  168. # define WAIT3        1    /* Berkeley style wait3() */
  169. # define BSD_SIGS    1    /* Berkeley style signals */
  170. # define SYSV        1    /* System V everything else */
  171. # define TERMIO    1    /* uses termio struct for terminal modes */
  172. #endif
  173.  
  174. #ifdef AIX    /* from guttman@mashie.ece.jhu.edu via buchanan@cs.ubc.ca */
  175. # define BSD_DIR
  176. # define HAVE_GETWD
  177. # define SYSV
  178. # define TERMIO    1    /* uses termio struct for terminal modes */
  179. #endif
  180.  
  181. #if    (defined(mips) || defined(__mips__)) && !defined(BSD4_2)
  182. /*
  183.  * Older MIPS (UMIPS-SYSV, anything other than their 4.3 port before
  184.  * RISCOS4.x) and SGI 4D OSes (anything before Irix3.3) have BSD style wait,
  185.  * and directory routines if you link -lbsd and define -I/usr/include/bsd on
  186.  * the compile line. But they have SysV style signals.  Jove was ported to the
  187.  * SGI 68K boxes once, but it the mods seem to have been lost.
  188.  */
  189. # ifndef    ULTRIX
  190.    /* Not a DECstation 3100 or suchlike */
  191. #  define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  192. #  define BSD_DIR    1    /* Berkeley style dirent routines */
  193. # else
  194. #  undef ULTRIX        1    /* Only needed it for this test */
  195. # endif
  196. # if    defined(sgi) || defined(__sgi__)
  197. #  define WAIT3        1    /* Berkeley style wait3() */
  198. #  define JOB_CONTROL    1    /* if you have job stopping */
  199. #  define HAVE_GETWD    1
  200.    /* All the following are for Irix 3.3 onwards */
  201. #  define BSD_SIGS    1    /* Berkeley style signals */
  202. #  define DIRENT    1    /* Posix style dirent.h */
  203. #  define TERMIOS    1    /* new Posix terminal mode management */
  204. #  ifndef REALSTDC
  205. #   define REALSTDC    1    /* close enough for Jove's needs */
  206. #  endif
  207. #  define HAVE_STRERROR    1    /* have ANSI strerror() */
  208. #  define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  209. #  define SIGRESULT    void
  210. #  define SIGRETURN    { return; }
  211. #  undef SIGCHLD        /* #define SIGCHLD SIGCLD in signal.h */
  212. # endif
  213. #endif
  214.  
  215. #ifndef    BSD4_2
  216. # define KBDSIG        SIGEMT
  217. #endif
  218.  
  219. #if    defined(SYSV) || defined(MSDOS) || defined(M_XENIX)
  220. # include <memory.h>
  221. # define byte_copy(from, to, count)    memcpy((UnivPtr)(to), (UnivConstPtr)(from), (size_t)(count))
  222. # define byte_zero(s, n)        memset((UnivPtr)(s), 0, (size_t)(n))
  223. #endif
  224.  
  225. #ifdef    UNIX
  226. # define TERMCAP    1
  227. # define ASCII7    1
  228. #endif
  229.  
  230. #ifdef    ASCII7    /* seven bit characters */
  231. # define NCHARS 0200
  232. #else
  233. # define NCHARS 0400
  234. #endif
  235.  
  236. #define CHARMASK (NCHARS - 1)
  237.  
  238. #ifndef    MSDOS
  239. # define FILESIZE    256
  240. #else    /* MSDOS */
  241. # define FILESIZE    64
  242. #endif    /* MSDOS */
  243.  
  244. #ifndef    SIGRESULT    /* default to old-style */
  245. # define    SIGRESULT    int
  246. # define    SIGRETURN    { return 0; }
  247. #endif
  248.  
  249. #ifndef    BSD4_2
  250. # ifdef    MENLO_JCL
  251. #  define signal    sigset
  252. # endif    /* MENLO_JCL */
  253. #endif
  254.  
  255. #ifdef    BSD_SIGS
  256. extern long    SigMask;
  257.  
  258. # define SigHold(s)    sigblock(SigMask |= sigmask((s)))
  259. # define SigRelse(s)    sigsetmask(SigMask &= ~sigmask((s)))
  260. #else
  261. # define SigHold(s)    sighold(s)
  262. # define SigRelse(s)    sigrelse(s)
  263. # define killpg(pid, sig)    kill(-(pid), (sig))
  264. #endif
  265.  
  266. /* On a system which limits JOVE to a very small data segment,
  267.  * it may be worthwhile limiting daddr to a short.  This reduces
  268.  * the size of a Line descriptor, but reduces the addressable size
  269.  * of the temp file.  This is reasonable on a PDP-11 and perhaps
  270.  * an iAPX*86.
  271.  */
  272.  
  273. #ifdef    SMALL
  274.   typedef unsigned short    daddr;
  275. #else
  276.   typedef unsigned long    daddr;
  277. #endif    /* SMALL */
  278.  
  279. #define    NULL_DADDR        ((daddr) 0)
  280.  
  281. #if !defined(TERMIOS) && !defined(SGTTY)
  282. # define TERMIO    1    /* uses termio struct for terminal modes */
  283. #endif
  284.  
  285. #ifdef SYSV
  286. # define MAILSPOOL "/usr/mail"
  287. #else
  288. # define MAILSPOOL "/usr/spool/mail"
  289. #endif
  290.