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

getWarn

getWarn( 
) 
=> t_warning

Description

Returns the buffered warning if it has not already been printed.

Arguments

None

Value Returned

t_warning

The warning message that would have been printed if it had not been intercepted by the call to getWarn.

Examples

procedure( testWarn( @key ( getLastWarn nil ) )
warn("This is warning %d\n" 1 ) ;;; print previous warning
warn("This is warning %d\n" 2 ) ;;; and buffer new one.
warn("This is warning %d\n" 3 )
when( getLastWarn
thrownAwayWarn = getWarn( ) ;;; throw away last warning
nil ;;; return nil
) ; when
) ; procedure

The testWarn function intercepts the last warning message and stores it in a global variable if t is passed in, and lets the system print all the warnings if nil is given as an argument. Use of the getWarn( ) function makes it possible to throw away a warning message, if desired.

testWarn( ?getLastWarn t)
=> nil
*WARNING* This is warning 1
*WARNING* This is warning 2

Returns nil. The system prints the first two warnings and the third is intercepted and stored in global variable thrownAwayWarn.

testWarn( ?getLastWarn nil) 
=> nil
*WARNING* This is warning 1
*WARNING* This is warning 2
*WARNING* This is warning 3

Returns nil. The system prints all the queued warnings.

The return value may be interleaved with the warning message output. The following example shows how the output can appear in the CIW.

testWarn( ?getLastWarn t)
*WARNING* This is warning 1
*WARNING* This is warning 2
=> nil
testWarn( ?getLastWarn nil)
*WARNING* This is warning 1
*WARNING* This is warning 2
=> nil
*WARNING* This is warning 3

Related Topics

Core Functions


Return to top
 ⠀
X