2013-05-18 02:21:28 -04:00
# ifndef _ESTRUCT_H_
# define _ESTRUCT_H_
2005-05-31 11:50:56 -04:00
/* ESTRUCT.H
*
* Structure and preprocessor defines
*
* written by Dave G . Conroy
* modified by Steve Wilhite , George Jones
* substantially modified by Daniel Lawrence
* modified by Petri Kutvonen
*/
2013-05-18 20:43:30 -04:00
2005-05-31 11:50:56 -04:00
# ifdef MSDOS
# undef MSDOS
# endif
# ifdef EGA
# undef EGA
# endif
2010-08-14 23:11:27 -04:00
/* Machine/OS definitions. */
2005-05-31 11:50:56 -04:00
# if defined(AUTOCONF) || defined(MSDOS) || defined(BSD) || defined(SYSV) || defined(VMS)
2010-08-14 23:11:27 -04:00
/* Make an intelligent guess about the target system. */
2005-05-31 11:50:56 -04:00
# if defined(__TURBOC__)
2010-08-14 23:11:27 -04:00
# define MSDOS 1 /* MS/PC DOS 3.1-4.0 with Turbo C 2.0 */
2005-05-31 11:50:56 -04:00
# else
2010-08-14 23:11:27 -04:00
# define MSDOS 0
2005-05-31 11:50:56 -04:00
# endif
# if defined(BSD) || defined(sun) || defined(ultrix) || (defined(vax) && defined(unix)) || defined(ultrix) || defined(__osf__)
# ifndef BSD
2010-08-14 23:11:27 -04:00
# define BSD 1 /* Berkeley UNIX */
2005-05-31 11:50:56 -04:00
# endif
# else
2010-08-14 23:11:27 -04:00
# define BSD 0
2005-05-31 11:50:56 -04:00
# endif
# if defined(SVR4) || defined(__linux__) /* ex. SunOS 5.3 */
2010-08-14 23:11:27 -04:00
# define SVR4 1
# define SYSV 1
2005-05-31 11:50:56 -04:00
# undef BSD
# endif
2013-09-14 09:31:42 -04:00
# if defined(SYSV) || defined(u3b2) || defined(_AIX) || (defined(i386) && defined(unix)) || defined(__hpux) || defined( __unix__)
2010-08-14 23:11:27 -04:00
# define USG 1 /* System V UNIX */
2005-05-31 11:50:56 -04:00
# else
2010-08-14 23:11:27 -04:00
# define USG 0
2005-05-31 11:50:56 -04:00
# endif
# if defined(VMS) || (defined(vax) && ! defined(unix))
2010-08-14 23:11:27 -04:00
# define VMS 1 /* VAX/VMS */
2005-05-31 11:50:56 -04:00
# else
2010-08-14 23:11:27 -04:00
# define VMS 0
2005-05-31 11:50:56 -04:00
# endif
2010-08-14 23:11:27 -04:00
# define V7 0 /* No more. */
2005-05-31 11:50:56 -04:00
# else
2005-09-30 18:26:09 -04:00
# define MSDOS 1 /* MS-DOS */
# define V7 0 /* V7 UNIX or Coherent or BSD4.2 */
# define BSD 0 /* UNIX BSD 4.2 and ULTRIX */
# define USG 0 /* UNIX system V */
# define VMS 0 /* VAX/VMS */
2005-05-31 11:50:56 -04:00
2005-09-30 18:26:09 -04:00
# endif /*autoconf */
2005-05-31 11:50:56 -04:00
# ifndef AUTOCONF
/* Compiler definitions */
2005-09-30 18:26:09 -04:00
# define UNIX 0 /* a random UNIX compiler */
# define MSC 0 /* MicroSoft C compiler, versions 3 up */
# define TURBO 1 /* Turbo C/MSDOS */
2005-05-31 11:50:56 -04:00
# else
# define UNIX (V7 | BSD | USG)
# define MSC 0
# define TURBO MSDOS
2005-09-30 18:26:09 -04:00
# endif /*autoconf */
2005-05-31 11:50:56 -04:00
/* Debugging options */
2005-09-30 18:26:09 -04:00
# define RAMSIZE 0 /* dynamic RAM memory usage tracking */
2013-10-11 03:36:36 -04:00
# if RAMSIZE
# define RAMSHOW 1 /* auto dynamic RAM reporting */
# endif
2005-05-31 11:50:56 -04:00
# ifndef AUTOCONF
/* Special keyboard definitions */
2005-09-30 18:26:09 -04:00
# define VT220 0 /* Use keypad escapes P.K. */
# define VT100 0 /* Handle VT100 style keypad. */
2005-05-31 11:50:56 -04:00
/* Terminal Output definitions */
2005-09-30 18:26:09 -04:00
# define ANSI 0 /* ANSI escape sequences */
# define VMSVT 0 /* various VMS terminal entries */
# define VT52 0 /* VT52 terminal (Zenith). */
# define TERMCAP 0 /* Use TERMCAP */
# define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
2005-05-31 11:50:56 -04:00
2014-06-18 02:59:40 -04:00
# elif defined( MINGW32)
# define VT220 (UNIX | VMS)
# define VT100 0
# define ANSI 0
# define VMSVT 0
# define VT52 0
# define TERMCAP 0
# define IBMPC 0
2005-05-31 11:50:56 -04:00
# else
# define VT220 (UNIX | VMS)
# define VT100 0
# define ANSI 0
# define VMSVT VMS
# define VT52 0
# define TERMCAP UNIX
# define IBMPC MSDOS
2010-08-14 23:11:27 -04:00
# endif /* Autoconf. */
2005-05-31 11:50:56 -04:00
/* Configuration options */
2010-08-14 23:11:27 -04:00
# define CFENCE 1 /* fench matching in CMODE */
# define VISMAC 0 /* update display during keyboard macros */
2005-05-31 11:50:56 -04:00
# ifndef AUTOCONF
2010-08-14 23:11:27 -04:00
# define COLOR 1 /* color commands and windows */
# define FILOCK 0 /* file locking under unix BSD 4.2 */
2005-05-31 11:50:56 -04:00
# else
# define COLOR MSDOS
# ifdef SVR4
# define FILOCK 1
# else
# define FILOCK BSD
# endif
2010-08-14 23:11:27 -04:00
# endif /* Autoconf. */
2005-05-31 11:50:56 -04:00
2010-08-14 23:11:27 -04:00
# define CLEAN 0 /* de-alloc memory on exit */
2005-05-31 11:50:56 -04:00
2010-08-14 23:11:27 -04:00
# define ASCII 1 /* always using ASCII char sequences for now */
# define EBCDIC 0 /* later IBM mainfraim versions will use EBCDIC */
2005-05-31 11:50:56 -04:00
# ifndef AUTOCONF
2010-08-14 23:11:27 -04:00
# define XONXOFF 0 /* don't disable XON-XOFF flow control P.K. */
# define NATIONL 0 /* interprete [,],\,{,},| as characters P.K. */
2005-05-31 11:50:56 -04:00
# else
# define XONXOFF (UNIX | VMS)
# define NATIONL (UNIX | VMS)
2010-08-14 23:11:27 -04:00
# endif /* Autoconf. */
2005-05-31 11:50:56 -04:00
2010-08-14 23:11:27 -04:00
# define PKCODE 1 /* include my extensions P.K., define always */
# define IBMCHR MSDOS /* use IBM PC character set P.K. */
# define SCROLLCODE 1 /* scrolling code P.K. */
2005-05-31 11:50:56 -04:00
2010-08-14 23:11:27 -04:00
/* System dependant library redefinitions, structures and includes. */
2005-05-31 11:50:56 -04:00
2010-08-14 23:11:27 -04:00
# if TURBO
# include <dos.h>
# include <mem.h>
2005-05-31 11:50:56 -04:00
# undef peek
# undef poke
# define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
# define poke(a,b,c,d) movedata(FP_SEG(c),FP_OFF(c),a,b,d)
# endif
2010-08-14 23:11:27 -04:00
# if MSDOS & MSC
2005-05-31 11:50:56 -04:00
# include <dos.h>
# include <memory.h>
# define peek(a,b,c,d) movedata(a,b,FP_SEG(c),FP_OFF(c),d)
# define poke(a,b,c,d) movedata(FP_SEG(c),FP_OFF(c),a,b,d)
# define movmem(a, b, c) memcpy(b, a, c)
# endif
# if VMS
# define unlink(a) delete(a)
# endif
2010-08-14 23:11:27 -04:00
/* Define some ability flags. */
2005-05-31 11:50:56 -04:00
# if IBMPC
# define MEMMAP 1
# else
# define MEMMAP 0
# endif
# if MSDOS | V7 | USG | BSD
# define ENVFUNC 1
# else
# define ENVFUNC 0
# endif
/* DIFCASE represents the integer difference between upper
and lower case letters . It is an xor - able value , which is
fortunate , since the relative positions of upper to lower
case letters is the opposite of ascii in ebcdic .
*/
# ifdef islower
# undef islower
# endif
# if PKCODE
# ifdef isupper
# undef isupper
# endif
# endif
# if ASCII
# define DIFCASE 0x20
# if NATIONL
# define LASTUL ']'
# define LASTLL '}'
# else
# define LASTUL 'Z'
# define LASTLL 'z'
# endif
# if IBMCHR
# define isletter(c) (('a' <= c && LASTLL >= c) || ('A' <= c && LASTUL >= c) || (128<=c && c<=167))
# define islower(c) (('a' <= c && LASTLL >= c))
# define isupper(c) (('A' <= c && LASTUL >= c))
# else
2015-03-19 02:29:24 -04:00
# define isletter(c) __isxletter((0xFF & (c)))
2005-05-31 11:50:56 -04:00
# define islower(c) isxlower((0xFF & (c)))
# define isupper(c) isxupper((0xFF & (c)))
2015-03-19 02:29:24 -04:00
# define __isxletter(c) (('a' <= c && LASTLL >= c) || ('A' <= c && LASTUL >= c) || (192<=c /* && c<=255 */ ))
2005-05-31 11:50:56 -04:00
# define isxlower(c) (('a' <= c && LASTLL >= c) || (224 <= c && 252 >= c))
# define isxupper(c) (('A' <= c && LASTUL >= c) || (192 <= c && 220 >= c))
# endif
# endif
# if EBCDIC
# define DIFCASE 0x40
# define isletter(c) (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c) || ('A' <= c && 'I' >= c) || ('J' <= c && 'R' >= c) || ('S' <= c && 'Z' >= c))
# define islower(c) (('a' <= c && 'i' >= c) || ('j' <= c && 'r' >= c) || ('s' <= c && 'z' >= c))
# if PKCODE
# define isupper(c) (('A' <= c && 'I' >= c) || ('J' <= c && 'R' >= c) || ('S' <= c && 'Z' >= c))
# endif
# endif
/* Dynamic RAM tracking and reporting redefinitions */
# if RAMSIZE
2013-10-11 03:36:36 -04:00
# include <stdlib.h>
void * allocate ( size_t size ) ;
void release ( void * ptr ) ;
2005-05-31 11:50:56 -04:00
# define malloc allocate
# define free release
# endif
/* De-allocate memory always on exit (if the operating system or
main program can not
*/
# if CLEAN
# define exit(a) cexit(a)
2013-06-05 21:28:34 -04:00
2015-02-15 01:41:35 -05:00
void cexit ( int status ) ;
2005-05-31 11:50:56 -04:00
# endif
2013-05-18 02:21:28 -04:00
# endif