InChI
 
Loading...
Searching...
No Matches
incomdef.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 _INCOMDEF_H_
43#define _INCOMDEF_H_
44
45
46#include "ichisize.h"
47#include "mode.h"
48
49/* Common definitions -- do not change */
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
126typedef signed char S_CHAR;
127typedef unsigned char U_CHAR;
128#define INCHI_US_CHAR_DEF
129#endif
130
131#ifndef INCHI_US_SHORT_DEF
132typedef signed short S_SHORT;
133typedef unsigned short U_SHORT;
134#define INCHI_US_SHORT_DEF
135#endif
136
137#ifndef COMPILE_ALL_CPP
138#ifdef __cplusplus
139extern "C" {
140#endif
141#endif
142
143
144/* allocator */
145#ifndef inchi_malloc
146 void *inchi_malloc( size_t c );
147#endif
148#ifndef inchi_calloc
149 void *inchi_calloc( size_t c, size_t n );
150#endif
151#ifndef inchi_free
152 void inchi_free( void *p );
153#endif
154
155
156
157/* sorting etc */
158
159 void inchi_swap( char *a, char *b, size_t width );
160
161 int insertions_sort( void *pCG,
162 void *base, size_t num, size_t width, int( *compare )( const void *e1, const void *e2, void * ) );
163 int insertions_sort_AT_NUMBERS( void *pCG,
164 AT_NUMB *base, int num, int( *compare )( const void *e1, const void *e2, void * ) );
165 /*
166 int insertions_sort( void *base, size_t num, size_t width, int ( *compare )(const void *e1, const void *e2 ) );
167 int insertions_sort_AT_NUMBERS( AT_NUMB *base, int num, int ( *compare )(const void *e1, const void *e2 ) );
168 */
169
170
171 /* min-max */
172
173#define inchi_max(a,b) (((a)>(b))?(a):(b))
174#define inchi_min(a,b) (((a)<(b))?(a):(b))
175
176#ifndef COMPILE_ALL_CPP
177#ifdef __cplusplus
178}
179#endif
180#endif
181
182
183#endif /* _INCOMDEF_H_ */
unsigned short AT_NUMB
Definition ichisize.h:45
signed char S_CHAR
Definition incomdef.h:126
unsigned short U_SHORT
Definition incomdef.h:133
unsigned char U_CHAR
Definition incomdef.h:127
void inchi_swap(char *a, char *b, size_t width)
Definition ichisort.c:286
int insertions_sort_AT_NUMBERS(void *pCG, AT_NUMB *base, int num, int(*compare)(const void *e1, const void *e2, void *))
Definition ichisort.c:331
int insertions_sort(void *pCG, void *base, size_t num, size_t width, int(*compare)(const void *e1, const void *e2, void *))
signed short S_SHORT
Definition incomdef.h:132
#define inchi_malloc
Definition mode.h:1153
#define inchi_calloc
Definition mode.h:1156
#define inchi_free(X)
Definition mode.h:1162