Npt documentation.
Reference: ANSI Common Lisp npt
The following function specifications are described in lisp.h
.
void lisp_abort(void);
void lisp_abortf(const char *fmt, ...);
void lisp_abort8(const void *fmt, ...);
void lisp_abort16(const void *fmt, ...);
void lisp_abort32(const void *fmt, ...);
(lisp_abort_calltype call);
lisp_abort_calltype lisp_set_abort_handler(void);
lisp_abort_calltype lisp_set_abort_setjmp_handler
Lisp_abort_Begin
Lisp_abort_End Lisp_abort_throw
int lisp_signal_(addr condition);
int lisp_error_(addr condition);
int lisp_error8_(const void *str, ...);
int lisp_error16_(const void *str, ...);
int lisp_error32_(const void *str, ...);
int lisp_warn8_(const void *str, ...);
int lisp_warn16_(const void *str, ...);
int lisp_warn32_(const void *str, ...);
Functions of the LISP ABORT
.
void lisp_abort(void);
void lisp_abortf(const char *fmt, ...);
void lisp_abort8(const void *fmt, ...);
void lisp_abort16(const void *fmt, ...);
void lisp_abort32(const void *fmt, ...);
(lisp_abort_calltype call);
lisp_abort_calltype lisp_set_abort_handler(void);
lisp_abort_calltype lisp_set_abort_setjmp_handler
Lisp_abort_Begin
Lisp_abort_End Lisp_abort_throw
lisp_abort
void lisp_abort(void);
Executes LISP ABORT
.
When LISP ABORT
is executed, the following behavior is performed.
LISP ABORT
.exit(1)
(process termination)lisp_abortf
void lisp_abortf(const char *fmt, ...);
: fmt, `printf` format. Input
Print a message to standard error and then LISP ABORT
.
No Lisp is used, so it can be run at any time.
lisp_abort8
void lisp_abort8(const void *fmt, ...);
void lisp_abort16(const void *fmt, ...);
void lisp_abort32(const void *fmt, ...);
: fmt, unicode string. Input
Output error messages to error-output
using the lisp_format_
function,and then LISP ABORT
.
Since the process is executed via Lisp, Common Lisp must be executable.
See the lisp_string8_
function for details on Unicode strings.
lisp_abort16
See lisp_abort8
.
lisp_abort32
See lisp_abort8
.
lisp_set_abort_handler
(lisp_abort_calltype call);
lisp_abort_calltype lisp_set_abort_handler
: call, handler, void (*)(void).
Input: Handler before configuration. Return
Specifies a handler to be called when LISP ABORT
is executed.
If the argument is NULL, the handler will be removed.
lisp_set_abort_setjmp_handler
(void);
lisp_abort_calltype lisp_set_abort_setjmp_handler
: Handler before configuration. Return
Set the handler for setjmp
.
Lisp_abort_Begin
#define Lisp_abort_Begin ...
#define Lisp_abort_End ...
#define Lisp_abort_throw() ...
Capture LISP ABORT.
To use this mechanism, you need to run lisp_set_abort_setjmp_handler
to set the setjmp
handler.
Use Lisp_abort_Begin
and Lisp_abort_End
for capturing.
Examples are shown below.
{
Lisp_abort_Begin /* code */
}
; Lisp_abort_End
If Lisp_abort_throw()
is executed, the control jumps to Lisp_abort_End
by longjmp
.
The handler registered by lisp_set_abort_setjmp_handler
is simply a code that Lisp_abort_throw()
will be executed, for example, the following function.
void abort_setjmp_handler(void)
{
();
Lisp_abort_throw}
Normally, macros are expanded to setjmp
/longjmp
, but if you have a C++ compiler and LISP_ABORT_SETJMP
is not defined, macros are expanded to try
/catch
.
A typical usage example is shown below.
int main(void)
{
int finish;
;
lisp_abort_calltype handler
= lisp_set_abort_setjmp_handler();
handler = 0;
finish {
Lisp_abort_Begin ();
lisp_abort= 1;
finish }
;
Lisp_abort_End(handler);
lisp_set_abort_handler
if (finish == 0)
("LISP ABORT\n");
printf
return 0;
}
Lisp_abort_End
See Lisp_abort_Begin
.
Lisp_abort_throw
See Lisp_abort_Begin
.
Function to generate a condition.
int lisp_signal_(addr condition);
int lisp_error_(addr condition);
lisp_signal_
int lisp_signal_(addr condition);
: condition, instance.
Input: Non-zero when escaping. Return
Passes the condition
argument to signal
.
It is the same as signal
in Common Lisp.
If condition
is a hold variable, its contents will be used.
lisp_error_
int lisp_error_(addr condition);
: condition, instance.
Input: Non-zero. Return
Passes the condition
argument to error
.
It is the same as error
in Common Lisp.
If condition
is a hold variable, its contents will be used.
Functions of the error
.
int lisp_error8_(const void *str, ...);
int lisp_error16_(const void *str, ...);
int lisp_error32_(const void *str, ...);
lisp_error8_
int lisp_error8_(const void *str, ...);
int lisp_error16_(const void *str, ...);
int lisp_error32_(const void *str, ...);
: str, unicode string.
Input: Non-zero. Return
Run the simple-error
condition.
It is the same as error
in Common Lisp.
See the lisp_string8_
function for details on Unicode strings.
lisp_error16_
See lisp_error8_
.
lisp_error32_
See lisp_error8_
.
Functions of the warn
.
int lisp_warn8_(const void *str, ...);
int lisp_warn16_(const void *str, ...);
int lisp_warn32_(const void *str, ...);
lisp_warn8_
int lisp_warn8_(const void *str, ...);
int lisp_warn16_(const void *str, ...);
int lisp_warn32_(const void *str, ...);
: str, unicode string.
Input: Non-zero when escaping. Return
Run the simple-warning
condition.
It is the same as warn
in Common Lisp.
See the lisp_string8_
function for details on Unicode strings.
lisp_warn16_
See lisp_warn8_
.
lisp_warn32_
See lisp_warn8_
.