% C Function: Function
Npt documentation.
Reference: ANSI Common Lisp npt
The following function specifications are described in lisp.h.
void lisp_get_function(addr x, addr symbol);
void lisp_get_setf(addr x, addr symbol);
int lisp_get_function_(addr x, addr value);
int lisp_get_function8_(addr x, const void *str);
int lisp_get_function16_(addr x, const void *str);
int lisp_get_function32_(addr x, const void *str);
int lisp_get_setf_(addr x, addr value);
int lisp_get_setf8_(addr x, const void *str);
int lisp_get_setf16_(addr x, const void *str);
int lisp_get_setf32_(addr x, const void *str);
void lisp_compiled_dynamic(int index, lisp_calltype_dynamic call);
void lisp_compiled_rest(int index, lisp_calltype_rest call);
void lisp_compiled_empty(int index, lisp_calltype_empty call);
void lisp_compiled_var1(int index, lisp_calltype_var1 call);
void lisp_compiled_var2(int index, lisp_calltype_var2 call);
void lisp_compiled_var3(int index, lisp_calltype_var3 call);
int lisp_compiled_function_(addr x, int index, addr symbol);
int lisp_compiled_function8_(addr x, int index, const void *str);
int lisp_compiled_function16_(addr x, int index, const void *str);
int lisp_compiled_function32_(addr x, int index, const void *str);
int lisp_compiled_defun_(int index, addr symbol);
int lisp_compiled_defun8_(int index, const void *str);
int lisp_compiled_defun16_(int index, const void *str);
int lisp_compiled_defun32_(int index, const void *str);
int lisp_compiled_defun_setf_(int index, addr symbol);
int lisp_compiled_defun_setf8_(int index, const void *str);
int lisp_compiled_defun_setf16_(int index, const void *str);
int lisp_compiled_defun_setf32_(int index, const void *str);
void lisp_compiled_setvalue(addr pos, addr value);
void lisp_compiled_getvalue(addr *ret);
Function to get a function object from symbol.
void lisp_get_function(addr x, addr symbol);
void lisp_get_setf(addr x, addr symbol);
int lisp_get_function_(addr x, addr value);
int lisp_get_function8_(addr x, const void *str);
int lisp_get_function16_(addr x, const void *str);
int lisp_get_function32_(addr x, const void *str);
int lisp_get_setf_(addr x, addr value);
int lisp_get_setf8_(addr x, const void *str);
int lisp_get_setf16_(addr x, const void *str);
int lisp_get_setf32_(addr x, const void *str);
lisp_get_functionvoid lisp_get_function(addr x, addr symbol);
Input: symbol, symbol object.
Output: x, hold variable.[
Get a function object from symbol.
This is the same as symbol-function in Common Lisp.
If value is a hold variable, the content is used.
If the function is unbound, NULL will be returned.
If the argument is not a symbol type, LISP ABORT.
lisp_get_setfvoid lisp_get_setf(addr x, addr symbol);
Input: symbol, symbol object.
Output: x, hold variable.[
Get a setf function object from symbol.
This is the same as (fdefinition (list 'setf symbol)) in Common Lisp.
If value is a hold variable, the content is used.
If the function is unbound, NULL will be returned.
If the argument is not a symbol type, LISP ABORT.
lisp_get_function_int lisp_get_function_(addr x, addr value);
Input: value, object.
Output: x, hold variable.
Return: Non-zero when escaping.
If value is a symbol, get the function.
If value is a function type, the value is returned as is.
If value is a hold variable, the content is used.
If the function is unbound, NULL is returned.
lisp_get_function8_int lisp_get_function8_(addr x, const void *str);
int lisp_get_function16_(addr x, const void *str);
int lisp_get_function32_(addr x, const void *str);
input: str, unicode string.
Output: x, hold variable.
Return: Non-zero when escaping.
Get a function with str as the symbol name.
If the function is unbound, NULL is returned.
See the lisp_string8_ function for details on Unicode strings.
lisp_get_function16_See lisp_get_function8_.
lisp_get_function32_See lisp_get_function8_.
lisp_get_setf_int lisp_get_setf_(addr x, addr value);
Input: value, object.
Output: x, hold variable.
Return: Non-zero when escaping.
If value is a symbol, get the setf function.
If value is a function type, the value is returned as is.
If value is a hold variable, the content is used.
If the function is unbound, NULL is returned.
lisp_get_setf8_int lisp_get_setf8_(addr x, const void *str);
int lisp_get_setf16_(addr x, const void *str);
int lisp_get_setf32_(addr x, const void *str);
input: str, unicode string.
Output: x, hold variable.
Return: Non-zero when escaping.
Get a setf function with str as the symbol name.
If the function is unbound, NULL is returned.
See the lisp_string8_ function for details on Unicode strings.
lisp_get_setf16_See lisp_get_setf8_.
lisp_get_setf32_See lisp_get_setf8_.
Function for creating a function.
void lisp_compiled_dynamic(int index, lisp_calltype_dynamic call);
void lisp_compiled_rest(int index, lisp_calltype_rest call);
void lisp_compiled_empty(int index, lisp_calltype_empty call);
void lisp_compiled_var1(int index, lisp_calltype_var1 call);
void lisp_compiled_var2(int index, lisp_calltype_var2 call);
void lisp_compiled_var3(int index, lisp_calltype_var3 call);
int lisp_compiled_function_(addr x, int index, addr symbol);
int lisp_compiled_function8_(addr x, int index, const void *str);
int lisp_compiled_function16_(addr x, int index, const void *str);
int lisp_compiled_function32_(addr x, int index, const void *str);
int lisp_compiled_defun_(int index, addr symbol);
int lisp_compiled_defun8_(int index, const void *str);
int lisp_compiled_defun16_(int index, const void *str);
int lisp_compiled_defun32_(int index, const void *str);
int lisp_compiled_defun_setf_(int index, addr symbol);
int lisp_compiled_defun_setf8_(int index, const void *str);
int lisp_compiled_defun_setf16_(int index, const void *str);
int lisp_compiled_defun_setf32_(int index, const void *str);
void lisp_compiled_setvalue(addr pos, addr value);
void lisp_compiled_getvalue(addr *ret);
lisp_compiled_dynamicvoid lisp_compiled_dynamic(int index, lisp_calltype_dynamic call);
Input: index, function number.
Input: call, function pointer, int (*call)(addr)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
When called from Lisp, the arguments are passed as a list as the first argument,
like the &rest specification.
Unlike rest, the list is allocated with dynamic-extent,
so it cannot be set as the return value of the function.
A function like the following declaration will be created.
(defun name (&rest args)
(declare (dynamic-extent args)
...)
lisp_compiled_restvoid lisp_compiled_rest(int index, lisp_calltype_rest call);
Input: index, function number.
Input: call, function pointer, int (*call)(addr)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
When called from Lisp, the arguments are passed as a list as the first argument,
like the &rest specification.
Unlike dynamic, the list is allocated in the heap area,
so it can be set to the value returned by the function.
A function like the following declaration will be created.
(defun name (&rest args)
...)
lisp_compiled_emptyvoid lisp_compiled_empty(int index, lisp_calltype_empty call);
Input: index, function number.
Input: call, function pointer, int (*call)(void)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
It is called from Lisp with no arguments.
If there is an argument, it is an error.
A function like the following declaration will be created.
(defun name ()
...)
lisp_compiled_var1void lisp_compiled_var1(int index, lisp_calltype_var1 call);
Input: index, function number.
Input: call, function pointer, int (*call)(addr)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
It is called from Lisp with a single argument.
It is an error if there is not a single argument.
A function like the following declaration will be created.
(defun name (x)
...)
lisp_compiled_var2void lisp_compiled_var2(int index, lisp_calltype_var2 call);
Input: index, function number.
Input: call, function pointer, int (*call)(addr, addr)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
It is called from Lisp with two arguments.
If there are not two arguments, an error occurs.
A function like the following declaration will be created.
(defun name (x y)
...)
lisp_compiled_var3void lisp_compiled_var3(int index, lisp_calltype_var3 call);
Input: index, function number.
Input: call, function pointer, int (*call)(addr, addr, addr)
Registers a function pointer call to the indexth.
index is a value between 0 and 31,
and the upper limit of 31 can be set with the define value LISP_POINTER_EXTEND.
It is called from Lisp with three arguments.
If there are not three arguments, an error occurs.
A function like the following declaration will be created.
(defun name (x y z)
...)
lisp_compiled_function_int lisp_compiled_function_(addr x, int index, addr symbol);
Input: index, function number.
Input: symbol, symbol object or NULL.
Return: Non-zero when escaping.
Creates a function object.
The name to be held inside the function is specified as symbol.
If symbol is null, NIL is used.
If symbol is a hold variable, the content is used.
When the object is called, the function pointer registered
in the function number will be executed.
lisp_compiled_function8_int lisp_compiled_function8_(addr x, int index, const void *str);
int lisp_compiled_function16_(addr x, int index, const void *str);
int lisp_compiled_function32_(addr x, int index, const void *str);
Input: index, function number.
Input: str, Unicode string.
Return: Non-zero when escaping.
Creates a function object.
The name to be held inside the function is specified as str.
When the object is called, the function pointer registered
in the function number will be executed.
See the lisp_string8_ function for details on Unicode strings.
lisp_compiled_function16_See lisp_compiled_function8_.
lisp_compiled_function32_See lisp_compiled_function8_.
lisp_compiled_defun_int lisp_compiled_defun_(int index, addr symbol);
Input: index, function number.
Input: symbol, symbol object.
Return: Non-zero when escaping.
Register a function.
Create an object and register it with symbol-function.
If symbol is a hold variable, the content is used.
When the generated function is called,
the function pointer registered in the function number will be executed.
lisp_compiled_defun8_int lisp_compiled_defun8_(int index, const void *str);
int lisp_compiled_defun16_(int index, const void *str);
int lisp_compiled_defun32_(int index, const void *str);
Input: index, function number.
Input: str, Unicode string.
Return: Non-zero when escaping.
Register a function.
Create an object and register it with symbol-function.
When the generated function is called,
the function pointer registered in the function number will be executed.
See the lisp_string8_ function for details on Unicode strings.
lisp_compiled_defun16_See lisp_compiled_defun8_.
lisp_compiled_defun32_See lisp_compiled_defun8_.
lisp_compiled_defun_setf_int lisp_compiled_defun_setf_(int index, addr symbol);
Input: index, function number.
Input: symbol, symbol object.
Return: Non-zero when escaping.
Register a setf function.
If symbol is a hold variable, the content is used.
When the generated function is called,
the function pointer registered in the function number will be executed.
lisp_compiled_defun_setf8_int lisp_compiled_defun_setf8_(int index, const void *str);
int lisp_compiled_defun_setf16_(int index, const void *str);
int lisp_compiled_defun_setf32_(int index, const void *str);
Input: index, function number.
Input: str, Unicode string.
Return: Non-zero when escaping.
Register a setf function.
When the generated function is called,
the function pointer registered in the function number will be executed.
See the lisp_string8_ function for details on Unicode strings.
lisp_compiled_defun_setf16_See lisp_compiled_defun_setf8_.
lisp_compiled_defun_setf32_See lisp_compiled_defun_setf8_.
lisp_compiled_getvaluevoid lisp_compiled_getvalue(addr *ret);
Output: ret, object.
Get the value of the closure.
The value will be retrieved from the stack frame,
so do not use lisp_push_control before retrieving it.
lisp_compiled_setvaluevoid lisp_compiled_setvalue(addr pos, addr value);
Input: pos, function object.
Input: value, object or NULL.
Set the closure of a function object to a value.
If value is null, NIL will be used.
If value is a hold variable, the content will be used.