% C Function: Stack Frame
Npt documentation.
Reference: ANSI Common Lisp npt
The following function specifications are described in lisp.h.
void lisp_push_control(addr *ret);
int lisp_pop_control_(addr control);
int lisp_push_special_(addr symbol, addr value);
int lisp_push_special8_(const void *name, addr value);
int lisp_push_special16_(const void *name, addr value);
int lisp_push_special32_(const void *name, addr value);
int lisp_get_special_(addr x, addr symbol);
int lisp_get_special8_(addr x, const void *name);
int lisp_get_special16_(addr x, const void *name);
int lisp_get_special32_(addr x, const void *name);
int lisp_set_special_(addr symbol, addr value);
int lisp_set_special8_(const void *name, addr value);
int lisp_set_special16_(const void *name, addr value);
int lisp_set_special32_(const void *name, addr value);
int lisp_defvar_(addr symbol);
int lisp_defvar8_(const void *str);
int lisp_defvar16_(const void *str);
int lisp_defvar32_(const void *str);
void lisp_catch(addr symbol);
int lisp_throw_(addr symbol);
int lisp_handler_bind_(addr name, addr call);
int lisp_handler_case_(addr name, addr call);
void lisp_handler_reverse(void);
void lisp_restart_make(addr x, addr name, addr call, int casep);
void lisp_restart_interactive(addr restart, addr call);
void lisp_restart_report(addr restart, addr call);
void lisp_restart_test(addr restart, addr call);
void lisp_restart_push(addr restart);
void lisp_restart_reverse(void);
Functions for allocating and releasing stack frame space.
void lisp_push_control(addr *ret);
int lisp_pop_control_(addr control);
lisp_push_controlvoid lisp_push_control(addr *ret);
Output: ret, New stack frame
Allocates a new stack frame.
The stack frame is mainly used for hold variables.
lisp_pop_control_int lisp_pop_control_(addr control);
Input: control, Stack frames to be released.
Return: Non-zero when escaping.
Releases the stack frame.
The current stack frame is also held by the execution environment,
and it is an error if the argument control is different from
the current stack frame.
This function can also be used for escape.
It is an error if control is a hold variable.
Functions for manipulating special variables.
int lisp_push_special_(addr symbol, addr value);
int lisp_push_special8_(const void *name, addr value);
int lisp_push_special16_(const void *name, addr value);
int lisp_push_special32_(const void *name, addr value);
int lisp_get_special_(addr x, addr symbol);
int lisp_get_special8_(addr x, const void *name);
int lisp_get_special16_(addr x, const void *name);
int lisp_get_special32_(addr x, const void *name);
int lisp_set_special_(addr symbol, addr value);
int lisp_set_special8_(const void *name, addr value);
int lisp_set_special16_(const void *name, addr value);
int lisp_set_special32_(const void *name, addr value);
lisp_push_special_int lisp_push_special_(addr symbol, addr value);
Input: symbol, symbol.
Input: value, Object.
Return: Non-zero when escaping.
Adds a special variable of symbol to the current stack frame.
The value is the initial value of the special variable,
which is unbound if it is null.
If symbol and value are hold variables, the stored value will be used.
lisp_push_special8_int lisp_push_special8_(const void *name, addr value);
int lisp_push_special16_(const void *name, addr value);
int lisp_push_special32_(const void *name, addr value);
Input: name, Unicode string.
Input: value, Object.
Return: Non-zero when escaping.
Find the symbol name in the current package and add a special variable.
The value is the initial value of the special variable,
which is unbound if it is null.
If symbol and value are hold variables, the stored value will be used.
See the lisp_string8_ function for details on Unicode strings.
lisp_push_special16_See lisp_push_special8_.
lisp_push_special32_See lisp_push_special8_.
lisp_get_special_int lisp_get_special_(addr x, addr symbol);
Input: symbol, symbol
Output: x, Hold variable.
Return: Non-zero when escaping.
Get the value of the special variable.
If the retrieved value is unbound, NULL is stored.
The NULL value stored in the hold variable can be checked
with the lisp_null_p function.
If symbol is a hold variable, its content will be used.
lisp_get_special8_int lisp_get_special8_(addr x, const void *name);
int lisp_get_special16_(addr x, const void *name);
int lisp_get_special32_(addr x, const void *name);
Input: name, Unicode string.
Output: x, Hold variable.
Find the symbol name in the current package and
get the value of the special variable.
If the retrieved value is unbound, NULL is stored.
The NULL value stored in the hold variable can be checked
with the lisp_null_p function.
See the lisp_string8_ function for details on Unicode strings.
lisp_get_special16_See lisp_get_special8_.
lisp_get_special32_See lisp_get_special8_.
lisp_set_special_int lisp_set_special_(addr symbol, addr value);
Input: symbol, symbol.
Input: value, Object.
Return: Non-zero when escaping.
Sets the value to the special variable.
If value is null, unbound is set.
If symbol or value is a hold variable, its content will be used.
lisp_set_special8_int lisp_set_special8_(const void *name, addr value);
int lisp_set_special16_(const void *name, addr value);
int lisp_set_special32_(const void *name, addr value);
Input: name, Unicode string.
Input: value, Object.
Return: Non-zero when escaping.
Find the symbol name in the current package and add a special variable.
If value is null, unbound is set.
See the lisp_string8_ function for details on Unicode strings.
lisp_set_special16_See lisp_set_special8_.
lisp_set_special32_See lisp_set_special8_.
Functions of the defvar.
int lisp_defvar_(addr symbol);
int lisp_defvar8_(const void *str);
int lisp_defvar16_(const void *str);
int lisp_defvar32_(const void *str);
lisp_defvar_int lisp_defvar_(addr symbol);
Input: symbol, symbol.
Return: Non-zero when escaping.
Make symbol a special variable.
If symbol or value is a hold variable, its content will be used.
lisp_defvar8_int lisp_defvar8_(const void *str);
int lisp_defvar16_(const void *str);
int lisp_defvar32_(const void *str);
Input: str, Unicode string.
Return: Non-zero when escaping.
Make the symbol represented by str a special variable.
See the lisp_string8_ function for details on Unicode strings.
lisp_defvar16_See lisp_defvar8_.
lisp_defvar32_See lisp_defvar8_.
Functions of catch and throw.
void lisp_catch(addr symbol);
int lisp_throw_(addr symbol);
lisp_catchvoid lisp_catch(addr symbol);
Input: symbol, symbol.
Register a symbol for catch in the current stack frame.
If symbol or value is a hold variable, its content will be used.
lisp_throw_int lisp_throw_(addr symbol);
Input: symbol, symbol.
Return: Non-zero.
Execute throw with the symbol argument.
It will search back through the stack frame and
start escaping if it finds a symbol for catch.
If symbol is not found, error will be raised.
If symbol or value is a hold variable, its content will be used.
The handler-bind and handler-case functions.
int lisp_handler_bind_(addr name, addr call);
int lisp_handler_case_(addr name, addr call);
void lisp_handler_reverse(void);
lisp_handler_bind_int lisp_handler_bind_(addr name, addr call);
Input: name, Symbol or condition.
Input: call, Function object.
Return: Non-zero when escaping.
Register the code for handler-bind in the current stack frame.
If name is symbol, find-class will be called.
call specifies a function object that takes one argument.
If name and call are hold variables, the contents will be used.
lisp_handler_case_int lisp_handler_case_(addr name, addr call);
Input: name, Symbol or condition.
Input: call, Function object.
Return: Non-zero when escaping.
Register the code for handler-case in the current stack frame.
If name is symbol, find-class will be called.
call specifies a function object that takes one argument.
If name and call are hold variables, the contents will be used.
lisp_handler_reversevoid lisp_handler_reverse(void);
Put the handler list in reverse order.
You can register multiple lisp_handler_bind_ and lisp_handler_case_,
but since they are added to the current stack frame with push,
the evaluation order will be reversed.
However, since they are added to the current stack frame by push,
the order of evaluation is not in the order of registration
but in the reverse order.
Therefore, this function can be used to reverse the order of the handler list.
Functions of restart.
void lisp_restart_make(addr x, addr name, addr call, int casep);
void lisp_restart_interactive(addr restart, addr call);
void lisp_restart_report(addr restart, addr call);
void lisp_restart_test(addr restart, addr call);
void lisp_restart_push(addr restart);
void lisp_restart_reverse(void);
lisp_restart_makevoid lisp_restart_make(addr x, addr name, addr call, int casep);
Input: name, Symbol or NULL.
Input: call, Function object.
Input: casep, `restart-bind` is 1, `restart-case` is non-zero.
Output: x, Hold variable.
Creates a restart object.
name is the name, or NIL if it is NULL.
call specifies a function object.
casep is an argument to distinguish between restart-bind and restart-case,
and should be non-zero if you want to specify restart-case.
This function creates a restart object,
but does not register it into the stack frame.
If name or call is a hold variable, its content will be used.
lisp_restart_interactivevoid lisp_restart_interactive(addr restart, addr call);
Input: restart, Restart object.
Input: call, Function object.
Sets the restart object to the interactive code.
call specifies a function to call with no arguments.
If call is NULL, it is not specified.
If restart and call are hold variables, the contents will be used.
lisp_restart_reportvoid lisp_restart_report(addr restart, addr call);
Input: restart, Restart object.
Input: call, Function object.
Set the restart object to the report code.
call specifies the function to call with one argument.
If call is NULL, it is not specified.
If restart and call are hold variables, the contents will be used.
lisp_restart_testvoid lisp_restart_test(addr restart, addr call);
Input: restart, Restart object.
Input: call, Function object.
Sets the restart object to the test code.
call specifies the function to call with one argument.
If call is NULL, it is not specified.
If restart and call are hold variables, the contents will be used.
lisp_restart_pushvoid lisp_restart_push(addr restart);
Input: restart, Restart object.
Registers restart with the current stack frame.
If restart is a hold variable, use its contents.
lisp_restart_reversevoid lisp_restart_reverse(void);
Put the restart list in reverse order.
Although multiple lisp_restart_push can be registered,
they are added to the current stack frame with push.
However, since they are added to the current stack frame by push,
the order of evaluation is not in the order of registration
but in the reverse order.
Therefore, this function can be used to reverse the order of the restart list.