load


(load  lspfile  [ failure-expression ] )

This function loads the specified lspfile file; all code outside a (defun) block is evaluated at load-time; nested loading is supported.

Arguments

lspfile  (string) Lisp file to be loaded; can optionally contain a path/folder - without path/folder, all defined support pathes are searched

failure-expression  (optional) if specified

Return

value of last evaluated expression;
in case of an error, and if failure-expression is specified, then failure-expression is returned

Example

(load "MyTest.lsp" "oops")
- returns last-evaluated expression, if no error happens
- returns the string "oops" if an error happened

(load "MyTest.lsp")
- returns last-evaluated expression, if no error happens
- if an error happens, Lisp loading stops and error message is shown in command line

Remarks

if no file extension is specified, BricsCAD Lisp searches in this sequence :
1. name.des
2. name.lsp

if failure-expression is not specified, and any Lisp error happens during load-time, the Lisp processing is stopped, and an error message is displayed;
if failure-expression is specified, and any Lisp error happens during load-time, Lisp processing is continued, no error message is shown

Remarks 2

since BricsCAD V20, the (load) functions also supports Lisp files which are stored as "Unicode" files :
- using UTF-8 format in "Little-Endian" byte order (Intel/AMD processors)
- using UTF-16 format in "Little-Endian" byte order (Intel/AMD processors)

!!! for both UTF-8/16 format, the Byte-Order-Mark (BOM) is absolutely required; UTF-8 without BOM might fail !!!



©  Bricsys NV. All rights reserved.