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

printlev

printlev( 
g_value 
x_level 
x_length 
[ p_outputPort ] 
) 
=> nil

Description

Prints a list with a limited number of elements and levels of nesting.

Lists are normally printed in their entirety no matter how many elements they have or how deeply nested they are. Applications have the option, however, of setting upper limits on the number of elements and the levels of nesting shown when printing lists. These limits are sometimes necessary to control the volume of interactive output because the SKILL top-level automatically prints the results of expression evaluation. Limits can also protect against the infinite looping on circular lists possibly created by programming mistakes.

Two integer variables, print length and print level (specified by x_length and x_level), control the maximum number of elements and the levels of nesting that are printed. List elements beyond the maximum specified by print length are abbreviated as “...” and lists nested deeper than the maximum level specified by print level are abbreviated as &. Both print length and print level are initialized to nil (meaning no limits are imposed) by SKILL, but each application is free to set its own limits.

The printlev function is identical to print except that it takes two additional arguments specifying the maximum level and length to be used in printing the expression.

Arguments

g_value

Any SKILL value.

x_level

Specifies the level of nesting that you want to print; lists nested deeper than the maximum level specified are abbreviated as “&”.

x_length

Specifies the length (or maximum number of elements) you want to print. List elements beyond the maximum specified here are abbreviated as “...”.

p_outputPort

Output port. Default is poport.

Value Returned

nil

Prints the argument value and then returns nil.

Examples

List = '(1 2 (3 (4 (5))) 6)
=> '(1 2 (3 (4 (5))) 6)
printlev(List 100 2)
(1 2 ...)
=> nil
printlev(List 3 100)
(1 2 (3 (4 &)) 6)
=> nil
printlev(List 3 3 p)            ; Assumes port p exists.
(1 2 (3 (4 &)) ...) ; Prints to port p.
=> nil

Related Topics

list

print


Return to top
 ⠀
X