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

load

load( 
t_fileName 
[ t_password ] 
) 
=> t

Description

Opens a file, repeatedly calls lineread to read in the file, immediately evaluating each form after it is read in. Uses the file extension to determine the language mode (.il/.ile for SKILL and .ils/.ilse for SKILL++) for processing the language expressions contained in the file. By default, the loaded code is evaluated in dynamic scoping. However, if the extension is .ils/.ilse, lexical scoping is used. For a SKILL++ file, the loaded code is always evaluated in the top level environment.

It closes the file when end of file is reached. Unless errors are discovered, the file is read in quietly. If load is interrupted by pressing Control-c, the function skips the rest of the file being loaded.

SKILL has an autoload feature that allows applications to load functions into SKILL on demand. If a function being executed is undefined, SKILL checks to see if the name of the function (a symbol) has a property called autoload attached to it. If the property exists, its value, which must be either a string or an expression that evaluates to a string, is used as the name of a file to be loaded. The file should contain a definition for the function that triggered the autoload. Execution proceeds normally after the function is defined.

Arguments

t_fileName

File to be loaded. Uses the file name extension to determine the language mode to use.

The valid values are:

  • 'ils/'ilse, which indicates that the file contains SKILL++ code.
  • 'il/'ils, which indicates that the file contains SKILL code.

t_password

Password, if t_fileName is an encrypted file.

Value Returned

t

The file is successfully loaded.

Examples

load( "testfns.il")             ; Load file testfns.il
fn.autoload = "myfunc.il" ; Declares an autoload property.
fn(1)

fn is undefined at this point, so this call triggers an autoload of myfunc.il, which contains the definition of fn. The function call fn(1) is then successfully performed.

fn(2)      ; fn is now defined and executes normally.

You might have an application partitioned into two files. Assume that UtilsA.il contains classic SKILL code and UtilsB.ils contains SKILL/SKILL++ code. The following example loads both files appropriately.

procedure( trLoadSystem()
load( "UtilsA.il" ) ;;; SKILL code
load( "UtilsB.ils" ) ;;; SKILL++ code
) ; procedure

Related Topics

include

loadi

lineread


Return to top
 ⠀
X