InChI
 
Loading...
Searching...
No Matches
ichierr.h
Go to the documentation of this file.
1/*
2 * International Chemical Identifier (InChI)
3 * Version 1
4 * Software version 1.07
5 * April 30, 2024
6 *
7 * MIT License
8 *
9 * Copyright (c) 2024 IUPAC and InChI Trust
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28*
29* The InChI library and programs are free software developed under the
30 * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
31 * Originally developed at NIST.
32 * Modifications and additions by IUPAC and the InChI Trust.
33 * Some portions of code were developed/changed by external contributors
34 * (either contractor or volunteer) which are listed in the file
35 * 'External-contributors' included in this distribution.
36 *
37 * info@inchi-trust.org
38 *
39*/
40
41
42#ifndef _ICCHIERR_H_
43#define _ICCHIERR_H_
44
45#define _IS_OKAY 0
46#define _IS_WARNING 1
47#define _IS_ERROR 2 /* Microsoft defined its own IS_ERROR() macro */
48#define _IS_FATAL 3
49#define _IS_UNKNOWN 4 /* unknown error: used in INChI DLL only */
50#define _IS_EOF -1 /* end of file */
51#define _IS_SKIP -2
52
53#define CT_ERR_FIRST (-30000)
54#define CT_OVERFLOW (CT_ERR_FIRST- 0) /*(-30000) */
55#define CT_LEN_MISMATCH (CT_ERR_FIRST- 1) /*(-30001) */
56#define CT_OUT_OF_RAM (CT_ERR_FIRST- 2) /*(-30002) */
57#define CT_RANKING_ERR (CT_ERR_FIRST- 3) /*(-30003) */
58#define CT_ISOCOUNT_ERR (CT_ERR_FIRST- 4) /*(-30004) */
59#define CT_TAUCOUNT_ERR (CT_ERR_FIRST- 5) /*(-30005) */
60#define CT_ISOTAUCOUNT_ERR (CT_ERR_FIRST- 6) /*(-30006) */
61#define CT_MAPCOUNT_ERR (CT_ERR_FIRST- 7) /*(-30007) */
62#define CT_TIMEOUT_ERR (CT_ERR_FIRST- 8) /*(-30008) */
63#define CT_ISO_H_ERR (CT_ERR_FIRST- 9) /*(-30009) */
64#define CT_STEREOCOUNT_ERR (CT_ERR_FIRST-10) /*(-30010) */
65#define CT_ATOMCOUNT_ERR (CT_ERR_FIRST-11) /*(-30011) */
66#define CT_STEREOBOND_ERROR (CT_ERR_FIRST-12) /*(-30012) */
67#define CT_USER_QUIT_ERR (CT_ERR_FIRST-13) /*(-30013) */
68#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14) /*(-30014) */
69#define CT_CALC_STEREO_ERR (CT_ERR_FIRST-15) /*(-30015) */
70#define CT_CANON_ERR (CT_ERR_FIRST-16) /*(-30016) */
71#define CT_STEREO_CANON_ERR (CT_ERR_FIRST-17) /*(-30017) */
72#define CT_WRONG_FORMULA (CT_ERR_FIRST-18) /*(-30017) */
73#define CT_UNKNOWN_ERR (CT_ERR_FIRST-19) /*(-30019) */
74
75#define CT_ERR_MIN CT_UNKNOWN_ERR
76#define CT_ERR_MAX CT_ERR_FIRST
77
78#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
79#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
80
81
82#define BNS_ERR -9999
83#define BNS_WRONG_PARMS (BNS_ERR + 0) /*(-9999)*/
84#define BNS_OUT_OF_RAM (BNS_ERR + 1) /*(-9998)*/
85#define BNS_PROGRAM_ERR (BNS_ERR + 2) /*(-9997)*/
86#define BNS_ALTPATH_OVFL (BNS_ERR + 3) /*(-9996)*/
87#define BNS_BOND_ERR (BNS_ERR + 4) /*(-9995)*/
88#define BNS_VERT_NUM_ERR (BNS_ERR + 5) /*(-9994)*/
89#define BNS_VERT_EDGE_OVFL (BNS_ERR + 6) /*(-9993)*/
90#define BNS_SET_ALTP_ERR (BNS_ERR + 7) /*(-9992)*/
91#define BNS_CPOINT_ERR (BNS_ERR + 8) /*(-9991)*/
92#define BNS_CANT_SET_BOND (BNS_ERR + 9) /*(-9990)*/
93#define BNS_CAP_FLOW_ERR (BNS_ERR + 10) /*(-9989)*/
94#define BNS_RADICAL_ERR (BNS_ERR + 11) /*(-9988)*/
95#define BNS_REINIT_ERR (BNS_ERR + 12) /*(-9987)*/
96#define BNS_ALTBOND_ERR (BNS_ERR + 13) /*(-9986)*/
97
98#define BNS_TIMEOUT (BNS_ERR + 14) /*(-9985)*/ /* v. 1.05 */
99
100#define BNS_MAX_ERR_VALUE (BNS_ERR + 19) /*(-9980)*/
101
102#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
103
104
105#define INCHI_INP_ERROR_ERR 40
106#define INCHI_INP_ERROR_RET (-1)
107
108#define INCHI_INP_FATAL_ERR 1
109#define INCHI_INP_FATAL_RET 0
110
111#define INCHI_INP_EOF_ERR 11
112#define INCHI_INP_EOF_RET 0
113
114#ifndef COMPILE_ALL_CPP
115#ifdef __cplusplus
116extern "C" {
117#endif
118#endif
119
120 extern int( *UserAction )( void ); /* callback */
121 extern int( *ConsoleQuit )( void ); /* Console user issued CTRL+C etc. */
122
123#ifndef COMPILE_ALL_CPP
124#ifdef __cplusplus
125}
126#endif
127#endif
128
129#define LOG_MASK_WARN 1
130#define LOG_MASK_ERR 2
131#define LOG_MASK_FATAL 4
132
133#define LOG_MASK_ALL (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
134#define LOG_MASK_NO_WARN (LOG_MASK_ERR | LOG_MASK_FATAL)
135
136#ifdef TARGET_LIB_FOR_WINCHI
137#include <stdarg.h>
138
139#ifndef COMPILE_ALL_CPP
140#ifdef __cplusplus
141extern "C" {
142#endif
143#endif
144
145 extern void( *FWPRINT ) ( const char * format, va_list argptr );
146 extern void( *FWPUSH ) ( const char *s );
147 extern void( *DRAWDATA ) ( struct DrawData * pDrawData );
148 extern int( *DRAWDATA_EXISTS ) ( int nComponent, int nType, int bReconnected );
149 extern struct DrawData * ( *GET_DRAWDATA ) ( int nComponent, int nType, int bReconnected );
150
151#ifndef COMPILE_ALL_CPP
152#ifdef __cplusplus
153}
154#endif
155#endif
156
157#endif
158
159#define USER_ACTION_QUIT 1
160
161#define STR_ERR_LEN 256
162
163const char *ErrMsg( int nErrorCode );
164
165int AddErrorMessage( char *pStrErr, const char *szMsg );
166
167#define WarningMessage AddErrorMessage
168
169
170#define TREAT_ERR_AND_FIN(err, new_err, err_fin, msg) \
171 if ( !(err) && (new_err) ) { (err) = (new_err);} AddErrorMessage(pStrErr, (msg)); goto err_fin
172#define TREAT_ERR(err, new_err, msg) \
173 if ( !(err) && (new_err) ) { (err) = (new_err);} AddErrorMessage(pStrErr, (msg))
174
175
176#endif /* _ICCHIERR_H_ */
int(* ConsoleQuit)(void)
Definition runichi.c:193
int(* UserAction)(void)
Definition runichi.c:194
const char * ErrMsg(int nErrorCode)
Definition ichierr.c:54
int AddErrorMessage(char *pStrErr, const char *szMsg)
Definition ichierr.c:106