2.23 Environment


2.23.1 Dictionary

Function: disassemble function-designator*

Display the assembly code of a function

Synopsis

function-designator

A symbol which is bound to a function in the global environment, or a lambda form

Description

As specified in ANSI [see ANSI] this function outputs the internal representation of a compiled function, or of a lambda form, as it would look after being compiled.

ECL only has a particular difference: it has two different compilers, one based on bytecodes and one based on the C language. The output will thus depend on the arguments and on which compiler is active at the moment in which this function is run.

  • If the argument is a bytecompiled function or a lambda form, it will be processed by the active compiler and the appropriate output (bytecodes or C) will be shown.
  • If the argument is a C-compiled form, disassembling the function by showing its C source code is not possible, since that would require saving not only the lambda form of the function, but also the precise configuration of the compiler when the function was compiled. Hence no output will be shown.
Function: ed x?

Invoke an editor on the file or object specified by x.

Synopsis

(ed x?)

x

nil, a file path, or an object to edit.

Description

Starts the editor (on a file or an object if named). Functions from the list ext:*ed-functions* are called in order with x as an argument until one of them returns non-nil; these functions are responsible for signalling a file-error to indicate failure to perform an operation on the file system. If no function returns a non-nil value or ext:*ed-functions* is nil then a simple-error will be signalled.

The Common Lisp specification states that the x argument is either nil, a function name, or an instance of string or pathname and that a type-error may be signalled if is not one of these types. ECL does not check the type of x and thus permits any object to be passed to the hook functions. This allows for the possibility of editing other objects that have a representation in source code such as class definitions. Therefore, the hook functions should not make any assumptions about the type of x and should instead return nil if there is not an approriate edit method for a specific value of x.

By default ext:*ed-functions* contains a single function that attempts to run the program named in the environment variable EDITOR. If this environment variable is not set then the fallback program is vi.

Macro: trace function-name*

Follow the execution of functions

Synopsis

(trace function-name*)

function-name

{symbol | (symbol [option form]*)}

symbol

A symbol which is bound to a function in the global environment. Not evaluated.

option

One of :break, :break-after, :cond-before, :cond-after, :cond, :print, :print-after, :step

form

A lisp form evaluated in an special environment (or a list of forms for :print and :print-after).

returns

List of symbols with traced functions.

Description

Causes one or more functions to be traced. Each function-name can be a symbol which is bound to a function, or a list containing that symbol plus additional options. If the function bound to that symbol is called, information about the arguments and output of this function will be printed. Trace options will modify the amount of information and when it is printed.

Not that if the function is called from another function compiled in the same file, tracing might not be enabled. If this is the case, to enable tracing, recompile the caller with a notinline declaration for the called function.

trace returns a name list of those functions that were traced by the call to trace. If no function-name is given, trace simply returns a name list of all the currently traced functions.

Trace options cause the normal printout to be suppressed, or cause extra information to be printed. Each option is a pair of an option keyword and a value form. If an already traced function is traced again, any new options replace the old options and a warning might be printed. The lisp form accompanying the option is evaluated in an environment where sys::args contains the list of arguments to the function.

The following options are defined:

:cond, :cond-before, :cond-after

If :cond-before is specified, then trace does nothing unless form evaluates to true at the time of the call. :cond-after is similar, but suppresses the initial printout, and is tested when the function returns. :cond tries both before and after.

:step

If form evaluates to true, the stepper is entered.

:break, :break-after

If specified, and form evaluates to true, then the debugger is invoked at the start of the function or at the end of the function according to the respective option.

:print, :print-after

In addition to the usual printout, the result of evaluating each entry of the list of forms contained in form is printed at the start of the function or at the end of the function, depending on the option.

See also the following example:

> (defun abc (x)
    (if (>= x 10)
        x
        (abc (+ x (abc (1+ x))))))
> (trace abc)

> (abc 9)
1> (ABC 9)
| 2> (ABC 10)
| <2 (ABC 10)
| 2> (ABC 19)
| <2 (ABC 19)
<1 (ABC 19)
19
> (untrace abc)

(ABC)
;; Break if the first argument of the function is greater than 10
> (trace (abc :break (>= (first si::args) 10)))

((ABC :BREAK (>= (FIRST SI::ARGS) 10)))
> (abc 9)
1> (ABC 9)
| 2> (ABC 10)

Condition of type: SIMPLE-CONDITION
tracing ABC
Available restarts:

1. (CONTINUE) Return from BREAK.
2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at ABC. In: #<process TOP-LEVEL 0x1842f80>.
>> 

2.23.2 C Reference

2.23.2.1 ANSI Dictionary

Common Lisp and C equivalence

Lisp symbolC function
decode-universal-timecl_object cl_decode_universal_time(cl_narg narg, cl_object universal_time, ...)
encode-universal-timecl_object cl_encode_universal_time(cl_narg narg, cl_object second, cl_object minute, cl_object hour, cl_object date, cl_object month, cl_object year, ...)
get-universal-timecl_object cl_get_universal_time(void)
get-decoded-timecl_object cl_get_decoded_time(void)
sleepcl_object cl_sleep(cl_object seconds)
aproposcl_object cl_apropos(cl_narg narg, cl_object string, ...)
apropos-listcl_object cl_apropos_list(cl_narg narg, cl_object string, ...)
describecl_object cl_describe(cl_narg narg, cl_object object, ...)
describe-object[Only in Common Lisp]
get-internal-real-timecl_object cl_get_internal_real_time(void)
get-internal-run-timecl_object cl_get_internal_run_time(void)
disassemble[Only in Common Lisp]
documentation[Only in Common Lisp]
room[Only in Common Lisp]
ed[Only in Common Lisp]
inspectcl_object cl_inspect(cl_object object)
dribblecl_object cl_dribble(cl_narg narg, ...)
lisp-implementation-typecl_object cl_lisp_implementation_type(void)
lisp-implementation-versioncl_object cl_lisp_implementation_version(void)
short-site-namecl_object cl_short_site_name()
long-site-namecl_object cl_long_site_name()
machine-instancecl_object cl_machine_instance()
machine-typecl_object cl_machine_type()
machine-versioncl_object cl_machine_version()
software-typecl_object cl_software_type()
software-versioncl_object cl_software_version()
user-homedir-pathnamecl_object cl_user_homedir_pathname(cl_narg narg, ...)