DIRECTORY CD, CDDirectory, CDGenerate, CDMenus, CDProperties, CDRemote, CDSequencer, FileNames, PW, Rope, TerminalIO; CDBringoverCmds: CEDAR PROGRAM IMPORTS CDDirectory, CDGenerate, CDMenus, CDProperties, CDRemote, FileNames, PW, Rope, TerminalIO SHARES CDRemote = BEGIN ROPE: TYPE = Rope.ROPE; libraryProp: ATOM _ PW.RegisterProp[$CDBringoverLibraryName, TRUE]; deleteProp: ATOM _ $CDBringoverDelete; Bringover: PROC [comm: CDSequencer.Command] = { libFullFileName: ROPE _ TerminalIO.RequestRope["Library Name: "]; libFileName: ROPE _ GetNamePart[libFullFileName]; libDesign: CD.Design _ PW.OpenDesign[libFullFileName]; ForEachLibOb: CDDirectory.EachEntryAction = { targetFound: BOOL; targetOb: CD.Object; libObProp: ROPE _ NARROW[CDProperties.GetObjectProp[ob, libraryProp]]; [targetFound, targetOb] _ CDDirectory.Fetch[comm.design, name]; IF targetFound THEN { outRope: ROPE; targetObProp: ROPE _ NARROW[CDProperties.GetObjectProp[targetOb, libraryProp]]; IF targetObProp=NIL THEN outRope _ Rope.Cat["Object ", name, " from this design: "] ELSE outRope _ Rope.Cat["Object ", name, " from library ", targetObProp, ": "]; IF Rope.Equal[libObProp, targetObProp, FALSE] OR Rope.Equal[libFileName, targetObProp, FALSE] OR TerminalIO.Confirm["Replace it?", outRope] THEN { copyOfLibOb: CD.Object _ CDRemote.Get[comm.design, libDesign.name, name]; IF libObProp=NIL THEN PutLibraryName[copyOfLibOb, libFileName]; CDDirectory.ReplaceObject[comm.design, targetOb, copyOfLibOb]; MarkToBeDeleted[targetOb]; TerminalIO.WriteRopes["Replacing ", name, "\n"]; }; } ELSE { copyOfLibOb: CD.Object _ CDRemote.Get[comm.design, libDesign.name, name]; PutLibraryName[copyOfLibOb, libFileName]; TerminalIO.WriteRopes["Adding ", name, "\n"]; } }; SaveChildrenOfUnMarked: CDDirectory.EachEntryAction = { SaveChild: CDDirectory.EnumerateObjectsProc = { CDProperties.PutObjectProp[me, deleteProp, NIL] }; IF CDProperties.GetObjectProp[ob, deleteProp]=NIL THEN CDDirectory.EnumerateChildObjects[ob, SaveChild]; }; DeleteIfMarked: CDDirectory.EachEntryAction = { IF CDProperties.GetObjectProp[ob, deleteProp]#NIL THEN [] _ CDDirectory.Remove[comm.design, name, ob] }; FixNameIfLibraryObject: CDDirectory.EachEntryAction = { newName: ROPE; IF CDProperties.GetObjectProp[ob, libraryProp]=NIL THEN RETURN; newName _ Rope.Substr[name, 0, Rope.Index[name, 0, "@"]]; IF ~Rope.Equal[newName, name] THEN [] _ CDDirectory.Rename[comm.design, ob, newName, FALSE] }; IF libDesign=NIL THEN {TerminalIO.WriteRope["** Error: File not found\n"]; RETURN}; CDGenerate.FlushAll[CDRemote.GetTable[libDesign.name], comm.design]; CDRemote.CacheDesign[comm.design, libDesign]; [] _ CDDirectory.Enumerate[libDesign, ForEachLibOb]; [] _ CDDirectory.Enumerate[comm.design, SaveChildrenOfUnMarked]; [] _ CDDirectory.Enumerate[comm.design, DeleteIfMarked]; [] _ CDDirectory.Enumerate[comm.design, FixNameIfLibraryObject]; TerminalIO.WriteRope["Bringover done\n"]; }; PutLibraryName: PROC [ob: CD.Object, name: ROPE] = { ForEachChild: CDDirectory.EnumerateObjectsProc = { CDProperties.PutObjectProp[me, libraryProp, name]; }; CDDirectory.EnumerateChildObjects[ob, ForEachChild]; CDProperties.PutObjectProp[ob, libraryProp, name]; }; MarkToBeDeleted: PROC [ob: CD.Object] = { ForEachChild: CDDirectory.EnumerateObjectsProc = { CDProperties.PutObjectProp[me, deleteProp, $foo]; }; CDDirectory.EnumerateChildObjects[ob, ForEachChild]; CDProperties.PutObjectProp[ob, deleteProp, $foo]; }; GetNamePart: PROC [fileName: ROPE] RETURNS [name: ROPE] = { name _ FileNames.GetShortName[fileName]; name _ Rope.Substr[name, 0, Rope.Index[name, 0, "."]]; }; CDMenus.ImplementEntryCommand[menu: $IOMenu, entry: "Bringover Library", p: Bringover, key: $Bringover, queue: doQueueAndMark]; END. CDBringoverCmds.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. Pradeep Sindhu March 27, 1986 2:39:47 pm PST Louis Monier February 7, 1986 7:45:03 pm PST Bertrand Serlet June 16, 1986 4:42:09 pm PDT This property indicates that the object it hangs on comes from a library. The property's value is the name part of the library file. Ie, if the file name is "Foo.dale", the property value is "Foo". This property is used to mark objects to be deleted. Public functions Initialization Κκ– "cedar" style˜codešœ™Kšœ Οmœ7™BK™,K™,K™,—K™šΟk œ˜ KšžœTžœ˜k—K˜•StartOfExpansion[]šΟbœžœž˜KšžœFžœ˜aKšžœ ˜Kšœž˜K˜Kšžœžœžœ˜K˜šœ žœžœ'žœ˜CJšœΕ™Ε—šœ žœ˜&Jšœ4™4—Ihead™K˜šΟn œžœ ˜/Kšœžœ,˜AKšœ žœ ˜1Kšœ žœ žœ˜6šΠbn œ!˜-Kšœ žœ˜Kšœ žœ˜Kšœ žœžœ.˜FKšœ?˜?šžœ ˜šžœ˜Kšœ žœ˜Kšœž œ4˜Ošžœž˜Kšžœ;˜?KšžœK˜O—š žœ%žœžœ'žœžœ+˜‹šžœ˜Jšœ žœ:˜IKšžœ žœžœ*˜?Jšœ>˜>J˜Jšœ0˜0J˜——Kšœ˜—šžœ˜Kšœ žœ:˜IKšœ)˜)Jšœ-˜-K˜——K˜—šŸœ!˜7šŸ œ&˜/Kšœ+žœ˜/K˜—šžœ,ž˜1Kšžœ2˜6—K˜—šŸœ!˜/šžœ,ž˜1Kšžœ/˜3—K˜—šŸœ!˜7Kšœ žœ˜Kšžœ-žœžœžœ˜?Kšœ9˜9šžœž˜"Jšœ2žœ˜8—J˜—K˜Kšžœ žœžœ6žœ˜SKšœD˜DKšœ-˜-Kšœ4˜4Kšœ@˜@K˜8K˜@Jšœ)˜)K˜—K˜K˜š œžœžœžœ˜4šŸ œ&˜2Kšœ2˜2K˜—Kšœ4˜4Kšœ2˜2K˜K˜—š œžœžœ ˜)šŸ œ&˜2Kšœ1˜1K˜—Kšœ4˜4Kšœ1˜1K˜K˜—š   œžœ žœžœžœ˜;Kšœ(˜(Kšœ6˜6K˜—K˜Lšœ™Kšœ˜Kšžœ˜K˜——…—š†