home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / pascal2c / sysgloba.imp < prev    next >
Text File  |  1992-08-03  |  13KB  |  303 lines

  1.  
  2.  
  3. {IncludeFrom=sysglobals <sysgloba.h>}
  4.  
  5.  
  6. {*VarStrings=1} {*ExportSymbol=}
  7.  
  8.  
  9. module sysglobals;  
  10.  
  11. export 
  12.  
  13. type fsidctype = packed array[1..20] of char; 
  14. const 
  15.   fsidc = fsidctype['Rev.  3.1  18-Jul-85'];   
  16.                              (*20 CHARS: VERSION,DATE,TIME OF FILE SYS*)
  17.   mminint = -32768;          (*MINIMUM SHORT INTEGER VALUE*)
  18.   mmaxint =  32767;          (*MAXIMUM SHORT INTEGER VALUE*)
  19.   maxunit = 50;              (*MAXIMUM PHYSICAL UNIT NUMBER*)
  20.   passleng = 16;             (*NUMBER OF CHARS IN A PASSWORD*)
  21.   vidleng = 16;              (*NUMBER OF CHARS IN A VOLUME NAME*)
  22.   tidleng = 16;              (*NUMBER OF CHARS IN A FILE TITLE*)
  23.   fidleng = 120;             (*NUMBER OF CHARS IN FILE NAME*)
  24.   fblksize = 512;            (*STANDARD FILE BUFFER LENGTH*)
  25.   maxsc=63;                  (*LARGEST SELECT CODE *)
  26.   minlevel=1;                (*LOWEST INTERRUPT LEVEL*)
  27.   maxlevel=6;                (*LARGEST MASKABLE INTERRUPT LEVEL*)
  28.       
  29.   
  30. type  
  31.  
  32.   byte = 0..255; 
  33.   shortint = mminint..mmaxint;  
  34.   ipointer = ^integer;
  35.   charptr = ^char;
  36.   textpntr = ^text; 
  37.   string80 = string[80];
  38.   string255 = string[255];
  39.   suffixtype = string[5];
  40.   string255ptr = ^string255; 
  41.  
  42.                                                               
  43.   unitnum = 0..maxunit; 
  44.   vid = string[vidleng]; 
  45.   tid = string[tidleng];
  46.   fid = string[fidleng];
  47.   passtype = string[passleng];
  48.  
  49.   filekind = (untypedfile,      {directory entry} 
  50.               badfile,          {bad blocks}
  51.               codefile,         {executable or linkable}
  52.               textfile,         {UCSD format text with editor environment}
  53.               asciifile,        {L.I.F. ASCII format text strings}
  54.               datafile,         {file of  <data type, e.g. char, integer,etc.>}
  55.               sysfile,          {system (BOOT) file}
  56.      fkind7,  fkind8,  fkind9,  
  57.      fkind10, fkind11, fkind12, 
  58.      fkind13, fkind14, lastfkind);      {reserved for future expansion}
  59.  
  60.   
  61.                                                            (*FILE INFORMATION*)
  62.  
  63. window = packed array [0..maxint] of char;
  64. windowp = ^window;
  65.  
  66.  
  67. fibp = ^fib;
  68.  
  69. amrequesttype = (readbytes, writebytes, flush, writeeol, readtoeol, clearunit, 
  70.           setcursor, getcursor, startread, startwrite, unitstatus, seekeof); 
  71. amtype = procedure (fp: fibp; request: amrequesttype; 
  72.                            anyvar buffer: window; bufsize, position: integer); 
  73. eotproc = procedure(fp: fibp); 
  74.  
  75. fib = packed record 
  76.            fwindow: windowp;                         (*BUFFER VARIABLE...F^ *)
  77.            flistptr: fibp;                            (* LIST OF OPEN FILES *)
  78.        {declaration and type information}
  79.            frecsize: integer;                 (* SIZE OF ONE LOGICAL RECORD *)
  80.            feft: shortint;                            (* EXTERNAL FILE TYPE *)
  81.            fkind: filekind;                                    (* FILE KIND *)
  82.            fistextvar:  boolean;                  (* FILE IS LINE FORMATTED *)
  83.            fbuffered:   boolean;               (* HAS 512 BYTE BLOCK BUFFER *)
  84.            fanonymous: boolean;                         (* FILE HAS NO NAME *)
  85.            fisnew:  boolean;                (* WAS CREATED THIS ASSOCIATION *)
  86.            freadable, fwriteable: boolean;            (* FILE ACCESS RIGHTS *)
  87.        {state information}
  88.            freadmode, fbufvalid: boolean;         (*F^ AND LOOKAHEAD STATES *)
  89.            feoln: boolean;                          (* F^ IS AN END OF LINE *) 
  90.            feof: boolean;                 (* TRIED TO READ PAST END OF FILE *)
  91.            fmodified: boolean;                     (* FILE HAS CHANGED SIZE *)
  92.            fbufchanged: boolean;              (* BUFFER NEEDS TO BE WRITTEN *)
  93.        {file size and position}
  94.            fpos:  integer;           (* FILE POINTER, CURRENT FILE POSITION *)
  95.            fleof: integer;         (*LOGICAL END OF FILE, CURRENT FILE SIZE *)
  96.            fpeof: integer;        (*PHYSICAL END OF FILE, MAXIMUM FILE SIZE *)
  97.        {buffering and low level formatting information}
  98.            flastpos:  integer;                   (* FILE POSITION OF BUFFER *)
  99.            freptcnt:  shortint;                  (* SPACE COMPRESSION COUNT *)
  100.            am:  amtype;                              (*BUFFER METHOD MODULE *)
  101.        {file association info}
  102.            fstartaddress: integer;         (*EXECUTION ADDRESS IN BOOT FILE *)
  103.            fvid: vid;                                        (* VOLUME NAME *)
  104.            ffpw: passtype;                                 (* FILE PASSWORD *)
  105.            ftid: tid;                                          (* FILE NAME *)
  106.            pathid:  integer;     (* ADDITIONAL SYSTEM DEPENDENT INFORMATION *)
  107.            fanonctr: shortint;                      (* TEMP FILE IDENTIFIER *)
  108.            foptstring: string255ptr;               (* OPTIONAL STRING PARAM *)
  109.        {byte block transfer information}
  110.            fileid:  integer; (* START BYTE OF FILE, OR OTHER IDENTIFICATION *)
  111.            fb0,fb1,                                 (* FOR FUTURE EXPANSION *)
  112.            fnosrmtemp,                   (*TRUE IF NO SRM TEMP FILE CREATED *)
  113.            fwaitonlock,                  (*TRUE IF SRM SHOULD WAIT FOR LOCK *)
  114.            fpurgeoldlink,            (*TRUE IF OLD SRM LINK IS TO BE PURGED *)
  115.            foverwritten,                    (*TRUE IF OPENED WITH OVERWRITE *)
  116.            fsavepathid,               (*TRUE IF PATHID NOT UNIQUE TO FILEID *)
  117.            flockable,                     (*TRUE IF FILE OPENED AS LOCKABLE *)
  118.            flocked,                                (*TRUE IF FILE IS LOCKED *)
  119.            fbusy        : boolean;               (*TRUE IF DRIVER IS ACTIVE *)
  120.            funit        : unitnum;                   (*PHYSICAL UNIT NUMBER *)
  121.            feot         : eotproc;         (*CALLED WHEN TRANSFER COMPLETES *)
  122.            fxpos        : integer;                (* X POSITION FOR  GOTOXY *)
  123.            fypos        : integer;                (* Y POSITION FOR  GOTOXY *)
  124.            foldfileid   : integer;    (* FILEID FOR OLD SRM FILE ON REWRITE *)
  125.        {for future expansion}
  126.            fextra:  array[0..2] of integer;
  127.            fextra2: shortint;
  128.        {large miscellaneous fields sometimes present}
  129.            case integer of 
  130.              0: ( {minimal FIB ends here} );
  131.              1: (ftitle:  fid);        (* FILE NAME, EXCEPT VOLUME AND SIZE *)
  132.              2: (fbuffer: packed array [0..fblksize-1] of char); 
  133.         end (*FIB*) ;
  134.  
  135.  
  136. damrequesttype = (getvolumename, setvolumename, getvolumedate, setvolumedate,  
  137.  changename, purgename, 
  138.  openfile, createfile, overwritefile, closefile, purgefile,
  139.  stretchit, makedirectory, crunch, opendirectory, closedirectory, catalog,
  140.  stripname, setunitprefix, openvolume, duplicatelink, openparentdir,
  141.  catpasswords,setpasswords,lockfile,unlockfile,openunit); 
  142.   
  143. damtype = procedure (anyvar f: fib; unum:unitnum; request: damrequesttype); 
  144.   
  145. unitentry =  {unitable entry definition}
  146.     packed record
  147.       dam: damtype;                     {directory access method}
  148.       tm:  amtype;                      {byte block transfer method}
  149.       sc: byte;                         {select code}
  150.       ba: byte;                         {bus address} 
  151.       du: byte;                         {disc unit}  
  152.       dv: byte;                         {disc volume}
  153.       byteoffset: integer;              {physical starting byte of volume} 
  154.       devid: integer;                   {identifier (Amigo identify sequence)} 
  155.       uvid: vid;                        {volume id}
  156.       dvrtemp: integer;                 {temp for driver use only; init to 0!}
  157.       dvrtemp2: shortint;               {temp for driver use only; init to 0!}
  158.       letter: char;                     {device specifier letter}
  159.       offline,                          {unit absent or down flag}
  160.       uisinteractive,                   {user can edit input}
  161.       umediavalid,                      {medium not changed since last access}
  162.       uuppercase:   boolean;            {volume name must be uppercased}
  163.       uisfixed: boolean;                {fixed/removeable media flag}
  164.       ureportchange: boolean;           {driver mode: report/ignore media change}
  165.       pad: 0..1;                        {   (bit not used yet)  }
  166.       case uisblkd: boolean of          {blocked volume flag}
  167.         true: (umaxbytes: integer)      {volume size in bytes }
  168.     end;  {unitentry}
  169.     
  170. unitabletype = array [unitnum] of unitentry;                   (*0 NOT USED*)
  171. amtabletype  = array[filekind] of amtype; 
  172. suftabletype = array[filekind] of suffixtype; 
  173. efttabletype = array[filekind] of shortint; 
  174.  
  175. unitableptr     = ^unitabletype;
  176. amtableptrtype  = ^amtabletype; 
  177. suftableptrtype = ^suftabletype; 
  178. efttableptrtype = ^efttabletype; 
  179.   
  180.   
  181. iorsltwd = 
  182.             { *note* the ioresult enumerations have been partitioned into two
  183.               mutually-exclusive groups: those beginning with 'z' are reserved
  184.               for the low-level drivers , and those beginning
  185.               with 'i' are reserved for the higher-level routines.}
  186.              
  187.              (inoerror,zbadblock,ibadunit,zbadmode,ztimeout,
  188.               ilostunit,ilostfile,ibadtitle,inoroom,inounit,
  189.               inofile,idupfile,inotclosed,inotopen,ibadformat,
  190.               znosuchblk,znodevice,zinitfail,zprotected,
  191.               zstrangei,zbadhardware,zcatchall,zbaddma,
  192.               inotvalidsize,inotreadable,inotwriteable,inotdirect,
  193.               idirfull,istrovfl,ibadclose,ieof,
  194.               zuninitialized,znoblock,znotready,znomedium,
  195.               inodirectory,ibadfiletype,ibadvalue,icantstretch,
  196.               ibadrequest, inotlockable, ifilelocked, ifileunlocked, 
  197.               idirnotempty, itoomanyopen, inoaccess, ibadpass, ifilenotdir, 
  198.               inotondir, ineedtempdir, isrmcatchall, zmediumchanged,
  199.               {end marker} endioerrs);
  200.   
  201. proctype=procedure;
  202. sctype=0..maxsc;
  203. leveltype=minlevel..maxlevel;
  204. pisrib = ^isrib;
  205. isrproctype = procedure(isribptr: pisrib);
  206. isrib = {isr information block}
  207.    packed record
  208.      intregaddr: charptr;       {interrupt register address}
  209.      intregmask: byte;          {interrupt register mask}
  210.      intregvalue: byte;         {interrupt register target value after masking}
  211.      chainflag: boolean;        {chaining flag}
  212.      proc: isrproctype;         {isr}
  213.      link: pisrib;              {pointer to next isrib in linked list}
  214.    end;
  215.  
  216. inttabletype = array [1..7] of pisrib;
  217.  
  218. action = procedure; 
  219.  
  220. daterec         = packed record
  221.                     year        : 0..100;       (*100 IS TEMP DISK FLAG*)
  222.                     day         : 0..31;        (*DAY OF MONTH*)
  223.                     month       : 0..12;        (*0 ==> DATE NOT MEANINGFUL*)
  224.                   end; 
  225.  
  226. timerec         = packed record
  227.                     hour        : 0..23;
  228.                     minute      : 0..59;
  229.                     centisecond : 0..5999;
  230.                   end; 
  231.   
  232. datetimerec     = packed record
  233.                     date        : daterec;
  234.                     time        : timerec;
  235.                   end;
  236.  
  237. var
  238. (*========= MANY OF THE FOLLOWING HAVE HARDCODED
  239.             ADDRESSES IN COMPILER AND ELSEWHERE  =====*)
  240.        
  241. (*** ERROR RECOVERY  ***)
  242.   sysescapecode:        shortint; 
  243.   openfileptr:  anyptr; 
  244.   recoverblock: anyptr; 
  245.   
  246. (*** MEMORY MANAGEMENT ***)
  247.   heapmax:      anyptr; 
  248.   heapbase:     anyptr; 
  249.   
  250. (*** I/O DRIVERS ***)
  251.   sysioresult:          integer; 
  252.   hardwarestatus:       integer;
  253.   locklevel:      integer; 
  254.   unitable: unitableptr;
  255.   interrupttable: inttabletype;
  256.   endisrhook:  integer;
  257.   actionspending: integer; 
  258.   
  259. (*** FILE SYSTEM ***)
  260.   gfiles: array[0..5] of textpntr;    
  261.   {  [0] INPUT          [3] (unused)
  262.      [1] OUTPUT         [4] LISTING 
  263.      [2] KEYBOARD       [5] (unused)   }
  264.   
  265.   amtable:     amtableptrtype;                  {pointer to access methods }
  266.   suffixtable: suftableptrtype;                 {pointer to list of suffixes}
  267.   efttable:    efttableptrtype;                 {pointer to LIF file types}
  268.   sysunit: integer;
  269.   syvid,dkvid: vid;                           (*SYSUNIT VOLID & DEFAULT VOLID*)
  270.   syslibrary: fid; 
  271.   
  272.   (*** DEBUGGER HOOK ***)
  273.   debugger: procedure(p1, p2, p3: integer); 
  274.   
  275.   (*** CLEAR I/O HOOK ***)
  276.   cleariohook : procedure;    
  277.   
  278.   perminttable: inttabletype;
  279.   
  280.   deferredaction: array[1..10] of action; 
  281.   
  282.   serialtextamhook: amtype;             {access method for serial devices}
  283.   
  284.   sysname[-574]: packed array[1..10] of char; 
  285.   
  286.   sysflag[-302]: packed record
  287.     reserved1, reserved2, nointhpib, crtconfigreg, 
  288.     nokeyboard, highlightsxorbiggraphics, biggraphics,
  289.     alpha50: boolean; 
  290.     end; 
  291.  
  292.   sysflag2[hex('FFFFFEDA')]: packed record    {extend to 8 digits SFB 4/26/85}
  293.                              pad7to1    : 0..127;
  294.                              prompresent: boolean;
  295.                            end;
  296.                            
  297.   endsysvars : shortint;   {must be last thing
  298.                             in SYSGLOBALS}
  299.   
  300.  
  301. end.
  302.  
  303.