static char apl_h_Sccsid
[] = "apl.h @(#)apl.h 1.4 7/3/83 Berkeley ";
* UNIX APL was originally written by Ken Thompson at Bell Labs.
* It spent some time at Yale and finally arrived at Purdue
* University. Since 1976 it has been modified by Jim Besemer
* and John Bruner at the School of Electrical Engineering, Purdue,
* under the direction of Dr. Anthony P. Reeves. It is currently
* being developed and supported at Purdue/EE by J. Bruner and
* A. Reeves on both PDP-11's and VAX-11/780's
* New file system param.h defines MIN and MAX; we
* have to undefine them to avoid conflicts
* Configuration information
* The C preprocessor will automatically supply "vax" if APL is compiled
* Other configuration parameters which may be specified are:
* PURDUE_EE enable special Purdue/EE code
* VMUNIX enable code for Berkeley virtual UNIX stuff
* VFORK use vfork() when possible (implied by VMUNIX)
* VLIMIT use 4.1bsd vlimit() (implied by VMUNIX)
* NDIR 4.2bsd directory format (implied by VMUNIX)
* APL2 generate single-precision version
#define NFDS 20 /* Number of available fd's */
#define MAXEOT 8 /* # of input EOT's before panic */
#define WSFILE ws_file /* work space file */
#define MAGIC 0100555 /* PDP-11 single-precision format */
#define MAGIC 0100554 /* PDP-11 double-precision format */
#define MAGIC 0100557 /* VAX single-precision format */
#define MAGIC 0100556 /* VAX double-precision format */
#define SDAT sizeof(data)
#define MENC 102 /* monadic encode */
#define LABEL 103 /* statement label */
#define PSI 104 /* PSI input character */
#define PSI1 105 /* PSI monadic half */
#define PSI2 106 /* PSI dyadic half */
#define ISP 107 /* ISP input code */
#define ISP1 108 /* ISP monadic half */
#define ISP2 109 /* ISP dyadic half */
#define QWID 110 /* quad fn1 */
#define QFLOAT 141 /* Float character string to data */
#define QNL 142 /* Produce namelist */
char c
[2]; /* Can't be 0 anymore (VAX) */
char cv
[sizeof(int)]; /* character array */
unsigned i
; /* unsigned integer value */
data maxexp
; /* the largest value such that exp(maxexp) is defined */
int funtrace
; /* function trace enabled */
int labgen
; /* label processing being done */
int apl_term
; /* flag set if apl terminal mapping req'd */
jmp_buf gbl_env
; /* Used for setexit/reset */
* Several unrelated values, which appear
* together in the header of an apl workspace file.
int rl
; /* Random Seed (Ph.A. S.B.B.) */
* Each new type should be accomodated for
#define QV 12 /* quad variables */
#define DU 13 /* dummy -- causes fetch error except on print */
#define QX 14 /* latent expr. quad "Llx" */
#define LBL 15 /* locked label value */
#define NTYPES 16 /* number of defined types */
* This is a descriptor for apl data, allocated by "newdat".
* The actual data starts at item.dim[item.rank], and thus
* &item.dim[item.rank] should always == item.datap.
* See the comment in "newdat" (a0.c) about "dim".
* A null item is a vector(!), and is rank==1, size==0.
* the stack is the operand stack, and sp is the pointer to the
* variable/fn (and file name) descriptor block.
* contains useful information about all LVals.
* Also kludged up to handle file names (only nlist.namep
* For fns, nlist.itemp is an array of pointers to character
* strings which are the compiled code for a line of the fn.
* (Itemp == 0) means that the fn has not yet been compiled .
* nlist.itemp[0] == the number of lines in the fn, and
* nlist.itemp[1] == the function startup code, and
* nlist.itemp[max] == the close down shop code.
* This is the structure used to implement the
* The structure is allocated dynamically in ex_fun (ai.c),
* but not explicitly. Ex_fun declares a single, local
* structure (allocated by C, itself), and links it to
* previous instances of the structure. SI is used for
* 1) error traceback (Including ")SI" stuff).
* 2) Restoration of the global variable environment
* (or any other, pending environment).
* The global variable "gsip" is a pointer to the
* head of a chain of these structures, one for each
* instance of an activated function. (Gsip == 0) implies
* an empty list, (gsip->sip == 0) implies the end of the list,
* and (gsip->np == 0) implies a state indicator seperator.
* (A new function was evoked with an old one pending.)
* Note that "gsip->funlc" is the same as the old global
* (gsip && gsip->sip ? gsip->sip->funlc : 0)
* is the value of the old global, "ibeam36".
int suspended
; /* fn is suspended <=1, pending <= 0 */
struct si
*sip
; /* previous fn activation */
struct nlist
*np
; /* current fn vital stats. */
int funlc
; /* current fn current line number */
struct item
**oldsp
; /* top of operand stack upon fn entry */
char *oldpcp
; /* execution string upon fn entry */
jmp_buf env
; /* for restoration of local
* fn activation record */
* exop[i] is the address of the i'th action routine.
* Because of a "symbol table overflow" problem with C,
* the table was moved from a1.c to its own at.c
struct item
*fetch(), *fetch1(), *fetch2(), *extend();
struct item
*newdat(), *dupdat();
int offexit
; /* if != 0, require ")off" to exit */
char *pcp
; /* global copy of arg to exec */
int lastop
; /* last (current) operator exec'ed */
char *scr_file
; /* scratch file name */
char *ws_file
; /* apl workspace file */
/* Following are definitions for buffered I/O.
* To generate a version of APL without buffered I/O,
#define NBUF 4 /* Number of I/O buffers */
#define BLEN 512 /* Buffered I/O buffer length */
#define BLEN 256 /* Buffered I/O buffer length */
struct iobuf
{ /* Buffered I/O buffer structure */
int b_len
; /* Buffer length */
int b_next
; /* Next available character */
int b_fd
; /* Assigned file descriptor */
char b_buf
[BLEN
]; /* Actual buffer */
dev_t fd_dev
; /* Device major/minor number */
ino_t fd_ind
; /* File inode number */
int fd_pipe
; /* (1=pipe, 0=not a pipe) */
int fd_buf
; /* Number of assigned buffer */
char fd_lastop
; /* Last operation (0=read, 1=write) */
char fd_uniq
; /* Unique flag (1=unique, 0=not unique) */
char fd_dup
; /* Principal fd for dups */
char fd_open
; /* (0=closed, 1=open) */
#define READF readf /* Buffered read routine */
#define WRITEF writef /* Buffered write routine */
#define SEEKF lseekf /* Buffered seek routine */
#define OPENF openf /* Buffered file open routine */
#define CREATF creatf /* Buffered file create routine */
#define DUPF dupf /* Buffered file dup routine */
#define CLOSEF closef /* Buffered file close routine */
#define FSTATF fstatf /* Buffered "fstat" call */
#define FORKF(x) (bflush(),fork())
#define FORKF(x) (bflush(),(x) ? vfork() : fork())
#define READF read /* Normal read routine */
#define WRITEF write /* Normal write routine */
#define SEEKF lseek /* Normal seek routine */
#define OPENF open /* Normal file open routine */
#define CREATF creat /* Normal file create routine */
#define DUPF dup /* Normal file dup routine */
#define CLOSEF close /* Normal file close routine */
#define FSTATF fstat /* Normal "fstat" call */
#define FORKF(x) fork() /* Normal "fork" call */
long SEEKF(); /* declare SEEKF properly */
#define setexit() setjmp(gbl_env) /* "setexit" equivalent */
#define reset() longjmp(gbl_env) /* "reset" equivalent */
#define alloc(x) malloc(x)