File: sysglobals.imp

package info (click to toggle)
p2c 1.21alpha2-1
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 1,996 kB
  • ctags: 3,399
  • sloc: ansic: 38,617; pascal: 2,499; makefile: 213; perl: 101
file content (302 lines) | stat: -rw-r--r-- 13,046 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302


{IncludeFrom=sysglobals <p2c/sysglobals.h>}


{*VarStrings=1} {*ExportSymbol=}


module sysglobals;  

export 

type fsidctype = packed array[1..20] of char; 
const 
  fsidc = fsidctype['Rev.  3.1  18-Jul-85'];   
                             (*20 CHARS: VERSION,DATE,TIME OF FILE SYS*)
  mminint = -32768;          (*MINIMUM SHORT INTEGER VALUE*)
  mmaxint =  32767;          (*MAXIMUM SHORT INTEGER VALUE*)
  maxunit = 50;              (*MAXIMUM PHYSICAL UNIT NUMBER*)
  passleng = 16;             (*NUMBER OF CHARS IN A PASSWORD*)
  vidleng = 16;              (*NUMBER OF CHARS IN A VOLUME NAME*)
  tidleng = 16;              (*NUMBER OF CHARS IN A FILE TITLE*)
  fidleng = 120;             (*NUMBER OF CHARS IN FILE NAME*)
  fblksize = 512;            (*STANDARD FILE BUFFER LENGTH*)
  maxsc=63;                  (*LARGEST SELECT CODE *)
  minlevel=1;                (*LOWEST INTERRUPT LEVEL*)
  maxlevel=6;                (*LARGEST MASKABLE INTERRUPT LEVEL*)
      
  
type  

  byte = 0..255; 
  shortint = mminint..mmaxint;  
  ipointer = ^integer;
  charptr = ^char;
  textpntr = ^text; 
  string80 = string[80];
  string255 = string[255];
  suffixtype = string[5];
  string255ptr = ^string255; 

                                                              
  unitnum = 0..maxunit; 
  vid = string[vidleng]; 
  tid = string[tidleng];
  fid = string[fidleng];
  passtype = string[passleng];

  filekind = (untypedfile,      {directory entry} 
              badfile,          {bad blocks}
              codefile,         {executable or linkable}
              textfile,         {UCSD format text with editor environment}
              asciifile,        {L.I.F. ASCII format text strings}
              datafile,         {file of  <data type, e.g. char, integer,etc.>}
              sysfile,          {system (BOOT) file}
     fkind7,  fkind8,  fkind9,  
     fkind10, fkind11, fkind12, 
     fkind13, fkind14, lastfkind);      {reserved for future expansion}

  
                                                           (*FILE INFORMATION*)

window = packed array [0..maxint] of char;
windowp = ^window;


fibp = ^fib;

amrequesttype = (readbytes, writebytes, flush, writeeol, readtoeol, clearunit, 
          setcursor, getcursor, startread, startwrite, unitstatus, seekeof); 
amtype = procedure (fp: fibp; request: amrequesttype; 
                           anyvar buffer: window; bufsize, position: integer); 
eotproc = procedure(fp: fibp); 

fib = packed record 
           fwindow: windowp;                         (*BUFFER VARIABLE...F^ *)
           flistptr: fibp;                            (* LIST OF OPEN FILES *)
       {declaration and type information}
           frecsize: integer;                 (* SIZE OF ONE LOGICAL RECORD *)
           feft: shortint;                            (* EXTERNAL FILE TYPE *)
           fkind: filekind;                                    (* FILE KIND *)
           fistextvar:  boolean;                  (* FILE IS LINE FORMATTED *)
           fbuffered:   boolean;               (* HAS 512 BYTE BLOCK BUFFER *)
           fanonymous: boolean;                         (* FILE HAS NO NAME *)
           fisnew:  boolean;                (* WAS CREATED THIS ASSOCIATION *)
           freadable, fwriteable: boolean;            (* FILE ACCESS RIGHTS *)
       {state information}
           freadmode, fbufvalid: boolean;         (*F^ AND LOOKAHEAD STATES *)
           feoln: boolean;                          (* F^ IS AN END OF LINE *) 
           feof: boolean;                 (* TRIED TO READ PAST END OF FILE *)
           fmodified: boolean;                     (* FILE HAS CHANGED SIZE *)
           fbufchanged: boolean;              (* BUFFER NEEDS TO BE WRITTEN *)
       {file size and position}
           fpos:  integer;           (* FILE POINTER, CURRENT FILE POSITION *)
           fleof: integer;         (*LOGICAL END OF FILE, CURRENT FILE SIZE *)
           fpeof: integer;        (*PHYSICAL END OF FILE, MAXIMUM FILE SIZE *)
       {buffering and low level formatting information}
           flastpos:  integer;                   (* FILE POSITION OF BUFFER *)
           freptcnt:  shortint;                  (* SPACE COMPRESSION COUNT *)
           am:  amtype;                              (*BUFFER METHOD MODULE *)
       {file association info}
           fstartaddress: integer;         (*EXECUTION ADDRESS IN BOOT FILE *)
           fvid: vid;                                        (* VOLUME NAME *)
           ffpw: passtype;                                 (* FILE PASSWORD *)
           ftid: tid;                                          (* FILE NAME *)
           pathid:  integer;     (* ADDITIONAL SYSTEM DEPENDENT INFORMATION *)
           fanonctr: shortint;                      (* TEMP FILE IDENTIFIER *)
           foptstring: string255ptr;               (* OPTIONAL STRING PARAM *)
       {byte block transfer information}
           fileid:  integer; (* START BYTE OF FILE, OR OTHER IDENTIFICATION *)
           fb0,fb1,                                 (* FOR FUTURE EXPANSION *)
           fnosrmtemp,                   (*TRUE IF NO SRM TEMP FILE CREATED *)
           fwaitonlock,                  (*TRUE IF SRM SHOULD WAIT FOR LOCK *)
           fpurgeoldlink,            (*TRUE IF OLD SRM LINK IS TO BE PURGED *)
           foverwritten,                    (*TRUE IF OPENED WITH OVERWRITE *)
           fsavepathid,               (*TRUE IF PATHID NOT UNIQUE TO FILEID *)
           flockable,                     (*TRUE IF FILE OPENED AS LOCKABLE *)
           flocked,                                (*TRUE IF FILE IS LOCKED *)
           fbusy        : boolean;               (*TRUE IF DRIVER IS ACTIVE *)
           funit        : unitnum;                   (*PHYSICAL UNIT NUMBER *)
           feot         : eotproc;         (*CALLED WHEN TRANSFER COMPLETES *)
           fxpos        : integer;                (* X POSITION FOR  GOTOXY *)
           fypos        : integer;                (* Y POSITION FOR  GOTOXY *)
           foldfileid   : integer;    (* FILEID FOR OLD SRM FILE ON REWRITE *)
       {for future expansion}
           fextra:  array[0..2] of integer;
           fextra2: shortint;
       {large miscellaneous fields sometimes present}
           case integer of 
             0: ( {minimal FIB ends here} );
             1: (ftitle:  fid);        (* FILE NAME, EXCEPT VOLUME AND SIZE *)
             2: (fbuffer: packed array [0..fblksize-1] of char); 
        end (*FIB*) ;


damrequesttype = (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); 
  
damtype = procedure (anyvar f: fib; unum:unitnum; request: damrequesttype); 
  
unitentry =  {unitable entry definition}
    packed record
      dam: damtype;                     {directory access method}
      tm:  amtype;                      {byte block transfer method}
      sc: byte;                         {select code}
      ba: byte;                         {bus address} 
      du: byte;                         {disc unit}  
      dv: byte;                         {disc volume}
      byteoffset: integer;              {physical starting byte of volume} 
      devid: integer;                   {identifier (Amigo identify sequence)} 
      uvid: vid;                        {volume id}
      dvrtemp: integer;                 {temp for driver use only; init to 0!}
      dvrtemp2: shortint;               {temp for driver use only; init to 0!}
      letter: char;                     {device specifier letter}
      offline,                          {unit absent or down flag}
      uisinteractive,                   {user can edit input}
      umediavalid,                      {medium not changed since last access}
      uuppercase:   boolean;            {volume name must be uppercased}
      uisfixed: boolean;                {fixed/removeable media flag}
      ureportchange: boolean;           {driver mode: report/ignore media change}
      pad: 0..1;                        {   (bit not used yet)  }
      case uisblkd: boolean of          {blocked volume flag}
        true: (umaxbytes: integer)      {volume size in bytes }
    end;  {unitentry}
    
unitabletype = array [unitnum] of unitentry;                   (*0 NOT USED*)
amtabletype  = array[filekind] of amtype; 
suftabletype = array[filekind] of suffixtype; 
efttabletype = array[filekind] of shortint; 

unitableptr     = ^unitabletype;
amtableptrtype  = ^amtabletype; 
suftableptrtype = ^suftabletype; 
efttableptrtype = ^efttabletype; 
  
  
iorsltwd = 
            { *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.}
             
             (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,
              {end marker} endioerrs);
  
proctype=procedure;
sctype=0..maxsc;
leveltype=minlevel..maxlevel;
pisrib = ^isrib;
isrproctype = procedure(isribptr: pisrib);
isrib = {isr information block}
   packed record
     intregaddr: charptr;       {interrupt register address}
     intregmask: byte;          {interrupt register mask}
     intregvalue: byte;         {interrupt register target value after masking}
     chainflag: boolean;        {chaining flag}
     proc: isrproctype;         {isr}
     link: pisrib;              {pointer to next isrib in linked list}
   end;
 
inttabletype = array [1..7] of pisrib;

action = procedure; 

daterec         = packed record
                    year        : 0..100;       (*100 IS TEMP DISK FLAG*)
                    day         : 0..31;        (*DAY OF MONTH*)
                    month       : 0..12;        (*0 ==> DATE NOT MEANINGFUL*)
                  end; 

timerec         = packed record
                    hour        : 0..23;
                    minute      : 0..59;
                    centisecond : 0..5999;
                  end; 
  
datetimerec     = packed record
                    date        : daterec;
                    time        : timerec;
                  end;

var
(*========= MANY OF THE FOLLOWING HAVE HARDCODED
            ADDRESSES IN COMPILER AND ELSEWHERE  =====*)
       
(*** ERROR RECOVERY  ***)
  sysescapecode:        shortint; 
  openfileptr:  anyptr; 
  recoverblock: anyptr; 
  
(*** MEMORY MANAGEMENT ***)
  heapmax:      anyptr; 
  heapbase:     anyptr; 
  
(*** I/O DRIVERS ***)
  sysioresult:          integer; 
  hardwarestatus:       integer;
  locklevel:      integer; 
  unitable: unitableptr;
  interrupttable: inttabletype;
  endisrhook:  integer;
  actionspending: integer; 
  
(*** FILE SYSTEM ***)
  gfiles: array[0..5] of textpntr;    
  {  [0] INPUT          [3] (unused)
     [1] OUTPUT         [4] LISTING 
     [2] KEYBOARD       [5] (unused)   }
  
  amtable:     amtableptrtype;                  {pointer to access methods }
  suffixtable: suftableptrtype;                 {pointer to list of suffixes}
  efttable:    efttableptrtype;                 {pointer to LIF file types}
  sysunit: integer;
  syvid,dkvid: vid;                           (*SYSUNIT VOLID & DEFAULT VOLID*)
  syslibrary: fid; 
  
  (*** DEBUGGER HOOK ***)
  debugger: procedure(p1, p2, p3: integer); 
  
  (*** CLEAR I/O HOOK ***)
  cleariohook : procedure;    
  
  perminttable: inttabletype;
  
  deferredaction: array[1..10] of action; 
  
  serialtextamhook: amtype;             {access method for serial devices}
  
  sysname[-574]: packed array[1..10] of char; 
  
  sysflag[-302]: packed record
    reserved1, reserved2, nointhpib, crtconfigreg, 
    nokeyboard, highlightsxorbiggraphics, biggraphics,
    alpha50: boolean; 
    end; 

  sysflag2[hex('FFFFFEDA')]: packed record    {extend to 8 digits SFB 4/26/85}
                             pad7to1    : 0..127;
                             prompresent: boolean;
                           end;
                           
  endsysvars : shortint;   {must be last thing
                            in SYSGLOBALS}
  

end.