• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to access the data of a treeStruct (created by hiCreateTree...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 145
  • Views 16674
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to access the data of a treeStruct (created by hiCreateTree) ?

Rein
Rein over 13 years ago

Hi,

     For example,  

                a = hiCreateTree('a)   

 

                b = hiCreateTreeItem(......)   

 

                hiTreeAppendItems(a list(b))

 

How to access data b from a?

I try to use a~>?? to view data of a. But it is display (activeUT hiFieldSym a).


Thanks

Rein

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    Rein,

    Using the example code below, I can do:

    abTreeExample(geGetEditCellView()~>shapes)

    with some layout view. Then I get:

    items=hiGetTreeItems(abTreeExampleForm->treeField->choice)
    (pathSeg arc line dot polygon
        donut path label ellipse rect
    )

    itemStructs=foreach(mapcar item items symeval(item))


    subtrees=foreach(mapcar itemStruct itemStructs symeval(hiGetTree(itemStruct)))

    etc, etc.

    Andrew.

    /* abTreeExample.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Feb 16, 2010 
    Modified   
    By         
    
    ***************************************************
    
    SCCS Info: @(#) abTreeExample.il 02/16/10.11:37:50 1.1
    
    */
    
    /****************************************************************
    *                                                               *
    *                 (abCreateTreeExample shapes)                  *
    *                                                               *
    *    Given a list of db objects (e.g. shapes) create a tree     *
    * representation of the data in a form called abTreeExampleForm *
    *                                                               *
    ****************************************************************/
    
    (defun abCreateTreeExample (shapes)
      (let (tree subTreeLookup (shapeNum 1) objType bBox treeItem
                 select delete info subTree treeField)
        ;--------------------------------------------------------------------
        ; Create a table to store the trees for each type of object encountered
        ;--------------------------------------------------------------------
        (setq subTreeLookup (makeTable 'subTreeLookup nil))
        ;--------------------------------------------------------------------
        ; Then traverse the shapes (doesn't have to just be shapes - any db object
        ; will do) and add an item for each
        ;--------------------------------------------------------------------
        (foreach shape shapes
                 (setq objType (dbGetq shape objType))
                 ;-----------------------------------------------------------
                 ; Find the existing tree, or create a new one
                 ;-----------------------------------------------------------
                 (setq subTree 
                       (or 
                         (arrayref subTreeLookup objType)
                         (setarray subTreeLookup objType
                                   (hiCreateTree (concat objType 'tree))
                                   )
                         ))
                 (setq bBox (dbGetq shape bBox))
                 ;-----------------------------------------------------------
                 ; Add an item to the appropriate shape tree for this
                 ; object
                 ;-----------------------------------------------------------
                 (hiTreeAppendItem
                   subTree
                   (hiCreateTreeItem (concat 'shape shapeNum)
                                     (list (sprintf nil "Shape %d" shapeNum)
                                           (dbGetq shape layerName)
                                           (dbGetq shape purpose)
                                           (xCoord (lowerLeft bBox))
                                           (yCoord (lowerLeft bBox))
                                           (xCoord (upperRight bBox))
                                           (yCoord (upperRight bBox))
                                           )
                                     )
                   )
                 (postincrement shapeNum)
                 )
        ;--------------------------------------------------------------------
        ; Now create the main tree
        ;--------------------------------------------------------------------
        (setq tree (hiCreateTree 'shapes))
        (foreach shapeType subTreeLookup
                 (setq treeItem
                   (hiCreateTreeItem 
                     (concat shapeType)
                     (list shapeType)
                     )
                   )
                 (hiTreeAppendItem shapes treeItem)
                 (hiItemInsertTree treeItem (arrayref subTreeLookup shapeType))
                 )
        ;--------------------------------------------------------------------
        ; And the tree field itself
        ;--------------------------------------------------------------------
        (setq treeField
              (hiCreateTreeTable
                ?name 'shapeTree
                ?title "Shapes"
                ?titleAlignment 'center
                ?headers (list
                           (list "Type" 125 'left 'string t)
                           (list "Layer" 80 'left 'string t)
                           (list "Purpose" 80 'left 'string t)
                           (list "LLX" 80 'left 'float t)
                           (list "LLY" 80 'left 'float t)
                           (list "URX" 80 'left 'float t)
                           (list "URY" 80 'left 'float t)
                           )
                ?choice tree
                )
              )
        ;--------------------------------------------------------------------
        ; Now create the context menu
        ;--------------------------------------------------------------------
        (setq select
              (hiCreateMenuItem
                ?name 'select
                ?itemText "Select"
                )
              )
        (setq delete
              (hiCreateMenuItem
                ?name 'delete
                ?itemText "Delete"
                )
              )
        (setq info
              (hiCreateMenuItem
                ?name 'info
                ?itemText "Delete"
                )
              )
        (hiCreateMenu
          'abTreeExampleMenu
          "Tree Item"
          (list select delete info)
          )
        ;--------------------------------------------------------------------
        ; Attach the context menu to the field
        ;--------------------------------------------------------------------
        (putpropq treeField abTreeExampleMenu hiContextMenu)
        (putpropq treeField 'abTreeExampleMenuContextCB hiShowContextMenuCallback)
        ;--------------------------------------------------------------------
        ; Then finally create the form
        ;--------------------------------------------------------------------
        (hiCreateAppForm
          ?name 'abTreeExampleForm
          ?formTitle "Tree Example"
          ?fields (list
                    (list treeField 5:5 610:400 20)
                    )
          ?initialSize 620:420
          ?attachmentList (list
                            hicLeftPositionSet|hicRightPositionSet|
                            hicTopPositionSet|hicBottomPositionSet
                            )
          ) ; hiCreateAppForm
        ) ; let
      ) ; defun abCreateTreeExampleForm
    
    /***************************************************************
    *                                                              *
    *      (abTreeExampleMenuContextCB menu form field item)       *
    *                                                              *
    *                Callback for the context menu                 *
    *                                                              *
    ***************************************************************/
    
    (defun abTreeExampleMenuContextCB (menu form field item)
      (printf "Context Menu called: %L %L %L %L\n"
              menu form field item)
      (printf "Value of tree is %L\n"
              (getq (get form field) value))
      )
    
    /***************************************************************
    *                                                              *
    *                   (abTreeExample objects)                    *
    *                                                              *
    *                       Main entry point                       *
    *                                                              *
    ***************************************************************/
    
    (defun abTreeExample (objects)
      (abCreateTreeExample objects)
      (hiDisplayForm abTreeExampleForm)
      ) 
    

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mjskier
    mjskier over 10 years ago
    In the example above. Let say you add callback to your entries context menu. (For example when the user selects delete, you want to delete that entry. Assume a callback called deleteCB was registered with the "delete" menu entry. How do you get the selected item to deleteCB? abTreeExampleMenuContextCB is called BEFORE the context menu is shown. So while the tree and the item on which you right clicked are available in that CB, they aren't available in deleteCB
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    One option is to have abTreeExampleMenuContextCB record the item that was passed into it in a user-defined property on the field:

    (defun abTreeExampleMenuContextCB (menu form field item)
      (printf "Context Menu called: %L %L %L %L\n"
              menu form field item)
      (putpropq (get form field) item abCurrentItem)
      (printf "Value of tree is %L\n"
              (getq (get form field) value))
      )

    Then if you defined your deleteCB to be:

    (defun MyDeleteCB (form field)
      (printf "Current item was %L\n" (getq (get form field) abCurrentItem))
    )

    and then when you create the menu item:

        (setq delete
              (hiCreateMenuItem
                ?name 'delete
                ?itemText "Delete"
                ?callback "MyDeleteCB(hiGetCurrentForm() 'shapeTree)"
                )
              )

    Hopefully that shows the idea clearly enough?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mjskier
    mjskier over 10 years ago

    Thanks Andrew.  

    I actually didn't understand what I really wanted (not the first or last time :-)

    Since I could potentially have multiple selections, I ended up registering my context menu entry callback as

    "(myCB (hiGetCurrentForm)  delete)"

    And then in hiGetCurrentForm I can just call hiTreeTableGetSelectedItems on the treeTable inside of the form (which I have access to since I get the form as an argument)

    (defun myCB (form action) ...)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Laur9
    Laur9 over 10 years ago

    Hi Andrew,

    I tried to understand your code and I'm asking if shouldn't it be

    items=hiGetTreeItems( abTreeExampleForm->shapeTree->choice)

    instead of abTreeExampleForm->treeField->choice  ???

    What I can't understand is why this

    (putpropq treeField abTreeExampleMenu hiContextMenu) is Ok but this

    treeField[ hiContextMenu] = abTreeExampleMenu  not ?!?

    When I try latter I get *Error* eval: unbound variable - hiContextMenu

    Thank you in advance

    Laurent

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Laurent,

    Yes, you're right. It should be:

    items=hiGetTreeItems( abTreeExampleForm->shapeTree->choice)

    I had a slightly hacked version of this code in my work area, and for some reason I'd changed the field name to be treeField in my local version and I'd not noticed.

    For your second question, there's two reasons why it doesn't work. First, putpropq is not the same as an array access. It's equivalent (in fact identical to):

    treeField->hiContextMenu=abTreeExampleMenu

    The "q" at the end of putpropq means that the second argument is implicitly quoted - so that means the function is not a normal lambda function in that its arguments are not evaluated before the call - the function itself determines which arguments to evaluate, and which to take literally. It's equivalent (but not identical to):

    putprop(treeField abTreeExampleMenu 'hiContextMenu) ; notice the quote that is necessary if you use putprop rather than putpropq.

    You can use the -> operator (or putpropq) on hash tables, but you can't use the hash table (array access) syntax on forms, form fields, etc. So that's why the [] syntax wouldn't work. If it had have been possible, you'd have had to do:

    treeField['hiContextMenu]=abTreeExampleMenu

    but that won't work because [] is not supported on structures or fields etc.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Laur9
    Laur9 over 10 years ago

    Thank you Andrew for taking time to explain this tricky things. I appreciate this !

    Now I can see better the little differences. In the skill manual I'm missing this depth explanations at many places.

    I'm playing with your CreateTree example because is the best example showing how to create dynamically the tree that I founded. What I'm dreaming of is to build some day a Database Browser "Explorer" to help me to get inside information about objects/forms etc.

    Best Regards

    Laurent

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Here's some code that has existed for many, many years, which acts as a browser to find your way around the database. It's not using modern tree objects, but a much older "dag" browser. However, it's still useful for exploring the database (and many other types of objects) in a tree-like fashion - great for debugging.

    ;----------------------------------------------------------------------------;
     
    /*
    Function        : dataBrowser.il
    Title           : A database browser
    Author          : Keith Sabine [Cadence Bracknell UK]
                      With additions by Ian Dobinson [Cadence Consulting, Abingdon]
                      Additions for 4.4 by Andrew Beckett [Cadence Bracknell UK]
                      Added support for ROD objects - Andrew Beckett
    Date            : 23rd September 2002
    Revision        : 1.5
    SW release      : 4.2.1 -> 4.4.X
    Prerequesites   : none
    Synopsis        : This functionality allows graphical viewing of the 
                      properties and attributes of SKILL objects.
    
    User's guide    : none
    Description     : Load this file and type 'brDataBrowser'. You need to have
                    : a cellview open in the current window. Alternatively,
                    : type 'dataBrowser(cv)' where cv is a database pointer
                    : to a cellview, or a design management object, or a list.
    
    SCCS Info: @(#) dataBrowser.il 11/20/08.15:26:22 1.5
    
    */
    
    /* define a couple of useful utility functions for 4.4 unless they've
       already been defined */
    (unless (getd 'ddobjectp)
      (procedure (ddobjectp obj)
                 (equal (substring (type obj) 1 2) "dd")))
    
    ; cope with this function not existing (happens sometimes)
    (unless (isCallable 'rodIsObj)
      (procedure (rodIsObj obj) nil)
      )
    
    (unless (getd 'ddordbobjectp)
          (procedure (ddordbobjectp obj)
                     (or (dbobjectp obj) (ddobjectp obj) (rodIsObj obj))))
    
    
    /*
     * Global variables controling whether values of leaf cell objects
     * are displayed on the browser.
     */
    brShowValues = t
    
    /*
     * Create the menus for the browser.
     */
    hiCreateMenu('brMenu "Commands"
    
        list(
            ; Close Browser.
            hiCreateMenuItem(
                ?name 'closeHandle
                ?itemText "Close browser"
                ?callback "brCloseBrowser()"
            )
    
            ; Centre the browser in the window.
            hiCreateMenuItem(
                ?name 'centreHandle
                ?itemText "Centre"
                ?callback "brCentre(dagGetCurrentTool())"
            )
    
            ; Switch on
            brClearValuesMenuItem = hiCreateMenuItem(
                ?name 'noShowValues
                ?itemText "Don't Show Values"
                ?callback "brClearShowValues()"
            )
        )
    )
    
    brShowValuesMenuItem = hiCreateMenuItem(
                ?name 'showValues
                ?itemText "Show Values"
                ?callback "brSetShowValues()"
            )
    
    
    /*******************************************************************************
     * brCloseBrowser()
     *
     * Close down the browser.
     * Callback for the close function on the top level menu.
     ******************************************************************************/
    procedure( brCloseBrowser()
    
        hiCloseWindow(dagGetCurrentTool()->window)
    
    ) ; end procedure brCloseBrowser
    
    
    /*******************************************************************************
     * brSetShowValues()
     *
     * Set the global controlling showing of leaf cell values, and then
     * swap the menus on the command menu.
     ******************************************************************************/
    procedure( brSetShowValues()
    
        brShowValues = t
        hiDeleteMenuItem(brMenu 'showValues)
        hiAddMenuItem(brMenu brClearValuesMenuItem)
    
    ) ; end procedure brSetShowValues
    
    
    /*******************************************************************************
     * brClearShowValues()
     *
     * Clear the global controlling showing of leaf cell values, and then
     * swap the menus on the command menu.
     ******************************************************************************/
    procedure( brClearShowValues()
    
        brShowValues = nil
        hiDeleteMenuItem(brMenu 'noShowValues)
        hiAddMenuItem(brMenu brShowValuesMenuItem)
    
    ) ; end procedure brClearShowValues
    
    
    /*******************************************************************************
     * brPrintAttributes(node)
     *
     * Print attributes of a node
     ******************************************************************************/
    procedure(brPrintAttributes(node)
    
        let( (obj attribs)
    
            obj = node->obj
            cond(
    
                (!obj
                    printf("nil\n")
                )
    
                (ddordbobjectp(obj)
    
                    printf("\n%s--------------------------------------\n"
                           "------------------------------------------")
                    printf("\nattributes of %s:\n\n" brGetDBName(obj))
                    attribs = obj~>??
                    unless(symbolp(car(attribs))
                        attribs = cdr(attribs)
                        )
                    while(attribs
                        printf("%-32s : " car(attribs))
                        print(cadr(attribs))
                        printf("\n")
                        attribs = cddr(attribs)
                    )
                    printf("\n%s--------------------------------------\n"
                           "------------------------------------------")
    
                )
    
                (t
                    printf("Sorry - not a database object (%L)." typep(obj))
                )
    
            ) ; end cond
    
        ) ; end let
    
    ) ; end procedure brPrintAttributes
    
    
    /*******************************************************************************
     * brPrintProperties(node)
     *
     * print properties of a node
     ******************************************************************************/
    procedure(printProperties(node)
    
        let( (obj)
    
            obj = node->obj
            if(ddordbobjectp(obj) && obj~>objType then
                printf("\n%s--------------------------------------\n"
                       "------------------------------------------")
                printf("\nproperties of %s:\n\n" obj~>objType)
                foreach(prop obj~>prop
                    printf("%-32s :  " prop~>name)
                    print(prop~>value)
                    printf("  (%s)\n" prop~>valueType)
                )
                printf("\n%s--------------------------------------\n"
                       "------------------------------------------")
            else
                printf("Sorry - not a database object\n")
            )
    
        ) ; end let
    
    ) ; end procedure printProperties
    
    
    /*******************************************************************************
     * brEditProps(node)
     *
     * Edit properties of a node.
     ******************************************************************************/
    procedure(brEditProps(node)
    
        if(ddordbobjectp(node->obj)
            hiEditPropList(node->obj)
        ; else
            printf("Sorry - can only edit properties of a database object.\n")
        )
    
    ) ; end procedure brEditProps
    
    
    /*******************************************************************************
     * brShowValue(node)
     *
     * Show value associated with a leaf node.
     ******************************************************************************/
    procedure( brShowValue(node)
    
        printf("Value is: %L\n" node->obj)
    
    ) ; end brShowValue
    
    
    /*******************************************************************************
     * brExpandObjNew(startNode)
     *
     * Expand a node into a new browser.
     ******************************************************************************/
    procedure( brExpandObjNew(startNode)
    
        brDataBrowser(startNode->obj startNode->name)
    
    ) ; end procedure brExpandObjNew
    
    
    /*******************************************************************************
     * beUnexpandNode(startNode)
     *
     * Unexpand node
     ******************************************************************************/
    procedure( beUnexpandNode(startNode)
    
        mapc('dagDestroyNode startNode->childObjects)
    
    ) ; end beUnexpandNode
    
    
    /*******************************************************************************
     * brDeleteObject(node)
     *
     * Attempt to delete the given object.
     ******************************************************************************/
    procedure(brDeleteObject(node)
    
        when( hiDisplayModalDBox( 'brBox
                            "Deleting a database object"
                            "Do you REALLY want to do this?"
                            "" "" )
    
            printf("Deleting object type %L " node->obj~>objType)
            cond(
    
                (node->obj~>cellName
                    printf("%s" node->obj~>cellName)
                )
    
                (node->obj~>name
                    printf("%s" node->obj~>name)
                )
    
            ) ; end cond
    
            printf("\n")
    
            ; Try to delete the object.
            if(errset(dbDeleteObject(node->obj)) then
    
                /* Delete the children from the display. */
                foreach( child node->childObjects
                        dagDestroyNode(child)
                )
    
                /* Delete the node itself. */
                dagDestroyNode(node)
    
            else
    
                printf("Sorry - could not delete this object.\n")
    
            ) ; end i
    
        ) ; end when
    
    ) ; end procedure brDeleteObject
    
    
    /*******************************************************************************
     * brExpandNode(startNode)
     *
     * Expand node into objects
     ******************************************************************************/
    procedure( brExpandNode(startNode )
        let( (obj node entries names name count)
    
            ; go through list of objects and create their nodes
            ; first destroy any child nodes...
    
            foreach( child startNode->childObjects
                dagDestroyNode(child)
            )
    
            obj = startNode->obj
    
            when(startNode->expandable
                ; Expand the object into names and values.
                entries = brExpandObject(obj)
                count = 1
        
                ; Convert the values into nodes.
                foreach(entry entries
    
                    ; If we have already had the name in this expansion, then
                    ; we prefix it with a count, otherwise actions will be applied
                    ; to the wrong object.
                    name = car(entry)
                    when(member(name names)
                        name = sprintf(nil "%d_%s" count++ name)
                    )
                    names = cons(name names)
        
                    ; Create the node.
                    node = dagCreateNode(name 
                        cond( (ddordbobjectp(cadr(entry)) brDBObjectClass)
                              (caddr(entry) brObjectClass)
                              (t brNonExpandObjectClass)))
                    node->obj = cadr(entry)
                    node->expandable = caddr(entry)
    
                    ; Set the colour.
                    if(ddordbobjectp(cadr(entry)) || typep(cadr(entry))==t
                        node->textColor = brRedColor
                    ; else
                    if(caddr(entry)
                        node->textColor = brBlueColor
                    ; else
                        node->textColor = brBlackColor
                    ))
    
                    ; Link the node to its parent.
                    dagLinkParentToChild(startNode node)
        
                ) ; end foreach 
    
            ) ; end when
        
        ) ; end let
    
    ) ; end procedure brExpandNode
    
    
    /*******************************************************************************
     * beExpandObject(val)
     *
     * Expand a general object, according to its type.
     ******************************************************************************/
    procedure( brExpandObject(val)
    
        caseq(typep(val)
    
            ((dbobject rodObj t) brExpandDBObject(val))
    
            (list brExpandList(val))
    
            ((wtype other) brExpandUserType(val))
    
            (array brExpandArray(val))
    
            (t
                cond( 
                    (ddobjectp(val) brExpandDBObject(val))
                    (defstructp(val) brExpandUserType(val))
                )
            )
    
        ) ; end caseq
    
    ) ; end procedure brExpandObject
    
    
    /*******************************************************************************
     * beExpandCBObject(dbId)->expansionList
     *
     * Convert a db object into its expansion entries.
     ******************************************************************************/
    procedure(brExpandDBObject(dbId)
    
        let( (objList objNames)
    
            objList = dbId~>??
            unless(symbolp(car(objList))
                objList=cdr(objList)
            )
            /* Convert to an assoc type list. */
            while(objList
                if(brExpandable(cadr(objList))
                    objNames = cons(list(get_pname(car(objList))
                                 cadr(objList)
                                 t) objNames)
                ; else
                    objNames = cons(list(sprintf(nil "%s %s %L" 
                                            get_pname(car(objList)) 
                                            if(brShowValues "-" "")
                                            if(brShowValues cadr(objList) ""))
                                    cadr(objList) nil) objNames)
                )
                objList = cddr(objList)
            )
    
            objNames
    
        ) ; end let
    
    ) ; end procedure brExpandDBObject
    
    
    /*******************************************************************************
     * beExpandList(list)
     *
     * Expand list into nodes
     ******************************************************************************/
    procedure( brExpandList( list )
    
        /* Take each element, get a name, and whether expandable, and
           build the result list.
        */
        foreach(mapcar element list
            list(brGetName(element) element brExpandable(element))
        )
    
    ) ; end procedure brExpandList
    
    
    /*******************************************************************************
     * beExpandArray(arr)
     *
     * Expand list into nodes
     ******************************************************************************/
    procedure( brExpandArray( arr )
    
        let( (res val)
    
            for(i 0 length(arr)-1
                unless((val = arrayref(arr i)) == 'unbound
                    res = cons(list(sprintf(nil "%d - %L" i brGetName(val)) 
                                    val brExpandable(val)) 
                               res)
                )
            )
    
            reverse(res)
    
        ) ; end let
    
    ) ; end procedure brExpandArray
    
    
    /*******************************************************************************
     * brExpandUserType(obj)->expansionList
     *
     * Expand a 'user type', such as a window, menu, or defstruct type object.
     * This means picking objects from the ->?? structure.
     ******************************************************************************/
    procedure(brExpandUserType(dbId)
    
        let( (objList objNames)
    
            if(typep(dbId) == 'wtype
                objList = plist(dbId)
            ; else
                objList = dbId->??
            )
            /* Convert to an assoc type list. */
            while(objList
                if(brExpandable(cadr(objList))
                    objNames = cons(list(get_pname(car(objList))
                                 cadr(objList)
                                 t) objNames)
                ; else
                    objNames = cons(list(sprintf(nil "%s %s %L" 
                                            get_pname(car(objList)) 
                                            if(brShowValues "-" "")
                                            if(brShowValues cadr(objList) ""))
                                    cadr(objList) nil) objNames)
                )
                objList = cddr(objList)
            )
    
            objNames
    
        ) ; end let
    
    ) ; end procedure brExpandUserType
    
    
    /*******************************************************************************
     * brDataBrowser([d_cv] [t_rootName])
     *
     * Main entry point to the browser.
     * The arguments are both optional, and are the object to expand, and the
     * name to use for the top level object. The later is used when expanding
     * an object into a new browser, and is not expected to be used by the
     * user.
     ******************************************************************************/
    procedure( brDataBrowser(@optional cv rootName)
    let( (rootNode firstNode browser expandable dbObj)
    
        unless(cv
            cv = hiGetCurrentWindow()->cellView
        )
    
        unless(boundp('brObjectClass) && brObjectClass
    
            ; create brObjectClass, used for display of objects
            brObjectClass = dagCreateClass("brObjectClass")
        
            ; valid actions for obj...
            dagAddActionToObject( '("expand object" "brExpandNode" 
                                    "dagGetCurrentObject()" "mouseLeft" t) 
                                    brObjectClass)
            dagAddActionToObject( '("unexpand object" "beUnexpandNode"
                                    "dagGetCurrentObject()" "mouseRight" t) 
                                    brObjectClass)
            dagAddActionToObject( '("expand to new browser" "brExpandObjNew"
                                    "dagGetCurrentObject()" "mouseRight" t) 
                                    brObjectClass)
    
            brDBObjectClass = dagCreateClass("brDBObjectClass")
            ; valid actions for obj...
            dagAddActionToObject( '("expand object" "brExpandNode" 
                                    "dagGetCurrentObject()" "mouseLeft" t) 
                                    brDBObjectClass)
            dagAddActionToObject( '("unexpand object" "beUnexpandNode"
                                    "dagGetCurrentObject()" "mouseRight" t) 
                                    brDBObjectClass)
            dagAddActionToObject( '("expand to new browser" "brExpandObjNew"
                                    "dagGetCurrentObject()" "mouseRight" t) 
                                    brDBObjectClass)
            dagAddActionToObject( '("show attributes" "brPrintAttributes" 
                                    "dagGetCurrentObject()" "" t) brDBObjectClass)
            dagAddActionToObject( '("show properties" "printProperties" 
                                    "dagGetCurrentObject()" "" t) brDBObjectClass)
            dagAddActionToObject( '("edit properties" "brEditProps" 
                                    "dagGetCurrentObject()" "" t) brDBObjectClass)
            dagAddActionToObject( '("delete" "brDeleteObject" 
                                    "dagGetCurrentObject()" "" t) brDBObjectClass)
    
            brNonExpandObjectClass = dagCreateClass("brNonExpandObjectClass")
            dagAddActionToObject( '("Show Value" "brShowValue" 
                                    "dagGetCurrentObject()" "mouseLeft" t) 
                                    brNonExpandObjectClass)
    
            ; Set up colors.
            brRedColor   = hiMatchColorByName("red")
            brBlackColor = hiMatchColorByName("black")
            brBlueColor = hiMatchColorByName("blue")
    
        ) ; end unless
        
        ; now setup root node, doesn't matter which class.
        firstNode = dagCreateNode("" brObjectClass)
    
        ; set the value
        firstNode->obj = cv
    
        ; open the browser, same size as library browser...
        browser = dagOpenTool( hiMatchColorByName("white") list(200:200 500:700) 
                             firstNode "database browser" "help")
        browser->horizontal = t
        browser->textOnly = t
        browser->showLabels = t
        browser->labelJustification = 'centerLeft
        browser->scaleToFit = nil
        browser->anchorObject = firstNode
        browser->rootNode = firstNode
        browser->anchorTo = 'centerLeft
        browser->placer = dagFindPlacer("versionPlacer")
        unless(rootName rootName = brGetName(cv))
    
        expandable = brExpandable(cv)
        dbObj = ddordbobjectp(cv) || typep(cv)==t
        rootNode = dagCreateNode(rootName 
                    cond( (dbObj brDBObjectClass) (expandable brObjectClass)
                            (t brNonExpandObjectClass)))
        dagLinkParentToChild( firstNode rootNode)          
        rootNode->obj = cv  
        firstNode->invisible = t  
        rootNode->expandable = expandable                            
        rootNode->textColor = if(dbObj brRedColor 
                                  if(expandable brBlueColor brBlackColor))
    
        ; redraw the browser with the above options...
        dagDisplayTool(browser)
    
        hiInsertBannerMenu(browser->window 'brMenu 0)
    
    )) ; end procedure brDataBrowser
    
    
    /*******************************************************************************
     * brGetName(obj)->name
     *
     * Get a name for an object.
     ******************************************************************************/
    procedure(brGetName(obj)
    
        caseq(typep(obj)
    
            ((dbobject rodObj t)
                sprintf(nil "%s" brGetDBName(obj))
            )
    
            (string
                sprintf(nil "'%s'" obj)
            )
    
            (wtype
                sprintf(nil "window %d" obj->windowNum)
            )
    
            (list
                "<list>"
            )
    
            (t
                if( ddobjectp(obj) then
                    sprintf(nil "%s" brGetDBName(obj))
                else
                    sprintf(nil "<%L> %L" typep(obj) if(brShowValues obj ""))
                )
            )
    
        ) ; end caseq
    
    ) ; end procedure brGetName
    
    
    /*******************************************************************************
     * brGetDBName(obj)->name
     *
     * Get the name of a db object.
     ******************************************************************************/
    procedure( brGetDBName(obj)
    
        case(obj~>objType
    
            ("cellView" sprintf(nil "(cv) %s %s" obj~>cellName obj~>viewName))
    
            (("lib" "cell" "view" "prop") 
                    sprintf(nil "(%s) %s " obj~>objType obj~>name))
    
            ("cellview" sprintf(nil "(cv) %s %s" obj~>cell~>name obj~>view~>name))
    
            ("version" sprintf(nil "(v) %L.%L" obj~>primaryIndex
                                    obj~>secondaryIndex))
    
            ("LP" sprintf(nil "%s %s" obj~>layerName obj~>purpose))
    
            (t obj~>name || "<>")
    
        ) ; end case
    
    ) ; end procedure brGetDBName
    
    
    /*******************************************************************************
     * brExpandable(obj)->t/nil
     *
     * Whether an object type is expandable.
     ******************************************************************************/
    procedure(brExpandable(obj)
    
        ((memq(typep(obj) '(list dbobject wtype other array rodObj t)) || ddobjectp(obj)) && obj) ||
            defstructp(obj)
    
    ) ; end procedure brExpandable
    
    
    /*******************************************************************************
     * brCentre(tool)
     *
     * Centre the browser.
     ******************************************************************************/
    procedure(brCentre(tool)
    
        tool->anchorObject = tool->rootNode
        tool->anchorTo = 'centerLeft
    
    ) ; end brCentre
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Laur9
    Laur9 over 10 years ago

    It is indeed a great tool for debugging !

    Thank you Andrew for making this tool available for us !!!

    I've been looking after this kind of tool for so long time. This tool should be added to the standard icfb tools in CIW-Window.

    Best regards

    Laurent

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information