% C Function: Error
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 lisp_set_abort_handler(lisp_abort_calltype call);
lisp_abort_calltype lisp_set_abort_setjmp_handler(void);
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 lisp_set_abort_handler(lisp_abort_calltype call);
lisp_abort_calltype lisp_set_abort_setjmp_handler(void);
Lisp_abort_Begin
Lisp_abort_End
Lisp_abort_throw
lisp_abortvoid lisp_abort(void);
Executes LISP ABORT.
When LISP ABORT is executed, the following behavior is performed.
LISP ABORT.exit(1) (process termination)lisp_abortfvoid lisp_abortf(const char *fmt, ...);
Input: fmt, `printf` format.
Print a message to standard error and then LISP ABORT.
No Lisp is used, so it can be run at any time.
lisp_abort8void lisp_abort8(const void *fmt, ...);
void lisp_abort16(const void *fmt, ...);
void lisp_abort32(const void *fmt, ...);
Input: fmt, unicode string.
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_abort16See lisp_abort8.
lisp_abort32See lisp_abort8.
lisp_set_abort_handlerlisp_abort_calltype lisp_set_abort_handler(lisp_abort_calltype call);
Input: call, handler, void (*)(void).
Return: Handler before configuration.
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_handlerlisp_abort_calltype lisp_set_abort_setjmp_handler(void);
Return: Handler before configuration.
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;
handler = lisp_set_abort_setjmp_handler();
finish = 0;
Lisp_abort_Begin {
lisp_abort();
finish = 1;
}
Lisp_abort_End;
lisp_set_abort_handler(handler);
if (finish == 0)
printf("LISP ABORT\n");
return 0;
}
Lisp_abort_EndSee Lisp_abort_Begin.
Lisp_abort_throwSee 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);
Input: condition, instance.
Return: Non-zero when escaping.
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);
Input: condition, instance.
Return: Non-zero.
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, ...);
Input: str, unicode string.
Return: Non-zero.
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, ...);
Input: str, unicode string.
Return: Non-zero when escaping.
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_.