InChI
 
Loading...
Searching...
No Matches
ichierr.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2024 IUPAC and InChI Trust
4 */
5
6
7#ifndef _ICCHIERR_H_
8#define _ICCHIERR_H_
9
10#define _IS_OKAY 0
11#define _IS_WARNING 1
12#define _IS_ERROR 2 /* Microsoft defined its own IS_ERROR() macro */
13#define _IS_FATAL 3
14#define _IS_UNKNOWN 4 /* unknown error: used in INChI DLL only */
15#define _IS_EOF -1 /* end of file */
16#define _IS_SKIP -2
17
18#define CT_ERR_FIRST (-30000)
19#define CT_OVERFLOW (CT_ERR_FIRST- 0) /*(-30000) */
20#define CT_LEN_MISMATCH (CT_ERR_FIRST- 1) /*(-30001) */
21#define CT_OUT_OF_RAM (CT_ERR_FIRST- 2) /*(-30002) */
22#define CT_RANKING_ERR (CT_ERR_FIRST- 3) /*(-30003) */
23#define CT_ISOCOUNT_ERR (CT_ERR_FIRST- 4) /*(-30004) */
24#define CT_TAUCOUNT_ERR (CT_ERR_FIRST- 5) /*(-30005) */
25#define CT_ISOTAUCOUNT_ERR (CT_ERR_FIRST- 6) /*(-30006) */
26#define CT_MAPCOUNT_ERR (CT_ERR_FIRST- 7) /*(-30007) */
27#define CT_TIMEOUT_ERR (CT_ERR_FIRST- 8) /*(-30008) */
28#define CT_ISO_H_ERR (CT_ERR_FIRST- 9) /*(-30009) */
29#define CT_STEREOCOUNT_ERR (CT_ERR_FIRST-10) /*(-30010) */
30#define CT_ATOMCOUNT_ERR (CT_ERR_FIRST-11) /*(-30011) */
31#define CT_STEREOBOND_ERROR (CT_ERR_FIRST-12) /*(-30012) */
32#define CT_USER_QUIT_ERR (CT_ERR_FIRST-13) /*(-30013) */
33#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14) /*(-30014) */
34#define CT_CALC_STEREO_ERR (CT_ERR_FIRST-15) /*(-30015) */
35#define CT_CANON_ERR (CT_ERR_FIRST-16) /*(-30016) */
36#define CT_STEREO_CANON_ERR (CT_ERR_FIRST-17) /*(-30017) */
37#define CT_WRONG_FORMULA (CT_ERR_FIRST-18) /*(-30017) */
38#define CT_UNKNOWN_ERR (CT_ERR_FIRST-19) /*(-30019) */
39
40#define CT_ERR_MIN CT_UNKNOWN_ERR
41#define CT_ERR_MAX CT_ERR_FIRST
42
43#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
44#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
45
46
47#define BNS_ERR -9999
48#define BNS_WRONG_PARMS (BNS_ERR + 0) /*(-9999)*/
49#define BNS_OUT_OF_RAM (BNS_ERR + 1) /*(-9998)*/
50#define BNS_PROGRAM_ERR (BNS_ERR + 2) /*(-9997)*/
51#define BNS_ALTPATH_OVFL (BNS_ERR + 3) /*(-9996)*/
52#define BNS_BOND_ERR (BNS_ERR + 4) /*(-9995)*/
53#define BNS_VERT_NUM_ERR (BNS_ERR + 5) /*(-9994)*/
54#define BNS_VERT_EDGE_OVFL (BNS_ERR + 6) /*(-9993)*/
55#define BNS_SET_ALTP_ERR (BNS_ERR + 7) /*(-9992)*/
56#define BNS_CPOINT_ERR (BNS_ERR + 8) /*(-9991)*/
57#define BNS_CANT_SET_BOND (BNS_ERR + 9) /*(-9990)*/
58#define BNS_CAP_FLOW_ERR (BNS_ERR + 10) /*(-9989)*/
59#define BNS_RADICAL_ERR (BNS_ERR + 11) /*(-9988)*/
60#define BNS_REINIT_ERR (BNS_ERR + 12) /*(-9987)*/
61#define BNS_ALTBOND_ERR (BNS_ERR + 13) /*(-9986)*/
62
63#define BNS_TIMEOUT (BNS_ERR + 14) /*(-9985)*/ /* v. 1.05 */
64
65#define BNS_MAX_ERR_VALUE (BNS_ERR + 19) /*(-9980)*/
66
67#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
68
69
70#define INCHI_INP_ERROR_ERR 40
71#define INCHI_INP_ERROR_RET (-1)
72
73#define INCHI_INP_FATAL_ERR 1
74#define INCHI_INP_FATAL_RET 0
75
76#define INCHI_INP_EOF_ERR 11
77#define INCHI_INP_EOF_RET 0
78
79#ifndef COMPILE_ALL_CPP
80#ifdef __cplusplus
81extern "C" {
82#endif
83#endif
84
85 extern int( *UserAction )( void ); /* callback */
86 extern int( *ConsoleQuit )( void ); /* Console user issued CTRL+C etc. */
87
88#ifndef COMPILE_ALL_CPP
89#ifdef __cplusplus
90}
91#endif
92#endif
93
94#define LOG_MASK_WARN 1
95#define LOG_MASK_ERR 2
96#define LOG_MASK_FATAL 4
97
98#define LOG_MASK_ALL (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
99#define LOG_MASK_NO_WARN (LOG_MASK_ERR | LOG_MASK_FATAL)
100
101#ifdef TARGET_LIB_FOR_WINCHI
102#include <stdarg.h>
103
104#ifndef COMPILE_ALL_CPP
105#ifdef __cplusplus
106extern "C" {
107#endif
108#endif
109
110 extern void( *FWPRINT ) ( const char * format, va_list argptr );
111 extern void( *FWPUSH ) ( const char *s );
112 extern void( *DRAWDATA ) ( struct DrawData * pDrawData );
113 extern int( *DRAWDATA_EXISTS ) ( int nComponent, int nType, int bReconnected );
114 extern struct DrawData * ( *GET_DRAWDATA ) ( int nComponent, int nType, int bReconnected );
115
116#ifndef COMPILE_ALL_CPP
117#ifdef __cplusplus
118}
119#endif
120#endif
121
122#endif
123
124#define USER_ACTION_QUIT 1
125
126#define STR_ERR_LEN 256
127
128const char *ErrMsg( int nErrorCode );
129
130int AddErrorMessage( char *pStrErr, const char *szMsg );
131
132#define WarningMessage AddErrorMessage
133
134
135#define TREAT_ERR_AND_FIN(err, new_err, err_fin, msg) \
136 if ( !(err) && (new_err) ) { (err) = (new_err);} AddErrorMessage(pStrErr, (msg)); goto err_fin
137#define TREAT_ERR(err, new_err, msg) \
138 if ( !(err) && (new_err) ) { (err) = (new_err);} AddErrorMessage(pStrErr, (msg))
139
140
141#endif /* _ICCHIERR_H_ */
int(* ConsoleQuit)(void)
Definition runichi.c:158
int(* UserAction)(void)
Definition runichi.c:159
const char * ErrMsg(int nErrorCode)
Definition ichierr.c:19
int AddErrorMessage(char *pStrErr, const char *szMsg)
Definition ichierr.c:71