Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

copyDefstructDeep

copyDefstructDeep( 
r_object 
) 
=> r_defstruct

Description

Performs a deep or recursive copy on defstructs with other defstructs as sub-elements, making copies of all the defstructs encountered.

The various copy_<name> functions are called to create copies for the various defstructs encountered in the deep copy.

Only defstruct sub-elements are recursively copied. Other data types, like lists, are still shared.

Arguments

r_object

An instance of a defstruct.

Value Returned

r_defstruct

A deep copy of the given instance.

Examples

defstruct(myStruct a b c) => t ;creates a function _myStruct
m1 = _myStruct(?a 3 ?b 2 ?c 1) 
=> array[5]:3873024
m2 = _myStruct(?a m1 ?b '(a b c) ?c 5) 
=> array[5]:3873208 ; m1 is m2's sub-element
m3 = copyDefstructDeep(m2) 
=> array[5]:3873056 ; uses deep copy
m3->a 
=> array[5]:3873344 ; a new object
eq(m3->a m2->a) => nil      ; eq checks object identity
m2->b 
=> (a b c)
eq(m3->b m2->b) 
=> t ; still sharing the same object because
; the sub-element b is not a defstruct
m4 = copy_myStruct(m2) 
=> array[5]:3873376 ; uses shallow copy
m4->a => array[5]:3873024
eq(m4->a m2->a) => t ; share identical substructure
eq(m4->b m2->b) => t   ; the same object

Related Topics

copy_<name>

printstruct


Return to top
 ⠀
X