procedure(fixm_uniq(lib) ;_Sep 7 01 sikand 1146 prog((dbad xim libid x y yim legallibs ydbad copysrc status utable ulibid cvid matchname obj) libid=ddGetObj(lib) ;; get all the headers uniqlib= "locked" when( lib == uniqlib println("Duh!") return(t) ) ;; check instances for references that should come from the ;; unique reference library ;; create a table of cell names in the uniq library utable = makeTable("uniq" nil) deltable = makeTable("deltable" nil) ulibid = ddGetObj(uniqlib) foreach( libcell ulibid~>cells foreach(viewcell libcell~>views cvid=dbOpenCellView(uniqlib libcell~>name viewcell~>name nil "r" nil) utable[strcat(lib " " libcell~>name " " viewcell~>name)] = cvid ) ) ; ** foreach libcell ** foreach( libcell libid~>cells foreach(viewcell libcell~>views printf("Check %s %s\n" libcell~>name viewcell~>name) x=dbOpenCellView(lib libcell~>name viewcell~>name nil "r" nil) xim=x~>instHeaders ddd = xim dbad=setof(xx xim utable[strcat(xx~>libName " " xx~>cellName " " xx~>viewName)]) when(dbad printf("Modify %s %s\n" libcell~>name viewcell~>name) y=dbOpenCellView(lib libcell~>name viewcell~>name nil "a" nil) yim=y~>instHeaders ydbad=setof(yy yim utable[strcat(yy~>libName " " yy~>cellName " " yy~>viewName)]) foreach( thing ydbad if( viewcell~>name == "schematic" then foreach( inst thing~>instances println("Unsupported for no real reason") ;;schReplaceProperty( list(inst) "libName" to_lib ) ) else foreach( inst thing~>instances printf("Fix %s [%s->%s] %s %s\n" inst~>name thing~>libName uniqlib thing~>cellName thing~>viewName) leReplaceAnyInstMaster(inst uniqlib thing~>cellName thing~>viewName) ;; now delete the cell name so it exists only ;; in the uniq ;; but put it in a table for post-proc so ;; you don't damage the DB obj = ddGetObj(lib thing~>cellName thing~>viewName "*") unless( obj warn("Obj trap!") ) deltable[obj] = t ) ; ** foreach inst ** ) ; ** if viewcell ** ) ; ** foreach thing ** dbSave(y) dbClose(y) ) ; ** when dbad ** ) ; ** foreach viewcell ** ) ; ** foreach libcell ** xxx = deltable delfile = outfile(sprintf(nil "%s.deleteme" lib)) unless( delfile error("Couldn't write\n") ) printf("Begin delete loop\n") foreach( entry deltable~>? println(entry~>writePath) ;;fprintf(delfile entry~>writePath) ;;ddDeleteObj(entry) ) close(delfile) ) ; ** let ** t ) ; ** procedure fixm **