Product Documentation
Cadence User Interface SKILL Reference
Product Version IC23.1, September 2023

Nesting Enterfunctions

Most enterfunctions can be nested inside one another, meaning that while one is active, another can be started. When the nested enterfunction terminates, the previous one again becomes active, and its state at the time of the second enterfunction is restored.

Because you can nest enterfunctions, and because the functions block until they are canceled or completed, it helps to be aware of what happens inside the software. Enterfunctions start new SKILL top levels, in which the flow of control is passed from one topLevel to another. The processing of user events does not stop, but evaluation of statements after the enterfunction is blocked until the topLevel is completed (either by completing an enterfunction or by cancelling it).

Suppose you have two procedures A and B

procedure( A( )
prog( (result)
result = enterBox( )
println("The result from A is %L\n" result)
return(result)
)
)
procedure( B( )    prog( (result)
result = enterArc( )
println("The result from B is %L\n" result)
return(result)
)
)

and you have two windows, window1 and window2. If window1 is current and you type A( ) in the CIW, procedure A executes. From within procedure A, enterBox is called and evaluation blocks at this statement, waiting for you to complete the enterfunction.

Now suppose you went to window2, made it current, and then invoked procedure B. Procedure B calls enterArc and evaluation blocks at this statement, waiting for you to complete the arc.

The system allows you to enter points in either window1 or window2. Suppose you enter the two points of the box in window1. The println will not be executed because evaluation is blocked inside procedure B. As soon as you finish the arc in window2, the println statement in procedure B is evaluated. Procedure B then returns, allowing procedure A to return, and its println statement is evaluated.

Due to this blocking behavior, we strongly suggest that you use a doneProc whenever you need to do something immediately after you complete an enterfunction.

If we rewrote the previous example using a doneProc, it would behave better.

procedure( resultsA( windowId doneOrCancel pointsList)
if( doneOrCancel == t) /* it was finished */
then println("The result from A is %L" pointsList)
)
)
procedure( A( )
enterBox(?doneProc "resultsA")
)
procedure( resultsB( windowId doneOrCancel pointsList)    if( doneOrCancel == t) /* it was finished */
then println("The result from B is %L" pointsList)
)
)
procedure( B( )
enterArc(?doneProc "resultsB")
)

The trick to using the enterfunctions in a nested environment is to organize your code in a callback style, doing what you want to do with the data in a callback procedure, rather than after the enterfunction statement.

Related Topics

Enterfunction Flags

Callback Procedures

Enterfunction Prompts


Return to top
 ⠀
X