;;; SCL is short for SKILL Code Library ;;; Lint wants you to prefix custom procedures, if you don't, you won't be able to get a high score... procedure( SCLCreateToolboxMenuCIW() ;;; ;;; Make sure this procedure is loaded somewhere! ;;; Normally done in .tools.init ;;; let( ( ( alreadyOnBanner nil ) isMember menuPosition menus dummyItem ) ;;; To be able to create a menu, at least one item must be added to this menu. ;;; This item will be removed when more items are added. ;;; For an example see the code in file SCLBatchRenameReRefCellView.il dummyItem = hiCreateMenuItem( ?name 'dummyItem ?itemText "Dummy Menu Item" ?callback "printf(\"Dummy Menu Item clicked...\\n\")" ?statusTip "Dummy Menu Item" ) ;;; Create a menu that includes the dummy menu item... hiCreateMenu( 'ToolboxMenuCIW "Toolbo&x" list( dummyItem ) ) ;;; In case there's already a menu with the same name, remove it and then add this new one... isMember = member( 'ToolboxMenuCIW hiGetBannerMenus( hiGetCIWindow() ) ) when( length( isMember ) > 0 alreadyOnBanner = t menuPosition = hiGetNumMenus( hiGetCIWindow() ) - length( isMember ) ) ;;; end of when when( alreadyOnBanner hiDeleteBannerMenu( hiGetCIWindow() menuPosition ) ) ;;; end of when ;;; Now put up the new menu numMenus = hiGetNumMenus( hiGetCIWindow() ) hiInsertBannerMenu( hiGetCIWindow() 'ToolboxMenuCIW hiGetNumMenus( hiGetCIWindow() ) ) ) ;;; end of let ) ;;; end of procedure SCLCreateToolboxMenuCIW ;;; Here the Toolbox menu is added to the CIW... SCLCreateToolboxMenuCIW() ;;; BRRC is short for Batch Rename Rereference Cellview... procedure( SCLAddBRRCBuildGuiToToolboxMenuCIW() ;;; The underscore (_) signals LINT that this argument is not used. ;;; ;;; Make sure this procedure is loaded somewhere! ;;; Normally done in .tools.init ;;; let( ( ( SCLBRRCMenuItem nil ) ( retVal nil ) ) if( boundp( 'ToolboxMenuCIW ) then unless( ToolboxMenuCIW->SCLBRRCMenuItem SCLBRRCMenuItem = hiCreateMenuItem( ?name 'SCLBRRCMenuItem ?itemText "&Rename Cells and Re-reference" ;;; The ampersand (&) specifies which letter will be the access key (and underlines it) ?callback "SCLBRRCBuildGui()" ?statusTip "This opens the GUI to rename (and re-reference) one or many cells/views at once." ) hiAddMenuItem( ToolboxMenuCIW SCLBRRCMenuItem ) ) ;;; end of unless when( ToolboxMenuCIW->dummyItem hiDeleteMenuItem( ToolboxMenuCIW 'dummyItem ) ) ;;; end of when retVal = ToolboxMenuCIW->SCLBRRCMenuItem else warn( "SCLAddBRRCBuildGuiToToolboxMenuCIW - Something went wrong creating the menu item.") ) ;;; end of if retVal ) ;;; end of let ) ;;; end of procedure SCLAddBRRCBuildGuiToToolboxMenuCIW ;;; Here the Toolbox Menu Item is added to the menu... SCLAddBRRCBuildGuiToToolboxMenuCIW() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; This is the procedure with which all starts... ;;; Building the GUI form... procedure( SCLBRRCBuildGui() let( ( ( theLibList nil ) ) theLibList = sort( ddGetLibList()~>name nil ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Creating the form fields... SCLBRRCEncloseAllFrameField = hiCreateFrameField( ?name 'SCLBRRCEncloseAllFrameField ) SCLBRRCActionsFrameField = hiCreateFrameField( ?name 'SCLBRRCActionsFrameField ?labelText " Actions to Perform " ) SCLBRRCActionsHint = hiCreateLabel( ?name 'SCLBRRCActionsHint ?labelText "To rename a cell or multiple cells, please enable both 'Copy to New (Target)' and 'Delete Originals (Source)', AND choose 'Same As Source' for the target library." ?justification 'left ?enabled t ) SCLBRRCCopyToNew = hiCreateBooleanButton( ?name 'SCLBRRCCopyToNew ?buttonText "Copy to New (Target):" ?buttonLocation 'right ?value t ?defValue t ?callback "SCLBRRCCopyToNewCB()" ?enabled t ) SCLBRRCRemoveSource = hiCreateBooleanButton( ?name 'SCLBRRCRemoveSource ?buttonText "Delete Originals (Source):" ?buttonLocation 'right ?value t ?defValue t ?enabled t ) SCLBRRCReRef = hiCreateBooleanButton( ?name 'SCLBRRCReRef ?buttonText "Re-Reference Instances:" ?buttonLocation 'right ?value t ?defValue t ?callback "SCLBRRCReRefInstancesCB()" ?enabled t ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; SOURCE SCLBRRCSourceFrameField = hiCreateFrameField( ?name 'SCLBRRCSourceFrameField ?labelText " Source Information " ) SCLBRRCFindSourceLibraries = hiCreateStringField( ?name 'SCLBRRCFindSourceLibraries ?prompt "Find Source Library(ies):" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFindSourceLibrariesCB" ?editable t ?enabled t ) SCLBRRCSelectSourceLibraries = hiCreateListBoxField( ?name 'SCLBRRCSelectSourceLibraries ?choices theLibList ?callback "SCLBRRCSelectSourceLibrariesCB()" ?prompt "Select Source Library(ies):" ?value nil ?defValue nil ?multipleSelect t ?enabled t ) SCLBRRCSelectAllSourceLibraries = hiCreateButton( ?name 'SCLBRRCSelectAllSourceLibraries ?buttonText "Select All Libraries" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceLibraries->value = SCLBRRCGuiForm->SCLBRRCSelectSourceLibraries->choices SCLBRRCSelectSourceLibrariesCB()" ?enabled t ) SCLBRRCInvertSourceLibraries = hiCreateButton( ?name 'SCLBRRCInvertSourceLibraries ?buttonText "Invert Library Selection" ?callback "let( ( ( temp nil ) ) foreach( item SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>choices unless( member( item SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value ) temp = append1( temp item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value = sort( temp nil ) ) SCLBRRCSelectSourceLibrariesCB()" ?enabled t ) SCLBRRCSelectNoneSourceLibraries = hiCreateButton( ?name 'SCLBRRCSelectNoneSourceLibraries ?buttonText "De-select All Libraries" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceLibraries->value = nil SCLBRRCEnableSourceViewsFields( nil ) SCLBRRCEnableSourceCellsFields( nil ) SCLBRRCEnableOKApply()" ?enabled t ) SCLBRRCFindSourceCells = hiCreateStringField( ?name 'SCLBRRCFindSourceCells ?prompt "Find Source Cell(s):" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFindSourceCellsCB" ?editable t ?enabled t ) SCLBRRCSelectSourceCells = hiCreateListBoxField( ?name 'SCLBRRCSelectSourceCells ?choices list( "Select Source Library(ies) First..." ) ?callback "SCLBRRCSelectSourceCellsCB()" ?prompt "Select Source Cell(s):" ?value nil ?defValue nil ?multipleSelect t ?enabled t ) SCLBRRCSelectAllSourceCells = hiCreateButton( ?name 'SCLBRRCSelectAllSourceCells ?buttonText "Select All Cells" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceCells->value = SCLBRRCGuiForm->SCLBRRCSelectSourceCells->choices SCLBRRCSelectSourceCellsCB()" ?enabled t ) SCLBRRCInvertSourceCells = hiCreateButton( ?name 'SCLBRRCInvertSourceCells ?buttonText "Invert Cell Selection" ?callback "let( ( ( temp nil ) ) foreach( item SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>choices unless( member( item SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value ) temp = append1( temp item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value = sort( temp nil ) ) SCLBRRCSelectSourceCellsCB()" ?enabled t ) SCLBRRCSelectNoneSourceCells = hiCreateButton( ?name 'SCLBRRCSelectNoneSourceCells ?buttonText "De-select All Cells" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceCells->value = nil SCLBRRCEnableSourceViewsFields( nil ) SCLBRRCEnableOKApply()" ?enabled t ) SCLBRRCFindSourceViews = hiCreateStringField( ?name 'SCLBRRCFindSourceViews ?prompt "Find Source Views:" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFindSourceViewsCB" ?editable t ?enabled t ) SCLBRRCSelectSourceViews = hiCreateListBoxField( ?name 'SCLBRRCSelectSourceViews ?choices list( "Select Source Cell(s) First..." ) ?callback "SCLBRRCSelectSourceViewsCB()" ?prompt "Select Source View(s):" ?value nil ?defValue nil ?multipleSelect t ?enabled t ) SCLBRRCSelectAllSourceViews = hiCreateButton( ?name 'SCLBRRCSelectAllSourceViews ?buttonText "Select All Views" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceViews->value = SCLBRRCGuiForm->SCLBRRCSelectSourceViews->choices SCLBRRCSelectSourceViewsCB()" ?enabled t ) SCLBRRCInvertSourceViews = hiCreateButton( ?name 'SCLBRRCInvertSourceViews ?buttonText "Invert View Selection" ?callback "let( ( ( temp nil ) ) foreach( item SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices unless( member( item SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value ) temp = append1( temp item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value = sort( temp nil ) ) SCLBRRCSelectSourceViewsCB()" ?enabled t ) SCLBRRCSelectNoneSourceViews = hiCreateButton( ?name 'SCLBRRCSelectNoneSourceViews ?buttonText "De-select All Views" ?callback "SCLBRRCGuiForm->SCLBRRCSelectSourceViews->value = nil SCLBRRCSelectSourceViewsCB()" ?enabled t ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; TARGET SCLBRRCTargetFrameField = hiCreateFrameField( ?name 'SCLBRRCTargetFrameField ?labelText " Target Information " ) SCLBRRCTargetChoice = hiCreateRadioField( ?name 'SCLBRRCTargetChoice ?choices list( "Same As Source" "Select Manually" ) ?prompt "Choose Target Library(ies):" ?value "Same As Source" ?defValue "Same As Source" ?enabled t ?callback list( "SCLBRRCTargetChoiceCB()" "SCLBRRCTargetChoiceCB()" ) ) SCLBRRCFindTargetLibraries = hiCreateStringField( ?name 'SCLBRRCFindTargetLibraries ?prompt "Find Target Library(ies):" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFindTargetLibrariesCB" ?editable t ?enabled t ) SCLBRRCSelectTargetLibraries = hiCreateListBoxField( ?name 'SCLBRRCSelectTargetLibraries ?choices theLibList ?callback "SCLBRRCSelectTargetLibrariesCB()" ?prompt "Select Target Library(ies):" ?value nil ?defValue nil ?multipleSelect t ?enabled t ) SCLBRRCSelectAllTargetLibraries = hiCreateButton( ?name 'SCLBRRCSelectAllTargetLibraries ?buttonText "Select All Libraries" ?callback "SCLBRRCGuiForm->SCLBRRCSelectTargetLibraries->value = SCLBRRCGuiForm->SCLBRRCSelectTargetLibraries->choices SCLBRRCSelectTargetLibrariesCB()" ?enabled t ) SCLBRRCInvertTargetLibraries = hiCreateButton( ?name 'SCLBRRCInvertTargetLibraries ?buttonText "Invert Library Selection" ?callback "let( ( ( temp nil ) ) foreach( item SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>choices unless( member( item SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value ) temp = append1( temp item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value = sort( temp nil ) ) SCLBRRCSelectTargetLibrariesCB()" ?enabled t ) SCLBRRCSelectNoneTargetLibraries = hiCreateButton( ?name 'SCLBRRCSelectNoneTargetLibraries ?buttonText "De-select All Views" ?callback "SCLBRRCGuiForm->SCLBRRCSelectTargetLibraries->value = nil SCLBRRCSelectTargetLibrariesCB()" ?enabled t ) SCLBRRCNoNameChange = hiCreateBooleanButton( ?name 'SCLBRRCNoNameChange ?buttonText "No name change (copy to different library(ies) only)" ?buttonLocation 'left ?value nil ?defValue nil ?callback "SCLBRRCNoNameChangeCB()" ?enabled t ) SCLBRRCFullNameReplace = hiCreateBooleanButton( ?name 'SCLBRRCFullNameReplace ?buttonText "Full Name Replacement" ?buttonLocation 'left ?value nil ?defValue nil ?callback "SCLBRRCFullNameReplaceCB()" ?enabled t ) SCLBRRCFullName = hiCreateStringField( ?name 'SCLBRRCFullName ?prompt "" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFullNameCB" ?editable nil ?enabled nil ) SCLBRRCAddPrefix = hiCreateBooleanButton( ?name 'SCLBRRCAddPrefix ?buttonText "Add Prefix To All (Source) Cells" ?buttonLocation 'left ?value nil ?defValue nil ?callback "SCLBRRCAddPrefixCB()" ?enabled t ) SCLBRRCPrefix = hiCreateStringField( ?name 'SCLBRRCPrefix ?prompt "" ?value "" ?defValue "" ?modifyCallback "SCLBRRCPrefixCB" ?editable nil ?enabled nil ) SCLBRRCAddPostfix = hiCreateBooleanButton( ?name 'SCLBRRCAddPostfix ?buttonText "Add Postfix To All (Source) Cells" ?buttonLocation 'left ?value nil ?defValue nil ?callback "SCLBRRCAddPostfixCB()" ?enabled t ) SCLBRRCPostfix = hiCreateStringField( ?name 'SCLBRRCPostfix ?prompt "" ?value "" ?defValue "" ?modifyCallback "SCLBRRCPostfixCB" ?editable nil ?enabled nil ) SCLBRRCAddRegExPart = hiCreateBooleanButton( ?name 'SCLBRRCAddRegExPart ?buttonText "Part-of-name Replacement For All (Source) Cells" ?buttonLocation 'left ?value nil ?defValue nil ?callback "SCLBRRCAddRegExPartCB()" ?enabled t ) SCLBRRCRegExOldPartLabel = hiCreateLabel( ?name 'SCLBRRCRegExOldPartLabel ?labelText "Old (part to replace, may be a regular expression):" ?justification 'left ?enabled t ) SCLBRRCRegExOldPart = hiCreateStringField( ?name 'SCLBRRCRegExOldPart ?prompt "" ?value "" ?defValue "" ?callback "SCLBRRCEnableOKApply()" ?editable nil ?enabled nil ) SCLBRRCRegExNewPartLabel = hiCreateLabel( ?name 'SCLBRRCRegExNewPartLabel ?labelText "New (the replacement part):" ?justification 'left ?enabled t ) SCLBRRCRegExNewPart = hiCreateStringField( ?name 'SCLBRRCRegExNewPart ?prompt "" ?value "" ?defValue "" ?callback "SCLBRRCEnableOKApply()" ?editable nil ?enabled nil ) SCLBRRCBeforeLabel = hiCreateLabel( ?name 'SCLBRRCBeforeLabel ?labelText "Before Rename:" ?justification 'left ?enabled t ) SCLBRRCAfterLabel = hiCreateLabel( ?name 'SCLBRRCAfterLabel ?labelText "After Rename:" ?justification 'left ?enabled t ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; REREF SCLBRRCReRefFrameField = hiCreateFrameField( ?name 'SCLBRRCReRefFrameField ?labelText " Re-reference Information " ) SCLBRRCFindReRefLibraries = hiCreateStringField( ?name 'SCLBRRCFindReRefLibraries ?prompt "Find Re-ref. Library(ies):" ?value "" ?defValue "" ?modifyCallback "SCLBRRCFindReRefLibrariesCB" ?editable t ?enabled t ) SCLBRRCSelectReRefLibraries = hiCreateListBoxField( ?name 'SCLBRRCSelectReRefLibraries ?choices theLibList ?callback "SCLBRRCSelectReRefLibrariesCB()" ?prompt "Select Re-ref. Library(ies):" ?value nil ?defValue nil ?multipleSelect t ?enabled t ) SCLBRRCSelectAllReRefLibraries = hiCreateButton( ?name 'SCLBRRCSelectAllReRefLibraries ?buttonText "Select All Libraries" ?callback "SCLBRRCGuiForm->SCLBRRCSelectReRefLibraries->value = SCLBRRCGuiForm->SCLBRRCSelectReRefLibraries->choices SCLBRRCSelectReRefLibrariesCB()" ?enabled t ) SCLBRRCInvertReRefLibraries = hiCreateButton( ?name 'SCLBRRCInvertReRefLibraries ?buttonText "Invert Library Selection" ?callback "let( ( ( temp nil ) ) foreach( item SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>choices unless( member( item SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value ) temp = append1( temp item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value = sort( temp nil ) ) SCLBRRCSelectReRefLibrariesCB()" ?enabled t ) SCLBRRCSelectNoneReRefLibraries = hiCreateButton( ?name 'SCLBRRCSelectNoneReRefLibraries ?buttonText "De-select All Libraries" ?callback "SCLBRRCGuiForm->SCLBRRCSelectReRefLibraries->value = nil SCLBRRCSelectReRefLibrariesCB()" ?enabled t ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; RUN SCLBRRCRunFrameField = hiCreateFrameField( ?name 'SCLBRRCRunFrameField ?labelText " Run settings " ) SCLBRRCOutputFileName = hiCreateStringField( ?name 'SCLBRRCOutputFileName ?prompt "Log output file name:" ?value "BatchRenameReRefCellView.rep" ?defValue "BatchRenameReRefCellView.rep" ?callback "SCLBRRCEnableOKApply()" ?editable t ?enabled t ) SCLBRRCOutputFileNameLabel1 = hiCreateLabel( ?name 'SCLBRRCOutputFileNameLabel1 ?labelText "Log-file will be opened after run completes." ?justification 'left ?enabled t ) SCLBRRCOverwrite = hiCreateToggleField( ?name 'SCLBRRCOverwrite ?choices list( list( 'overwrite "Overwrite Target Cell If It Exist." ) ) ?prompt "Write mode:" ?value '( nil ) ?defValue '( nil ) ?enabled t ) SCLBRRCPreview = hiCreateToggleField( ?name 'SCLBRRCPreview ?choices list( list( 'preview "No changes to database, log-file only." ) ) ?prompt "Preview mode (dry-run):" ?value '( t ) ?defValue '( t ) ?enabled t ) ;;;;;;;;;;;;;;;;;;;;;; ;;; Building the form... hiCreateAppForm( ?name 'SCLBRRCGuiForm ?formTitle "Batch Rename and Re-Reference Cells..." ?callback "SCLBRRCFormPostProcessing()" ?dontBlock t ?fields list( list( SCLBRRCEncloseAllFrameField 0:0 1350:815 0 ) list( SCLBRRCActionsFrameField 5:5 1340:75 0 ) list( SCLBRRCActionsHint 10:25 1300:20 150 ) list( SCLBRRCCopyToNew 15:50 435:20 150 ) list( SCLBRRCRemoveSource 460:50 435:20 150 ) list( SCLBRRCReRef 905:50 435:20 150 ) list( SCLBRRCSourceFrameField 5:90 1340:300 0 ) list( SCLBRRCFindSourceLibraries 15:105 435:25 147 ) list( SCLBRRCSelectSourceLibraries 15:135 435:250 150 ) list( SCLBRRCSelectAllSourceLibraries 15:165 135:25 150 ) list( SCLBRRCInvertSourceLibraries 15:195 135:25 150 ) list( SCLBRRCSelectNoneSourceLibraries 15:225 135:25 150 ) list( SCLBRRCFindSourceCells 460:105 435:25 147 ) list( SCLBRRCSelectSourceCells 460:135 435:250 150 ) list( SCLBRRCSelectAllSourceCells 460:165 135:25 150 ) list( SCLBRRCInvertSourceCells 460:195 135:25 150 ) list( SCLBRRCSelectNoneSourceCells 460:225 135:25 150 ) list( SCLBRRCFindSourceViews 905:105 435:25 147 ) list( SCLBRRCSelectSourceViews 905:135 435:250 150 ) list( SCLBRRCSelectAllSourceViews 905:165 135:25 150 ) list( SCLBRRCInvertSourceViews 905:195 135:25 150 ) list( SCLBRRCSelectNoneSourceViews 905:225 135:25 150 ) list( SCLBRRCTargetFrameField 5:400 890:325 0 ) list( SCLBRRCTargetChoice 15:417 435:25 147 ) list( SCLBRRCFindTargetLibraries 15:440 435:25 147 ) list( SCLBRRCSelectTargetLibraries 15:470 435:250 150 ) list( SCLBRRCNoNameChange 585:420 285:20 25 ) list( SCLBRRCFullNameReplace 585:445 285:20 25 ) list( SCLBRRCFullName 607:460 285:25 25 ) list( SCLBRRCAddPrefix 585:495 285:20 25 ) list( SCLBRRCPrefix 607:510 285:25 25 ) list( SCLBRRCAddPostfix 585:545 285:20 25 ) list( SCLBRRCPostfix 607:560 285:25 25 ) list( SCLBRRCAddRegExPart 585:595 285:20 25 ) list( SCLBRRCRegExOldPartLabel 605:615 285:25 25 ) list( SCLBRRCRegExOldPart 607:635 285:25 25 ) list( SCLBRRCRegExNewPartLabel 605:665 285:25 25 ) list( SCLBRRCRegExNewPart 607:685 285:25 25 ) list( SCLBRRCReRefFrameField 900:400 445:325 0 ) list( SCLBRRCFindReRefLibraries 905:415 435:25 147 ) list( SCLBRRCSelectReRefLibraries 905:445 435:275 150 ) list( SCLBRRCSelectAllReRefLibraries 905:475 135:25 150 ) list( SCLBRRCInvertReRefLibraries 905:505 135:25 150 ) list( SCLBRRCSelectNoneReRefLibraries 905:535 135:25 150 ) list( SCLBRRCRunFrameField 5:735 1340:75 0 ) list( SCLBRRCOutputFileName 10:750 435:25 147 ) list( SCLBRRCOutputFileNameLabel1 155:780 435:20 150 ) list( SCLBRRCOverwrite 460:753 435:25 150 ) list( SCLBRRCPreview 905:753 435:25 150 ) ) ;;; end list ?fields ?buttonLayout list( 'OKCancelApply ) ;;; end list ?buttonLayout ?buttonDisabled list( 'OK 'Apply 'Help ) ?unmapAfterCB t ?initialSize 2000:1000 ) ;;; end hiCreateAppForm ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; Set defaults... SCLBRRCEnableTargetLibrariesFields( nil ) SCLBRRCEnableSourceViewsFields( nil ) SCLBRRCEnableSourceCellsFields( nil ) SCLBRRCEnableSourceLibrariesFields( t ) SCLBRRCHiDisplayForm( SCLBRRCGuiForm 125:125 ) SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = t SCLBRRCEnableOKApply() ) ;;; end let ) ;;; end procedure SCLBRRCBuildGui ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCFormPostProcessing() let( ( ( fromLibNameList nil ) ( fromCellNameList nil ) ( fromViewNameListChoices nil ) ( toLibNameList nil ) ( toCellNameList nil ) ( regExpList nil ) ( rename nil ) ( deleteOrigin nil ) ( overwriteDestination nil ) ( reRef nil ) ( reRefLibNameList nil ) ( fromViewNameList nil ) ( nestChanges nil ) ( reportFileName nil ) ( preview nil ) ( regExOldPart nil ) ( regExNewPart nil ) ) fromLibNameList = SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value fromCellNameList = SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value toLibNameList = SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value rename = SCLBRRCGuiForm~>SCLBRRCCopyToNew~>value deleteOrigin = SCLBRRCGuiForm~>SCLBRRCRemoveSource~>value overwriteDestination = car( SCLBRRCGuiForm~>SCLBRRCOverwrite~>value ) reRef = SCLBRRCGuiForm~>SCLBRRCReRef~>value reRefLibNameList = SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value fromViewNameList = SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value reportFileName = SCLBRRCGuiForm~>SCLBRRCOutputFileName~>value preview = car( SCLBRRCGuiForm~>SCLBRRCPreview~>value ) regExOldPart = SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value regExNewPart = SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value for( i 1 length( fromCellNameList ) toCellNameList = append1( toCellNameList regExNewPart ) regExpList = append1( regExpList regExOldPart ) ) ;;; end of for i fromViewNameListChoices = SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices when( !car( SCLDiffOfLists( fromViewNameList fromViewNameListChoices ) ) && !car( last( SCLDiffOfLists( fromViewNameList fromViewNameListChoices ) ) ) fromViewNameList = nil ) ;;; end of when SCLBatchRenameReRefCellView( fromLibNameList fromCellNameList toLibNameList toCellNameList regExpList rename deleteOrigin overwriteDestination reRef reRefLibNameList fromViewNameList nestChanges reportFileName preview ) ;;; Be nice... t ) ;;; end of let ) ;;; end of procedure SCLBRRCFormPostProcessing ;;;;;;;;;;;;;;;;;;;;;; ;;; The following procedures are used to enable or disable certain fields of the form. procedure( SCLBRRCCopyToNewCB() let( ( ( copySwitchState nil ) ) copySwitchState = SCLBRRCGuiForm~>SCLBRRCCopyToNew~>value if( copySwitchState then SCLBRRCGuiForm~>SCLBRRCRemoveSource~>enabled = t SCLBRRCGuiForm~>SCLBRRCReRef~>enabled = t SCLBRRCGuiForm~>SCLBRRCTargetChoice~>enabled = t SCLBRRCGuiForm~>SCLBRRCOverwrite~>enabled = t else SCLBRRCGuiForm~>SCLBRRCRemoveSource~>value = nil SCLBRRCGuiForm~>SCLBRRCRemoveSource~>enabled = nil SCLBRRCGuiForm~>SCLBRRCReRef~>value = nil SCLBRRCGuiForm~>SCLBRRCReRef~>enabled = nil SCLBRRCGuiForm~>SCLBRRCTargetChoice~>value = SCLBRRCGuiForm~>SCLBRRCTargetChoice~>defValue SCLBRRCGuiForm~>SCLBRRCTargetChoice~>enabled = nil SCLBRRCGuiForm~>SCLBRRCOverwrite~>value = list( nil ) SCLBRRCGuiForm~>SCLBRRCOverwrite~>enabled = nil ) ;;; end of if ) ;;; end of let ) ;;; end of procedure SCLBRRCCopyToNewCB procedure( SCLBRRCReRefInstancesCB() let( ( ( rerefSwitchState nil ) ) rerefSwitchState = SCLBRRCGuiForm~>SCLBRRCReRef~>value if( rerefSwitchState then SCLBRRCGuiForm~>SCLBRRCFindReRefLibraries~>enabled = t SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>enabled = t SCLBRRCGuiForm~>SCLBRRCSelectAllReRefLibraries~>enabled = t SCLBRRCGuiForm~>SCLBRRCInvertReRefLibraries~>enabled = t SCLBRRCGuiForm~>SCLBRRCSelectNoneReRefLibraries~>enabled = t else SCLBRRCGuiForm~>SCLBRRCFindReRefLibraries~>value = "" SCLBRRCGuiForm~>SCLBRRCFindReRefLibraries~>enabled = nil SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value = nil SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>enabled = nil SCLBRRCGuiForm~>SCLBRRCSelectAllReRefLibraries~>enabled = nil SCLBRRCGuiForm~>SCLBRRCInvertReRefLibraries~>enabled = nil SCLBRRCGuiForm~>SCLBRRCSelectNoneReRefLibraries~>enabled = nil ) ;;; end of if SCLBRRCEnableOKApply() ) ;;; end of let ) ;;; end of procedure SCLBRRCReRefInstancesCB procedure( SCLBRRCEnableSourceLibrariesFields( enable ) SCLBRRCGuiForm~>SCLBRRCFindSourceLibraries~>editable = enable SCLBRRCGuiForm~>SCLBRRCFindSourceLibraries~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectAllSourceLibraries~>enabled = enable SCLBRRCGuiForm~>SCLBRRCInvertSourceLibraries~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectNoneSourceLibraries~>enabled = enable ) ;;; end of procedure SCLBRRCEnableSourceLibrariesFields procedure( SCLBRRCEnableSourceCellsFields( enable ) unless( enable SCLBRRCGuiForm~>SCLBRRCFindSourceCells~>value = SCLBRRCGuiForm~>SCLBRRCFindSourceCells~>defValue SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value = SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>defValue SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>choices = list( "Select Source Library(ies) First..." ) ) ;;; end of unless SCLBRRCGuiForm~>SCLBRRCFindSourceCells~>editable = enable SCLBRRCGuiForm~>SCLBRRCFindSourceCells~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectAllSourceCells~>enabled = enable SCLBRRCGuiForm~>SCLBRRCInvertSourceCells~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectNoneSourceCells~>enabled = enable ) ;;; end of procedure SCLBRRCEnableSourceCellsFields procedure( SCLBRRCEnableSourceViewsFields( enable ) unless( enable SCLBRRCGuiForm~>SCLBRRCFindSourceViews~>value = SCLBRRCGuiForm~>SCLBRRCFindSourceViews~>defValue SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value = SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>defValue SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices = list( "Select Source Cell(s) First..." ) ) ;;; end of unless SCLBRRCGuiForm~>SCLBRRCFindSourceViews~>editable = enable SCLBRRCGuiForm~>SCLBRRCFindSourceViews~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectAllSourceViews~>enabled = enable SCLBRRCGuiForm~>SCLBRRCInvertSourceViews~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectNoneSourceViews~>enabled = enable ) ;;; end of procedure SCLBRRCEnableSourceViewsFields procedure( SCLBRRCEnableTargetLibrariesFields( enable ) unless( enable SCLBRRCGuiForm~>SCLBRRCFindTargetLibraries~>value = SCLBRRCGuiForm~>SCLBRRCFindTargetLibraries~>defValue SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value = nil ) ;;; end of unless SCLBRRCGuiForm~>SCLBRRCFindTargetLibraries~>enabled = enable SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>enabled = enable ) ;;; end of procedure SCLBRRCEnableTargetLibrariesFields procedure( SCLBRRCEnableOKApply() let( ( reRef selectReRefLibraries selectSourceLibraries selectSourceCells targetChoices targetChoice selectTargetLibraries regExOldPart outputFileName ( proceed t ) ) reRef = SCLBRRCGuiForm~>SCLBRRCReRef~>value selectReRefLibraries = SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value selectSourceLibraries = SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value selectSourceCells = SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value targetChoices = SCLBRRCGuiForm~>SCLBRRCTargetChoice~>choices targetChoice = SCLBRRCGuiForm~>SCLBRRCTargetChoice~>value selectTargetLibraries = SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value regExOldPart = SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value outputFileName = SCLBRRCGuiForm~>SCLBRRCOutputFileName~>value when( reRef && !selectReRefLibraries proceed = nil ) ;;; end of unless when( !selectSourceLibraries || !selectSourceCells proceed = nil ) ;;; end of unless when( equal( targetChoice nthelem( 2 targetChoices ) ) && !selectTargetLibraries proceed = nil ) ;;; end of when when( equal( regExOldPart "" ) proceed = nil ) ;;; end of when when( equal( outputFileName "" ) proceed = nil ) ;;; end of when hiSetFormButtonEnabled( SCLBRRCGuiForm 'OK proceed ) hiSetFormButtonEnabled( SCLBRRCGuiForm 'Apply proceed ) ) ;;; end of let ) ;;; end of procedure SCLBRRCEnableOKApply ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure is used when typing a lib-name in the "Find Source Library(ies)" string field. ;;; While typing, it will update the list of libraries that match the given input. ;;; Three values are being passed to this procedure by the ?modifyCallback function of the string-field. ;;; So they have to be accepted as parameters to this procedure. It is not needed to use all of them. procedure( SCLBRRCFindSourceLibrariesCB( _fieldName fieldValue _changeSource ) let( ( ( theLibList nil ) ( tempList nil ) ) SCLBRRCEnableSourceViewsFields( nil ) SCLBRRCEnableSourceCellsFields( nil ) theLibList = sort( ddGetLibList()~>name nil ) SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value = nil if( equal( fieldValue "" ) then SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>choices = theLibList else foreach( item theLibList when( rexMatchp( fieldValue item ) tempList = append1( tempList item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>choices = tempList ) ;;; end of if SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ;;; Return true to accept the change of input in the string field. This is mandatory. t ) ;;; end of let ) ;;; end of procedure SCLBRRCFindSourceLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; After the source library(ies) has/have been selected, the source cell list box must be updated. procedure( SCLBRRCSelectSourceLibrariesCB() SCLBRRCEnableSourceViewsFields( nil ) SCLBRRCEnableSourceCellsFields( t ) SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value = nil SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>choices = SCLBRRCDefineSourceCellList() SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end procedure SCLBRRCSelectSourceLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure creates (defines) the list of cells that has to be set as choices for the source cells. procedure( SCLBRRCDefineSourceCellList() let( ( ( sourceLibList nil ) ( libId nil ) ( sourceCellList nil ) ) sourceLibList = SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value foreach( sourceLib sourceLibList libId = ddGetObj( sourceLib ) when( libId sourceCellList = append( sourceCellList libId~>cells~>name ) ddReleaseObj( libId ) ) ) ;;; end of foreach sourceLib sourceCellList = SCLRemoveDuplicatesFromList( sort( sourceCellList nil ) ) ;;; Return the list... sourceCellList ) ;;; end of let ) ;;; end of procedure SCLBRRCDefineSourceCellList ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure is used when typing a cell-name in the "Find Source Cell(s)" string field. ;;; While typing, it will update the list of cells that match the given input. ;;; Three values are being passed to this procedure by the ?modifyCallback function of the string-field. ;;; So they have to be accepted as parameters to this procedure. It is not needed to use all of them. procedure( SCLBRRCFindSourceCellsCB( _fieldName fieldValue _changeSource ) let( ( ( theCellList nil ) ( tempList nil ) ) SCLBRRCEnableSourceViewsFields( nil ) theCellList = SCLBRRCDefineSourceCellList() SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value = nil if( equal( fieldValue "" ) then SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>choices = theCellList else foreach( item theCellList when( rexMatchp( fieldValue item ) tempList = append1( tempList item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>choices = tempList ) ;;; end of if SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ;;; Return true to accept the change of input in the string field. This is mandatory. t ) ;;; end of let ) ;;; end of procedure SCLBRRCFindSourceCellsCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; After the source cell(s) has/have been selected, the source view list box must be updated. procedure( SCLBRRCSelectSourceCellsCB() SCLBRRCEnableSourceViewsFields( t ) SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value = nil SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices = SCLBRRCDefineSourceViewList() SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end procedure SCLBRRCSelectSourceCellsCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure creates (defines) the list of views that has to be set as choices for the source views. procedure( SCLBRRCDefineSourceViewList() let( ( ( sourceLibList nil ) ( sourceCellList nil ) ( sourceViewList nil ) ( cellNameList nil ) ) sourceLibList = SCLBRRCGuiForm~>SCLBRRCSelectSourceLibraries~>value sourceCellList = SCLBRRCGuiForm~>SCLBRRCSelectSourceCells~>value foreach( sourceLib sourceLibList cellNameList = ddGetObj( sourceLib )~>cells~>name foreach( sourceCell sourceCellList when( member( sourceCell cellNameList ) sourceViewList = append( sourceViewList ddGetObj( sourceLib sourceCell )~>views~>name ) ) ;;; end of when ) ;;; end of foreach sourceCellList ) ;;; end of foreach sourceLib sourceViewList = SCLRemoveDuplicatesFromList( sort( sourceViewList nil ) ) ;;; Return the list... sourceViewList ) ;;; end of let ) ;;; end of procedure SCLBRRCDefineSourceViewList ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure is used when typing a view-name in the "Find Source Cell(s)" string field. ;;; While typing, it will update the list of cells that match the given input. ;;; Three values are being passed to this procedure by the ?modifyCallback function of the string-field. ;;; So they have to be accepted as parameters to this procedure. It is not needed to use all of them. procedure( SCLBRRCFindSourceViewsCB( _fieldName fieldValue _changeSource ) let( ( ( theViewList nil ) ( tempList nil ) ) theViewList = SCLBRRCDefineSourceViewList() SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>value = nil if( equal( fieldValue "" ) then SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices = theViewList else foreach( item theViewList when( rexMatchp( fieldValue item ) tempList = append1( tempList item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectSourceViews~>choices = tempList ) ;;; end of if SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ;;; Return true to accept the change of input in the string field. This is mandatory. t ) ;;; end of let ) ;;; end of procedure SCLBRRCFindSourceViewsCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCSelectSourceViewsCB() SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end procedure SCLBRRCSelectSourceViewsCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCTargetChoiceCB() let( ( ( choices nil ) ( value "" ) ) choices = SCLBRRCGuiForm~>SCLBRRCTargetChoice~>choices value = SCLBRRCGuiForm~>SCLBRRCTargetChoice~>value cond( ( equal( value nthelem( 1 choices ) ) SCLBRRCEnableTargetLibrariesFields( nil ) ) ( equal( value nthelem( 2 choices ) ) SCLBRRCEnableTargetLibrariesFields( t ) ) ) ;;; end of cond SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCTargetChoiceCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; This procedure is used when typing a lib-name in the "Find Target Library(ies)" string field. ;;; While typing, it will update the list of libraries that match the given input. ;;; Three values are being passed to this procedure by the ?modifyCallback function of the string-field. ;;; So they have to be accepted as parameters to this procedure. It is not needed to use all of them. procedure( SCLBRRCFindTargetLibrariesCB( _fieldName fieldValue _changeSource ) let( ( ( theLibList nil ) ( tempList nil ) ) theLibList = sort( ddGetLibList()~>name nil ) SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>value = nil if( equal( fieldValue "" ) then SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>choices = theLibList else foreach( item theLibList when( rexMatchp( fieldValue item ) tempList = append1( tempList item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectTargetLibraries~>choices = tempList ) ;;; end of if SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ;;; Return true to accept the change of input in the string field. This is mandatory. t ) ;;; end of let ) ;;; end of procedure SCLBRRCFindTargetLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCSelectTargetLibrariesCB() SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end procedure SCLBRRCSelectTargetLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCNoNameChangeCB() let( ( ( noChangeButton nil ) ( fullNameButton nil ) ( prefixButton nil ) ( postfixButton nil ) ( regExPartButton nil ) ) ;;; Every change of state of the noChangeButton boolean button causes this callback to be triggerd. ;;; Either done by the user himself, or by a state-change in one of the other four buttons. ;;; Here, radio buttons are emulated for the boolean buttons that select what kind of renaming has to happen. ;;; Radio buttons could not be used in a way that was looking good (aesthetically pleasing). ;;; Radio buttons are buttons of which only 1 can and must be enabled. The others must be disalbed. noChangeButton = SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value fullNameButton = SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value prefixButton = SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value postfixButton = SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value regExPartButton = SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value ;;; First check the state of the other four: if they are all 'nil', then the user tried to disable the noChangeButton button ;;; which is not allowed. It must be enabled again (remember: 1 of the 5 must be enabled) unless( fullNameButton || prefixButton || postfixButton || regExPartButton SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value = t ) ;;; end of unless ;;; Now, when the noChangeButton button changes state and is enabled, the others must be disabled. when( noChangeButton SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value = nil SCLBRRCGuiForm~>SCLBRRCFullName~>value = "" SCLBRRCGuiForm~>SCLBRRCFullName~>enabled = nil SCLBRRCGuiForm~>SCLBRRCFullName~>editable = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>value = "" SCLBRRCGuiForm~>SCLBRRCPrefix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>editable = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>value = "" SCLBRRCGuiForm~>SCLBRRCPostfix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value = "^" SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = "" SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>editable = nil ) ;;; end of when SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCNoNameChangeCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCFullNameReplaceCB() let( ( ( noChangeButton nil ) ( fullNameButton nil ) ( prefixButton nil ) ( postfixButton nil ) ( regExPartButton nil ) ) noChangeButton = SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value fullNameButton = SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value prefixButton = SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value postfixButton = SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value regExPartButton = SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value unless( noChangeButton || prefixButton || postfixButton || regExPartButton SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value = t ) ;;; end of unless when( fullNameButton SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value = nil SCLBRRCGuiForm~>SCLBRRCFullName~>enabled = t SCLBRRCGuiForm~>SCLBRRCFullName~>editable = t SCLBRRCGuiForm~>SCLBRRCPrefix~>value = "" SCLBRRCGuiForm~>SCLBRRCPrefix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>editable = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>value = "" SCLBRRCGuiForm~>SCLBRRCPostfix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value = ".+" SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = SCLBRRCGuiForm~>SCLBRRCFullName~>value SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>editable = nil ) ;;; end of when SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCFullNameReplaceCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCFullNameCB( _fieldName fieldValue _changeSource ) SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = fieldValue ) ;;; end of procedure SCLBRRCFullNameCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCAddPrefixCB() let( ( ( noChangeButton nil ) ( fullNameButton nil ) ( prefixButton nil ) ( postfixButton nil ) ( regExPartButton nil ) ) noChangeButton = SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value fullNameButton = SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value prefixButton = SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value postfixButton = SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value regExPartButton = SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value unless( noChangeButton || fullNameButton || postfixButton || regExPartButton SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = t ) ;;; end of unless when( prefixButton SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value = nil SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value = nil SCLBRRCGuiForm~>SCLBRRCFullName~>value = "" SCLBRRCGuiForm~>SCLBRRCFullName~>enabled = nil SCLBRRCGuiForm~>SCLBRRCFullName~>editable = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>enabled = t SCLBRRCGuiForm~>SCLBRRCPrefix~>editable = t SCLBRRCGuiForm~>SCLBRRCPostfix~>value = "" SCLBRRCGuiForm~>SCLBRRCPostfix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value = "^" SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = SCLBRRCGuiForm~>SCLBRRCPrefix~>value SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>editable = nil ) ;;; end of when SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCAddPrefixCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCPrefixCB( _fieldName fieldValue _changeSource ) SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = fieldValue ) ;;; end of procedure SCLBRRCPrefixCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCAddPostfixCB() let( ( ( noChangeButton nil ) ( fullNameButton nil ) ( prefixButton nil ) ( postfixButton nil ) ( regExPartButton nil ) ) noChangeButton = SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value fullNameButton = SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value prefixButton = SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value postfixButton = SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value regExPartButton = SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value unless( noChangeButton || fullNameButton || prefixButton || regExPartButton SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value = t ) ;;; end of unless when( postfixButton SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value = nil SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value = nil SCLBRRCGuiForm~>SCLBRRCFullName~>value = "" SCLBRRCGuiForm~>SCLBRRCFullName~>enabled = nil SCLBRRCGuiForm~>SCLBRRCFullName~>editable = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>value = "" SCLBRRCGuiForm~>SCLBRRCPrefix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>editable = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>enabled = t SCLBRRCGuiForm~>SCLBRRCPostfix~>editable = t SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value = "$" SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>editable = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = SCLBRRCGuiForm~>SCLBRRCPostfix~>value SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>enabled = nil SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>editable = nil ) ;;; end of when SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCAddPostfixCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCPostfixCB( _fieldName fieldValue _changeSource ) SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = fieldValue ) ;;; end of procedure SCLBRRCPostfixCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCAddRegExPartCB() let( ( ( noChangeButton nil ) ( fullNameButton nil ) ( prefixButton nil ) ( postfixButton nil ) ( regExPartButton nil ) ( proceed t ) ) noChangeButton = SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value fullNameButton = SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value prefixButton = SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value postfixButton = SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value regExPartButton = SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value unless( noChangeButton || fullNameButton || prefixButton || postfixButton SCLBRRCGuiForm~>SCLBRRCAddRegExPart~>value = t proceed = nil ) ;;; end of unless when( regExPartButton SCLBRRCGuiForm~>SCLBRRCNoNameChange~>value = nil SCLBRRCGuiForm~>SCLBRRCFullNameReplace~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPrefix~>value = nil SCLBRRCGuiForm~>SCLBRRCAddPostfix~>value = nil SCLBRRCGuiForm~>SCLBRRCFullName~>value = "" SCLBRRCGuiForm~>SCLBRRCFullName~>enabled = nil SCLBRRCGuiForm~>SCLBRRCFullName~>editable = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>value = "" SCLBRRCGuiForm~>SCLBRRCPrefix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPrefix~>editable = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>value = "" SCLBRRCGuiForm~>SCLBRRCPostfix~>enabled = nil SCLBRRCGuiForm~>SCLBRRCPostfix~>editable = nil when( proceed SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>value = "" ) SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>enabled = t SCLBRRCGuiForm~>SCLBRRCRegExOldPart~>editable = t when( proceed SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>value = "" ) SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>enabled = t SCLBRRCGuiForm~>SCLBRRCRegExNewPart~>editable = t ) ;;; end of when SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end of let ) ;;; end of procedure SCLBRRCAddRegExPartCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;; ;;; This procedure is used when typing a lib-name in the "Find Re-ref. Library(ies)" string field. ;;; While typing, it will update the list of libraries that match the given input. ;;; Three values are being passed to this procedure by the ?modifyCallback function of the string-field. ;;; So they have to be accepted as parameters to this procedure. It is not needed to use all of them. procedure( SCLBRRCFindReRefLibrariesCB( _fieldName fieldValue _changeSource ) let( ( ( theLibList nil ) ( tempList nil ) ) theLibList = sort( ddGetLibList()~>name nil ) SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>value = nil if( equal( fieldValue "" ) then SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>choices = theLibList else foreach( item theLibList when( rexMatchp( fieldValue item ) tempList = append1( tempList item ) ) ) SCLBRRCGuiForm~>SCLBRRCSelectReRefLibraries~>choices = tempList ) ;;; end of if SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ;;; Return true to accept the change of input in the string field. This is mandatory. t ) ;;; end of let ) ;;; end of procedure SCLBRRCFindReRefLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBRRCSelectReRefLibrariesCB() SCLBRRCEnableOKApply() SCLBRRCUpdateFormBlock( SCLBRRCGuiForm ) ) ;;; end procedure SCLBRRCSelectReRefLibrariesCB ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; Function which is a wrapper around dbOpenCellViewByType ;;; which suppresses any warnings it produces procedure( SCLBRRCOpenCellViewByType( @rest args ) ;;; Define a global variable to store the null port in, to ;;; save reopening it next time unless( boundp( 'SCLBRRCNullPort ) && openportp( SCLBRRCNullPort ) SCLBRRCNullPort = outfile( "/dev/null" ) ) ;;; unless ;;; Be good - force any buffered warning to be displayed - this means ;;; we don't swallow any warning unrelated to opening a cellView. ;;; This is done by creating a new warning (which we'll swallow in a moment) ;;; which forces what is in the buffer to be output. warn("") ;;; use SKILL's dynamic scoping to redefine woport to send all ;;; warnings to /dev/null - and get the final (unprinted) warning ;;; with getWarn() let( ( cv ( woport SCLBRRCNullPort ) ) cv = apply( 'dbOpenCellViewByType args ) getWarn() cv ) ;;; end let ) ;;; end procedure SCLBRRCOpenCellViewByType ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; Function which is a wrapper around hiUpdateFormBlock ;;; which suppresses any warnings it produces procedure( SCLBRRCUpdateFormBlock( @rest args ) unless( boundp( 'SCLBRRCNullPort ) && openportp( SCLBRRCNullPort ) SCLBRRCNullPort = outfile( "/dev/null" ) ) ;;; unless warn("") let( ( ( woport SCLBRRCNullPort ) ) apply( 'hiUpdateFormBlock args ) getWarn() ) ;;; end let ) ;;; end procedure SCLBRRCUpdateFormBlock ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;; Function which is a wrapper around hiUpdateFormBlock ;;; which suppresses any warnings it produces procedure( SCLBRRCHiDisplayForm( @rest args ) unless( boundp( 'SCLBRRCNullPort ) && openportp( SCLBRRCNullPort ) SCLBRRCNullPort = outfile( "/dev/null" ) ) ;;; unless warn("") let( ( ( woport SCLBRRCNullPort ) ) apply( 'hiDisplayForm args ) getWarn() ) ;;; end let ) ;;; end procedure SCLBRRCHiDisplayForm ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; procedure( SCLBatchRenameReRefCellView( fromLibNameList fromCellNameList toLibNameList toCellNameList regExpList @optional ( rename t ) ( deleteOrigin t ) ( overwriteDestination nil ) ( reRef t ) ( reRefLibNameList nil ) ( fromViewNameList nil ) ( nestChanges t ) ( reportFileName "SCLBatchRenameReRefCellView.rep" ) ( preview t ) "lllllggggllgSg" ) let( ( ( theDPList list( nil ) ) ( rePort nil ) ( reportString "" ) ( validLibList nil ) ) unless( listp( fromLibNameList ) && fromLibNameList error( "SCLBatchRenameReRefCellView: argument #1 must be a list of one or more valid libraries - %L" fromLibNameList ) ) ;;; end of unless unless( listp( fromCellNameList ) && fromCellNameList error( "SCLBatchRenameReRefCellView: argument #2 must be a list of one or more valid cell-names - %L" fromCellNameList ) ) ;;; end of unless unless( listp( toLibNameList ) error( "SCLBatchRenameReRefCellView: argument #3 must be either empty (nil) or a list of one or more valid libraries - %L" toLibNameList ) ) ;;; end of unless unless( listp( toCellNameList ) && toCellNameList error( "SCLBatchRenameReRefCellView: argument #4 must be a list of one or more replacement strings - %L" toCellNameList ) ) ;;; end of unless unless( listp( regExpList ) && regExpList error( "SCLBatchRenameReRefCellView: argument #5 must be a list of one or more regular expressions - %L" regExpList ) ) ;;; end of unless unless( booleanp( rename ) error( "SCLBatchRenameReRefCellView: argument #6 (rename yes or no) must be a boolean (t or nil), - %L" rename ) ) ;;; end of unless unless( booleanp( deleteOrigin ) error( "SCLBatchRenameReRefCellView: argument #7 (delete origin yes or no) must be a boolean (t or nil), - %L" deleteOrigin ) ) ;;; end of unless unless( booleanp( overwriteDestination ) error( "SCLBatchRenameReRefCellView: argument #8 (overwrite destination yes or no) must be a boolean (t or nil), - %L" overwriteDestination ) ) ;;; end of unless unless( booleanp( reRef ) error( "SCLBatchRenameReRefCellView: argument #9 (re-reference libraries yes or no) must be a boolean (t or nil), - %L" reRef ) ) ;;; end of unless unless( listp( reRefLibNameList ) error( "SCLBatchRenameReRefCellView: argument #10 must be either empty (nil) or a list of one or more valid libraries - %L" reRefLibNameList ) ) ;;; end of unless unless( listp( fromViewNameList ) error( "SCLBatchRenameReRefCellView: argument #11 must be either empty (nil) or a list of one or more view names - %L" fromViewNameList ) ) ;;; end of unless unless( booleanp( nestChanges ) error( "SCLBatchRenameReRefCellView: argument #12 must be a boolean (t or nil), indicating whether or not to nest changes - %L" nestChanges ) ) ;;; end of unless unless( stringp( reportFileName ) error( "SCLBatchRenameReRefCellView: argument #13 must be a string, either empty (\"\")or a file-name for the report file - %L" reportFileName ) ) ;;; end of unless unless( booleanp( preview ) error( "SCLBatchRenameReRefCellView: argument #14 must be a boolean (t or nil), set to t (which is default) to preview changes, set to nil to apply changes - %L" preview ) ) ;;; end of unless validLibList = ddGetLibList()~>name when( car( last( SCLDiffOfLists( validLibList fromLibNameList ) ) ) error( "SCLBatchRenameReRefCellView: argument #1 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList fromLibNameList ) ) ) ) ) ;;; end of when when( member( nil fromCellNameList ) || member( "" fromCellNameList ) || member( !nil foreach( mapcar cellValue fromCellNameList unless( stringp( cellValue ) t ) ) ) error( "SCLBatchRenameReRefCellView: argument #2 contains an invalid value, must be a list of one or more strings representing valid cell-names - %L" fromCellNameList ) ) ;;; end of unless when( toLibNameList && car( last( SCLDiffOfLists( validLibList toLibNameList ) ) ) error( "SCLBatchRenameReRefCellView: argument #3 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList toLibNameList ) ) ) ) ) ;;; end of when when( member( nil toCellNameList ) || member( !nil foreach( mapcar cellValue toCellNameList unless( stringp( cellValue ) t ) ) ) ; || member( "" toCellNameList ) error( "SCLBatchRenameReRefCellView: argument #4 contains an invalid value, must be a list of one or more strings representing valid cell-names - %L" toCellNameList ) ) ;;; end of unless when( member( nil foreach( mapcar cellValue regExpList pcreCompile( cellValue ) ) ) || member( !nil foreach( mapcar cellValue regExpList unless( stringp( cellValue ) t ) ) ) error( "SCLBatchRenameReRefCellView: argument #5 contains an invalid regular expression, must be a list of one or more strings representing valid Python compatible regular expressions - %L" regExpList ) ) ;;; end of when when( car( last( SCLDiffOfLists( validLibList reRefLibNameList ) ) ) error( "SCLBatchRenameReRefCellView: argument #10 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList reRefLibNameList ) ) ) ) ) ;;; end of when when( nequal( length( fromCellNameList ) length( toCellNameList ) ) || nequal( length( fromCellNameList ) length( regExpList ) ) || nequal( length( toCellNameList ) length( regExpList ) ) error( "SCLBatchRenameReRefCellView: arguments #2, #4 and #5 must be lists of equal length - #2=%n | #4=%n | #5=%n" length( fromCellNameList ) length( toCellNameList ) length( regExpList ) ) ) ;;; end of when ;;; Open the port to the output file... unless( equal( reportFileName "" ) rePort = outfile( reportFileName "w" ) ) ;;; end of unless sprintf( reportString "Output of the SCLBatchRenameReRefCellView script." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) sprintf( reportString "\n-----------------------------------------------------------" ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nfromLibNameList = list%L" fromLibNameList ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nfromCellNameList = list%L" fromCellNameList ) rePort && fprintf( rePort "%s" reportString ) toLibNameList && sprintf( reportString "\ntoLibNameList = list%L" toLibNameList ) !toLibNameList && sprintf( reportString "\ntoLibNameList = %L" toLibNameList ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\ntoCellNameList = list%L" toCellNameList ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nregExpList = list%L" regExpList ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nrename = %L" rename ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\ndeleteOrigin = %L" deleteOrigin ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\noverwriteDestination = %L" overwriteDestination ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nreRef = %L" reRef ) rePort && fprintf( rePort "%s" reportString ) reRefLibNameList && sprintf( reportString "\nreRefLibNameList = list%L" reRefLibNameList ) !reRefLibNameList && sprintf( reportString "\nreRefLibNameList = %L" reRefLibNameList ) rePort && fprintf( rePort "%s" reportString ) fromViewNameList && sprintf( reportString "\nfromViewNameList = list%L" fromViewNameList ) !fromViewNameList && sprintf( reportString "\nfromViewNameList = %L" fromViewNameList ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nnestChanges = %L" nestChanges ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nreportFileName = %L" reportFileName ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\npreview = %L" preview ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\nSCLBatchRenameReRefCellView( fromLibNameList fromCellNameList toLibNameList toCellNameList regExpList rename deleteOrigin overwriteDestination reRef reRefLibNameList fromViewNameList nestChanges reportFileName preview )" ) rePort && fprintf( rePort "%s" reportString ) sprintf( reportString "\n-----------------------------------------------------------\n" ) rePort && fprintf( rePort "%s" reportString ) theDPList = SCLBatchRenameReRefCellViewBuildList( fromLibNameList fromCellNameList toLibNameList toCellNameList regExpList fromViewNameList nestChanges rePort ) when( nequal( theDPList list( nil ) ) && rename SCLBatchRenameCellView( theDPList deleteOrigin overwriteDestination rePort preview ) ) ;;; end of when when( nequal( theDPList list( nil ) ) && reRef unless( reRefLibNameList unless( toLibNameList toLibNameList = fromLibNameList ) ;;; end of unless toLibNameList reRefLibNameList = toLibNameList ) ;;; end of unless reRefLibNameList SCLBatchReRefCellView( theDPList reRefLibNameList rePort preview ) ) ;;; end of when reRef when( rePort close( rePort) rePort = nil ;;; Opening the output file view( reportFileName nil reportFileName t ) ) ;;; end of when rePort ;;; Be nice... t ) ;;; end of let ) ;;; end of procedure SCLBatchRenameReRefCellView procedure( SCLBatchRenameCellView( theDPList @optional ( deleteOrigin t ) ( overwriteDestination nil ) ( rePort nil ) ( preview t ) "lggpg" ) let( ( ( srcLibName "" ) ( srcCellName "" ) (destCellName "" ) ( cellId nil ) ( srcViewName "" ) ( destViewName "" ) ( reportString "" ) ( destLibs 1 ) ( value nil ) ( destLibIndex 1 ) ( managed nil ) ( oneManaged nil ) ( dmType "" ) ( srcSpec nil ) ( destSpec nil ) ( deleteSpec nil ) ( delCellSpec nil ) ( delCellSpecList nil ) ( srcSpecList nil ) ( destSpecList nil ) ( deleteSpecList nil ) ( deleteList nil ) ( destSpecListList nil ) ( progressBoxCreated nil ) ( progressBoxTotal 0 ) ( progressBoxCurrent 1 ) ( copyOkay t ) ( deleteOkay t ) ( deleteUnmanOkay t ) ( deleteManOkay t ) ( deleteAllOkay t ) ) unless( booleanp( deleteOrigin ) error( "SCLBatchRenameCellView: argument #2 (delete origin yes or no) must be a boolean (t or nil), - %L" deleteOrigin ) ) ;;; end of unless unless( booleanp( overwriteDestination ) error( "SCLBatchRenameCellView: argument #3 (overwrite destination yes or no) must be a boolean (t or nil), - %L" overwriteDestination ) ) ;;; end of unless unless( booleanp( preview ) error( "SCLBatchRenameCellView: argument #5 must be a boolean (t or nil), set to t (which is default) to preview changes, set to nil to apply changes - %L" preview ) ) ;;; end of unless sprintf( reportString "\n\nThe copy/delete (=rename) of the cells starts now..." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ;;; Creating the spec. lists, even if none of the libraries are managed. ;;; it is needed to create multiple destination lists, since a source list may not contain duplicate entries. ;;; If multiple target (to) libraries have been specified, it would result in duplicates in the source list. ;;; The way to circumvent this is: create only 1 source list, without duplicates of course, and create multiple destination lists. ;;; Per target (to) library a list. When performing the actual copy, every time use the same source list, but use a differenent destination list. destLibs = get( get( get( theDPList car( theDPList->? ) ) car( get( theDPList car( theDPList->? ) )->? ) ) car( get( get( theDPList car( theDPList->? ) ) car( get( theDPList car( theDPList->? ) )->? ) )->? ) )->? srcSpecList = gdmCreateSpecList() deleteSpecList = gdmCreateSpecList() delCellSpecList = gdmCreateSpecList() for( i 1 length( destLibs ) destSpecListList = append1( destSpecListList gdmCreateSpecList() ) ) ;;; end of for i ;;; Define the total number of cells to process... ;;; This is for the progress box. foreach( srcLibName theDPList->? progressBoxTotal = progressBoxTotal + length( get( theDPList srcLibName )->? ) ) ;;; end of foreach srcLibName ;;; Create and display the progressbox... when( progressBoxTotal != 0 value = sprintf( nil "Processing %n of %n cell(s) in selected library(ies), please wait..." progressBoxCurrent progressBoxTotal ) progressBoxCreated = hiDisplayProgressBox( ?name 'SCLBatchRenameCellViewProgressBox ?banner "Processing..." ?text value ?totalSteps progressBoxTotal ?delay 10 ?autoClose nil ) value = nil ) ;;; end unless when( progressBoxCreated hiSetProgressButtonText( SCLBatchRenameCellViewProgressBox "Close" ) ) ;;; end of when foreach( srcLibName theDPList->? srcLibName = symbolToString( srcLibName ) sprintf( reportString "\n Source Library %L..." srcLibName ) vprintf( "%s" reportString ) ;;; Find out whether or not this source library is managed by any DM tool (like SOS, DesignSync, etc.) when( value = car( SCLIsLibManaged( list( srcLibName ) ) ) managed = t dmType = value sprintf( reportString "\n (library managed by %L)" dmType ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ;;; If this is true, at least one library is managed, ;;; This variable is net being set to 'nil' hereafter, thus if a unmanaged library is used after this one, it is still t... oneManaged = t ) ;;; end of when value = nil foreach( srcCellName get( theDPList srcLibName )->? srcCellName = symbolToString( srcCellName ) sprintf( reportString "\n Source Cell %L..." srcCellName ) vprintf( "%s" reportString ) ;;; Update the value of the progressbox... when( progressBoxCreated value = sprintf( nil "Processing %n of %n cell(s) in selected library(ies), please wait..." progressBoxCurrent progressBoxTotal ) hiSetProgressAndText( SCLBatchRenameCellViewProgressBox progressBoxCurrent value ) cond( ( progressBoxCurrent == progressBoxTotal / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "1/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal / 2 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Halfway!" ) ) ( progressBoxCurrent == progressBoxTotal * 3 / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "3/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal - 1 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ) ;;; end of cond value = nil progressBoxCurrent++ ) ;;; end of when progressBoxCreated foreach( srcViewName get( get( theDPList srcLibName ) srcCellName )->? srcViewName = symbolToString( srcViewName ) destLibIndex = 1 sprintf( reportString "\n Source View %L..." srcViewName ) vprintf( "%s" reportString ) foreach( destLibName get( get( get( theDPList srcLibName ) srcCellName ) srcViewName )->? destLibName = symbolToString( destLibName ) value = get( get( get( get( theDPList srcLibName ) srcCellName ) srcViewName ) destLibName ) destCellName = nthelem( 1 value ) destViewName = nthelem( 2 value ) sprintf( reportString "\n Destination Cell-view %L - %L..." destCellName destViewName ) vprintf( "%s" reportString ) sprintf( reportString "\n Destination Library %L..." destLibName ) vprintf( "%s" reportString ) if( preview then sprintf( reportString "\n\tPreview mode: < %L | %L | %L > to be copied to < %L | %L | %L > added to list" srcLibName srcCellName srcViewName destLibName destCellName destViewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) else copyOkay = srcSpec = destSpec = deleteSpec = nil when( onep( destLibIndex ) srcSpec = gdmCreateSpec( srcLibName srcCellName srcViewName "" "CDBA") gdmAddSpecToSpecList( srcSpec srcSpecList ) ) ;;; end of when destSpecList = nthelem( destLibIndex destSpecListList ) destSpec = gdmCreateSpec( destLibName destCellName destViewName "" "CDBA") when( destSpec copyOkay = gdmAddSpecToSpecList( destSpec destSpecList ) ;;; Database is managed, and at least one view has been processed, ;;; which resulted in ALL views being added to the list, ;;; no views need to be processed anymore ;proceed = nil ) ;;; end of when if( copyOkay then sprintf( reportString "\n\t< %L | %L | %L > to be copied to < %L | %L | %L > added to list" srcLibName srcCellName srcViewName destLibName destCellName destViewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ;;; Now create the correct lists for deletion, only if necessary... when( deleteOrigin && !preview if( managed then deleteSpec = gdmCreateSpec( srcLibName srcCellName srcViewName "" "CDBA") gdmAddSpecToSpecList( deleteSpec deleteSpecList ) else deleteList = append1( deleteList list( srcLibName srcCellName srcViewName ) ) ) ;;; end of if ) ;;; end of when else sprintf( reportString "SCLBatchRenameCellView: Something went wrong during copy from < %L | %L | %L > to < %L | %L | %L >" srcLibName srcCellName srcViewName destLibName destCellName destViewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ;;; end of if copyOkay ) ;;; end of if preview destLibIndex++ ) ;;; end of foreach destLibName copyOkay = t ) ;;; end of foreach srcViewName ) ;;; end of foreach srcCellName ) ;;; end of foreach srcLibName ;;; Make sure the progreessbox reaches 100%... when( progressBoxCreated hiSetProgress( SCLBatchRenameCellViewProgressBox progressBoxTotal ) hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ;;; end of when progressBoxCreated ;;; Now copy and delete all the lib-cell-views... !preview && sprintf( reportString "\n\nActual Copying of all cells/views starts (processing of list)...\n\n" ) preview && sprintf( reportString "\n\nPreview mode: Actual Copying of all cells/views starts (processing of list)...\n\n" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) if( preview then sprintf( reportString "\nPreview mode: ...done!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) else copyOkay = t foreach( destSpecList destSpecListList ;;; In case there is more then one destination library, and copying to at least one of them fails, ;;; the colpyOkay variable will be set to 'nil', and won't be set to 't' anymore, thus indicating ;;; that at least one copy action did not finish properly. copyOkay = and( copyOkay ccpCopy(srcSpecList destSpecList overwriteDestination 'CCP_EXPAND_ALL) ) ) ;;; end of foreach destSpecList copyOkay && sprintf( reportString "\n...done!" ) !copyOkay && sprintf( reportString "\n...bummer, something went wrong!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of if cond( ( !deleteOrigin sprintf( reportString "\nNO cells/views deleted per user request NOT to delete origin" ) preview && sprintf( reportString "\nPreview mode: NO cells/views deleted per user request NOT to delete origin" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( preview sprintf( reportString "\nPreview mode: All original cells/views deleted..." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( !copyOkay sprintf( reportString "\nDue to issues during copy in previous step none of the original cells/views have been deleted." srcLibName srcCellName srcViewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( deleteOrigin && !preview sprintf( reportString "\n\nDeleting all original cells/views..." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) when( progressBoxCreated progressBoxTotal = length( deleteList ) progressBoxCurrent = 1 when( progressBoxTotal != 0 value = sprintf( nil "Deleting %n of %n original cell-view(s), please wait..." progressBoxCurrent progressBoxTotal ) progressBoxCreated = hiResetProgressBox( SCLBatchRenameCellViewProgressBox progressBoxTotal value nil ) value = nil ) ;;; end of when ) ;;; end of when progressBoxCreated foreach( item deleteList ;;; Update the value of the progressbox... when( progressBoxCreated value = sprintf( nil "Deleting %n of %n original cell-view(s), please wait..." progressBoxCurrent progressBoxTotal ) hiSetProgressAndText( SCLBatchRenameCellViewProgressBox progressBoxCurrent value ) cond( ( progressBoxCurrent == progressBoxTotal / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "1/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal / 2 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Halfway!" ) ) ( progressBoxCurrent == progressBoxTotal * 3 / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "3/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal - 1 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ) ;;; end of cond value = nil progressBoxCurrent++ ) ;;; end of when progressBoxCreated deleteOkay = SCLDeleteLibCellView( nthelem( 1 item ) nthelem( 2 item ) nthelem( 3 item ) ) deleteOkay && sprintf( reportString "\n\tUnmanaged view %L - %L - %L successfully deleted" nthelem( 1 item ) nthelem( 2 item ) nthelem( 3 item ) ) !deleteOkay && sprintf( reportString "\n>>>>>>> UNMANAGED CELL/VIEW %L - %L - %L NOT DELETED!" nthelem( 1 item ) nthelem( 2 item ) nthelem( 3 item ) ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) deleteUnmanOkay = and( deleteUnmanOkay deleteOkay ) ) ;;; end of foreach item ;;; Make sure the progreessbox reaches 100%... when( progressBoxCreated hiSetProgress( SCLBatchRenameCellViewProgressBox progressBoxTotal ) hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ;;; end of when progressBoxCreated ;;; If, after deletion of a view, the result is an empty cell, but it is not automatically removed due to the fact that ;;; a data.dm file is present in the cell, the cell is removed by the following steps. Empty cells should not remain in the library. when( progressBoxCreated progressBoxTotal = length( deleteList ) progressBoxCurrent = 1 when( progressBoxTotal != 0 value = sprintf( nil "Deleting %n of %n empty original cell(s), please wait..." progressBoxCurrent progressBoxTotal ) progressBoxCreated = hiResetProgressBox( SCLBatchRenameCellViewProgressBox progressBoxTotal value nil ) value = nil ) ;;; end of when ) ;;; end of when progressBoxCreated foreach( item deleteList ;;; From a programming point of view, this code could have been included in the previous foreach( item deleteList ... ) loop. ;;; However, if no data.dm file is present, Virtuoso will remove the empty cell automatically, which takes some time. ;;; If this would have been placed in the previous foreach() loop, Virtuoso would not have finished the deletion of the cell ;;; yet thus triggering the code, which would result in an error. Therefor a new loop had to be used. ;;; Update the value of the progressbox... when( progressBoxCreated value = sprintf( nil "Deleting %n of %n empty original cell(s), please wait..." progressBoxCurrent progressBoxTotal ) hiSetProgressAndText( SCLBatchRenameCellViewProgressBox progressBoxCurrent value ) cond( ( progressBoxCurrent == progressBoxTotal / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "1/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal / 2 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Halfway!" ) ) ( progressBoxCurrent == progressBoxTotal * 3 / 4 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "3/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal - 1 hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ) ;;; end of cond value = nil progressBoxCurrent++ ) ;;; end of when progressBoxCreated cellId = ddGetObj( nthelem( 1 item ) nthelem( 2 item ) ) when( cellId && not( cellId~>views ) deleteOkay = SCLDeleteLibCellView( nthelem( 1 item ) nthelem( 2 item ) ) deleteOkay && sprintf( reportString "\n\tUnmanaged empty cell %L - %L successfully deleted" nthelem( 1 item ) nthelem( 2 item ) ) !deleteOkay && sprintf( reportString "\n>>>>>>> UNMANAGED EMPTY CELL %L - %L NOT DELETED!" nthelem( 1 item ) nthelem( 2 item ) ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) deleteUnmanOkay = and( deleteUnmanOkay deleteOkay ) ) ;;; end of unless ) ;;; end of foreach item ;;; Make sure the progreessbox reaches 100%... when( progressBoxCreated hiSetProgress( SCLBatchRenameCellViewProgressBox progressBoxTotal ) hiSetProgressBannerText( SCLBatchRenameCellViewProgressBox "Complete!" ) ) ;;; end of when progressBoxCreated when( oneManaged deleteOkay = gdmdelete( deleteSpecList ) deleteOkay && sprintf( reportString "\n\tAll managed views successfully deleted" ) !deleteOkay && sprintf( reportString "\n>>>>>>> UNSUCCESSFULL IN DELETING MANAGED VIEWS!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) deleteManOkay = and( deleteManOkay deleteOkay ) ) ;;; end of when ;;; If, after deletion of a view, the result is an empty cell, but it is not automatically removed due to the fact that ;;; a data.dm file is present in the cell, the cell is removed by the following steps. Empty cells should not remain in the library. when( oneManaged && deleteManOkay gdmResetSpecList( deleteSpecList ) while( deleteSpec = gdmNextFromSpecList( deleteSpecList ) value = gdmInspectSpec( deleteSpec "CDBA" ) cellId = ddGetObj( nthelem( 1 value ) nthelem( 2 value ) ) when( cellId && not( cellId~>views ) delCellSpec = gdmCreateSpec( nthelem( 1 value ) nthelem( 2 value ) "" "" "CDBA") deleteOkay = gdmAddSpecToSpecList( delCellSpec delCellSpecList ) deleteOkay && sprintf( reportString "\n\tManaged empty cell %L - %L successfully deleted" nthelem( 1 value ) nthelem( 2 value ) ) !deleteOkay && sprintf( reportString "\n>>>>>>> MANAGED EMPTY CELL %L - %L NOT DELETED!" nthelem( 1 value ) nthelem( 2 value ) ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) deleteManOkay = and( deleteManOkay deleteOkay ) ) ;;; end of unless ) ;;; end of while deleteOkay = gdmdelete( delCellSpecList ) deleteOkay && sprintf( reportString "\n\tAll managed empty cells successfully deleted" ) !deleteOkay && sprintf( reportString "\n>>>>>>> UNSUCCESSFULL IN DELETING MANAGED EMPTY CELLS!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) deleteManOkay = and( deleteManOkay deleteOkay ) ) ;;; end of when deleteAllOkay = and( deleteUnmanOkay deleteManOkay ) cond( ( deleteAllOkay sprintf( reportString "\n...done" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( t sprintf( reportString "SCLBatchRenameCellView: Something went wrong during deletion of all original cells/views." ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ) ;;; end of cond ) ) ;;; end of cond ;;; Dismissing the progress box... when( progressBoxCreated hiCancelProgressBox( SCLBatchRenameCellViewProgressBox ) ) ;;; end of when progressBoxCreated sprintf( reportString "\n\nCopy/delete (=rename) has finished." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ;;; Be nice... t ) ;;; end of let ) ;;; end of procedure SCLBatchRenameCellView procedure( SCLBatchReRefCellView( theDPList reRefLibNameList @optional ( rePort nil ) ( preview t ) "llpg" ) let( ( ( validLibList nil ) ( cellNameList nil ) ( viewNameList nil ) ( cellViewTypeList nil ) ( instViewTypeList nil ) ( viewType "" ) ( libId nil ) ( cellId nil ) ( viewId nil ) ( cvId nil ) ( editMode nil ) ( libToFindList nil ) ( cellToFindList nil ) ( viewToFindList nil ) ( destLibNameList nil ) ( allCellsToFindList nil ) ( allViewsToFindList nil ) ( instIdList nil ) ( instName nil ) ( instLibName nil ) ( instCellName nil ) ( instViewName nil ) ( instViewType nil ) ( newViewId nil ) ( newLibName "" ) ( newCellName "" ) ( newViewName "" ) ( reRefOkay nil ) ( reportString "" ) ( progressBoxCreated nil ) ( progressBoxTotal 0 ) ( progressBoxCurrent 1 ) ) unless( listp( theDPList ) && theDPList error( "SCLBatchRenameCellView: argument #1 must be a disembodied property list containing lib/cell/view information - %L" theDPList ) ) ;;; end of unless unless( listp( reRefLibNameList ) error( "SCLBatchRenameReRefCellView: argument #10 must be either empty (nil) or a list of one or more valid libraries - %L" reRefLibNameList ) ) ;;; end of unless validLibList = ddGetLibList()~>name when( car( last( SCLDiffOfLists( validLibList reRefLibNameList ) ) ) error( "SCLBatchRenameReRefCellView: argument #10 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList reRefLibNameList ) ) ) ) ) ;;; end of when unless( booleanp( preview ) error( "SCLBatchRenameReRefCellView: argument #14 must be a boolean (t or nil), set to t (which is default) to preview changes, set to nil to apply changes - %L" preview ) ) ;;; end of unless ;viewTypeList = list( "layout" "maskLayout" "maskLayoutGXL" "maskLayoutXL" "schematic" "schematicSymbol" "schematicSymbolXL" "schematicXL" ) ;viewTypeList = list( "layout" "maskLayout" "maskLayoutGXL" "maskLayoutXL" "schematic" "schematicXL" ) cellViewTypeList = list( "schematic" "schematicXL" "maskLayout" "maskLayoutGXL" "maskLayoutXL" ) instViewTypeList = list( "schematicSymbol" "maskLayout" "maskLayoutGXL" "maskLayoutXL" ) sprintf( reportString "\n\nRe-referencing in progress..." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) libToFindList = theDPList->? foreach( libToFind libToFindList cellToFindList = get( theDPList libToFind )->? allCellsToFindList = append( allCellsToFindList cellToFindList ) foreach( cellToFind cellToFindList viewToFindList = get( get( theDPList libToFind ) cellToFind )->? allViewsToFindList = append( allViewsToFindList viewToFindList ) ) ;;; end of foreach cellToFind ) ;;; end of foreach libToFind allCellsToFindList = SCLRemoveDuplicatesFromList( sort( allCellsToFindList nil ) ) allViewsToFindList = SCLRemoveDuplicatesFromList( sort( allViewsToFindList nil ) ) ;;; Define the total number of cells to process... ;;; This is for the progress box. foreach( libName reRefLibNameList progressBoxTotal = progressBoxTotal + length( ddGetObj( libName )~>cells ) ) ;;; end of foreach libName ;;; Create and display the progressbox... when( progressBoxTotal != 0 value = sprintf( nil "Processing %n of %n cell(s) in selected library(ies), please wait..." progressBoxCurrent progressBoxTotal ) progressBoxCreated = hiDisplayProgressBox( ?name 'SCLBatchReRefCellViewProgressBox ?banner "Re-referencing..." ?text value ?totalSteps progressBoxTotal ?delay 10 ?autoClose t ) value = nil ) ;;; end unless when( progressBoxCreated hiSetProgressButtonText( SCLBatchReRefCellViewProgressBox "Close" ) ) ;;; end of when foreach( libName reRefLibNameList libId = ddGetObj( libName ) cellNameList = sort( libId~>cells~>name nil ) foreach( cellName cellNameList cellId = ddGetObj( libName cellName ) viewNameList = cellId~>views~>name ;;; Update the value of the progressbox... when( progressBoxCreated value = sprintf( nil "Processing %n of %n cell(s) in selected library(ies), please wait..." progressBoxCurrent progressBoxTotal ) hiSetProgressAndText( SCLBatchReRefCellViewProgressBox progressBoxCurrent value ) cond( ( progressBoxCurrent == progressBoxTotal / 4 hiSetProgressBannerText( SCLBatchReRefCellViewProgressBox "1/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal / 2 hiSetProgressBannerText( SCLBatchReRefCellViewProgressBox "Halfway!" ) ) ( progressBoxCurrent == progressBoxTotal * 3 / 4 hiSetProgressBannerText( SCLBatchReRefCellViewProgressBox "3/4 Done!" ) ) ( progressBoxCurrent == progressBoxTotal hiSetProgressBannerText( SCLBatchReRefCellViewProgressBox "Complete!" ) ) ) ;;; end of cond value = nil progressBoxCurrent++ ) ;;; end of when progressBoxCreated foreach( viewName viewNameList viewId = ddGetObj( libName cellName viewName ) editMode = nil cvId = SCLOpenCellViewByType( libName cellName viewName "" "r" ) viewType = cvId->cellViewType if( member( viewType cellViewTypeList ) then sprintf( reportString "\n\tSupported view type %L (%L - %L - %L) " viewType libName cellName viewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) instIdList = cvId~>instances instIdList && sprintf( reportString "\n\t\t-> %n instance(s) or mosaic(s) found" length( instIdList ) ) !instIdList && sprintf( reportString "\n\t\t-> NO instance or mosaic found" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) when( instIdList instIdList = setof( instId instIdList member( stringToSymbol( instId~>libName ) libToFindList ) ) instIdList = setof( instId instIdList member( stringToSymbol( instId~>cellName ) allCellsToFindList ) ) instIdList = setof( instId instIdList member( stringToSymbol( instId~>viewName ) allViewsToFindList ) ) sprintf( reportString " of which %n possibly valid remaining" length( instIdList ) ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of when instIdList foreach( instId instIdList instName = instId~>name ;;; i.e. I4 instLibName = instId~>libName ;;; i.e. umc55eflash instCellName = instId~>cellName ;;; i.e. nmos instViewName = instId~>viewName ;;; i.e. symbol/layout instViewType = instId~>master~>cellViewType ;;; i.e. schematicSymbol/layout cellToFindList = get( theDPList stringToSymbol( instLibName ) )->? viewToFindList = get( get( theDPList stringToSymbol( instLibName ) ) stringToSymbol( instCellName ) )->? destLibNameList = get( get( get( theDPList stringToSymbol( instLibName ) ) stringToSymbol( instCellName ) ) stringToSymbol( instViewName ) )->? newLibName = nil when( and( member( stringToSymbol( instCellName ) cellToFindList ) member( stringToSymbol( instViewName ) viewToFindList ) member( instViewType instViewTypeList ) ) sprintf( reportString "\n\t\t\tInstance/mosaic found: %L -> %L - %L - %L" instName instLibName instCellName instViewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) cond( ( onep( length( destLibNameList ) ) ;;; Only one library as target/destination/to library, so this must be the new library new for the new instance... newLibName = symbolToString( car( destLibNameList ) ) ) ( member( stringToSymbol( libName ) destLibNameList ) ;;; Since the old instance has been copied to more than one (destination) library, the correct library for the new ;;; instance has to be chosen. If the new instance has been copied to the same library as the library of the cell ;;; which is currently processed (cell libName/cellName/viewName), then this libName is used: it is asumed that ;;; it is wanted to use only instances from the same library. newLibName = libName ) ( t ;;; None of the above is true, so too many options to decide what to do, simply not doing anything. sprintf( reportString "SCLBatchReRefCellView: more than 1 source libraries possible, will not re-reference %L %L %L - %L %L %L %L" libName cellName viewName instName instLibName instCellName instViewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ) ;;; end of cond when( newLibName newCellName = car( get( get( get( get( theDPList stringToSymbol( instLibName ) ) stringToSymbol( instCellName ) ) stringToSymbol( instViewName ) ) stringToSymbol( newLibName ) ) ) newViewName = cadr( get( get( get( get( theDPList stringToSymbol( instLibName ) ) stringToSymbol( instCellName ) ) stringToSymbol( instViewName ) ) stringToSymbol( newLibName ) ) ) ;;; Check to confirm that the new... Name stuff actually exists newViewId = ddGetObj( newLibName newCellName newViewName ) if( newViewId then preview && sprintf( reportString "\n\t\t\t\tPREVIEW: Re-referencing to %L - %L - %L... " newLibName newCellName newViewName ) !preview && sprintf( reportString "\n\t\t\t\tRe-referencing to %L - %L - %L... " newLibName newCellName newViewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) cond( ( equal( instId~>objType "inst" ) when( !preview && !editMode editMode = dbReopen( cvId "a" ) editMode && sprintf( reportString "\n\t\t\t\t\tRe-opend in edit mode" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of when if( editMode || preview then unless( preview reRefOkay = leReplaceAnyInstMaster( instId newLibName newCellName newViewName ) ) ;;; end of when reRefOkay && sprintf( reportString "\n\t\t\t\t\tSucceeded!" ) !reRefOkay && sprintf( reportString "\n\t\t\t\t\tFAILED INSTANCE REPLACE!!!" ) preview && sprintf( reportString "\n\t\t\t\t\tSucceeded!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) else sprintf( reportString "SCLBatchReRefCellView: unable to open %L %L %L in edit mode, will not re-reference" libName cellName viewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ;;; end of if editMode ) ( equal( instId~>objType "mosaic" ) && equal( instId~>mosaicType "simple" ) when( !preview && !editMode editMode = dbReopen( cvId "a" ) editMode && sprintf( reportString "\n\t\t\t\t\tRe-opend in edit mode" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of when if( editMode || preview then unless( preview reRefOkay = leReplaceAnyInstMaster( car( instId~>instanceList ) newLibName newCellName newViewName ) ) ;;; end of when reRefOkay && sprintf( reportString "\n\t\t\t\t\tSucceeded!" ) !reRefOkay && sprintf( reportString "\n\t\t\t\t\tFAILED MOSAIC REPLACE!!!" ) preview && sprintf( reportString "\n\t\t\t\t\tSucceeded!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) else sprintf( reportString "SCLBatchReRefCellView: unable to open %L %L %L in edit mode, will not re-reference" libName cellName viewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ;;; end of if editMode ) ( t sprintf( reportString "SCLBatchReRefCellView: instance of unknow (object) type, will not re-reference %L %L %L - %L %L %L %L" libName cellName viewName instName instLibName instCellName instViewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ) ;;; end of cond reRefOkay = nil else sprintf( reportString "SCLBatchReRefCellView: new cell(view) does not exist, will not re-reference %L %L %L - %L %L %L %L to %L %L %L" libName cellName viewName instName instLibName instCellName instViewName newLibName newCellName newViewName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ;;; end of if newViewId when( newViewId ddReleaseObj( newViewId ) ) newViewId = nil ) ;;; end of when newLibName ) ;;; end of when ) ;;; end of foreach instId else sprintf( reportString "\n!\tUNSUPPORTED view type %L (%L - %L - %L), doing nothing." viewType libName cellName viewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of if when( cvId && editMode when( equal( viewType nthelem( 1 cellViewTypeList ) ) || equal( viewType nthelem( 2 cellViewTypeList ) ) dbCheck( cvId ) ) ;;; end of when dbSave( cvId ) ) ;;; end of when when( cvId dbClose( cvId ) ) when( viewId ddReleaseObj( viewId ) ) ) ;;; end of foreach viewName when( cellId ddReleaseObj( cellId ) ) ) ;;; end of foreach cellName when( libId ddReleaseObj( libId ) ) ) ;;; end of foreach libName ;;; Dismissing the progreessbox... when( progressBoxCreated hiCancelProgressBox( SCLBatchReRefCellViewProgressBox ) ) ;;; end of when progressBoxCreated ) ;;; end of let ) ;;; end of procedure SCLBatchReRefCellView procedure( SCLBatchRenameReRefCellViewBuildList( fromLibNameList fromCellNameList toLibNameList toCellNameList regExpList @optional ( fromViewNameList nil ) ( nestChanges nil ) ( rePort nil ) "llllllgp" ) let( ( ( validLibList nil ) ( cellNameList nil ) ( fromLibId nil ) ( fromCellId nil ) ( toViewId nil ) ( fromCellName "" ) ( viewNameList nil ) ( toLibNameListInt nil ) ( fromViewNameListInt nil ) ( toCellName "" ) ( newCellName "" ) ( regExp "" ) ( compiledPattern nil ) ( value nil ) ( toProcessDPList list( nil ) ) ( reportString "" ) ) unless( listp( fromLibNameList ) && fromLibNameList error( "SCLBatchRenameReRefCellViewBuildList: argument #1 must be a list of one or more valid libraries - %L" fromLibNameList ) ) ;;; end of unless unless( listp( fromCellNameList ) && fromCellNameList error( "SCLBatchRenameReRefCellViewBuildList: argument #2 must be a list of one or more valid cell-names - %L" fromCellNameList ) ) ;;; end of unless unless( listp( toLibNameList ) error( "SCLBatchRenameReRefCellViewBuildList: argument #3 must be either empty (nil) or a list of one or more valid libraries - %L" toLibNameList ) ) ;;; end of unless unless( listp( toCellNameList ) && toCellNameList error( "SCLBatchRenameReRefCellViewBuildList: argument #4 must be a list of one or more replacement strings - %L" toCellNameList ) ) ;;; end of unless unless( listp( regExpList ) && regExpList error( "SCLBatchRenameReRefCellViewBuildList: argument #5 must be a list of one or more regular expressions - %L" regExpList ) ) ;;; end of unless unless( listp( fromViewNameList ) error( "SCLBatchRenameReRefCellViewBuildList: argument #6 must be either empty (nil) or a list of one or more view names - %L" fromViewNameList ) ) ;;; end of unless unless( booleanp( nestChanges ) error( "SCLBatchRenameReRefCellViewBuildList: argument #7 must be a boolean (t or nil), indicating whether or not to nest changes - %L" nestChanges ) ) ;;; end of unless validLibList = ddGetLibList()~>name when( car( last( SCLDiffOfLists( validLibList fromLibNameList ) ) ) error( "SCLBatchRenameReRefCellViewBuildList: argument #1 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList fromLibNameList ) ) ) ) ) ;;; end of when when( member( nil fromCellNameList ) || member( "" fromCellNameList ) || member( !nil foreach( mapcar cellValue fromCellNameList unless( stringp( cellValue ) t ) ) ) error( "SCLBatchRenameReRefCellViewBuildList: argument #2 contains an invalid value, must be a list of one or more strings representing valid cell-names - %L" fromCellNameList ) ) ;;; end of unless when( toLibNameList && car( last( SCLDiffOfLists( validLibList toLibNameList ) ) ) error( "SCLBatchRenameReRefCellViewBuildList: argument #3 contains an invalid library name - %L" car( last( SCLDiffOfLists( validLibList toLibNameList ) ) ) ) ) ;;; end of when when( member( nil toCellNameList ) || member( !nil foreach( mapcar cellValue toCellNameList unless( stringp( cellValue ) t ) ) ) ; || member( "" toCellNameList ) error( "SCLBatchRenameReRefCellViewBuildList: argument #4 contains an invalid value, must be a list of one or more strings representing valid cell-names - %L" toCellNameList ) ) ;;; end of unless when( member( nil foreach( mapcar cellValue regExpList pcreCompile( cellValue ) ) ) || member( !nil foreach( mapcar cellValue regExpList unless( stringp( cellValue ) t ) ) ) error( "SCLBatchRenameReRefCellViewBuildList: argument #5 contains an invalid regular expression, must be a list of one or more strings representing valid Python compatible regular expressions - %L" regExpList ) ) ;;; end of when when( nequal( length( fromCellNameList ) length( toCellNameList ) ) || nequal( length( fromCellNameList ) length( regExpList ) ) || nequal( length( toCellNameList ) length( regExpList ) ) error( "SCLBatchRenameReRefCellViewBuildList: arguments #2, #4 and #5 must be lists of equal length - #2=%n | #4=%n | #5=%n" length( fromCellNameList ) length( toCellNameList ) length( regExpList ) ) ) ;;; end of when sprintf( reportString "\n\nStart with building the disembodied property list of all that has to be done..." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) foreach( fromLibName fromLibNameList unless( get( toProcessDPList stringToSymbol( fromLibName ) ) putprop( toProcessDPList list( nil ) stringToSymbol( fromLibName ) ) ) ;;; end of unless sprintf( reportString "\nProcessing library %L..." fromLibName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) fromLibId = ddGetObj( fromLibName ) cellNameList = sort( fromLibId~>cells~>name nil ) ;;; Here an internal list has to be used. ;;; If the original list would be overwritten, for all cells after the first one, this list would be used, which might not be correct. if( toLibNameList then toLibNameListInt = toLibNameList else toLibNameListInt = list( fromLibName ) ) ;;; end of if ;;; A for-loop is used in stead of a foreach-loop. ;;; This is done since values from multiple lists have to be extracted, which is in this case easier to do within a for-loop. for( i 1 length( fromCellNameList ) fromCellName = nthelem( i fromCellNameList ) toCellName = nthelem( i toCellNameList ) regExp = nthelem( i regExpList ) if( member( fromCellName cellNameList ) then newCellName = nil compiledPattern = pcreCompile( regExp ) ;;; Only when the wanted pattern exists in the original cell-name, it will replace it. when( pcreExecute( compiledPattern fromCellName ) newCellName = pcreReplace( compiledPattern fromCellName toCellName 0 ) ) ;;; end of when case( newCellName ( nil sprintf( reportString "\n\t%L - %L | Cell %L from library %L skipped: cell-name does not contain the string to replace - %L" i length( fromCellNameList ) fromCellName fromLibName regExp ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( "" sprintf( reportString "SCLBatchRenameReRefCellViewBuildList: renaming results in empty cell-name, this is not allowed: %L - %L -> %L ( %L - %L ). Doing nothing." fromLibName fromCellName newCellName regExp toCellName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ( t sprintf( reportString "\n\t%L - %L | Processing cell %L from library %L... " i length( fromCellNameList ) fromCellName fromLibName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) fromCellId = ddGetObj( fromLibName fromCellName ) viewNameList = fromCellId~>views~>name ;;; Here an internal list has to be used. ;;; If the original list would be overwritten, for all cells after the first one, this list would be used, which might not be correct. if( fromViewNameList then fromViewNameListInt = fromViewNameList else fromViewNameListInt = viewNameList ) ;;; end of if foreach( viewName fromViewNameListInt sprintf( reportString "\n\t\tProcessing view %L... " viewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) if( member( viewName viewNameList ) then foreach( toLibName toLibNameListInt toViewId = ddGetObj( toLibName newCellName viewName ) cond( ( equal( fromLibName toLibName ) && equal( fromCellName newCellName ) sprintf( reportString "\n!\t\t\tCowardly refusing to rename %L - %L - %L to itself." fromLibName fromCellName viewName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ( toViewId sprintf( reportString "SCLBatchRenameReRefCellViewBuildList: target cell-view %L - %L - %L already exists (source %L - %L - %L with regular expression %L). Doing nothing." toLibName newCellName viewName fromLibName fromCellName viewName regExp ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ( t unless( get( get( toProcessDPList stringToSymbol( fromLibName ) ) stringToSymbol( fromCellName ) ) putprop( get( toProcessDPList stringToSymbol( fromLibName ) ) list( nil ) stringToSymbol( fromCellName ) ) ) ;;; end of unless unless( get( get( get( toProcessDPList stringToSymbol( fromLibName ) ) stringToSymbol( fromCellName ) ) stringToSymbol( viewName ) ) putprop( get( get( toProcessDPList stringToSymbol( fromLibName ) ) stringToSymbol( fromCellName ) ) list( nil ) stringToSymbol( viewName ) ) ) ;;; end of unless value = get( get( get( get( toProcessDPList stringToSymbol( fromLibName ) ) stringToSymbol( fromCellName ) ) stringToSymbol( viewName ) ) stringToSymbol( toLibName ) ) cond( ( value && nestChanges newCellName = pcreReplace( compiledPattern nthelem( 1 value ) toCellName 0 ) sprintf( reportString "\n\t\t\tCell (view) already renamed in a previous step, nesting is enabled, update new name to %L (from %L) and put in library %L" newCellName nthelem( 1 value ) toLibName ) ) ( value && !nestChanges newCellName = nthelem( 1 value ) sprintf( reportString "\n\t\t\tCell (view) already renamed in a previous step, nesting is disabled, keeping original new name %L in library %L" newCellName toLibName ) ) ( t sprintf( reportString "\n\t\t\tCell (view) will be renamed to %L and put in library %L" newCellName toLibName ) ) ) ;;; end of cond value = list( newCellName viewName ) putprop( get( get( get( toProcessDPList stringToSymbol( fromLibName ) ) stringToSymbol( fromCellName ) ) stringToSymbol( viewName ) ) value stringToSymbol( toLibName ) ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ) ;;; end of cond ) ;;; end of foreach toLibName else sprintf( reportString "DOES NOT EXIST!" ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of if member... ) ;;; end of foreach viewName ) ;;; end of case t ) ;;; end of case newCellName else sprintf( reportString "\n\t%L - %L | Cell %L does not exist in library %L." i length( fromCellNameList ) fromCellName fromLibName ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ) ;;; end of if ) ;;; end of for i ;;; If no cell has to be processed from this from-lib, remove it from the list, it would cause issues later-on. unless( cadr( get( toProcessDPList stringToSymbol( fromLibName ) ) ) remprop( toProcessDPList stringToSymbol( fromLibName ) ) sprintf( reportString "SCLBatchRenameReRefCellViewBuildList: no cells to rename (copy) from library %L, removing entry from list." fromLibName ) rePort && fprintf( rePort "\n*WARNING* %s" reportString ) warn( "%s" reportString ) ) ;;; end of unless ) ;;; end of foreach fromLibName sprintf( reportString "\n\nList of all lib/cell/view to process has been build." ) rePort && fprintf( rePort "%s" reportString ) vprintf( "%s" reportString ) ;;; Be nice... when( fromLibId ddReleaseObj( fromLibId ) ) when( fromCellId ddReleaseObj( fromCellId ) ) when( toViewId ddReleaseObj( toViewId ) ) ;;; Return the list to process... toProcessDPList ) ;;; end of let ) ;;; end of procedure SCLBatchRenameReRefCellViewBuildList