1 /*
2  * International Chemical Identifier (InChI)
3  * Version 1
4  * Software version 1.04
5  * September 9, 2011
6  *
7  * The InChI library and programs are free software developed under the
8  * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
9  * Originally developed at NIST. Modifications and additions by IUPAC
10  * and the InChI Trust.
11  *
12  * IUPAC/InChI-Trust Licence for the International Chemical Identifier (InChI)
13  * Software version 1.0.
14  * Copyright (C) IUPAC and InChI Trust Limited
15  *
16  * This library is free software; you can redistribute it and/or modify it under the
17  * terms of the IUPAC/InChI Trust Licence for the International Chemical Identifier
18  * (InChI) Software version 1.0; either version 1.0 of the License, or
19  * (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24  * See the IUPAC/InChI Trust Licence for the International Chemical Identifier (InChI)
25  * Software version 1.0 for more details.
26  *
27  * You should have received a copy of the IUPAC/InChI Trust Licence for the
28  * International Chemical Identifier (InChI) Software version 1.0 along with
29  * this library; if not, write to:
30  *
31  * The InChI Trust
32  * c/o FIZ CHEMIE Berlin
33  * Franklinstrasse 11
34  * 10587 Berlin
35  * GERMANY
36  *
37  */
38 
39 
40 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41 Former COMDEF.H
42 Renamed 06/12/07 to avoid occassional conflict with Microsoft's COMDEF.H
43 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
44 /* common definitions -- do not change */
45 #ifndef __INCOMDEF_H__
46 #define __INCOMDEF_H__
47 
48 #include "ichisize.h"
49 
50 
51 /* SDF treatment */
52 #define MAX_SDF_HEADER        64 /* max length of the SDFile data header */
53 #define MAX_SDF_VALUE        255 /* max lenght of the SDFile data value */
54 
55 /* size resrictions */
56 #define ATOM_EL_LEN           6  /* length of atom name string including zero termination */
57 #define ATOM_INFO_LEN         36 /* inf_ATOM output string ^123Al^+2H12..(+)/999/999/999/999: 32 chars */
58 #define MAXVAL                20 /* max number of bonds per atom */
59 #define MAX_STEREO_BONDS      3  /* max number of stereogenic bonds per atom */
60 #define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
61 #define ATW_H                 1  /* hydrogen atomic weight */
62 
63 /* input bond type definition */
64 #define MIN_INPUT_BOND_TYPE 1
65 #define MAX_INPUT_BOND_TYPE 4
66 
67 #define BOND_TYPE_SINGLE    1
68 #define BOND_TYPE_DOUBLE    2
69 #define BOND_TYPE_TRIPLE    3
70 #define BOND_TYPE_ALTERN    4
71 
72 #define STEREO_SNGL_UP       1
73 #define STEREO_SNGL_EITHER   4
74 #define STEREO_SNGL_DOWN     6
75 #define STEREO_DBLE_EITHER   3
76 
77 
78 /* MOlfile */
79 #define INPUT_STEREO_SNGL_UP       1
80 #define INPUT_STEREO_SNGL_EITHER   4
81 #define INPUT_STEREO_SNGL_DOWN     6
82 #define INPUT_STEREO_DBLE_EITHER   3
83 
84 /*
85 #define BOND_MARK_ODD      0x10
86 #define BOND_MARK_EVEN     0x20
87 */
88 #define BOND_MARK_PARITY    0x30
89 #define BOND_MARK_HIGHLIGHT 0x40  /* highlight equivalent components */
90 
91 #define BOND_MARK_ODD      '-'
92 #define BOND_MARK_EVEN     '+'
93 #define BOND_MARK_UNDF     '?'
94 #define BOND_MARK_UNKN     'u'
95 #define BOND_MARK_ERR      '*'
96 
97 #define SALT_DONOR_H      1
98 #define SALT_DONOR_Neg    2
99 #define SALT_ACCEPTOR     4
100 #define SALT_p_DONOR      8  /* >C-SH   */
101 #define SALT_p_ACCEPTOR  16  /* >C-S(-) */
102 #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
103 #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
104 #define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
105 #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
106 
107 #define SALT_SELECTED    32
108 
109 /* radical definitions */
110 #define RADICAL_SINGLET 1
111 #define RADICAL_DOUBLET 2
112 #define RADICAL_TRIPLET 3
113 
114 /* metal definition */
115 #define METAL           1          /* definition of an element: lowest valence */
116 #define METAL2          3          /* definition of an element: lowest and next to it valence */
117 #define IS_METAL        3          /* metal bitmap */
118 /* isotopic shift */
119 #define ZERO_ATW_DIFF        127   /* mark mass of the most abundant isotope */
120 
121 /* other types */
122 
123 #define UCINT  (int)(unsigned char)
124 
125 #ifndef INCHI_US_CHAR_DEF
126 typedef signed char   S_CHAR;
127 typedef unsigned char U_CHAR;
128 #define INCHI_US_CHAR_DEF
129 #endif
130 
131 #ifndef INCHI_US_SHORT_DEF
132 typedef signed short   S_SHORT;
133 typedef unsigned short U_SHORT;
134 #define INCHI_US_SHORT_DEF
135 #endif
136 
137 /* BILLY 8/6/04 */
138 #ifndef COMPILE_ALL_CPP
139 #ifdef __cplusplus
140 extern "C" {
141 #endif
142 #endif
143 
144 #define STR_ERR_LEN 256
145 int AddMOLfileError( char *pStrErr, const char *szMsg );
146 
147 /* allocator */
148 #ifndef inchi_malloc
149 void *inchi_malloc(size_t c);
150 #endif
151 #ifndef inchi_calloc
152 void *inchi_calloc(size_t c, size_t n);
153 #endif
154 #ifndef inchi_free
155 void inchi_free(void *p);
156 #endif
157 
158 
159 
160 /* sorting etc */
161 void inchi_swap ( char *a, char *b, size_t width );
162 int insertions_sort( void *base, size_t num, size_t width, int ( *compare )(const void *e1, const void *e2 ) );
163 int insertions_sort_AT_NUMBERS( AT_NUMB *base, int num, int ( *compare )(const void *e1, const void *e2 ) );
164 
165 
166 #define MOLFILE_ERR_FIN(err, new_err, err_fin, msg) \
167         if ( !(err) && (new_err) ) { (err) = (new_err);} AddMOLfileError(pStrErr, (msg)); goto err_fin
168 #define MOLFILE_ERR_SET(err, new_err, msg) \
169         if ( !(err) && (new_err) ) { (err) = (new_err);} AddMOLfileError(pStrErr, (msg))
170 
171 
172 /* BILLY 8/6/04 */
173 #ifndef COMPILE_ALL_CPP
174 #ifdef __cplusplus
175 }
176 #endif
177 #endif
178 
179 #endif  /* __INCOMDEF_H__ */
180 
181