Category : Modula II Source Code
Archive   : FILETOO2.ZIP
Filename : TOOLCOMM.MOD

 
Output of file : TOOLCOMM.MOD contained in archive : FILETOO2.ZIP
IMPLEMENTATION MODULE ToolCommands;

(*
Title : TOOLCOMM.MOD
LastEdit : 01/04/88
Author : Russell G. Osterlund, Jr.
System : LOGITECH MODULA-2/86, REPERTOIRE, BlackBeard

This product has been developed with the use of, and embodies portions of,
LOGITECH software development tools - compiler, linker, and M2MAKE.

*)

FROM Strings IMPORT
Assign;
FROM Drectory IMPORT (* REPERTOIRE *)
FileMode;
FROM Drectory IMPORT (* REPERTOIRE *)
ChDir, SetDefaultDrive, GetDefaultDrive, GetCurrentDir;
FROM ToolUtilities IMPORT
InitDirectoryInfo, ReadInfo;
FROM ToolDisplay IMPORT
MaxDisplayLines,
DisplayInfo, DisplayFileLine, DisplaySummaryLine, NoErrorMsg;
FROM ToolTypes IMPORT
DirectoryRecPtr,
WindowType, ActiveWindow, BothWindowsActive;

PROCEDURE UpOneFile (directory: DirectoryRecPtr);
BEGIN
WITH directory^ DO
IF CurrentFile = 0 THEN
CurrentFile := NumberOfEntries;
IF NumberOfEntries + 1 < MaxDisplayLines THEN
FirstDisplayed := 0;
ELSE
FirstDisplayed := NumberOfEntries - MaxDisplayLines;
END;
DisplayInfo (directory, FirstDisplayed, TRUE);
ELSE
DEC (CurrentFile);
IF CurrentFile < FirstDisplayed THEN
FirstDisplayed := CurrentFile;
DisplayInfo (directory, FirstDisplayed, TRUE);
ELSE
DisplayFileLine (directory, CurrentFile + 1, TRUE);
DisplayFileLine (directory, CurrentFile, TRUE);
END;
END;
END;
DisplaySummaryLine (directory);
END UpOneFile;

PROCEDURE DownOneFile (directory: DirectoryRecPtr);
BEGIN
WITH directory^ DO
IF CurrentFile = NumberOfEntries THEN
CurrentFile := 0;
FirstDisplayed := 0;
IF NumberOfEntries + 1 <= MaxDisplayLines THEN
DisplayFileLine (directory, NumberOfEntries, TRUE);
DisplayFileLine (directory, CurrentFile, TRUE);
ELSE
DisplayInfo (directory, FirstDisplayed, TRUE);
END;
ELSE
INC (CurrentFile);
IF FirstDisplayed + MaxDisplayLines < CurrentFile THEN
INC (FirstDisplayed);
DisplayInfo (directory, FirstDisplayed, TRUE);
ELSE
DisplayFileLine (directory, CurrentFile - 1, TRUE);
DisplayFileLine (directory, CurrentFile, TRUE);
END;
END;
END;
DisplaySummaryLine (directory);
END DownOneFile;

PROCEDURE UpOnePage (directory: DirectoryRecPtr);
VAR
relpos: CARDINAL;
BEGIN
WITH directory^ DO
IF NumberOfEntries + 1 > MaxDisplayLines THEN (* > 1 page *)
relpos := CurrentFile - FirstDisplayed;
IF FirstDisplayed = 0 THEN
FirstDisplayed := NumberOfEntries - MaxDisplayLines;
ELSIF FirstDisplayed <= MaxDisplayLines THEN (* 1 .. MaxDisplayLines *)
FirstDisplayed := 0;
ELSE
FirstDisplayed := FirstDisplayed - MaxDisplayLines - 1;
END;
CurrentFile := FirstDisplayed + relpos;
DisplayInfo (directory, FirstDisplayed, TRUE);
DisplaySummaryLine (directory);
END;
END;
END UpOnePage;

PROCEDURE DownOnePage (directory: DirectoryRecPtr);
VAR
relpos: CARDINAL;
BEGIN
WITH directory^ DO
IF NumberOfEntries + 1 > MaxDisplayLines THEN (* > 1 page *)
relpos := CurrentFile - FirstDisplayed;
FirstDisplayed := FirstDisplayed + MaxDisplayLines + 1;
IF FirstDisplayed > NumberOfEntries THEN
FirstDisplayed := 0;
END;
CurrentFile := FirstDisplayed + relpos;
IF CurrentFile > NumberOfEntries THEN
CurrentFile := NumberOfEntries;
END;
DisplayInfo (directory, FirstDisplayed, TRUE);
DisplaySummaryLine (directory);
END;
END;
END DownOnePage;

PROCEDURE TopOfPage (directory: DirectoryRecPtr);
VAR
OldCurrent: CARDINAL;
BEGIN
WITH directory^ DO
OldCurrent := CurrentFile;
CurrentFile := FirstDisplayed;
DisplayFileLine (directory, OldCurrent, TRUE);
DisplayFileLine (directory, CurrentFile, TRUE);
END;
DisplaySummaryLine (directory);
END TopOfPage;

PROCEDURE BottomOfPage (directory: DirectoryRecPtr);
VAR
OldCurrent: CARDINAL;
BEGIN
WITH directory^ DO
OldCurrent := CurrentFile;
IF NumberOfEntries > FirstDisplayed + MaxDisplayLines - 1 THEN (* Full Page *)
CurrentFile := FirstDisplayed + MaxDisplayLines;
ELSE (* Last or Partial Page *)
CurrentFile := NumberOfEntries;
END;
DisplayFileLine (directory, OldCurrent, TRUE);
DisplayFileLine (directory, CurrentFile, TRUE);
END;
DisplaySummaryLine (directory);
END BottomOfPage;

PROCEDURE BeginningOfList (directory: DirectoryRecPtr);
BEGIN
WITH directory^ DO
CurrentFile := 0;
FirstDisplayed := 0;
DisplayInfo (directory, FirstDisplayed, TRUE);
END;
DisplaySummaryLine (directory);
END BeginningOfList;

PROCEDURE EndOfList (directory: DirectoryRecPtr);
BEGIN
WITH directory^ DO
CurrentFile := NumberOfEntries;
IF NumberOfEntries + 1 > MaxDisplayLines THEN
FirstDisplayed := NumberOfEntries - MaxDisplayLines;
ELSE
FirstDisplayed := 0;
END;
DisplayInfo (directory, FirstDisplayed, TRUE);
END;
DisplaySummaryLine (directory);
END EndOfList;

PROCEDURE TagCurrentFile (directory: DirectoryRecPtr);
BEGIN
WITH directory^ DO
WITH FileInfoArray [CurrentFile] DO
IF SubdirectoryFile IN FileAttribute THEN
ELSIF (FileName [0] = '.') OR (* special DOS *)
((FileName [0] = '.') AND (* directory *)
(FileName [1] = '.')) THEN (* files *)
ELSE
tagged := NOT (tagged);
IF tagged THEN
INC (NumberTagged);
TaggedSize := TaggedSize + FileSize;
ELSE
DEC (NumberTagged);
TaggedSize := TaggedSize - FileSize;
END;
END;
END;
END;
DownOneFile (directory);
END TagCurrentFile;

PROCEDURE MoveUpOneLevel (directory: DirectoryRecPtr);
VAR
SaveMask: ARRAY [0 .. 11] OF CHAR;
BEGIN
WITH directory^ DO
WITH FileInfoArray [CurrentFile] DO
IF (FileName [0] = '.') AND
(FileName [1] = '.') THEN
IF NoErrorMsg (ChDir (FileName)) THEN
Assign (DirectoryMask, SaveMask);
InitDirectoryInfo (directory);
Assign (SaveMask, DirectoryMask);
IF NoErrorMsg (GetCurrentDir (GetDefaultDrive (), DirectoryPath)) THEN
ReadInfo (directory);
IF (FileInfoArray [1] . FileName [0] = '.') AND
(FileInfoArray [1] . FileName [1] = '.') THEN
DisplayInfo (directory, 1, TRUE);
ELSE
DisplayInfo (directory, 0, TRUE);
END;
END;
END;
END;
END;
END;
END MoveUpOneLevel;

PROCEDURE MoveDownOneLevel (directory: DirectoryRecPtr);
VAR
SaveMask: ARRAY [0 .. 11] OF CHAR;
BEGIN
WITH directory^ DO
WITH FileInfoArray [CurrentFile] DO
IF (SubdirectoryFile IN FileAttribute) AND
(FileName [0] # '.') THEN
IF NoErrorMsg (ChDir (FileName)) THEN
Assign (DirectoryMask, SaveMask);
InitDirectoryInfo (directory);
Assign (SaveMask, DirectoryMask);
IF NoErrorMsg (GetCurrentDir (GetDefaultDrive (), DirectoryPath)) THEN
ReadInfo (directory);
DisplayInfo (directory, 1, TRUE);
END;
END;
END;
END;
END;
END MoveDownOneLevel;

PROCEDURE ActivateNewWindow (window: WindowType;
LeftDirectory,
RightDirectory: DirectoryRecPtr);
BEGIN
IF window = LeftWindow THEN
IF BothWindowsActive THEN
ActiveWindow := RightWindow;
DisplayFileLine (RightDirectory, RightDirectory^ . CurrentFile, FALSE);
END;
ActiveWindow := LeftWindow;
SetDefaultDrive (LeftDirectory^ . DirectoryDrive);
IF NoErrorMsg (ChDir (LeftDirectory^ . DirectoryPath)) THEN
DisplayFileLine (LeftDirectory, LeftDirectory^ . CurrentFile, TRUE);
END;
ELSE (* window = RightWindow *)
IF BothWindowsActive THEN
ActiveWindow := LeftWindow;
DisplayFileLine (LeftDirectory, LeftDirectory^ . CurrentFile, FALSE);
ActiveWindow := RightWindow;
SetDefaultDrive (RightDirectory^ . DirectoryDrive);
IF NoErrorMsg (ChDir (RightDirectory^ . DirectoryPath)) THEN
DisplayFileLine (RightDirectory, RightDirectory^ . CurrentFile, TRUE);
END;
END;
END;
END ActivateNewWindow;

BEGIN
END ToolCommands.


  3 Responses to “Category : Modula II Source Code
Archive   : FILETOO2.ZIP
Filename : TOOLCOMM.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/