Listing: 1 MODULE Append; 2 3 IMPORT Drectory; 4 IMPORT HandleIO; 5 IMPORT StringIO; 6 IMPORT LowLevel; 7 IMPORT M2Strings; 8 IMPORT Numbers; 9 IMPORT NumTypes; 10 IMPORT EnvironUtils; 11 IMPORT VStorage; 12 (* 13 IMPORT InitJPI; 14 *) 15 16 PROCEDURE AppendToFile(OldHandle : CARDINAL; DestFileName : ARRAY OF CHAR) : ***** ^ not supported yet 17 CARDINAL; 18 TYPE 19 memptr = 20 RECORD 21 addr : LowLevel.Address8086; ***** ^ not supported yet 22 size : CARDINAL; 23 END; ***** ^ not supported yet 24 VAR 25 TheDrive : CHAR; 26 MemoryPtr : memptr; ***** ^ not supported yet 27 NewHandle : CARDINAL; 28 SavedMessage : CARDINAL; 29 FreeBytes, FileSize, DestSize, BytesToRead : LONGINT; 30 31 PROCEDURE ReadOldFile(VAR MemoryPtr : memptr); 32 VAR 33 BytesAvailable : CARDINAL; 34 rgstr : LowLevel.regpack; ***** ^ not supported yet 35 BEGIN 36 (*ReadOldFile*) 37 IF BytesToRead <= Numbers.Lc( 0 ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 38 MemoryPtr.addr.x := NIL; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 39 RETURN; 40 END; 41 BytesAvailable := EnvironUtils.MemAvail( 10000); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 42 WITH MemoryPtr DO ***** ^ not supported yet 43 IF BytesToRead > Numbers.Lc( BytesAvailable ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 size := BytesAvailable; ***** ^ not supported yet ***** ^ incompatible assignment 45 ELSE 46 size := Numbers.C( BytesToRead ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 47 END; 48 VStorage.DosAlloc(addr.a, size); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 49 rgstr.c.x := size; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 (*CX gets number of bytes to read.*) 51 rgstr.a.h := CHR(3FH); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 52 (*DOS Read From file Code*) 53 rgstr.b.x := OldHandle; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 54 rgstr.d.x := addr.off; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 55 rgstr.ds := addr.seg; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 56 END; ***** ^ not supported yet 57 LowLevel.msdos(rgstr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 58 IF LowLevel.FlaggedError(rgstr.flags) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 59 StringIO.PrintMessage(StringIO.MessageType(rgstr.a.l)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 60 ELSE 61 BytesToRead := BytesToRead - Numbers.Lc( MemoryPtr.size ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 (* Can't use DEC here because JPI doesn't allow LONGINTs 63 to be decremented by CARDINAL values. *) 64 END; 65 END ReadOldFile; ***** ^ not supported yet 66 67 PROCEDURE WriteNewFile(MemoryPtr : memptr); 68 VAR 69 rgstr : LowLevel.regpack; ***** ^ not supported yet 70 BEGIN 71 (*WriteNewFile*) 72 IF MemoryPtr.addr.x=NIL THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 73 RETURN; 74 END; 75 rgstr.b.x := NewHandle; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 76 rgstr.c.x := MemoryPtr.size; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 77 rgstr.ds := MemoryPtr.addr.seg; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 78 rgstr.d.x := MemoryPtr.addr.off; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 79 rgstr.a.h := CHR(40H); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 80 (*Write to a file or device.*) 81 LowLevel.msdos(rgstr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 IF rgstr.a.x FreeBytes THEN 115 SavedMessage := StringIO.AccessDenied; ***** ^ not supported yet ***** ^ not supported yet 116 (*This will have to stand for 'Not enough room.'*) 117 RETURN SavedMessage; 118 END; 119 HandleIO.SetFilePtr( NewHandle, HandleIO.FromEnd, NumTypes.L0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 120 IF SavedMessage # StringIO.NoError THEN ***** ^ not supported yet ***** ^ not supported yet 121 RETURN SavedMessage; 122 END; 123 REPEAT 124 ReadOldFile(MemoryPtr); ***** ^ not supported yet ***** ^ not supported yet 125 WriteNewFile(MemoryPtr); ***** ^ not supported yet ***** ^ not supported yet 126 UNTIL BytesToRead <= Numbers.Lc( 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 127 RETURN HandleIO.CloseHandle(NewHandle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 128 END AppendToFile; ***** ^ not supported yet 129 130 131 VAR 132 fname1, fname2: ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 133 OldHandle : CARDINAL; 134 135 BEGIN 136 IF NOT EnvironUtils.ParsedParam( 1, fname1 ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 137 StringIO.WriteStr( StringIO.outp, 'Dest file: ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 138 StringIO.ReadStr( StringIO.inp, fname1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 139 END; 140 IF NOT EnvironUtils.ParsedParam( 2, fname2 ) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 141 StringIO.WriteStr( StringIO.outp, 'Srce file: ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 142 StringIO.ReadStr( StringIO.inp, fname2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 143 END; 144 IF HandleIO.OpenFile( OldHandle, fname2 ) = StringIO.NoError THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 145 IF AppendToFile( OldHandle, fname1 ) = StringIO.NoError THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 146 IF HandleIO.CloseHandle( OldHandle ) = StringIO.NoError THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 147 StringIO.PrintMessage( Drectory.DeleteFile( fname2 ) ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 148 END; 149 ELSE 150 StringIO.WriteStr( StringIO.outp, 'Could not append to ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 151 StringIO.WriteStr( StringIO.outp, fname1 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 152 END; 153 ELSE 154 StringIO.WriteStr( StringIO.outp, fname2 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 155 StringIO.WriteStr( StringIO.outp, ' not found.' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 156 END; 157 END Append. 242 errors