-- PrintInUseFileNames.Mesa -- Last Modified By Paul Rovner On June 21, 1982 2:57 pm DIRECTORY RTTypesBasicPrivate USING[MapStiStd], DCSFileTypes USING [tLeaderPage], File USING [Capability, GetAttributes], FileIOPrivate USING [LeaderPage], Space USING [CopyIn, Create, Delete, Handle, LongPointer, Map, virtualMemory], SymbolTable USING [nullHandle], UserExec USING [GetExecHandle], IO USING[Handle, PutRope, PutChar]; PrintInUseFileNames: PROGRAM IMPORTS RTTypesBasicPrivate, IO, Space, File, UserExec = BEGIN OPEN RTTypesBasicPrivate; PrintFileName: PROC[file: File.Capability, out: IO.Handle] = { IF File.GetAttributes[file].type # DCSFileTypes.tLeaderPage THEN out.PutRope["file with no leader page\n"] ELSE {leaderSpace: Space.Handle = Space.Create[1, Space.virtualMemory]; leader: LONG POINTER TO FileIOPrivate.LeaderPage _ Space.LongPointer[leaderSpace]; Space.Map[leaderSpace]; Space.CopyIn[space: leaderSpace, window: [file, 0]]; FOR i: NAT IN [0..leader.nameLength) DO out.PutChar[leader.name[i]] ENDLOOP; out.PutChar['\n]; Space.Delete[leaderSpace]; }; }; DoIt: PROC = {out: IO.Handle = UserExec.GetExecHandle[].out; FOR i: NAT IN [0..MapStiStd.length) DO IF MapStiStd[i] # NIL THEN IF MapStiStd[i].sth # SymbolTable.nullHandle THEN PrintFileName[MapStiStd[i].sth.file, out]; ENDLOOP}; -- START HERE DoIt[]; END.