| 
    cheax
    
   Lisp dialect with C API 
   | 
 
Error codes and ways to deal with them. More...

Macros | |
| #define | ERR_NAME_PAIR(NAME) {#NAME, CHEAX_##NAME} | 
| #define | CHEAX_BUILTIN_ERROR_NAMES(var) | 
| #define | cheax_ft(c, pad) { if (cheax_errno(c) != 0) goto pad; } | 
| Macro to fall through to a pad in case of an error.  More... | |
Enumerations | |
| enum | {  CHEAX_ENOERR = 0x0000 , CHEAX_EREAD = 0x0001 , CHEAX_EEOF = 0x0002 , CHEAX_EEVAL = 0x0101 , CHEAX_ENOSYM = 0x0102 , CHEAX_ESTACK = 0x0103 , CHEAX_ETYPE = 0x0104 , CHEAX_EMATCH = 0x0105 , CHEAX_ESTATIC = 0x0106 , CHEAX_EDIVZERO = 0x0107 , CHEAX_EREADONLY = 0x0108 , CHEAX_EWRITEONLY = 0x0109 , CHEAX_EEXIST = 0x010A , CHEAX_EVALUE = 0x010B , CHEAX_EOVERFLOW = 0x010C , CHEAX_EINDEX = 0x010D , CHEAX_EIO = 0x010E , CHEAX_EAPI = 0x0200 , CHEAX_ENOMEM = 0x0201 , CHEAX_EUSER0 = 0x0400 }  | 
| Pre-defined cheax error codes.  More... | |
Functions | |
| int | cheax_errno (CHEAX *c) CHX_PURE | 
| Gets the value of the current cheax error code.  More... | |
| void | cheax_perror (CHEAX *c, const char *s) | 
| Prints the current cheax error code and error message.  More... | |
| void | cheax_clear_errno (CHEAX *c) | 
| Sets cheax_errno() to 0.  More... | |
| void | cheax_throw (CHEAX *c, int code, struct chx_string *msg) | 
| Sets cheax_errno() to the given value.  More... | |
| void | cheax_throwf (CHEAX *c, int code, const char *fmt,...) CHX_FORMAT(printf | 
| void void | cheax_add_bt (CHEAX *c) | 
| int | cheax_new_error_code (CHEAX *c, const char *name) | 
| Creates a new error code with a given name.  More... | |
| int | cheax_find_error_code (CHEAX *c, const char *name) | 
| Looks up the value of a named error code.  More... | |
Error codes and ways to deal with them.
| #define ERR_NAME_PAIR | ( | NAME | ) | {#NAME, CHEAX_##NAME} | 
| #define CHEAX_BUILTIN_ERROR_NAMES | ( | var | ) | 
| #define cheax_ft | ( | c, | |
| pad | |||
| ) | { if (cheax_errno(c) != 0) goto pad; } | 
Macro to fall through to a pad in case of an error.
Jumps to pad if cheax_errno() is not 0. Most commonly used after cheax_eval().
| pad | Label to jump to in case of an error. | 
| anonymous enum | 
Pre-defined cheax error codes.
| Enumerator | |
|---|---|
| CHEAX_ENOERR | No error. Equal to 0. 
  | 
| CHEAX_EREAD | Generic read error.  | 
| CHEAX_EEOF | Unexpected end-of-file.  | 
| CHEAX_EEVAL | Generic eval error  | 
| CHEAX_ENOSYM | Symbol not found error.  | 
| CHEAX_ESTACK | Stack overflow error.  | 
| CHEAX_ETYPE | Invalid type error.  | 
| CHEAX_EMATCH | Unable to match expression error.  | 
| CHEAX_ESTATIC | Preprocessing failed.  | 
| CHEAX_EDIVZERO | Division by zero error.  | 
| CHEAX_EREADONLY | Attempted write to read-only symbol error.  | 
| CHEAX_EWRITEONLY | Attempted read from write-only symbol error.  | 
| CHEAX_EEXIST | Symbol already exists error.  | 
| CHEAX_EVALUE | Invalid value error.  | 
| CHEAX_EOVERFLOW | Integer overflow error.  | 
| CHEAX_EINDEX | Invalid index error.  | 
| CHEAX_EIO | IO error.  | 
| CHEAX_EAPI | API error. 
  | 
| CHEAX_ENOMEM | Out-of-memory error. 
  | 
| CHEAX_EUSER0 | First user-defineable error code. 
  | 
| int cheax_errno | ( | CHEAX * | c | ) | 
Gets the value of the current cheax error code.
| void cheax_perror | ( | CHEAX * | c, | 
| const char * | s | ||
| ) | 
Prints the current cheax error code and error message.
| s | Argument string, will be printed followed by a colon and an error description. | 
| void cheax_clear_errno | ( | CHEAX * | c | ) | 
Sets cheax_errno() to 0.
| void cheax_throw | ( | CHEAX * | c, | 
| int | code, | ||
| struct chx_string * | msg | ||
| ) | 
Sets cheax_errno() to the given value.
Sets cheax_errno() to CHEAX_EAPI if code is 0.
| code | Error code. | 
| msg | Error message string or NULL. | 
| void cheax_throwf | ( | CHEAX * | c, | 
| int | code, | ||
| const char * | fmt, | ||
| ... | |||
| ) | 
| void void cheax_add_bt | ( | CHEAX * | c | ) | 
| int cheax_new_error_code | ( | CHEAX * | c, | 
| const char * | name | ||
| ) | 
Creates a new error code with a given name.
Such new error codes can then be thrown with cheax_throw() or from within cheax.
Does not change cheax_errno(), except when name is NULL, in which case it is set to CHEAX_EAPI.
| name | The error code's name. Used to make the error code available in cheax, and for error reporting by cheax_perror(). | 
| int cheax_find_error_code | ( | CHEAX * | c, | 
| const char * | name | ||
| ) | 
Looks up the value of a named error code.
Sets cheax_errno() to CHEAX_EAPI if name is NULL.
| name | Error code name. |