InChI
 
Loading...
Searching...
No Matches
incomdef.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 _INCOMDEF_H_
8#define _INCOMDEF_H_
9
10
11#include "ichisize.h"
12#include "mode.h"
13
14/* Common definitions -- do not change */
15
16/* SDF treatment */
17#define MAX_SDF_HEADER 64 /* max length of the SDFile data header */
18#define MAX_SDF_VALUE 255 /* max lenght of the SDFile data value */
19
20/* size resrictions */
21#define ATOM_EL_LEN 6 /* length of atom name string including zero termination */
22#define ATOM_INFO_LEN 36 /* inf_ATOM output string ^123Al^+2H12..(+)/999/999/999/999: 32 chars */
23#define MAXVAL 50 /* max number of bonds per atom */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
24#define MAX_STEREO_BONDS 3 /* max number of stereogenic bonds per atom */
25#define NUM_H_ISOTOPES 3 /* number of hydrogen isotopes: protium, deuterium, tritium */
26#define ATW_H 1 /* hydrogen atomic weight */
27
28/* input bond type definition */
29#define MIN_INPUT_BOND_TYPE 1
30#define MAX_INPUT_BOND_TYPE 4
31
32#define BOND_TYPE_SINGLE 1
33#define BOND_TYPE_DOUBLE 2
34#define BOND_TYPE_TRIPLE 3
35#define BOND_TYPE_ALTERN 4
36
37#define STEREO_SNGL_UP 1
38#define STEREO_SNGL_EITHER 4
39#define STEREO_SNGL_DOWN 6
40#define STEREO_DBLE_EITHER 3
41
42
43/* MOlfile */
44#define INPUT_STEREO_SNGL_UP 1
45#define INPUT_STEREO_SNGL_EITHER 4
46#define INPUT_STEREO_SNGL_DOWN 6
47#define INPUT_STEREO_DBLE_EITHER 3
48
49/*
50#define BOND_MARK_ODD 0x10
51#define BOND_MARK_EVEN 0x20
52*/
53#define BOND_MARK_PARITY 0x30
54#define BOND_MARK_HIGHLIGHT 0x40 /* highlight equivalent components */
55
56#define BOND_MARK_ODD '-'
57#define BOND_MARK_EVEN '+'
58#define BOND_MARK_UNDF '?'
59#define BOND_MARK_UNKN 'u'
60#define BOND_MARK_ERR '*'
61
62#define SALT_DONOR_H 1
63#define SALT_DONOR_Neg 2
64#define SALT_ACCEPTOR 4
65#define SALT_p_DONOR 8 /* >C-SH */
66#define SALT_p_ACCEPTOR 16 /* >C-S(-) */
67#define SALT_DONOR_ALL (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
68#define SALT_DONOR_Neg2 (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
69#define SALT_DONOR_H2 (SALT_DONOR_H | SALT_p_DONOR)
70#define SALT_DONOR (SALT_DONOR_Neg | SALT_DONOR_H)
71
72#define SALT_SELECTED 32
73
74/* radical definitions */
75#define RADICAL_SINGLET 1
76#define RADICAL_DOUBLET 2
77#define RADICAL_TRIPLET 3
78
79/* metal definition */
80#define METAL 1 /* definition of an element: lowest valence */
81#define METAL2 3 /* definition of an element: lowest and next to it valence */
82#define IS_METAL 3 /* metal bitmap */
83/* isotopic shift */
84#define ZERO_ATW_DIFF 127 /* mark mass of the most abundant isotope */
85
86/* other types */
87
88#define UCINT (int)(unsigned char)
89
90#ifndef INCHI_US_CHAR_DEF
91typedef signed char S_CHAR;
92typedef unsigned char U_CHAR;
93#define INCHI_US_CHAR_DEF
94#endif
95
96#ifndef INCHI_US_SHORT_DEF
97typedef signed short S_SHORT;
98typedef unsigned short U_SHORT;
99#define INCHI_US_SHORT_DEF
100#endif
101
102#ifndef COMPILE_ALL_CPP
103#ifdef __cplusplus
104extern "C" {
105#endif
106#endif
107
108
109 /* allocator */
110#ifndef inchi_malloc
111 void* inchi_malloc(size_t c);
112#endif
113#ifndef inchi_calloc
114 void* inchi_calloc(size_t c, size_t n);
115#endif
116#ifndef inchi_free
117 void inchi_free(void* p);
118#endif
119
120
121
122 /* sorting etc */
123
124 void inchi_swap(char* a, char* b, size_t width);
125
126 int insertions_sort(void* pCG,
127 void* base, size_t num, size_t width, int(*compare)(const void* e1, const void* e2, void*));
128 int insertions_sort_AT_NUMBERS(void* pCG,
129 AT_NUMB* base, int num, int(*compare)(const void* e1, const void* e2, void*));
130 /*
131 int insertions_sort( void *base, size_t num, size_t width, int ( *compare )(const void *e1, const void *e2 ) );
132 int insertions_sort_AT_NUMBERS( AT_NUMB *base, int num, int ( *compare )(const void *e1, const void *e2 ) );
133 */
134
135
136 /* min-max */
137
138#define inchi_max(a,b) (((a)>(b))?(a):(b))
139#define inchi_min(a,b) (((a)<(b))?(a):(b))
140
141#ifndef COMPILE_ALL_CPP
142#ifdef __cplusplus
143}
144#endif
145#endif
146
147
148#endif /* _INCOMDEF_H_ */
unsigned short AT_NUMB
Definition ichisize.h:10
signed char S_CHAR
Definition incomdef.h:91
unsigned short U_SHORT
Definition incomdef.h:98
unsigned char U_CHAR
Definition incomdef.h:92
void inchi_swap(char *a, char *b, size_t width)
Definition ichisort.c:251
int insertions_sort_AT_NUMBERS(void *pCG, AT_NUMB *base, int num, int(*compare)(const void *e1, const void *e2, void *))
Definition ichisort.c:296
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:97
#define inchi_malloc
Definition mode.h:1122
#define inchi_calloc
Definition mode.h:1125
#define inchi_free(X)
Definition mode.h:1131