home *** CD-ROM | disk | FTP | other *** search
- Program PickEdit;
-
- Uses
- Crt;
-
- Type
- NameRecord = Record
- CursorPos : Word;
- PickName : Array [1..80] of Char;
- End;
- NameArray = Record
- num : Word;
- size : Word;
- ar : Array [1..9] of NameRecord
- End;
- FileOrder = Record
- num : Word;
- size : Word;
- ar : Array [1..9] of Word;
- End;
- EditInfo = Record
- ScreenOffset : Byte;
- UpLeftOffset : Word;
- CursorColumn : Word;
- PlaceMarkers : Array [1..4] of Word;
- StartOfBlock : Word;
- EndOfBlock : Word;
- End;
- EditArray = Record
- num : Word;
- size : Word;
- ar : Array [1..9] of EditInfo;
- End;
- BlockInfo = Record
- StatusOfBlock : Word;
- DateTimeStamp : LongInt;
- End;
- BlockArray = Record
- num : Word;
- size : Word;
- ar : Array [1..9] of BlockInfo;
- End;
- PickItems = Record
- one : NameArray;
- two : FileOrder;
- three : EditArray;
- four : BlockArray;
- End;
-
- Var
- pf : File;
- pl : PickItems;
- nm : Byte;
-
- Function GetChoice : Byte;
- { This function will get the correct key press. It handles }
- { 0..9 and Q to quit and ESC to abort. A byte value for the }
- { key is returned. }
- Var
- ch : char;
- Begin
- Repeat
- ch := Upcase ( ReadKey );
- Until ( ch in ['1'..'9','Q',#27] ); { Check if key is ok }
- if ( ch = 'Q' ) Then { If QUIT key is pressed }
- GetChoice := 0
- else
- if ( ch = #27 ) Then { If ABORT key is pressed }
- GetChoice := $FF
- else
- GetChoice := Ord ( ch ) - Ord ( '1' ) + 1;
- End;
-
- Procedure ShowPick;
- { This procedure will display the names of the files in the pick }
- { list to the screen based on their order in the list. }
- Var
- loop,
- entry : Word;
- s : String;
- Begin
- ClrScr;
- For loop := 1 To 9 Do
- Begin
- entry := pl.Two.Ar[loop] + 1;
- Write ( loop, '. [ ', entry, '[ ' );
- s := pl.One.Ar[entry].PickName;
- s[0] := chr ( Pos ( #0, s ) - 1 );
- WriteLn ( s );
- End;
- End;
-
- Procedure ReadPickFile;
- { This file opens the TURBO.PCK file and reads the pertinent }
- { information. }
- Begin
- Assign ( pf, 'TURBO.PCK' );
- Reset ( pf, 1 );
- Seek ( pf, 39 ); { Seek to start of information }
- BlockRead ( pf, pl, SizeOf ( pl ) );
- End;
-
- Procedure DeletePick ( b : Byte );
- Var
- i,
- tmp : Word;
- Begin
- tmp := pl.Two.Ar[b]; { Store array list info }
- for i := b + 1 to 9 do { Delete item from array list }
- pl.Two.Ar[i-1] := pl.Two.Ar[i];
- pl.Two.Ar[9] := 9;
- b := tmp + 1;
- For i := 1 to 9 do { Decrement elements in array list }
- If ( pl.Two.Ar[i] > tmp ) Then
- Dec ( pl.Two.Ar[i] );
- For i := b + 1 To 9 Do { Reorganize the list to fill the }
- Begin { empty space in. }
- pl.One.Ar[i-1] := pl.One.Ar[i];
- pl.Three.Ar[i-1] := pl.Three.Ar[i];
- pl.Four.Ar[i-1] := pl.Four.Ar[i];
- FillChar ( pl.One.Ar[i], SizeOf ( pl.One.Ar[i] ), #0 );
- FillChar ( pl.Three.Ar[i], SizeOf ( pl.Three.Ar[i] ), #0 );
- FillChar ( pl.Four.Ar[i], SizeOf ( pl.Four.Ar[i] ), #0 );
- End;
- End;
-
- Procedure WritePickFile;
- { This procedure will update the TURBO.PCK file on the disk. }
- Begin
- Seek ( pf, 39 );
- BlockWrite ( pf, pl, SizeOf ( pl ) );
- End;
-
- Begin
- ReadPickFile;
- Repeat
- ShowPick;
- Write ( 'Enter the number of file to delete, "Q" to quit or ESC to abort.' );
- nm := GetChoice;
- If ( nm > 0 ) AND ( nm < $FF ) Then
- DeletePick ( nm );
- Until ( nm = 0 ) OR ( nm = $FF );
- If ( nm < $FF ) Then
- WritePickFile;
- Close ( pf );
- End.