home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / Editors / mjovesrc.zoo / sysdep.h < prev    next >
C/C++ Source or Header  |  1991-10-21  |  8KB  |  280 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 DIRENT    1    /* Posix style dirent.h */
  84. #  define SIGRESULT    void
  85. #  define SIGRETURN    { return; }
  86. # endif
  87. #endif
  88. #define KILL0        1    /* kill(pid, 0) returns 0 if proc exists */
  89.  
  90. #if    defined(ultrix) || defined(__ultrix__)
  91. # define ULTRIX    1
  92. # define BSD4_2        1    /* True enough for Jove's purposes */
  93. # define SIGRESULT  void
  94. # define SIGRETURN  {return;}
  95. #endif
  96.  
  97. /* M_XENIX is defined by the Compiler */
  98. /* SYSV should be defined for (System III/System V) UNIX systems */
  99.  
  100. #ifdef SYSVR4
  101. # define SYSVR3        1
  102. # define DIRENT        1    /* Posix style dirent.h */
  103. /* # define TERMIOS    1     new Posix terminal mode management */
  104. # define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  105. #endif
  106.  
  107. #ifdef    SYSVR3
  108. # ifndef    SYSVR2
  109. #  define SYSVR2    1    /* SYSVR2 is a subset of SYSVR3 */
  110. # endif
  111. # define    SIGRESULT    void
  112. # define    SIGRETURN    { return; }
  113. # ifndef    SYSVR4
  114. #  define    SIGCHLD        SIGCLD
  115. # endif
  116. #endif
  117.  
  118. #ifdef    SYSVR2
  119. # ifndef    SYSV
  120. #  define SYSV    1    /* SYSV is a subset of SYSVR2 */
  121. # endif
  122. #endif
  123.  
  124. #ifdef    M_XENIX
  125. # define iAPX286 1    /* we have segments */
  126. # define BSD_DIR    1
  127. #endif
  128.  
  129. #if defined(SYSTYPE_BSD43) || defined(__SYSTYPE_BSD43)
  130. # define BSD4_2        1    /* RISCOS4.x on MIPS */
  131. #endif
  132.  
  133. #ifdef    BSD4_2
  134. # define byte_copy(from, to, len)    bcopy((UnivConstPtr)(from), (UnivPtr)(to), (size_t)(len))
  135. # define byte_zero(s, n)    bzero((UnivPtr)(s), (size_t)(n))
  136. #ifndef MiNT
  137. # define strchr    index
  138. # define strrchr    rindex
  139. #endif
  140. # define BSD_SIGS    1    /* Berkeley style signals */
  141. # define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  142. # define WAIT3        1    /* Berkeley style wait3() */
  143. # define BSD_DIR    1    /* Berkeley style dirent routines */
  144. # define VFORK        1    /* if you have vfork(2) */
  145. # define JOB_CONTROL    1    /* if you have job stopping */
  146. #ifndef MiNT
  147. # define MENLO_JCL    1
  148. #endif
  149. # define HAVE_GETWD    1    /* have the getwd() routine */
  150. # define SGTTY        1    /* uses SGTTY for terminal modes */
  151. #endif
  152.  
  153. #ifdef    A_UX        /* A/UX on a MacII (Do *not* define "MAC") */
  154. /* It might be better to define POSIX compatibility and try that. Oh well! */
  155. # define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  156. # define BSD_DIR    1    /* Berkeley style dirent routines */
  157. # define WAIT3        1    /* Berkeley style wait3() */
  158. # define BSD_SIGS    1    /* Berkeley style signals */
  159. # define SYSV        1    /* System V everything else */
  160. /* # define TERMIO    1     uses termio struct for terminal modes */
  161. #endif
  162.  
  163. #ifdef AIX    /* from guttman@mashie.ece.jhu.edu via buchanan@cs.ubc.ca */
  164. # define BSD_DIR
  165. # define HAVE_GETWD
  166. # define SYSV
  167. /* # define TERMIO    1     uses termio struct for terminal modes */
  168. #endif
  169.  
  170. #if    (defined(mips) || defined(__mips__)) && !defined(BSD4_2)
  171. /*
  172.  * Older MIPS (UMIPS-SYSV, anything other than their 4.3 port before
  173.  * RISCOS4.x) and SGI 4D OSes (anything before Irix3.3) have BSD style wait,
  174.  * and directory routines if you link -lbsd and define -I/usr/include/bsd on
  175.  * the compile line. But they have SysV style signals.  Jove was ported to the
  176.  * SGI 68K boxes once, but it the mods seem to have been lost.
  177.  */
  178. # ifndef    ULTRIX
  179.    /* Not a DECstation 3100 or suchlike */
  180. #  define BSD_WAIT    1    /* Berkeley style sys/wait.h */
  181. #  define BSD_DIR    1    /* Berkeley style dirent routines */
  182. # else
  183. #  undef ULTRIX        1    /* Only needed it for this test */
  184. # endif
  185. # if    defined(sgi) || defined(__sgi__)
  186. #  define WAIT3        1    /* Berkeley style wait3() */
  187. #  define JOB_CONTROL    1    /* if you have job stopping */
  188. #  define HAVE_GETWD    1
  189.    /* All the following are for Irix 3.3 onwards */
  190. #  define BSD_SIGS    1    /* Berkeley style signals */
  191. #  define DIRENT    1    /* Posix style dirent.h */
  192. /* #  define TERMIOS    1     new Posix terminal mode management */
  193. #  ifndef REALSTDC
  194. #   define REALSTDC    1    /* close enough for Jove's needs */
  195. #  endif
  196. #  define HAVE_STRERROR    1    /* have ANSI strerror() */
  197. #  define POSIX_UNISTD    1    /* prototypes in unistd.h, don't use our own */
  198. #  define SIGRESULT    void
  199. #  define SIGRETURN    { return; }
  200. #  undef SIGCHLD        /* #define SIGCHLD SIGCLD in signal.h */
  201. # endif
  202. #endif
  203.  
  204. #ifndef    BSD4_2
  205. # define KBDSIG        SIGEMT
  206. #endif
  207.  
  208. #if    defined(SYSV) || defined(MSDOS) || defined(M_XENIX)
  209. # include <memory.h>
  210. # define byte_copy(from, to, count)    memcpy((UnivPtr)(to), (UnivConstPtr)(from), (size_t)(count))
  211. # define byte_zero(s, n)        memset((UnivPtr)(s), 0, (size_t)(n))
  212. #endif
  213.  
  214. #ifdef    UNIX
  215. # define TERMCAP    1
  216. # define ASCII7    1
  217. #endif /* UNIX */
  218.  
  219. #ifdef    ASCII7    /* seven bit characters */
  220. # define NCHARS 0275
  221. #else
  222. # define NCHARS 0400
  223. #endif
  224.  
  225. #ifdef MiNT
  226. #define CHARMASK 0177
  227. #else
  228. #define CHARMASK (NCHARS - 1)
  229. #endif /* MiNT */
  230.  
  231. #ifndef    MSDOS
  232. # define FILESIZE    256
  233. #else    /* MSDOS */
  234. # define FILESIZE    64
  235. #endif    /* MSDOS */
  236.  
  237. #ifndef    SIGRESULT    /* default to old-style */
  238. # define    SIGRESULT    int
  239. # define    SIGRETURN    { return 0; }
  240. #endif
  241.  
  242. #ifndef    BSD4_2
  243. # ifdef    MENLO_JCL
  244. #  define signal    sigset
  245. # endif    /* MENLO_JCL */
  246. #endif
  247.  
  248. #ifdef    BSD_SIGS
  249. extern long    SigMask;
  250.  
  251. # define SigHold(s)    sigblock(SigMask |= sigmask((s)))
  252. # define SigRelse(s)    sigsetmask(SigMask &= ~sigmask((s)))
  253. #else
  254. # define SigHold(s)    sighold(s)
  255. # define SigRelse(s)    sigrelse(s)
  256. # define killpg(pid, sig)    kill(-(pid), (sig))
  257. #endif
  258.  
  259. /* On a system which limits JOVE to a very small data segment,
  260.  * it may be worthwhile limiting daddr to a short.  This reduces
  261.  * the size of a Line descriptor, but reduces the addressable size
  262.  * of the temp file.  This is reasonable on a PDP-11 and perhaps
  263.  * an iAPX*86.
  264.  */
  265.  
  266. #ifdef    SMALL
  267.   typedef unsigned short    daddr;
  268. #else
  269.   typedef unsigned long    daddr;
  270. #endif    /* SMALL */
  271.  
  272. #define    NULL_DADDR        ((daddr) 0)
  273.  
  274. #ifdef SYSV
  275. # define MAILSPOOL "/usr/mail"
  276. #else
  277. # define MAILSPOOL "/usr/spool/mail"
  278. #endif
  279.  
  280.