DIRECTORY Basics, CedarProcess, FS, FSBackdoor, IO, MakeDo, PrincOpsUtils, Process, RedBlackTree, Rope, UserProfile, ViewerClasses, ViewerIO; MakeDoFiles: CEDAR PROGRAM IMPORTS CedarProcess, FS, FSBackdoor, MakeDo, Rope, UserProfile EXPORTS MakeDo = BEGIN OPEN MakeDo; fileClass: PUBLIC NodeClass _ DeclareNodeClass[ name: "file", CanonizeName: CannonizeFileName, GetTime: GetFileTime ]; CannonizeFileName: PROC [random: ROPE] RETURNS [canonical: ROPE] = { full: ROPE; cp: FS.ComponentPositions; [full, cp] _ FS.ExpandName[random]; canonical _ full.Substr[len: cp.ext.start + cp.ext.length]; }; GetFileTime: PUBLIC PROC [n: Node] RETURNS [created: Time] --GetTimeProc-- = BEGIN name: ROPE = n.PublicPartsOfNode[].name; [created: created] _ FS.FileInfo[name !FS.Error => {created _ notExistTime; CONTINUE}]; END; fsWatchEnabled: BOOL _ TRUE; logFSWatch: BOOL _ FALSE; firstLocal: REF READONLY FSBackdoor.CreateEvent _ NIL; firstRemote: REF READONLY FSBackdoor.RemoteEvent _ NIL; WatchFSLocal: PROC [REF ANY] RETURNS [REF ANY _ NIL] = { ce: REF READONLY FSBackdoor.CreateEvent _ NIL; WHILE fsWatchEnabled DO ce _ FSBackdoor.NextCreateEvent[ce]; IF logFSWatch AND firstLocal=NIL THEN firstLocal _ ce; {ENABLE ABORTED => CONTINUE; n: Node _ GetNode[ce.fName, fileClass, FALSE]; IF n # NIL THEN { SuspectNodeChange[n]; }; }; ENDLOOP; ce _ ce; }; WatchFSRemote: PROC [REF ANY] RETURNS [REF ANY _ NIL] = { re: REF READONLY FSBackdoor.RemoteEvent _ NIL; WHILE fsWatchEnabled DO re _ FSBackdoor.NextRemoteEvent[re]; IF logFSWatch AND firstRemote=NIL THEN firstRemote _ re; {ENABLE ABORTED => CONTINUE; n: Node _ GetNode[re.fName, fileClass, FALSE]; IF n # NIL THEN { SuspectNodeChange[n]; }; }; ENDLOOP; re _ re; }; localWatcher, remoteWatcher: CedarProcess.Process; NoteProfile: PROC [reason: UserProfile.ProfileChangeReason] --UserProfile.ProfileChangedProc-- = { logFSWatch _ UserProfile.Boolean["MakeDo.LogFSWatch", FALSE]; }; Start: PROC = { UserProfile.CallWhenProfileChanges[NoteProfile]; localWatcher _ CedarProcess.Fork[action: WatchFSLocal, options: [inheritProperties: TRUE]]; remoteWatcher _ CedarProcess.Fork[action: WatchFSRemote, options: [inheritProperties: TRUE]]; }; Start[]; END. ¨MakeDoFiles.Mesa Last Edited by: Spreitzer, February 18, 1986 2:55:19 pm PST FileViewerOps.WaitUntilSaved[fileName: n.name, feedBack: GetCommanderHandle[].err]; Κk– "cedar" style˜code™J™;—K˜KšΟk œœœ[˜K˜šΠbx œœ˜Kšœœ'˜?Kšœ˜Kšœ˜—K˜Kšœœ˜K˜šœ œ˜/K˜ Kšœ ˜ K˜K˜—K˜š Οnœœ œœ œ˜DKšœœ˜ Kšœœ˜Kšœ œ˜#K˜;K˜—K˜š Ÿ œœœ œΟcœ˜LKš˜Kšœœ˜(KšœS™Sšœœœ ˜2Kšœœ˜$—Kšœ˜—K˜Kšœœœ˜Kšœ œœ˜Kšœ œœœ˜6Kšœ œœœ˜7K˜šŸ œœœœœœœœ˜8Kšœœœœ˜.šœ˜K˜$Kšœ œ œœ˜6Kšœœœœ˜Kšœ'œ˜.šœœœ˜Kšœ˜Kšœ˜—K˜Kšœ˜—K˜K˜—K˜šŸ œœœœœœœœ˜9Kšœœœœ˜.šœ˜Kšœ$˜$Kšœ œ œœ˜8Kšœœœœ˜Kšœ'œ˜.šœœœ˜Kšœ˜Kšœ˜—K˜Kšœ˜—Kšœ˜K˜—K˜Kšœ2˜2K˜šŸ œœ* #œ˜bKšœ6œ˜=K˜—K˜šŸœœ˜Kšœ0˜0KšœTœ˜[KšœVœ˜]K˜—K˜K˜K˜Kšœ˜—…—ž ±