InChI
 
Loading...
Searching...
No Matches
ichiprt2.c File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "mode.h"
#include "ichimain.h"
#include "ichimake.h"
#include "ichi_io.h"
#include "bcf_s.h"
+ Include dependency graph for ichiprt2.c:

Macros

#define INIT_MIN_NUM_H   (-4)
 
#define INIT_MAX_NUM_H   16
 
#define INIT_LEN_NUM_H   (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
 
#define ALPHA_MINUS   '-'
 
#define ALPHA_ZERO_VAL   '.'
 
#define ALPHA_ONE   'a'
 
#define ALPHA_ZERO   '@'
 
#define __MYTOLOWER(c)   ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
 
#define DECIMAL_BASE   10
 
#define DECIMAL_MINUS   '-'
 
#define DECIMAL_ZERO_VAL   '0'
 
#define DECIMAL_ONE   '1'
 
#define DECIMAL_ZERO   '0'
 

Functions

int Eql_INChI_Stereo (INChI_Stereo *s1, int eql1, INChI_Stereo *s2, int eql2, int bRelRac)
 Compares stereo information of two structures.
 
int Eql_INChI_Isotopic (INChI *i1, INChI *i2)
 Compares isotopic information of two InChIs.
 
int Eql_INChI_Aux_Equ (INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2)
 Compares two InChI AuxInfo objects.
 
int Eql_INChI_Aux_Num (INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2)
 Compares two InChI AuxInfo objects in terms of numbering.
 
int bHasOrigInfo (ORIG_INFO *OrigInfo, int num_atoms)
 
int EqlOrigInfo (INChI_Aux *a1, INChI_Aux *a2)
 
int bHasEquString (AT_NUMB *LinearCT, int nLenCT)
 Checks if a given array of equivalence numbers (LinearCT) contains any repetitions.
 
int MakeMult (int mult, const char *szTailingDelim, INCHI_IOS_STRING *buf, int nCtMode, int *bOverflow)
 
int MakeNumber_EnhStereo (int number, const char *szTailingDelim, INCHI_IOS_STRING *buf, int nCtMode, int *bOverflow)
 Adds the number to the string buffer.
 
int MakeDelim (const char *szTailingDelim, INCHI_IOS_STRING *buf, int *bOverflow)
 Adds the delimiter to the string buffer if it is not empty and there is no overflow.
 
int MakeEqStr (const char *szTailingDelim, int mult, INCHI_IOS_STRING *buf, int *bOverflow)
 
int MakeCtStringNew (CANON_GLOBALS *pCG, AT_NUMB *LinearCT, int nLenCT, int bAddDelim, S_CHAR *nNum_H, int num_atoms, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeCtStringOld (AT_NUMB *LinearCT, int nLenCT, int bAddDelim, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeHString (int bAddDelim, S_CHAR *LinearCT, int nLenCT, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeCtString (CANON_GLOBALS *pCG, AT_NUMB *LinearCT, int nLenCT, int bAddDelim, S_CHAR *nNum_H, int num_atoms, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeTautString (AT_NUMB *LinearCT, int nLenCT, int bAddDelim, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeCRVString (ORIG_INFO *OrigInfo, int nLenCT, int bAddDelim, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeEquString (AT_NUMB *LinearCT, int nLenCT, int bAddDelim, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeIsoAtomString (INChI_IsotopicAtom *IsotopicAtom, int nNumberOfIsotopicAtoms, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeIsoTautString (INChI_IsotopicTGroup *IsotopicTGroup, int nNumberOfIsotopicTGroups, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeIsoHString (int num_iso_H[], INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int MakeStereoString (AT_NUMB *at1, AT_NUMB *at2, S_CHAR *parity, int bAddDelim, int nLenCT, INCHI_IOS_STRING *strbuf, int nCtMode, int *bOverflow)
 
int compare_ints (const void *a, const void *b)
 Compares two integers for qsort.
 
int compare_third_value (const void *a, const void *b)
 Compares the third value of two integer arrays for qsort. Used to sort enhanced stereochemistry groups based on the canonical atom number of the first atom in the group.
 
int MakeEnhStereoString (INChI_Aux *pAux, INCHI_IOS_STRING *strbuf, const char *conf_stereo_string, int **enh_stereo, int nof_stereo_groups, int nCtMode, int *bOverflow)
 Creates the enhanced stereochemistry string for the s - layer.
 
int MakeSlayerString (ORIG_ATOM_DATA *orig_inp_data, INCHI_SORT *pINChISort, INCHI_IOS_STRING *strbuf, int bOutType, int num_components, int nCtMode, int *bOverflow)
 Creates the string for the s - layer based on the enhanced stereochemistry information.
 
int MakeAbcNumber (char *szString, int nStringLen, const char *szLeadingDelim, int nValue)
 
static long abctol (const char *szString, char **q)
 
long inchi_strtol (const char *str, const char **p, int base)
 Convert string to long integer.
 
double inchi_strtod (const char *str, const char **p)
 Convert string to double.
 
int MakeDecNumber (char *szString, int nStringLen, const char *szLeadingDelim, int nValue)
 
void print_sequence_of_nums_compressing_ranges (int n, int *num, INCHI_IOS_STRING *strbuf)
 

Macro Definition Documentation

◆ __MYTOLOWER

#define __MYTOLOWER (   c)    ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )

◆ ALPHA_MINUS

#define ALPHA_MINUS   '-'

◆ ALPHA_ONE

#define ALPHA_ONE   'a'

◆ ALPHA_ZERO

#define ALPHA_ZERO   '@'

◆ ALPHA_ZERO_VAL

#define ALPHA_ZERO_VAL   '.'

◆ DECIMAL_BASE

#define DECIMAL_BASE   10

◆ DECIMAL_MINUS

#define DECIMAL_MINUS   '-'

◆ DECIMAL_ONE

#define DECIMAL_ONE   '1'

◆ DECIMAL_ZERO

#define DECIMAL_ZERO   '0'

◆ DECIMAL_ZERO_VAL

#define DECIMAL_ZERO_VAL   '0'

◆ INIT_LEN_NUM_H

#define INIT_LEN_NUM_H   (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)

◆ INIT_MAX_NUM_H

#define INIT_MAX_NUM_H   16

◆ INIT_MIN_NUM_H

#define INIT_MIN_NUM_H   (-4)

Function Documentation

◆ abctol()

long abctol ( const char *  szString,
char **  q 
)
static
+ Here is the caller graph for this function:

◆ bHasEquString()

int bHasEquString ( AT_NUMB LinearCT,
int  nLenCT 
)

Checks if a given array of equivalence numbers (LinearCT) contains any repetitions.

Parameters
LinearCTPointer to equivalence numbers
nLenCTLength of the array
Returns
int 1 if the array contains repetitions, 0 otherwise
+ Here is the caller graph for this function:

◆ bHasOrigInfo()

int bHasOrigInfo ( ORIG_INFO OrigInfo,
int  num_atoms 
)
+ Here is the caller graph for this function:

◆ compare_ints()

int compare_ints ( const void *  a,
const void *  b 
)

Compares two integers for qsort.

Parameters
aFirst integer pointer.
bSecond integer pointer.
Returns
Returns negative, zero, or positive value based on comparison.
+ Here is the caller graph for this function:

◆ compare_third_value()

int compare_third_value ( const void *  a,
const void *  b 
)

Compares the third value of two integer arrays for qsort. Used to sort enhanced stereochemistry groups based on the canonical atom number of the first atom in the group.

Parameters
aFirst integer array pointer.
bSecond integer array pointer.
Returns
Returns negative, zero, or positive value based on comparison.
+ Here is the caller graph for this function:

◆ Eql_INChI_Aux_Equ()

int Eql_INChI_Aux_Equ ( INChI_Aux a1,
int  eql1,
INChI_Aux a2,
int  eql2 
)

Compares two InChI AuxInfo objects.

Parameters
a1Pointer to first AuxInfo
eql1Flag to compare type 1
a2Pointer to second AuxInfo
eql2Flag to compare type 2
Returns
int 0 if unequal or empty, 1 if equal
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Eql_INChI_Aux_Num()

int Eql_INChI_Aux_Num ( INChI_Aux a1,
int  eql1,
INChI_Aux a2,
int  eql2 
)

Compares two InChI AuxInfo objects in terms of numbering.

Parameters
a1Pointer to first AuxInfo
eql1Flag to compare type 1
a2Pointer to second AuxInfo
eql2Flag to compare type 2
Returns
int 0 if unequal or empty, 1 if numbering matches
+ Here is the caller graph for this function:

◆ Eql_INChI_Isotopic()

int Eql_INChI_Isotopic ( INChI i1,
INChI i2 
)

Compares isotopic information of two InChIs.

Parameters
i1Pointer to first InChI
i2Pointer to second InChI
Returns
int 0 if unequal, 1 if equal
+ Here is the caller graph for this function:

◆ Eql_INChI_Stereo()

int Eql_INChI_Stereo ( INChI_Stereo s1,
int  eql1,
INChI_Stereo s2,
int  eql2,
int  bRelRac 
)

Compares stereo information of two structures.

Parameters
s1Pointer to stereo information of first structure
eql1Flag for stereo information check (EQL_EXISTS, EQL_SP3, EQL_SP3_INV, EQL_SP2)
s2Pointer to stereo information of second structure
eql2Flag for stereo information check (EQL_EXISTS, EQL_SP3, EQL_SP3_INV, EQL_SP2)
bRelRacFlag to compare racemic stereo information
Returns
int 0 if unequal, 1 if equal
+ Here is the caller graph for this function:

◆ EqlOrigInfo()

int EqlOrigInfo ( INChI_Aux a1,
INChI_Aux a2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inchi_strtod()

double inchi_strtod ( const char *  str,
const char **  p 
)

Convert string to double.

Parameters
strPointer to the input string
pPointer to the position where conversion stopped
Returns
double Converted value
+ Here is the caller graph for this function:

◆ inchi_strtol()

long inchi_strtol ( const char *  str,
const char **  p,
int  base 
)

Convert string to long integer.

Parameters
strPointer to the input string
pPointer to the position where conversion stopped
baseBase for conversion
Returns
long Converted value
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeAbcNumber()

int MakeAbcNumber ( char *  szString,
int  nStringLen,
const char *  szLeadingDelim,
int  nValue 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeCRVString()

int MakeCRVString ( ORIG_INFO OrigInfo,
int  nLenCT,
int  bAddDelim,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeCtString()

int MakeCtString ( CANON_GLOBALS pCG,
AT_NUMB LinearCT,
int  nLenCT,
int  bAddDelim,
S_CHAR nNum_H,
int  num_atoms,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeCtStringNew()

int MakeCtStringNew ( CANON_GLOBALS pCG,
AT_NUMB LinearCT,
int  nLenCT,
int  bAddDelim,
S_CHAR nNum_H,
int  num_atoms,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeCtStringOld()

int MakeCtStringOld ( AT_NUMB LinearCT,
int  nLenCT,
int  bAddDelim,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeDecNumber()

int MakeDecNumber ( char *  szString,
int  nStringLen,
const char *  szLeadingDelim,
int  nValue 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeDelim()

int MakeDelim ( const char *  szTailingDelim,
INCHI_IOS_STRING buf,
int *  bOverflow 
)

Adds the delimiter to the string buffer if it is not empty and there is no overflow.

Parameters
szTailingDelimPointer to the trailing delimiter string
bufPointer to the output string buffer
bOverflowPointer to overflow flag
Returns
Returns the number of characters added to the buffer, or 0 if the delimiter is empty or there is an overflow
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeEnhStereoString()

int MakeEnhStereoString ( INChI_Aux pAux,
INCHI_IOS_STRING strbuf,
const char *  conf_stereo_string,
int **  enh_stereo,
int  nof_stereo_groups,
int  nCtMode,
int *  bOverflow 
)

Creates the enhanced stereochemistry string for the s - layer.

Parameters
pAuxPointer to the INCHI_AUX structure.
conf_stereo_stringPointer to the configuration stereochemistry string (abs, rel, rac).
enh_stereoPointer to list of enhanced stereochemistry groups.
nof_stereo_groupsNumber of enhanced stereochemistry groups.
strbufPointer to the output string buffer.
nCtModeMode flag for string representation.
bOverflowPointer to overflow flag.
Returns
Returns the length of the created string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeEqStr()

int MakeEqStr ( const char *  szTailingDelim,
int  mult,
INCHI_IOS_STRING buf,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeEquString()

int MakeEquString ( AT_NUMB LinearCT,
int  nLenCT,
int  bAddDelim,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeHString()

int MakeHString ( int  bAddDelim,
S_CHAR LinearCT,
int  nLenCT,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeIsoAtomString()

int MakeIsoAtomString ( INChI_IsotopicAtom IsotopicAtom,
int  nNumberOfIsotopicAtoms,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeIsoHString()

int MakeIsoHString ( int  num_iso_H[],
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeIsoTautString()

int MakeIsoTautString ( INChI_IsotopicTGroup IsotopicTGroup,
int  nNumberOfIsotopicTGroups,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeMult()

int MakeMult ( int  mult,
const char *  szTailingDelim,
INCHI_IOS_STRING buf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeNumber_EnhStereo()

int MakeNumber_EnhStereo ( int  number,
const char *  szTailingDelim,
INCHI_IOS_STRING buf,
int  nCtMode,
int *  bOverflow 
)

Adds the number to the string buffer.

Parameters
numberInput number to be added
szTailingDelimPointer to the trailing delimiter string
bufPointer to the output string buffer
nCtModeMode flag for string representation
bOverflowPointer to overflow flag
Returns
Returns the number of characters added to the buffer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeSlayerString()

int MakeSlayerString ( ORIG_ATOM_DATA orig_inp_data,
INCHI_SORT pINChISort,
INCHI_IOS_STRING strbuf,
int  bOutType,
int  num_components,
int  nCtMode,
int *  bOverflow 
)

Creates the string for the s - layer based on the enhanced stereochemistry information.

Parameters
orig_inp_dataPointer to the original atom data.
pINChISortPointer to the INCHI_SORT structure.
bOutTypeOutput type flag.
num_componentsNumber of components in the molecule.
strbufPointer to the output string buffer.
nCtModeMode flag for string representation.
bOverflowPointer to overflow flag.
Returns
Returns the length of the created string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeStereoString()

int MakeStereoString ( AT_NUMB at1,
AT_NUMB at2,
S_CHAR parity,
int  bAddDelim,
int  nLenCT,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeTautString()

int MakeTautString ( AT_NUMB LinearCT,
int  nLenCT,
int  bAddDelim,
INCHI_IOS_STRING strbuf,
int  nCtMode,
int *  bOverflow 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_sequence_of_nums_compressing_ranges()

void print_sequence_of_nums_compressing_ranges ( int  n,
int *  num,
INCHI_IOS_STRING strbuf 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function: