home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / jove-4.16-src.tgz / tar.out / bsd / jove / sysdep.doc < prev    next >
Text File  |  1996-09-28  |  18KB  |  383 lines

  1. ########################################################################
  2. # This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  #
  3. # 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. Jove has two classes of ifdefs.  Some are used to select system-dependent
  9. features, others are to select Jove features.  The former are defined in
  10. sysdep.h, the latter in tune.h.  This file describes the ones in sysdep.h.
  11.  
  12. sysdep.h is structured as a set of #ifdefs for different systems, each system
  13. being identified by some unique symbol (e.g. SUNOS41 for SunOS version 4.1
  14. and 4.1.*).  We do not use symbols pre-defined by the compilers, they're too
  15. hard to predict and often do not provide the granularity that's necessary to
  16. differentiate between system versions or types.  If the system you run is
  17. included in sysdep.h, just use it.  If not, select a symbol to define your
  18. system (e.g. SOMEOS) and choose the appropriate system-dependent options that
  19. characterise your systems terminal handling, process handling, header files,
  20. etc from the list below.
  21.  
  22. NOTE: We've removed almost all the "#ifdef system-type" ifdefs from the body
  23. of Jove code, replacing those with the feature ifdefs documented below.
  24. This sort of approach is necessary in this day & age of hybrid systems.
  25. If you're porting Jove to a new system, please follow the feature-based
  26. approach and don't stick "#ifdef system-type" ifdefs in the code.
  27.  
  28. For terminal handling under Unix, define one of the following, in
  29. decreasing order of preference.
  30. TERMIOS        Have "struct termios" and termios.h.  Posix systems,
  31.         most modern Unixes.
  32. SGTTY        Have stty() and gtty() for tty characteristics.
  33.         BSD4.3 and precursors, including V7.
  34. TERMIO        Have "struct termio" and termio.h for tty characteristics.
  35.         System V derivatives.  Warning: if your system supports
  36.         BSD-style Job Control, don't use TERMIO: it cannot
  37.         suppress the action of some magic characters.
  38.  
  39. Jove needs to know the current working directory for pathname optimization
  40. and the directory functions that it provides ("cd", "pushd", etc).
  41. Define one of the following, in order of decreasing preference:
  42. USE_GETCWD    have the getcwd() routine for the name of the current
  43.         directory.  Posix.
  44. USE_GETWD    have the getwd() routine for the name of the current dir.
  45.         BSD4.2 and derivatives (SunOS3, old Ultrix)
  46. USE_PWD        Run the 'pwd' program to find the name of the current
  47.         directory.  Old Unixes.
  48.  
  49. If the compiler is ANSI C, then prototyping will be supported
  50. automatically (this is determined by checking that __STDC__ is
  51. defined (by the system), and it is greater than 0).  For other
  52. systems, you may define:
  53. USE_PROTOTYPES    for non-ANSI systems that nevertheless support prototypes
  54. NO_PTRPROTO    for systems that botch prototypes in function pointer decls.
  55. STDARGS        for non-ANSI systems that nevertheless support stdargs.h,
  56.         as opposed to varargs.h
  57. MIPS_CC_BUG    avoid function definition syntax that provokes a MIPS cc bug.
  58.         This bug manifests itself as compiler complaints around the
  59.         extern declarations that have parentheses around them.
  60.         (e.g. select).  One version of the error looks like this:
  61.         externs.h, line 145: ccom: Internal: compiler takes size of function
  62.  
  63. Newer systems tend to have header files with more system calls defined,
  64. sometimes with prototypes.  Choose one of the following, depending on your
  65. system.  If neither of the following is defined, then the declarations in
  66. externs.h are used.
  67. POSIX_UNISTD    Have Posix P1003.1 compliant unistd.h with declarations.
  68. FULL_UNISTD    Have fully-prototyped header files, superset of Posix P1003.1
  69.  
  70. Usually, the result type returned by read() and write() is int.
  71. Posix carefully defines a type name for this type: ssize_t (it logically
  72. is a size_t, but it must be signed because -1 is a possible value).
  73. We use SSIZE_T which defaults to ssize_t if FULL_UNISTD, otherwise int.
  74. This can be overridden by defining SSIZE_T.
  75.  
  76. Different environments have different memory and address space limitations.
  77. Generally, these controls default appropriately.
  78. NBUF        Number of memory blocks allocated to cache for buffers.
  79. JLGBUFSIZ    log-base-2(sizeof buffer block).  Generally 9 or 10,
  80.         yielding blocks of size 512 or 1024 bytes.  Each text line
  81.         in Jove is restricted to fit within a single block, so
  82.         larger is better.  Also, larger blocks should reduce
  83.         the number of blocks transfered between the temp file
  84.         and RAM.  Smaller blocks reduce the number of bytes
  85.         transferred and more efficiently use cache memory
  86.         (there would be more blocks in an identically sized cache).
  87. SMALL        Intended for machines with small address spaces, for example
  88.         the PDP-11 and small or medium model on x86.  It drastically
  89.         reduces NBUF, cuts down JLGBUFSIZ, and makes daddr an
  90.         unsigned short.
  91. MALLOC_CACHE    Causes the in-core cache for disk blocks to be malloced
  92.         rather than allocated as a static variable.  This helps
  93.         environments where statically allocated things are placed
  94.         in one limited segment, but malloced things are placed
  95.         in separate segments.  Examples include MAC and large
  96.         model x86.  Remember that NBUF * ((1<<JLGBUFSIZ) + overhead)
  97.         will probably have to fit within a single segment.
  98. AUTO_BUFS    Allocate several of the fixed buffers on the stack
  99.         instead of statically.  On the PDP-11, this exploits
  100.         memory that would be otherwise wasted due to the
  101.         granularity of the MMU.  On the Macintosh under Think C,
  102.         this reduces the size of the static data segment enough
  103.         to avoid "far data".
  104.  
  105. IPROCS is defined if interactive processes are to be supported.  It
  106. is defined in tune.h, implying that it is a matter of preference, at
  107. least on UNIX systems.  Unfortunately, in some cases control is
  108. needed in sysdep.h (because it is a matter of feasibility).  To
  109. reflect this, if NO_IPROCS is defined in sysdep.h, tune.h will not
  110. define IPROCS.  Beware: doc/jove.rc (the standard system-wide rc file)
  111. binds several process commands, so it will need changing if interactive
  112. process support is not compiled in.
  113.  
  114. To multiplex between different processes and the keyboard (when IPROCS
  115. is defined), define USE_SELECT.
  116. USE_SELECT    Have the select() system call.  Almost essential!
  117. USE_SELECT_H    sys/select.h needed for FD_* macros.  AIX and QNX.
  118. Jove also uses select() for delays if available.  Without select(),
  119. the code is a kludge, but it may work...
  120.  
  121.  
  122. Jove sometimes tries to find out if there is pending keyboard input.
  123. There are too many different ways of doing this.  Jove will use FIONREAD
  124. if it finds that symbol defined by a header it includes.  It will use
  125. select if USE_SELECT is defined.  Older systems may support
  126. fcntl(... O_NDELAY); POSIX.1 systems should support O_NONBLOCK.
  127. NONBLOCKINGREAD    use O_NDELAY/O_NONBLOCK to test for pending keyboard input
  128.  
  129.  
  130. If IPROCS is defined in tune.h, one of the following two must be defined.
  131. If your system supports neither PTYS nor PIPES, don't define IPROCS unless
  132. you feel in the mood for very serious hacking.
  133. PTYPROCS    Use pseudo-ttys.  BSD and most modern Unixes.
  134. PIPEPROCS    Use pipes for interactive processes.  Older Unixes.
  135.  
  136.  
  137. If PTYPROCS is defined, then one of the following must be defined.  Or add
  138. your own code in iproc-ptys.c.
  139. SVR4_PTYS    SYSVR4 pty allocation.  ptym, grantpt() and friends.
  140. BSD_PTYS    canonical BSD ptys, search through pty[pqrst]
  141. IRIX_PTYS    Irix 3.x onwards -- open a master device, then fstat to get
  142.         major and minor numbers.
  143.  
  144. Certain early SVR4 systems have a buggy grantpt library routine that
  145. is used if PTYPROCS is defined.  A symptom is that the "shell"
  146. command will always fail with a [grantpt failed] message.  System V
  147. Release 4.0 and Solaris 2.0 (but not Solaris 2.3) and have this bug.
  148. GRANTPT_BUG  Define this to enable a work-around.
  149.  
  150. Certain systems, for example IRIX 4 and IRIX 5.3, define the symbol
  151. TIOCREMOTE but don't implement this ioctl correctly.  A symptom is
  152. that the eof-process command will not work.
  153. NO_TIOCREMOTE    Define this to avoid using TIOCREMOTE even if the
  154.         system defines it.
  155.  
  156. Certain systems, for example IRIX 5.3, define the symbol TIOCSIGNAL
  157. but don't implement this ioctl correctly.  A symptom is that the
  158. interrupt-process command will not work.
  159. NO_TIOCSIGNAL    Define this to avoid using TIOCSIGNAL and TIOCSIG even
  160.         if system defines them.
  161.  
  162. Certain systems, for example HP/UX 9, don't seem to send EOF to the master
  163. side of the pty when the slave side shuts down.  On these systems, Jove
  164. should be told not to wait for EOF:
  165. NO_EOF_FROM_PTY    Define this if your system fails to signal EOF to pty master
  166.  
  167. To deal with SUBSHELL and IPROCS (both in tune.h), define one of the
  168. following:
  169. POSIX_PROCS    Supports Posix processes, waitpid()
  170. BSD_WAIT    Has sys/wait.h and "union wait".
  171. If neither POSIX_PROCS nor BSD_WAIT is defined, Jove uses wait().  (old Unixes)
  172.  
  173.  
  174. If BSD_WAIT was defined, also consider defining
  175. WAIT3        use wait3() on systems that have it.  (BSD4.2 and modern
  176.         non-Posix Unixes).  If this is not defined, we try wait2().
  177.  
  178.  
  179. Signal handling varies between systems.  The original UNIX signal mechanism
  180. is unsafe -- if a second signal is received soon enough, the program will
  181. crash.  Furthermore, there is no mechanism for a process to request that
  182. signal delivery be held temporarily.  BSD, System V, and POSIX have each
  183. provided better but different facilities.  Without safe signals, Jove might
  184. crash, although this is not common.  Jove will use signal holding to more
  185. gracefully handle SIGINTs while starting processes; otherwise those SIGINTs
  186. will be ignored.  The feature select macros, in decreasing order of
  187. preference are:
  188. POSIX_SIGS    Use POSIX's safe sigaction(); use sigprocmask() for signal holding.
  189. USE_SIGSET    Use sigset(), 4.2BSD's safe signal mechanism.
  190.         Use sighold() and sigrelse() for signal holding.
  191. BSD_SIGS    Use 4.x BSD's safe signal(); use for sigsetmask() for holding.
  192. If none of these symbols is defined, unsafe normal signals are used (except
  193. on BSD systems, where the normally unsafe signal() is in fact safe).
  194.  
  195.  
  196. JOB_CONTROL    System supports job control (SIGTSTP, ^Z etc.  for pause-jove)
  197.  
  198.  
  199. USE_VFORK    system has a vfork that is much faster than fork.  This
  200.         capability should be nuked (any self-respecting copy-on-write
  201.         memory implementation should be able to do fork almost as
  202.         fast as vfork)!
  203.  
  204.  
  205. The following are only needed for IPROCS.
  206. BSD_SETPGRP    setpgrp takes two arguments.   If this is not defined,
  207.         assume System V setpgrp with no arguments.
  208. USE_KILLPG    Uses the BSD killpg() system call.  If this is not defined,
  209.         Jove assumes that kill(-pid, ...) is equivalent (SysV).
  210.  
  211.  
  212. If F_COMPLETION is defined, then Jove needs to be able to scan directories.
  213. By default, Jove assumes the system has "struct dirent" and "dirent.h".
  214. If not, define one of the following
  215. BSD_DIR        has "struct direct" and "sys/dir.h".  BSD4.2.  (maybe 4.1?)
  216. DIRENT_EMULATE    emulate dirent routines by open()ing and read()ing the
  217.         directory.
  218. M_XENIX        Support for some versions of XENIX, dealing with
  219.         peculiarities of directory handling.  Not recently tested.
  220.  
  221.  
  222. If F_COMPLETION is defined, and you want ~username to be expanded, then
  223. you may need to define the following, especially on systems running YP/NIS,
  224. or using a database form of the password file.
  225. USE_GETPWNAM    has the getpwnam() system call.  Just about every modern
  226.         Unix.
  227.  
  228.  
  229. Choose the type of signal handler.  If you don't define these, Jove
  230. defaults to "void" and "/*void!*/".
  231. SIGRESTYPE    the return type of signal handlers.  "void" on most modern
  232.         systems, "int" on older systems.
  233. SIGRESVALUE    the return value of signal handlers.  "/*void!*/" on systems
  234.         where SIGRESTYPE is "void", usually 0 on systems where
  235.         SIGRESTYPE is "int".
  236.  
  237.  
  238. Either of following two is useful to the "recover" program, but not both.
  239. USE_UNAME    has the uname() system call.  True on System V and Posix
  240.         and most hybrids.
  241. USE_GETHOSTNAME    has gethostname() system call.  True on most BSD machines.
  242.  
  243.  
  244. NO_STRERROR    If you do not have the strerror() routine.  Needed for
  245.         pre-ANSI systems (SunOS older than 4.1, BSD, older Unixes)
  246.         With this defined, Jove provides an emulation using
  247.         sys_errlist, which should work on most Unixes.
  248.  
  249. USE_FSYNC    Have the fsync() system call.  True on just about all modern
  250.         Unixes.  Not defining this does little harm (it's used only
  251.         to force a flush on files)
  252.  
  253. If BIFF is defined, you can usefully define either or both of the following:
  254. USE_FSTAT    Have the fstat() call.  Just about every modern Unix does.
  255. USE_FCHMOD    Have the fchmod() call.  Again, true on most modern Unixes
  256.         after BSD4.2.
  257.  
  258. Jove supports 7-bit or 8-bit character sets.  It has a wired-in
  259. notion of what each kind of character is, but it can use the
  260. system's classification of control characters.
  261. NCHARS        the number of distinct character codes.  This defaults to 256
  262.         but can be set to 128 for 7-bit character sets.
  263. USE_CTYPE    use the system's <ctype.h> functions.  If this is
  264.         defined and these functions only work for 7-bit
  265.         characters, be sure to define NCHARS to be 128
  266. NO_SETLOCALE    define if you wish to define USE_CTYPE but the system
  267.         has no setlocale routine.
  268. ISO_8859_1    use wired-in tables reflecting the characteristics of the
  269.         ISO 8859-1 character set (Latin1) (USE_CTYPE is better if
  270.         it works).
  271. For the IBM PC under MSDOS, look below for the description of CODEPAGE437.
  272. There is a wired-in table for the Macintosh used if MAC is defined.
  273.  
  274.  
  275. DEFINE_PC_BC_UP_OSPEED
  276.         Certain variables used by termcap/terminfo are
  277.         declared in the library on almost all systems.  For
  278.         those systems that don't define them, this macro
  279.         enables declarations within Jove.  Needed for HPUX
  280.         and possibly other SysV Rel.2 machines.  If you get
  281.         messages like "ospeed undefined" when linking, try
  282.         this.
  283.  
  284. USE_MEMORY_H    include memory.h for declarations of memcpy() et al.
  285.         Older SysV, IBMPCs, Xenix.
  286.  
  287.  
  288. USE_BCOPY    use bcopy in place of missing memcpy.
  289.         BSD4.2 and precursors from Berkeley.
  290.  
  291. USE_INDEX    use index in place of missing strchr.
  292.         BSD4.2 and precursors, including V7.
  293.  
  294. USE_INO        use the inode number (and device number) to tell if two
  295.         paths refer to the same file or directory.  Automatically
  296.         defined for UNIX.  Supported for MAC too.
  297.  
  298. USE_EXIT    Normally, Jove exits by calling _exit, to avoid stdio.
  299.         When this symbol is defined, exit() is used instead.
  300.         This is needed when profiling Jove or running it under
  301.         debugging tools like purify.
  302.  
  303. UNIX        This is automatically defined if we're none of MAC, MSDOS
  304.         or WIN32.  Yuk!
  305.  
  306. TERMCAP        Support display diversity via termcap database.
  307.         This is automatically defined for UNIX.
  308.  
  309. TERMINFO    Support for System V variant of TERMCAP.  TERMCAP
  310.         must also be defined.  This differentiates between
  311.         tparm and tgoto.  It is untested.
  312.  
  313. Jove has been built and tested on PC-compatible computers under
  314. several compilers and at least two environments.  The following
  315. manifests are primarily used to tailor the characteristics of
  316. various PC environments and/or differentiate them from the Unix or
  317. MAC variants of Jove.
  318.  
  319. MSDOS        MSDOS or MSDOS-like system, such as IBM PC, DEC Rainbow,
  320.         or Atari ST.  Only tested on IBMPCDOS recently.
  321.  
  322. IBMPCDOS    Indicates MSDOS on an IBM PC-Compatible hardware platform.
  323.         This enables hardware-specific characterstics of Jove on
  324.         this platform, such as the screen and keyboard interface.
  325.  
  326. WIN32        indicates Jove running as a Console app under the WIN32
  327.         api on Windows NT or Windows 95.
  328.  
  329. The following characteristics are currently enabled only in the MSDOS
  330. and WIN32 environments but could be enabled in other environments if
  331. it made sense to do so.
  332.  
  333. FILENAME_CASEINSENSITIVE    indicates that Jove should ignore case
  334.         when comparing filenames.  This should only be defined when
  335.         building Jove in an environment with this characteristic,
  336.         e.g. MSDOS or WIN32.  Note: this does not imply that filenames
  337.         are monocase; they may be (as for MSDOS) but may not be (e.g.
  338.         for WIN32).
  339.  
  340. DIRECT0RY_ADD_SLASH    indicates that Jove will display a slash at the end
  341.         of directory names when browsing for a file (i.e. when a ?
  342.         is entered during Jove's prompt for a file name).  Define
  343.         this only if it can be done cheaply in the jscandir
  344.         implementation (and also set up jscandir to do so).
  345.         It is presently defined for MAC, MSDOS, and WIN32.
  346.  
  347. MSFILESYSTEM    enables certain filename parsing features in Jove to support
  348.         Microsoft's manner of organizing a filesystem.  This includes
  349.         one-letter device names, use of backslash as a directory
  350.         separator, and avoidance of a "dot" as the first character of
  351.         a filename (as in .joverc).
  352.  
  353. EOL        character to recognize and use as end-of-line when loading or
  354.         saving text files.  Defaults to '\n'.
  355.  
  356. USE_CRLF    tells Jove to recognize and use CR/LF as end-of-line when
  357.         loading or saving text files.  A bare LF will still be
  358.         recognized on input.  EOL should be left as the default '\n'.
  359.  
  360. PCNONASCII    The IBM PC keyboards have a number of keys that don't
  361.         generate ASCII characters (for example, function keys).
  362.         Other systems use escape sequences or control characters
  363.         to encode these keys.  For the PC, we use a special
  364.         code (0xFF) as a prefix for the scan-code generated
  365.         by the key.  PCNONASCII is both the feature selector,
  366.         and, if defined, it has the value of this prefix.
  367.  
  368. NO_JSTDOUT    This suppresses stdio-style buffering for screen output.
  369.  
  370. CODEPAGE437    This is the name of the "ordinary" character set supported
  371.         by IBM PC displays.  It is described in the appendix of
  372.         "Microsoft MSDOS Operating System 5.0 User's Guide and
  373.         Reference" as supporting USA English.
  374.  
  375. PCSCRATTR    Exploit IBMPC screen attributes.  Enables variables
  376.         text-attribute, mode-line-attribute, and highlight-attribute.
  377.  
  378.  
  379. Jove has been ported to the Macintosh using Think C version 5.0.  This port
  380. has not been well tested, nor does it follow Mac conventions.  Perhaps it
  381. should be considered a proof of portability.
  382. MAC        Select all the Macintosh-specific code.
  383.