P11V4 VERSION APRIL 77 1978-03-29 13:43:25.5 PAGE 1 INSTRUCTIONCOUNT -LOCATIONCOUNT -000002 1 (*$R-*) -000002 2 program UnixTPInput ( TTY ); -000002 3 -000002 4 const Issuc = 1; -000002 5 Ieeof = 246; -000002 6 Ieeov = 245; -000002 7 BuffMax = 1024; -000002 8 MTlun = 7; -000002 9 -000002 10 type Buffer = packed array [0..1023] of CHAR; -000002 11 FileString = packed array [0..12] of CHAR; -000002 12 PathString = packed array [0..31] of CHAR; -000002 13 Gcmlbuf = packed array [0..79] of CHAR; -000002 14 TapeStatus = record Count,DSW:Integer end; -000002 15 Entry = record -000002 16 Path:Pathstring; -000002 17 Mode:Integer; -000002 18 UG :Integer; -000002 19 HSize:Integer; -000002 20 LSize:Integer; -000002 21 Time:packed array [0..3] of Char; -000002 22 Taddr:Integer; -000002 23 Unused:packed array [0..17] of Char -000002 24 end; -000002 25 Direct = array [0..7] of Entry; -000002 26 -000002 27 var Buff:Buffer; Result:TapeStatus; -002006 28 Fubar:file of char; -002366 29 Block:Integer; -002370 30 FileName:FileString; -002406 31 Pathname:PathString; -002446 32 I,IDX,INDEX:Integer; -002454 33 J:Integer; -002456 34 Directory:Direct; -003456 35 DirCount:Integer; -003460 36 CH:Char; -003462 37 Address,TSize,Size:Integer; -003470 38 Continue:Boolean; -003472 39 Found:Boolean; -003474 40 Length:Integer; -003476 41 GcmlData : GcmlBuf; -003616 42 -003616 43 procedure MTinit( Lun,MTlun,Charac:Integer; var Statis:TapeStatus );Extern; -000002 44 procedure MTrewd( Lun:Integer; var Statis:TapeStatus );Extern; -000002 45 procedure MTunld( Lun:Integer; var Statis:TapeStatus );Extern; -000002 46 procedure MTctrf( Lun,MaxRec:Integer; var Statis:TapeStatus );Extern; -000002 47 procedure MTread( Lun:Integer; var Buf:Buffer; MaxBC:Integer; -000002 48 var Statis:TapeStatus );Extern; -000002 49 procedure MTrdir( Lun:Integer; var Dir:Direct; MaxBC:Integer; -000002 50 var Statis:TapeStatus );Extern; -000002 51 procedure GCML( var Line:GcmlBuf; var Len:Integer);Extern; -000002 52 -000002 53 procedure Initialize; -000002 54 P11V4 VERSION APRIL 77 1978-03-29 13:43:25.5 PAGE 2 -000002 55 begin 000000 56 MTinit( MTlun, 0, 0, Result ); 000050 57 if Result.DSW <> Issuc then begin 000074 58 Writeln( TTY, 'Error accessing tape unit.'); Break; 000174 59 Continue := False 000174 60 end 000202 61 else Continue := True; 000216 62 if Continue then begin 000232 63 MTrewd( MTlun, Result ); 000252 64 MTctrf( MTlun, 1, Result ); (* First TP block is boot image. *) 000276 65 MTrdir( MTlun, Directory, BuffMax, Result ); (* Read first directory *) 000330 66 Block := 2; (* Current block number. *) 000340 67 DirCount := 2; (* Next directory number. *) 000350 68 Found := False; 000356 69 GCML(GcmlData,Length); 000400 70 I := 0; 000406 71 J := 0; 000414 72 while GcmlData[I] <> ' ' do I :=SUCC(I); 000472 73 I := SUCC(I); 000504 74 while GcmlData[I] <> '=' do begin 000546 75 FileName[J] := GcmlData[I]; 000610 76 I := SUCC(I); 000622 77 J := SUCC(J); 000634 78 end; 000636 79 I := SUCC(I); 000650 80 for J := I to Length do PathName[J-I] := GcmlData[J]; 000762 81 PathName[Length-I+1] := CHR(0) 001014 82 end 001020 83 end; (* Initialize *) 000000 84 000000 85 procedure ReadUnixTape; 000000 86 000000 87 begin 000000 88 MTctrf( MTlun, Address-Block, Result ); 000056 89 Block := Address; 000066 90 while Size<0 do begin 000110 91 Size := size - 512; 000126 92 TSize := TSize + 2 000132 93 end; 000146 94 while Size>0 do begin 000170 95 MTread( MTlun, Buff, BuffMax, Result ); 000222 96 INDEX:=Result.Count-1 000226 97 if INDEX>Size then INDEX:=Size-1; 000302 98 for I:=0 to INDEX do if Buff[I]=chr(10) then Writeln(Fubar) 000410 99 else Write(Fubar,Buff[I]); 000460 100 Block := SUCC(Block); 000472 101 if TSize>0 then TSize := TSize-2 000520 102 else Size := Size - 512 000542 103 end; 000560 104 Writeln(Fubar) 000572 105 end; (* ReadUnixTape *) 000000 106 000000 107 function Match( var S1,S2:PathString):Boolean; 000000 108 var Index:Integer; -000004 109 begin 000000 110 Index := 0; P11V4 VERSION APRIL 77 1978-03-29 13:43:25.5 PAGE 3 000032 111 while (S1[Index]=S2[Index]) and (Index<32) do Index := SUCC(Index); 000142 112 if (Index=32) or (S1[Index]=S2[Index]) then 000234 113 Match := True 000234 114 else 000250 115 Match := False 000250 116 end; (* Match *) 000000 117 000000 118 begin 000000 119 Initialize; 000050 120 if Result.DSW <> Issuc then Continue := False; 000102 121 while Continue do begin 000116 122 IDX := 0; 000124 123 while Continue and (IDX<8) do 000160 124 if Match(Directory[IDX].Path,PathName) then 000232 125 begin 000232 126 Address := Directory[IDX].Taddr; 000270 127 Size := Directory[IDX].LSize; 000326 128 TSize := Directory[IDX].HSize; 000364 129 Rewrite(Fubar,FileName); 000426 130 ReadUnixTape; 000434 131 Found := True; 000444 132 Continue := False 000444 133 end 000452 134 else 000456 135 IDX := SUCC(IDX); 000472 136 (* end while loop *) 000472 137 MTrewd( Mtlun, Result ); 000512 138 if Continue then begin 000526 139 MTctrf( Mtlun, Dircount, Result); 000552 140 MTrdir( Mtlun, Directory, BuffMax, Result ); 000604 141 DirCount := SUCC(DirCount); 000616 142 Block := DirCount; 000626 143 if Result.DSW=Issuc then Continue := True 000652 144 else Continue := False; 000674 145 if DirCount = 10 then Continue := False 000720 146 end 000726 147 end; 000732 148 MTrewd( Mtlun, Result ); 000752 149 if Found then Writeln(TTY, 'Unix TP Input proram exiting...') 001062 150 else Writeln(TTY, 'Input file not found...'); 001152 151 Break 001152 152 end. 000000 153 NO ERROR DETECTED TOTAL PROGRAM SIZE 003310 OUTERMOST DATA SIZE 003616 RESERVED STACK & HEAP 006262