| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- 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<rgstr.c.x THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 83 (*if fewer than c.x bytes were actually written*)
- 84 SavedMessage := HandleIO.CloseHandle(NewHandle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 85 StringIO.WriteEol(StringIO.outp, '');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 86 StringIO.WriteStr(StringIO.outp, 'No room.');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 87 HALT();
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 88 END;
- 89 VStorage.DosDealloc(MemoryPtr.addr.x, MemoryPtr.size);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 90 END WriteNewFile;
- ***** ^ not supported yet
- 91
- 92 BEGIN
- 93 (*AppendToFile*)
- 94 DestSize := Numbers.Lc( 0 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 95 FileSize := HandleIO.FileLength(OldHandle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 96 BytesToRead := FileSize;
- 97 IF M2Strings.Pos(':',DestFileName)=(1) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 98 TheDrive := DestFileName[0];
- ***** ^ not supported yet
- ***** ^ not supported yet
- 99 ELSE
- 100 TheDrive := 'Z';
- 101 (*Determines the drive to which we're copying.
- 102 'Z' means "default drive" to FreeDiskSpace.*)
- 103 END;
- 104 SavedMessage := Drectory.FreeDiskSpace(TheDrive,FreeBytes);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 105 IF SavedMessage # StringIO.NoError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 106 RETURN SavedMessage;
- 107 END;
- 108 SavedMessage := HandleIO.OpenFile(NewHandle,DestFileName);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 109 IF SavedMessage = StringIO.NoError THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 110 DestSize := HandleIO.FileLength(NewHandle);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 111 ELSE
- 112 RETURN SavedMessage;
- 113 END;
- 114 IF FileSize > 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
|