/************************************************************************ * This program is Copyright (C) 1986 by Jonathan Payne. JOVE is * * provided to you without charge, and with no warranty. You may give * * away copies of JOVE, including sources, provided that this notice is * * included in all the files. * ************************************************************************/ /* * (RCS Id at end of file.) * Modified: 1988-1992 by Tom Hageman [TRH] * add V7 support: * conditional TINY * add hpux support: * basically SYSV, with BSD extensions * has ptys, but (hp9000, sys 200/300/500 version 5.5) have no job control. * allow interactive processes without job-control * add support for ATARI ST * add MS-DOS support * add 8-bit extended character set support * add explicit MINIX, XENIX SCO_UNIX support * [09-Jan-91] * - BIG jove is now the default * - IPROCS is is now supported on all (non-TINY) unices. * - include "Local.h" if LOCAL is defined, to overrule any defs in here. */ #ifndef TUNED #define TUNED /* don't touch this */ /* Uncomment one of these, OR define one of these from the command line */ /*#define LSRHS /* if this is Lincoln-Sudbury Regional High School */ /*#define MSDOS /* MSDOS on a PC */ /*#define ATARIST /* ATARI ST/TT TOS */ /*#define V7 /* UNIX 7th Edition */ /*#define BSD4_2 /* Berkeley 4.2 BSD */ /*#define BSD4_3 /* Berkeley 4.3 BSD */ /*#define SYSV /* for (System III/System V) UNIX systems */ /*#define SYSV_BSD /* hybrid (System V / Berkeley) UNIX systems */ /*#define MINIX /* for Minix systems (+ ATARIST for Minix-ST) */ /*#define M_XENIX /* for Xenix (non-unix e.g. 2.3) 80386 */ /*#define SCO_SYSV /* for SCO Unix (implied by XENIX) */ /*#define ULTRIX /* for Ultrix */ /*#define MAC /* Apple Macintosh (NOT FINISHED!) */ /*=================== System / compiler dependencies ===================*/ #ifdef BSD4_3 # ifndef BSD4_2 # define BSD4_2 /* 4.3 is 4.2 only different. */ # endif # define RESHAPING /* enable windows to handle reshaping */ #endif #ifdef BSD4_2 # define JOB_CONTROL /* if you have job stopping */ /*# define GETWD /* has `getwd(buf)' */ #endif #ifdef XENIX # define SCO_SYSV # ifndef _ANSI_C_ # ifndef __GNUC__ # define _ANSI_C_ (_ANSI_COMPLIANT_ - _ANSI_NAMED_PROTO_ - \ _ANSI_const_) # endif # endif #endif #ifdef SCO_SYSV # define SYSV # define exp Jexp /* MSC name clash */ # ifndef _ANSI_C_ # ifndef __GNUC__ # define _ANSI_C_ (_ANSI_COMPLIANT_ - _ANSI_const_) # endif # endif /* native SCO 3.2 cc chokes on assignments to `const char **' vars. */ #endif #ifdef ULTRIX /* BSD without job-control */ # define BSD4_2 #endif #ifdef V7 # if pdp11 /* native compiler at least */ # define TINY # define size_t int /* since this is not defined in sys/types.h */ # endif #endif #ifdef SYSV_BSD /* System V with BSD extensions but no job-control */ # ifndef SYSV # define SYSV # endif # ifndef BSD4_2 # define BSD4_2 # endif #endif #ifdef SYSV # define _I_STRING 1 # ifndef XENIX # define _I_TERMIO 1/* vs. */ # endif /*# define GETCWD /* has getcwd(buf, size) */ #endif #ifdef _MINIX # define MINIX #endif #ifdef MINIX # ifndef _MINIX # define _MINIX # endif # ifndef __GNUC__ # define _HAS_UNSIGNED_ 0/* ACK compiler sign-extends (unsigned char)s! */ # define _STDARG_ 1 # endif # define BLKSIZ 1024 # define NBUF 3 # ifdef ATARIST /* in fact, any `big' Minix */ # undef ATARIST # define NFKEYS 56 # define NULL 0L # define CSPEED 5000 /* Console output rate in chars per sec. */ # define META_FKEYS /* some day I'll hack the kernel to support this. */ # define GETCWD /* has getcwd(buf, size) */ # define last_static_variable end # else /* Minix PC -- NOT YET TESTED */ # define TINY # endif #endif #ifdef ATARIST # define DOS /* ATARI ST and MS-DOS have similar file systems */ # undef BPC # define BPC 8 # define BLKSIZ 4096 /* big chunks! */ # define NBUF 12 # define FAST_IDLINE /* use fast insert/delete line */ # define FAST_FLASH /* use fast flash */ # define NFKEYS 48 # define RESHAPING /* allow reshaping */ # define MOUSE /* we want mouse handler */ MAUS /*...kludge for */ # define FILESELECTOR /* has File Selector */ # define GETWD /* emulate getwd(buf) */ # define CSPEED 2500 /* Console output rate in chars per sec. */ # if __TURBOC__ # define UpcTable _UpcTab /* so library will use JOVEs Upc/Loc-tables */ # define LocTable _LocTab # endif # if __GNUC__ /* to stop GNU linker from complaining about doubly-defined symbols. */ # ifndef NOT_JOVE # if __MSHORT__ # define read Jread # endif # define write Jwrite # define getwd Jgetwd # define unlink Junlink /* gnu's unlink crashes on some filenames. */ # endif # define signal Jsignal # endif # ifndef NOT_JOVE # ifndef TRH # define stat Jstat /* to generate semi-unique inode numbers */ # endif /* (My library stat already does it) */ # endif # define getuid() (0) /* single-user... */ #endif #ifdef __MSDOS__ # define MSDOS #endif #ifdef MSDOS # define DOS # undef BPC # define BPC 8 # define BLKSIZ 4096 /* big chunks */ # define NBUF 9 # define FAST_IDLINE /* use fast insert/delete line */ # define NFKEYS 48 # define RESHAPING /* allow reshaping */ # define MOUSE /* we want mouse handler */ # define GETWD /* emulate getwd(buf) */ # define CSPEED 2000 /* Console output rate in chars per sec. */ # define exp Jexp /* name clash */ # define signal Jsignal /* my own version of signal() ... */ # define SIGALRM 14 /* ... for SIGALRM */ # define SELECTABLE /* multi-codepage support. */ # ifndef NOT_JOVE # define stat Jstat /* to generate semi-unique inode numbers */ # endif # define getuid() (0) /* single-user */ # if __TURBOC__ /* missing from . Grrr! */ # define ino_t short # define dev_t short # define va_register /* Borland C cannot handle register va_list! */ # endif #endif #ifdef MAC # undef BPC # define BPC 8 # define BLKSIZ 4096 /* big chunks */ # define NBUF 12 # define FAST_IDLINE /* use fast insert/delete line */ # define FAST_FLASH /* use fast flash */ # define NFKEYS 48 # define RESHAPING /* allow reshaping */ # define MOUSE /* we want mouse handler */ # define FILESELECTOR /* has File Selector */ # define MENUS /* ... and Menu Handler */ # define WINDOWS /* ... and Windows */ # define NOPROCS /* No sub-programs */ # define GETWD /* emulate getwd(buf) */ # define CSPEED 960 /* Console output rate in chars per sec. */ # define VIDEO /* emulates ANSI-terminal */ # define getuid() (0) /* single-user... */ # ifndef NOT_JOVE # define main Jmain /* mac needs initialization before JOVEs main */ # define write Jwrite /* to intercept terminal output */ # define creat Jcreat /* for last-minute file name translation */ # define open Jopen # define rename Jrename # define unlink Junlink # endif #endif #if vms # define BIG # define RESHAPING # define GETWD /* we build it from getcwd (see vms.c) */ # define VMS_TERMCAP /* use layer incorporating SMG termtable into termcap */ # define IPROCS # define DYNCACHE /* dynamic data cache */ # define MAIL # ifndef NOT_JOVE # define creat Jcreat # define write Jwrite /* to intercept terminal output */ # define getenv Jgetenv /* to avoid special "TERM" handling. */ # define kill Jkill /* make sure SIGKILL works. */ # endif # define unlink delete # define STDIO /* so we can use shared C library */ # define CASECONFLICT /* external names converted to upper case */ #endif #include "portdefs.h" /* resolve compiler/ANSI/Posix compatibility issues. */ #if _ANSI_HEADERS_ # include # ifndef sig_tp # define sig_tp void # endif #else # ifndef sig_tp # define sig_tp int # endif #endif #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # define EXIT_FAILURE 1 #endif /*===================== JOVEs compilation features =====================*/ #ifndef BIG # ifndef SMALL # ifdef TINY /* TINY implies SMALL */ # define SMALL # else /* BIG is now the default (replaces VMUNIX) */ # if pdp11 # define SMALL # else # define BIG # endif # endif # endif #endif #define ABBREV /* word abbreviation mode */ #if !unix # define ARG_EXPAND /* add unix-like filename expansion */ #endif #ifndef TINY # define AUTOSCROLL /* include code for EDT-style auto-scroll */ #endif #if !vms # define BACKUPFILES /* enable the backup files code */ #endif #if unix # ifndef SMALL # ifndef MINIX # define BIFF /* if you have biff (or the equivalent) */ # endif # endif # ifndef TINY # define IPROCS /* interactive processes */ # endif # ifndef MINIX # define KILL0 /* kill(pid, 0) returns 0 if proc exists */ # endif /*# define LOAD_AV /* Use the load average for various commands. Do not define this if you lack a load average system call and kmem is read protected. */ # define MAIL /* check for new mail */ # ifndef SMALL # define PASSWD /* if your "/etc/passwd" format is weird */ # endif #endif /* unix */ #ifndef DOS # ifndef MAC # define TERMCAP /* truly termcap/terminfo based. */ # ifndef TINY # define CURSOPT /* do full cursor optimization */ # define DUMBTERMS /* to handle somewhat dumber terminals */ # define VARTERM /* to handle terminal screen resizing, using an extension of termcap. */ # ifndef SMALL # ifndef MINIX # define ID_CHAR /* include code to IDchar */ /*# define WIRED_TERMS /* include code for wired terminals */ # endif # endif # endif # endif #endif #define CHDIR /* cd command and absolute pathnames */ #ifndef TINY # define CHDIR_EXT /* tcsh-like dirstack extensions */ #endif #define CLIOPTIONS /* user-definable command-line options */ #ifndef TINY # define CMT_FMT /* include the comment formatting routines */ #endif /*#define COLOR /* Rainbow JOVE */ #define CTAGS /* include C tags package */ #define F_COMPLETION /* filename completion */ #ifdef TINY # define FIXED_MAPS #endif #define FUNCKEYS /* terminal-independent function key handling */ #ifndef SMALL # define FULLRECOVER /* include full-recovery package */ #endif #define ISEARCH /* include incremental search routines */ /*#define LISP /* include the code for Lisp Mode */ /*#define MOUSE /* Mouse support; not on UNIX systems yet */ /*#define NOPROCS /* if your system doesn't support subprocesses */ #define NULLCHARS /* '\0' character handling kludge */ /*#define PERL /* include the code for Perl Mode */ #ifndef TINY # define PROC_TYPEOUT /* include "shell-command-with-typeout" */ # define RALIGN_FILL /* include code for `right-alignment fill' */ # ifndef SMALL # define SPELL /* spell words and buffer commands */ # endif # define SKIPTABS /* Allow old Tab behaviour */ #endif /*#define EXTBINDINGS /* extended key bindings (implied if not STDBINDINGS, see keymaps.txt) */ /*#define STDBINDINGS /* standard Emacs key bindings for DEL */ /*====================== More system dependencies ======================*/ #ifdef JOB_CONTROL # define MENLO_JCL /* (some BSD system header files need this) */ # ifndef BSD4_2 # ifndef EUNICE /* BSD 2.x/4.1? */ # define signal sigset # endif # endif #endif #ifdef _POSIX_JOB_CONTROL # define JOB_CONTROL #endif #ifdef IPROCS # ifndef BSD4_2 # if !vms # define PIPEPROCS /* do it with pipes */ # endif # endif # define IPARSE /* include the i-process-parse code */ #endif #if unix && \ !__XENIX__ && !sun && !iAPX286 && !hpux && !i386 && !aiws && !NeXT # define MY_MALLOC /* use more memory efficient malloc (not on suns) */ #endif /* if SMALL, ignore `int' and most `void' declarations to get it through the compiler. Since that doesn't help enough for some big modules, these explicitly set NO_PROCDECL to throw out most of the other declarations. */ #ifdef SMALL # define NO_TRIV_PROTO #else # undef NO_PROCDECL /* Disable `small compiler' kludge. */ #endif #ifdef TINY # define execvp execv /* really need any savings I can get... */ #endif #if (sun && sparc) # define BAD_VARARGS /* cannot use %r directive */ # define STDIO #endif /*========================== Local overrules ===========================*/ #ifdef LOCAL /* nearly at end so Local.h can overrule anything. */ # include "Local.h" #endif /*=============== Calculated system-dependent parameters ===============*/ #ifndef BPC /* can be defined from command line */ # define BPC 7 /* use BPC-bits character set */ #else # if (BPC - 7) && (BPC - 8) #error "only 7- or 8-bits character sets supported" # endif #endif /* define block size and number of blocks in disk cache (if not yet defined) */ #ifdef SMALL typedef unsigned short disk_line; /* (unsigned to avoid sign-extension at >> operations.) */ # ifndef BLKSIZ # define BLKSIZ 512 # endif # ifndef NBUF # define NBUF 32 /* bigger now since Lines can be stolen from the cache */ # endif #else /* !SMALL i.e. BIG */ typedef long disk_line; # ifndef BLKSIZ # define BLKSIZ 1024 # endif # ifndef NBUF # define NBUF 64 # endif #endif /* SMALL */ #define MIN_BLOCKS 3 #ifdef FUNCKEYS # ifndef NFKEYS # ifdef TINY # define NFKEYS 64 # else # define NFKEYS 128 /* max number of function keys */ # endif # endif extern short FKeyMap[NFKEYS]; /* id's of available function keys */ #else # undef NFKEYS # define NFKEYS (128*(BPC-7)) /* to get full 8-bit keymap */ #endif #if _ANSI_LIBRARY_ || _I_STRING # include # define byte_copy(s, d, n) memcpy(d, s, (size_t)(n)) /* The next may already be defined by */ # ifndef bzero # define bzero(s, n) memset(s, 0, (size_t)(n)) # endif # ifndef bcmp # define bcmp(s, t, n) memcmp(s, t, (size_t)(n)) # endif # ifndef index # define index strchr # endif # ifndef rindex # define rindex strrchr # endif #else # ifdef BSD4_2 # define byte_copy bcopy /* use fast assembler version */ # include # endif #endif #if unix || vms /* {{maybe there is a better place for this??}} */ # define SLASH '/' /* path separator */ # define ISDIRSEP(c) ((c)==SLASH) # define ISABSPATH(cp) ISDIRSEP(*(cp)) # undef DOS /* these do not mix; UNIX takes precedence */ # undef MAC #endif #ifdef DOS # ifdef ATARIST # define SLASH '\\' /* AltSlash is a JOVE variable (declared in vars.c) */ # endif # ifdef MSDOS # define SLASH '\\' # define AltSlash '/' # endif # define ISDIRSEP(c) ((c)==SLASH || (c)==AltSlash) # define ISABSPATH(cp) (*(cp) && (cp)[1]==':' && (cp)[2]==SLASH) #endif #ifdef MAC /* for the Mac we use a Unix-like filename syntax, i.e., "/Volume/Subdir.../File". This filename is translated back to Mac syntax by the file system routines (see mac.c). */ # define SLASH '/' # define AltSlash ':' # define ISDIRSEP(c) ((c)==SLASH || (c)==AltSlash) # define ISABSPATH(cp) ISDIRSEP(*(cp)) #endif /* If you have a compiler that requires variables to be explicitly initialized to zero, you can define ZERO to " = {0}". For now, assume a good compiler. */ #ifndef ZERO # define ZERO #endif #ifdef STDIO /* kludge: C library incompatible with JOVEs "std"io */ # ifndef NOT_JOVE # undef printf # define printf Jprintf # undef fprintf # define fprintf Jfprintf # undef sprintf # define sprintf Jsprintf # undef stdout # define stdout Jstdout # undef getchar # define getchar Jgetchar # undef puts # define puts Jputs # undef putchar # define putchar Jputchar # undef getc # undef putc # endif #else # ifdef CTIME /* kludge for ctime()s incompatible w/ JOVEs sprintf */ # ifndef NOT_JOVE # define ctime Jctime # endif # endif #endif #ifdef BAD_VARARGS # define VA_INIT_PROPAGATE char _va_buf[MESG_SIZE]; # define VA_PROPAGATE(fmt,ap) "%s", \ (format(_va_buf, sizeof _va_buf, fmt, ap), _va_buf) #else # define VA_INIT_PROPAGATE /* dummy */ # define VA_PROPAGATE(fmt,ap) "%r",fmt,ap #endif #ifndef va_register # define va_register register #endif #ifndef RESHAPING # ifdef VARTERM # define RESHAPING # endif #endif #ifdef CASECONFLICT # define JoveRc JJoveRc # define Chdir JChdir # define SetBuf JSetBuf # define Ungetc JUngetc #endif #ifndef _SYS_TYPES_H_ /* everyone needs this (originally in jove.h) */ # if _I_SYS_TYPES - -1 # include # else # if _I_TYPES # include # endif # endif # define _SYS_TYPES_H_ #endif /* VMS defines struct stat.st_ino as an ARRAY of ino_t. In order to remain portable, define our own INO_T type and `ino_xxx' manipulation macros. */ #if !vms # define INO_T ino_t # define ino_cpy(d_ino, s_ino) ((d_ino)=(s_ino)) # define ino_val(ino, val) ((ino)=(val)) # define ino_eq(ino1, ino2) ((ino1)==(ino2)) #else # if _I_SYS_STAT - -1 # include # else # include /* for ino_t */ # endif typedef ino_t INO_T[3]; # define ino_cpy(d_ino, s_ino) memcpy(d_ino, s_ino, sizeof(INO_T)) # define ino_val(ino, val) memset(ino, val, sizeof(INO_T)) # define ino_eq(ino1, ino2) (memcmp(ino1, ino2, sizeof(INO_T)) == 0) #endif /*========================= Consistency checks =========================*/ #if !unix # ifndef DOS # ifdef MAC # define MAC "warning: MAC port is not yet fully completed or tested" # else # if !vms #error "only UNIX, VMS and DOS systems are supported currently." # endif # endif # endif #endif #ifdef NOPROCS /* NOPROCS silently suppresses all sub-process stuff */ # undef IPROCS # undef PIPEPROCS # undef IPARSE # undef PROC_TYPEOUT #endif #if !unix # ifdef IPROCS # if !vms #error "IPROCS is supported on UNIX and VMS systems only." # endif # endif # ifdef LOAD_AV #error "LOAD_AV is supported on UNIX systems only." # endif #else /* unix */ # ifdef MOUSE #error "MOUSE is not yet supported on UNIX or VMS systems." # endif #endif #ifndef IPROCS # ifdef PIPEPROCS #error "PIPEPROCS requires IPROCS." # endif # ifdef IPARSE #error "IPARSE requires IPROCS." # endif #endif #ifndef F_COMPLETION # ifdef FULLRECOVER #error "FULLRECOVER requires F_COMPLETION." # endif # ifdef ARG_EXPAND #error "ARG_EXPAND requires F_COMPLETION." # endif #endif #ifdef VARTERM # ifndef TERMCAP #error "VARTERM requires TERMCAP." # endif #endif /* These are here since they define things in tune.c. If you add things to tune.c, add them here too, if necessary. */ #ifndef NOEXTERNS extern char d_tempfile[], p_tempfile[], Recover[], CmdDb[], SystemRc[], JoveRc[], #ifdef PIPEPROCS Portsrv[], KbdProc[], #endif Root[], DevNull[], #if !unix Home[], #endif #ifndef TINY BadFChars[], #endif #ifdef TINY # if unix ctimeProg[], # endif #endif DevTty[]; #if !unix extern int CacheSize; #endif #endif /* NOEXTERNS */ /*===================== RCS identification macros ======================*/ #ifdef lint # undef RCS_ID #endif #ifdef RCS_ID # define RCS(id) static const char _RCS_ID[]=id; # define RCS_H(var, id) static const char _ANSI_CAT_(_RCS,var)[]=id; #else # define RCS(id) # define RCS_H(var, id) #endif #ifdef _TUNE_C_ RCS_H(tune, "$Id: tune.h,v 14.32.0.10 1994/04/22 18:24:24 tom Exp tom $") #endif #endif /* TUNED */ /*====================================================================== * $Log: tune.h,v $ * Revision 14.32.0.10 1994/04/22 18:24:24 tom * (va_register): new portability macro. * * Revision 14.32.0.9 1994/02/01 20:35:18 tom * (STDIO): #undef before redefines; add redefines for puts, putchar * to accommodate rogue inclusion of via * on HP-UX (at least with gcc). * * Revision 14.32.0.7 1993/10/29 02:43:04 tom * SELECTABLE: new default for MSDOS. * * Revision 14.32.0.6 1993/10/28 00:15:52 tom * (Atari-ST): port to gcc + gnulib. * * Revision 14.32 1993/03/22 11:18:46 tom * *** empty log message *** * * Revision 14.31.0.1 1993/03/22 11:18:46 tom * Don't assume _ANSI_HEADERS_ for SYSV; assume _I_STRING instead. * * Revision 14.31 1993/02/16 16:24:22 tom * add ctimeProg[] #ifdef TINY. * * Revision 14.30 1993/02/02 22:40:44 tom * cleanup whitespace; add CHDIR_EXT option; remove DFLT_MODE. * * Revision 14.29 1992/12/29 13:54:59 tom * kludge sun (sparc) port. * * Revision 14.28 1992/10/24 01:24:23 tom * convert to "port{ansi,defs}.h" conventions; move some system-dependencies * from jove.h to here. * * Revision 14.27 1992/09/21 14:54:03 tom * cleanup empty `#' directives; fix RCS id. * * Revision 14.26 1992/08/26 23:56:48 tom * reTINYfy; add RCS directives and -macros. * */