procedure(fixm_tolegal(lib) ;_Sep 7 01 sikand 1146
let((dbad xim libid x y yim legallibs ydbad copysrc status)
libid=ddGetObj(lib)
;; get all the headers
legallibs = list("locked" lib)
foreach( libcell libid~>cells
foreach(viewcell libcell~>views
x=dbOpenCellView(lib libcell~>name viewcell~>name nil "r" nil)
xim=x~>instHeaders
ddd = xim
dbad=setof(xx xim !member(xx~>libName legallibs))
when(dbad
printf("%s %s\n" libcell~>name viewcell~>name)
y=dbOpenCellView(lib libcell~>name viewcell~>name nil "a" nil)
yim=y~>instHeaders
ydbad=setof(yy yim !member(yy~>libName legallibs))
foreach( thing ydbad
if( viewcell~>name == "schematic" then
foreach( inst thing~>instances
println
;;schReplaceProperty( list(inst) "libName" to_lib )
)
else
foreach( inst thing~>instances
printf("Badness: (%s) %s %s\n" thing~>libName inst~>name thing~>cellName)
;; look for existence in self
lookup = ddGetObj(lib thing~>cellName thing~>viewName "*")
if( lookup then
printf("Replacing with master from %s\n" lib)
leReplaceAnyInstMaster(inst lib thing~>cellName thing~>viewName)
else
printf("Copying in\n")
copysrc=dbOpenCellView( thing~>libName thing~>cellName thing~>viewName nil "r" nil )
if( copysrc then
status = dbCopyCellView(copysrc lib thing~>cellName thing~>viewName "" nil nil)
unless( status
error("Copy failed")
)
leReplaceAnyInstMaster(inst lib thing~>cellName thing~>viewName)
else
error("Could not locate copy source object!")
) ; ** if copysrc **
) ; ** if lookup **
;;leReplaceAnyInstMaster(inst to_lib thing~>cellName thing~>viewName)
)
)
) ; ** foreach thing **
dbSave(y)
dbClose(y)
) ; ** when dbad **
) ; ** foreach viewcell **
) ; ** foreach libcell **
) ; ** let **
t
) ; ** procedure fixm **