/* Header for module sysglobals, generated by p2c */
#ifndef SYSGLOBALS_H
#define SYSGLOBALS_H



#ifdef SYSGLOBALS_G
# define vextern
#else
# define vextern extern
#endif



typedef Char fsidctype[20];



#define fsidc           "Rev.  3.1  18-Jul-85"

/*20 CHARS: VERSION,DATE,TIME OF FILE SYS*/
#define mminint         (-32768L)

/*MINIMUM SHORT INTEGER VALUE*/
#define mmaxint         32767

/*MAXIMUM SHORT INTEGER VALUE*/
#define maxunit         50

/*MAXIMUM PHYSICAL UNIT NUMBER*/
#define passleng        16

/*NUMBER OF CHARS IN A PASSWORD*/
#define vidleng         16

/*NUMBER OF CHARS IN A VOLUME NAME*/
#define tidleng         16

/*NUMBER OF CHARS IN A FILE TITLE*/
#define fidleng         120

/*NUMBER OF CHARS IN FILE NAME*/
#define fblksize        512

/*STANDARD FILE BUFFER LENGTH*/
#define maxsc           63

/*LARGEST SELECT CODE */
#define minlevel        1

/*LOWEST INTERRUPT LEVEL*/
#define maxlevel        6
/* p2c: Note: Field width for FKIND assumes enum filekind has 16 elements (from sysglobals.imp, line 81) */



/*LARGEST MASKABLE INTERRUPT LEVEL*/
/*directory entry*/
/*bad blocks*/
/*executable or linkable*/
/*UCSD format text with editor environment*/
/*L.I.F. ASCII format text strings*/
/*file of  <data type, e.g. char, integer,etc.>*/
/*system (BOOT) file*/
/*reserved for future expansion*/
/*FILE INFORMATION*/
/*BUFFER VARIABLE...F^ */
/* LIST OF OPEN FILES */
/*declaration and type information*/
/* SIZE OF ONE LOGICAL RECORD */
/* EXTERNAL FILE TYPE */
/* FILE KIND */
/* FILE IS LINE FORMATTED */
/* HAS 512 BYTE BLOCK BUFFER */
/* FILE HAS NO NAME */
/* WAS CREATED THIS ASSOCIATION */
/* FILE ACCESS RIGHTS */
/*state information*/
/*F^ AND LOOKAHEAD STATES */
/* F^ IS AN END OF LINE */
/* TRIED TO READ PAST END OF FILE */
/* FILE HAS CHANGED SIZE */
/* BUFFER NEEDS TO BE WRITTEN */
/*file size and position*/
/* FILE POINTER, CURRENT FILE POSITION */
/*LOGICAL END OF FILE, CURRENT FILE SIZE */
/*PHYSICAL END OF FILE, MAXIMUM FILE SIZE */
/*buffering and low level formatting information*/
/* FILE POSITION OF BUFFER */
/* SPACE COMPRESSION COUNT */
/*BUFFER METHOD MODULE */
/*file association info*/
/*EXECUTION ADDRESS IN BOOT FILE */
/* VOLUME NAME */
/* FILE PASSWORD */
/* FILE NAME */
/* ADDITIONAL SYSTEM DEPENDENT INFORMATION */
/* TEMP FILE IDENTIFIER */
/* OPTIONAL STRING PARAM */
/*byte block transfer information*/
/* START BYTE OF FILE, OR OTHER IDENTIFICATION */
/* FOR FUTURE EXPANSION */
/*TRUE IF NO SRM TEMP FILE CREATED */
/*TRUE IF SRM SHOULD WAIT FOR LOCK */
/*TRUE IF OLD SRM LINK IS TO BE PURGED */
/*TRUE IF OPENED WITH OVERWRITE */
/*TRUE IF PATHID NOT UNIQUE TO FILEID */
/*TRUE IF FILE OPENED AS LOCKABLE */
/*TRUE IF FILE IS LOCKED */
/*TRUE IF DRIVER IS ACTIVE */
/*PHYSICAL UNIT NUMBER */
/*CALLED WHEN TRANSFER COMPLETES */
/* X POSITION FOR  GOTOXY */
/* Y POSITION FOR  GOTOXY */
/* FILEID FOR OLD SRM FILE ON REWRITE */
/*for future expansion*/
/*large miscellaneous fields sometimes present*/
/*minimal FIB ends here*/
/* FILE NAME, EXCEPT VOLUME AND SIZE */
/*FIB*/
/*unitable entry definition*/
/*directory access method*/
/*byte block transfer method*/
/*select code*/
/*bus address*/
/*disc unit*/
/*disc volume*/
/*physical starting byte of volume*/
/*identifier (Amigo identify sequence)*/
/*volume id*/
/*temp for driver use only; init to 0!*/
/*temp for driver use only; init to 0!*/
/*device specifier letter*/
/*unit absent or down flag*/
/*user can edit input*/
/*medium not changed since last access*/
/*volume name must be uppercased*/
/*fixed/removeable media flag*/
/*driver mode: report/ignore media change*/
/*   (bit not used yet)  */
/*blocked volume flag*/
/*volume size in bytes */
/*unitentry*/
/*0 NOT USED*/
/* *note* the ioresult enumerations have been partitioned into two */
/*               mutually-exclusive groups: those beginning with 'z' are reserved */
/*               for the low-level drivers , and those beginning */
/*               with 'i' are reserved for the higher-level routines.*/
/*end marker*/
/*isr information block*/
/*interrupt register address*/
/*interrupt register mask*/
/*interrupt register target value after masking*/
/*chaining flag*/
/*isr*/
/*pointer to next isrib in linked list*/
/*100 IS TEMP DISK FLAG*/
/*DAY OF MONTH*/
/*0 ==> DATE NOT MEANINGFUL*/

typedef enum {
    untypedfile, badfile, codefile, textfile, asciifile, datafile, sysfile,
    fkind7, fkind8, fkind9, fkind10, fkind11, fkind12, fkind13, fkind14,
    lastfkind
} filekind;

typedef Char window[];

typedef enum {
    readbytes, writebytes, flush, writeeol, readtoeol, clearunit, setcursor,
    getcursor, startread, startwrite, unitstatus, seekeof
} amrequesttype;

typedef struct fib {
    Char *fwindow;
    struct fib *flistptr;
    long frecsize;
    short feft;
    unsigned fkind : 4, fistextvar : 1, fbuffered : 1, fanonymous : 1,
	     fisnew : 1, freadable : 1, fwriteable : 1, freadmode : 1,
	     fbufvalid : 1, feoln : 1, feof_ : 1, fmodified : 1,
	     fbufchanged : 1;
    long fpos, fleof, fpeof, flastpos;
    short freptcnt;
    _PROCEDURE am;
    long fstartaddress;
    Char fvid[vidleng + 1];
    Char ffpw[passleng + 1];
    Char ftid[tidleng + 1];
    long pathid;
    short fanonctr;
    Char *foptstring;
    long fileid;
    unsigned fb0 : 1, fb1 : 1, fnosrmtemp : 1, fwaitonlock : 1,
	     fpurgeoldlink : 1, foverwritten : 1, fsavepathid : 1,
	     flockable : 1, flocked : 1, fbusy : 1, funit : 6;
    _PROCEDURE feot;
    long fxpos, fypos, foldfileid;
    long fextra[3];
    short fextra2;
    union {
	Char ftitle[fidleng + 1];
	Char fbuffer[fblksize];
    } UU;
} fib;

typedef enum {
    getvolumename, setvolumename, getvolumedate, setvolumedate, changename,
    purgename, openfile, createfile, overwritefile, closefile, purgefile,
    stretchit, makedirectory, crunch, opendirectory, closedirectory, catalog,
    stripname, setunitprefix, openvolume, duplicatelink, openparentdir,
    catpasswords, setpasswords, lockfile, unlockfile, openunit
} damrequesttype;

typedef struct unitentry {
    _PROCEDURE dam;
    _PROCEDURE tm;
    uchar sc, ba, du, dv;
    long byteoffset, devid;
    Char uvid[vidleng + 1];
    long dvrtemp;
    short dvrtemp2;
    Char letter;
    unsigned offline : 1, uisinteractive : 1, umediavalid : 1, uuppercase : 1,
	     uisfixed : 1, ureportchange : 1, pad : 1, uisblkd : 1;
    union {
	long umaxbytes;
    } UU;
} unitentry;

typedef unitentry unitabletype[maxunit + 1];

typedef _PROCEDURE amtabletype[16];

typedef Char suftabletype[16][6];

typedef short efttabletype[16];

typedef enum {
    inoerror, zbadblock, ibadunit, zbadmode, ztimeout, ilostunit, ilostfile,
    ibadtitle, inoroom, inounit, inofile, idupfile, inotclosed, inotopen,
    ibadformat, znosuchblk, znodevice, zinitfail, zprotected, zstrangei,
    zbadhardware, zcatchall, zbaddma, inotvalidsize, inotreadable,
    inotwriteable, inotdirect, idirfull, istrovfl, ibadclose, ieof,
    zuninitialized, znoblock, znotready, znomedium, inodirectory,
    ibadfiletype, ibadvalue, icantstretch, ibadrequest, inotlockable,
    ifilelocked, ifileunlocked, idirnotempty, itoomanyopen, inoaccess,
    ibadpass, ifilenotdir, inotondir, ineedtempdir, isrmcatchall,
    zmediumchanged, endioerrs
} iorsltwd;

typedef struct isrib {
    Char *intregaddr;
    uchar intregmask, intregvalue;
    unsigned chainflag : 1;
    _PROCEDURE proc;
    struct isrib *link;
} isrib;

typedef isrib *inttabletype[7];

typedef struct daterec {
    char year;
    unsigned day : 5, month : 4;
} daterec;

typedef struct timerec {
    unsigned hour : 5, minute : 6, centisecond : 13;
} timerec;

typedef struct datetimerec {
    daterec date;
    timerec time;
} datetimerec;



vextern short sysescapecode;
vextern Anyptr *openfileptr, *recoverblock, *heapmax, *heapbase;
vextern long sysioresult, hardwarestatus, locklevel;
vextern unitentry *unitable;
vextern inttabletype interrupttable;
vextern long endisrhook, actionspending;
vextern FILE **gfiles[6];
vextern _PROCEDURE *amtable;
vextern Char (*suffixtable)[6];
vextern short *efttable;
vextern long sysunit;
vextern Char syvid[vidleng + 1], dkvid[vidleng + 1];
vextern Char syslibrary[fidleng + 1];
vextern _PROCEDURE debugger;
vextern _PROCEDURE cleariohook;
vextern inttabletype perminttable;
vextern _PROCEDURE deferredaction[10];
vextern _PROCEDURE serialtextamhook;
vextern Char sysname[10];
vextern struct {
    unsigned reserved1 : 1, reserved2 : 1, nointhpib : 1, crtconfigreg : 1,
	     nokeyboard : 1, highlightsxorbiggraphics : 1, biggraphics : 1,
	     alpha50 : 1;
} sysflag;
vextern struct {
    char pad7to1;
    unsigned prompresent : 1;
} sysflag2;
vextern short endsysvars;



#undef vextern

#endif /*SYSGLOBALS_H*/

/* End. */

