Listing: 1 IMPLEMENTATION MODULE DirManager; 2 (* 3 * REPERTOIRE 4 * Release 1.6 5 * By Charles Bradford and Cole Brecheen 6 * (c) Copyright 1985-1992 PMI 7 * Green Bay, Wisconsin 8 * All rights reserved 9 * (414) 468-6040 10 * 11 * $Header: D:/logfiles/mods/dirmanag.mov 1.5 10 Mar 1991 15:26:24 coleb $ 12 * 13 *) 14 15 16 IMPORT ControlUtils; 17 IMPORT Drectory; 18 IMPORT ErrStrgs; 19 IMPORT InputManager; 20 IMPORT FramePainter; 21 IMPORT M2Strings; 22 IMPORT PosUtils; 23 IMPORT ScrnTypes; 24 IMPORT ScrnUtl1; 25 IMPORT StrConv; 26 IMPORT StrEdit; 27 IMPORT StringIO; 28 29 30 VAR 31 Initialized : BOOLEAN; 32 33 PROCEDURE Init(); 34 BEGIN 35 IF Initialized THEN 36 RETURN; 37 ELSE 38 Initialized := TRUE; 39 END; 40 ControlUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 41 Drectory.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 42 ErrStrgs.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 InputManager.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 FramePainter.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 45 M2Strings.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 PosUtils.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 47 ScrnTypes.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 48 ScrnUtl1.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 49 StrConv.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 StrEdit.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 StringIO.Init(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 END Init; ***** ^ not supported yet 53 54 55 PROCEDURE MakeFileDataStr( FileInfo: Drectory.FileInfoRec; Columns: ***** ^ not supported yet 56 CARDINAL; VAR TheStr: ARRAY OF CHAR ); ***** ^ not supported yet 57 VAR 58 dumstr: ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 59 BEGIN 60 StrEdit.AssignStr( FileInfo.name, TheStr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 61 M2Strings.Concat(' ',TheStr,TheStr); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 IF Columns > 1 THEN 63 WHILE M2Strings.Length(TheStr) < 12 DO ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 64 StrEdit.Append( TheStr, ' ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 65 END; 66 IF Drectory.SubdirectoryFile IN FileInfo.attribute THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 67 StrEdit.Append( TheStr, ' ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 68 ELSE 69 StrConv.LongIntegerToStr( FileInfo.size, 8, dumstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 70 StrEdit.Append( TheStr, dumstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 71 END; 72 END; 73 IF Columns > 2 THEN 74 StrConv.DateToStr( FileInfo.month, FileInfo.day, FileInfo.year, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 75 dumstr ); ***** ^ not supported yet 76 StrEdit.Append( TheStr, ' ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 77 StrEdit.Append( TheStr, dumstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 78 END; 79 IF Columns > 3 THEN 80 StrConv.TimeToStr( FileInfo.hour, FileInfo.minute, FileInfo.second, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 81 FileInfo.second, dumstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 M2Strings.Delete( dumstr, M2Strings.Length(dumstr) - 7, 6 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 83 StrEdit.Append( TheStr, ' ' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 84 StrEdit.Append( TheStr, dumstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 85 END; 86 END MakeFileDataStr; ***** ^ not supported yet 87 88 PROCEDURE DirToFrame( FileSpec: ARRAY OF CHAR; TheFrame: ***** ^ not supported yet 89 ScrnTypes.DisplayFrame; ColumnsPerFile: CARDINAL ): CARDINAL; ***** ^ not supported yet 90 VAR 91 lngth1, VertSep, HorizSep, NextCol, NextRow: CARDINAL; 92 DirHandle, SavedMessage: CARDINAL; 93 InfoRec: Drectory.FileInfoRec; ***** ^ not supported yet 94 tmpstr: ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 95 LastCh: CHAR; 96 97 PROCEDURE AddOne( VAR TheStr: ARRAY OF CHAR; VAR col, row: ***** ^ not supported yet 98 CARDINAL ); 99 VAR 100 width: CARDINAL; 101 BEGIN 102 ControlUtils.AddMenuItem( TheFrame, col, row, TheStr, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 M2Strings.Length(TheStr), 0, TheFrame^.normlnext ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 104 IF ColumnsPerFile > 1 THEN 105 width := M2Strings.Length(TheStr) + HorizSep; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 106 ELSE 107 width := 12 + HorizSep; 108 END; 109 INC( col, width ); ***** ^ undeclared identifier ***** ^ not supported yet 110 IF (col + width) > (TheFrame^.endcol ***** ^ not supported yet ***** ^ not supported yet 111 + 1) THEN 112 col := HorizSep; 113 INC( row, VertSep ); ***** ^ undeclared identifier ***** ^ not supported yet 114 END; 115 END AddOne; ***** ^ not supported yet 116 117 BEGIN 118 (*DirToFrame*) 119 VertSep := 1; 120 HorizSep := 4; 121 NextCol := HorizSep; 122 NextRow := VertSep + TheFrame^.headline; ***** ^ not supported yet ***** ^ not supported yet 123 StrEdit.DeleteChar( ' ', FileSpec ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 124 lngth1 := M2Strings.Length( FileSpec ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 125 IF lngth1 > 0 THEN 126 LastCh := FileSpec[ lngth1 - 1 ]; ***** ^ not supported yet ***** ^ not supported yet 127 ELSE 128 LastCh := ':'; 129 END; 130 CASE LastCh OF 131 ':', '\', '/': StrEdit.Append( FileSpec, '*.*' ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 132 ELSE 133 (*do nothing*) 134 END; 135 DirHandle := 1; 136 SavedMessage := Drectory.FindFirstFile( FileSpec, DirHandle, InfoRec ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 137 IF SavedMessage # StringIO.NoError THEN ***** ^ not supported yet ***** ^ not supported yet 138 IF SavedMessage = StringIO.NoMoreFiles THEN ***** ^ not supported yet ***** ^ not supported yet 139 SavedMessage := StringIO.FileNotFound; ***** ^ not supported yet ***** ^ not supported yet 140 END; 141 ErrStrgs.NumToStr( SavedMessage, tmpstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 142 M2Strings.Insert( 'Error: ', tmpstr, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 143 AddOne( tmpstr, NextCol, NextRow ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 144 RETURN SavedMessage; 145 END; 146 WHILE SavedMessage = StringIO.NoError DO ***** ^ not supported yet ***** ^ not supported yet 147 MakeFileDataStr( InfoRec, ColumnsPerFile, tmpstr ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 148 AddOne( tmpstr, NextCol, NextRow ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 149 SavedMessage := Drectory.FindNextFile( DirHandle, InfoRec ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 150 END; 151 RETURN StringIO.NoError; ***** ^ not supported yet ***** ^ not supported yet 152 END DirToFrame; ***** ^ not supported yet 153 154 PROCEDURE ControlDirectory( FileSpec: ARRAY OF CHAR; ***** ^ not supported yet 155 TheFrame: ScrnTypes.DisplayFrame; ColumnsPerFile: CARDINAL; ***** ^ not supported yet 156 VAR SelectedFile: ARRAY OF CHAR; VAR NextFrame: ***** ^ not supported yet 157 ScrnTypes.AFrameName ); ***** ^ not supported yet 158 VAR 159 SavedMessage: CARDINAL; 160 TmpName: ScrnTypes.AFrameName; ***** ^ not supported yet 161 spot: CARDINAL; 162 DriveLetter: CHAR; 163 PathName: ARRAY [0..127] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 164 ImageRec: ScrnTypes.ImageElement; ***** ^ not supported yet 165 166 BEGIN 167 Drectory.GetDrivePathAndName( FileSpec, DriveLetter, PathName, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 168 SelectedFile ); ***** ^ not supported yet 169 SavedMessage := DirToFrame( FileSpec, TheFrame, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 170 ColumnsPerFile ); ***** ^ not supported yet 171 FramePainter.ShowDisplayFrame( TheFrame, 0, 0, 0, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 172 InputManager.ControlFrame( TheFrame, 1, '', FALSE, TmpName ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 173 ScrnUtl1.GetFieldImageRec( TheFrame, TheFrame^.CurrentField, ImageRec ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 174 StrEdit.AssignStr( ImageRec.text, SelectedFile ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 175 IF HIGH(SelectedFile) > 12 THEN ***** ^ undeclared identifier ***** ^ not supported yet 176 SelectedFile[13]:=0C ***** ^ not supported yet ***** ^ not supported yet 177 END; 178 StrEdit.DeleteChar( ' ', SelectedFile ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 179 IF M2Strings.Length(SelectedFile) > 0 THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 180 M2Strings.Insert( PathName, SelectedFile, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 181 M2Strings.Insert( ':', SelectedFile, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 182 M2Strings.Insert( DriveLetter, SelectedFile, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 183 END; 184 M2Strings.Assign( TmpName, NextFrame ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 185 END ControlDirectory; ***** ^ not supported yet 186 187 188 PROCEDURE OldControlDirectory( FileSpec: ARRAY OF CHAR; ***** ^ not supported yet 189 TheFrame: ScrnTypes.DisplayFrame; ColumnsPerFile: CARDINAL; ***** ^ not supported yet 190 VAR SelectedFile: ARRAY OF CHAR ): ScrnTypes.FrameKey; ***** ^ not supported yet ***** ^ not supported yet 191 VAR 192 NextFrame: ScrnTypes.AFrameName; ***** ^ not supported yet 193 BEGIN 194 ControlDirectory( FileSpec, TheFrame, ColumnsPerFile, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 195 SelectedFile, NextFrame ); ***** ^ not supported yet ***** ^ not supported yet 196 RETURN StrConv.ReturnedInt(NextFrame); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 197 END OldControlDirectory; ***** ^ not supported yet 198 199 BEGIN 200 Initialized := FALSE; 201 Init(); ***** ^ not supported yet ***** ^ not supported yet 202 END DirManager. ***** ^ not supported yet 273 errors