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

globalProc

globalProc( 
s_funcName( 
l_formalArglist 
) 
g_expr1 ... 
)
=> s_funcName

Description

Defines a global function using a formal argument list. The functions that you define using globalProc are defined within a lexical scope, but are globally accessible.

The body of globalProc is a list of expressions to be evaluated one after another when s_funcName is called. There must be no white space between globalProc and the open parenthesis that follows, nor between s_funcName and the open parenthesis of l_formalArglist. However, for defglobalfun there must be white space between s_funcName and the open parenthesis. This is the only difference between the two functions.

Expressions within a function can reference any variable on the formal argument list or any global variable defined outside the function. If necessary, local variables can be declared using the let or prog functions.

Arguments

s_funcName

Name of the function you are defining.

l_formalArglist

Formal argument list.

g_expr1

Expression or expressions to be evaluated when s_funcName is called.

Value Returned

s_funcName

Name of the function being defined.

Examples

Define two global functions, test_set and test_get using  and globalProc that reference a lexical variable secret_val:

toplevel 'ils
ILS-<2> (let ((secret_val 1))
(defglobalfun test_set (x) secret_val = x)
(globalProc test_get() secret_val)
)
ILS-<2> test_get()
=> 1
ILS-<2> test_set(2)
=> 2

ILS-<2> test_get()
=> 2

Related Topics

Function and Program Structure


Return to top
 ⠀
X