InChI
 
Loading...
Searching...
No Matches
util.h File Reference
#include "inpdef.h"
+ Include dependency graph for util.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EL_NUMBER_H   ((U_CHAR) 1)
 
#define EL_NUMBER_B   ((U_CHAR) 5)
 
#define EL_NUMBER_C   ((U_CHAR) 6)
 
#define EL_NUMBER_N   ((U_CHAR) 7)
 
#define EL_NUMBER_O   ((U_CHAR) 8)
 
#define EL_NUMBER_F   ((U_CHAR) 9)
 
#define EL_NUMBER_SI   ((U_CHAR) 14)
 
#define EL_NUMBER_P   ((U_CHAR) 15)
 
#define EL_NUMBER_S   ((U_CHAR) 16)
 
#define EL_NUMBER_CL   ((U_CHAR) 17)
 
#define EL_NUMBER_GE   ((U_CHAR) 32)
 
#define EL_NUMBER_AS   ((U_CHAR) 33)
 
#define EL_NUMBER_SE   ((U_CHAR) 34)
 
#define EL_NUMBER_BR   ((U_CHAR) 35)
 
#define EL_NUMBER_SB   ((U_CHAR) 51)
 
#define EL_NUMBER_TE   ((U_CHAR) 52)
 
#define EL_NUMBER_I   ((U_CHAR) 53)
 
#define EL_NUMBER_PO   ((U_CHAR) 84)
 
#define EL_NUMBER_AT   ((U_CHAR) 85)
 
#define EL_NUMBER_ZY   ((U_CHAR)119)
 
#define EL_NUMBER_ZZ   ((U_CHAR)120)
 
#define ALPHA_BASE   27
 
#define INCHI_BUILD_PLATFORM   ""
 
#define INCHI_BUILD_DEBUG   ""
 
#define INCHI_SRC_REV   ""
 
#define INCHI_BUILD_COMPILER   ""
 

Functions

int get_atomic_mass (const char *elname)
 Get the atomic mass object.
 
int get_atomic_mass_from_elnum (int nAtNum)
 Get the atomic mass from elnum object.
 
int get_num_H (const char *elname, int inp_num_H, S_CHAR num_iso_H[], int charge, int radical, int chem_bonds_valence, int atom_input_valence, int bAliased, int bDoNotAddH, int bHasMetalNeighbor)
 
int extract_charges_and_radicals (char *elname, int *pnRadical, int *pnCharge)
 
int extract_H_atoms (char *elname, S_CHAR num_iso_H[])
 
int normalize_string (char *name)
 
int read_upto_delim (char **pstring, char *field, int maxlen, char *delims)
 
int is_matching_any_delim (char c, char *delims)
 Check if a character is in the list of possible delimiters.
 
int dotify_non_printable_chars (char *line)
 
char * lrtrim (char *p, int *nLen)
 Remove leading and trailing white spaces.
 
void remove_trailing_spaces (char *p)
 Remove trailing spaces from a string.
 
void remove_one_lf (char *p)
 Remove one line feed character from the end of the string.
 
int mystrncpy (char *target, const char *source, unsigned maxlen)
 Copies up to maxlen characters INCLUDING end null from source to target. Fills out the rest of the target with null bytes. Protected from non-zero-terminated source and overlapped target/source.
 
void mystrrev (char *p)
 
int inchi_memicmp (const void *p1, const void *p2, size_t length)
 Compare two memory blocks in a case-insensitive manner.
 
int inchi_stricmp (const char *s1, const char *s2)
 
char * inchi__strnset (char *s, int val, size_t length)
 
char * inchi__strdup (const char *string)
 
long inchi_strtol (const char *str, const char **p, int base)
 
double inchi_strtod (const char *str, const char **p)
 
AT_NUMBis_in_the_list (AT_NUMB *pathAtom, AT_NUMB nNextAtom, int nPathLen)
 
int * is_in_the_ilist (int *pathAtom, int nNextAtom, int nPathLen)
 
int is_ilist_inside (int *ilist, int nlist, int *ilist2, int nlist2)
 
void extract_inchi_substring (char **buf, const char *str, size_t slen)
 
void extract_auxinfo_substring (char **buf, const char *str, size_t slen)
 
int extract_orig_nums_from_auxinfo_string (char *saux, int *orig)
 
int extract_nonstereo_eq_classes_from_auxinfo_string (char *saux, int nat, int *orig, int *have_eclass_info, int *eclass, int *eclass_by_origs)
 
int extract_stereo_info_from_inchi_string (char *sinchi, int nat, int *orig, int *at_stereo_mark)
 
int extract_all_backbone_bonds_from_inchi_string (char *sinchi, int *n_all_bkb_orig, int *orig, int *all_bkb_orig)
 
int get_periodic_table_number (const char *elname)
 
int is_el_a_metal (int nPeriodicNum)
 
int get_el_valence (int nPeriodicNum, int charge, int val_num)
 
int get_unusual_el_valence (int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds)
 
int detect_unusual_el_valence (int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds)
 
int needed_unusual_el_valence (int nPeriodicNum, int charge, int radical, int bonds_valence, int actual_bonds_val, int num_H, int num_bonds)
 
int get_el_type (int nPeriodicNum)
 
int if_skip_add_H (int nPeriodicNum)
 
int get_element_chemical_symbol (int nAtNum, char *szElement)
 
int get_element_or_pseudoelement_symbol (int nAtNum, char *szElement)
 
int MakeRemovedProtonsString (int nNumRemovedProtons, NUM_H *nNumExchgIsotopicH, NUM_H *nNumRemovedProtonsIsotopic, int bIsotopic, char *szRemovedProtons, int *num_removed_iso_H)
 
int num_of_H (inp_ATOM *at, int iat)
 
U_CHAR ion_el_group (int el)
 
int has_other_ion_neigh (inp_ATOM *at, int iat, int iat_ion_neigh)
 
int has_other_ion_in_sphere_2 (inp_ATOM *at, int iat, int iat_ion_neigh)
 
int nNoMetalNumBonds (inp_ATOM *at, int at_no)
 
int nNoMetalBondsValence (inp_ATOM *at, int at_no)
 
int nNoMetalNeighIndex (inp_ATOM *at, int at_no)
 
int nNoMetalOtherNeighIndex (inp_ATOM *at, int at_no, int cur_neigh)
 
int nNoMetalOtherNeighIndex2 (inp_ATOM *at, int at_no, int cur_neigh, int cur_neigh2)
 
int nBondsValToMetal (inp_ATOM *at, int iat)
 
int nBondsValenceInpAt (const inp_ATOM *at, int *nNumAltBonds, int *nNumWrongBonds)
 
int bHeteroAtomMayHaveXchgIsoH (inp_ATOM *atom, int iat)
 
int get_endpoint_valence (U_CHAR el_number)
 
int get_endpoint_valence_KET (U_CHAR el_number)
 
int SetBitFree (struct tagCANON_GLOBALS *pCG)
 
void WriteCoord (char *str, double x)
 

Variables

const int ERR_ELEM
 
const int nElDataLen
 

Macro Definition Documentation

◆ ALPHA_BASE

#define ALPHA_BASE   27

◆ EL_NUMBER_AS

#define EL_NUMBER_AS   ((U_CHAR) 33)

◆ EL_NUMBER_AT

#define EL_NUMBER_AT   ((U_CHAR) 85)

◆ EL_NUMBER_B

#define EL_NUMBER_B   ((U_CHAR) 5)

◆ EL_NUMBER_BR

#define EL_NUMBER_BR   ((U_CHAR) 35)

◆ EL_NUMBER_C

#define EL_NUMBER_C   ((U_CHAR) 6)

◆ EL_NUMBER_CL

#define EL_NUMBER_CL   ((U_CHAR) 17)

◆ EL_NUMBER_F

#define EL_NUMBER_F   ((U_CHAR) 9)

◆ EL_NUMBER_GE

#define EL_NUMBER_GE   ((U_CHAR) 32)

◆ EL_NUMBER_H

#define EL_NUMBER_H   ((U_CHAR) 1)

◆ EL_NUMBER_I

#define EL_NUMBER_I   ((U_CHAR) 53)

◆ EL_NUMBER_N

#define EL_NUMBER_N   ((U_CHAR) 7)

◆ EL_NUMBER_O

#define EL_NUMBER_O   ((U_CHAR) 8)

◆ EL_NUMBER_P

#define EL_NUMBER_P   ((U_CHAR) 15)

◆ EL_NUMBER_PO

#define EL_NUMBER_PO   ((U_CHAR) 84)

◆ EL_NUMBER_S

#define EL_NUMBER_S   ((U_CHAR) 16)

◆ EL_NUMBER_SB

#define EL_NUMBER_SB   ((U_CHAR) 51)

◆ EL_NUMBER_SE

#define EL_NUMBER_SE   ((U_CHAR) 34)

◆ EL_NUMBER_SI

#define EL_NUMBER_SI   ((U_CHAR) 14)

◆ EL_NUMBER_TE

#define EL_NUMBER_TE   ((U_CHAR) 52)

◆ EL_NUMBER_ZY

#define EL_NUMBER_ZY   ((U_CHAR)119)

◆ EL_NUMBER_ZZ

#define EL_NUMBER_ZZ   ((U_CHAR)120)

◆ INCHI_BUILD_COMPILER

#define INCHI_BUILD_COMPILER   ""

◆ INCHI_BUILD_DEBUG

#define INCHI_BUILD_DEBUG   ""

◆ INCHI_BUILD_PLATFORM

#define INCHI_BUILD_PLATFORM   ""

◆ INCHI_SRC_REV

#define INCHI_SRC_REV   ""

Function Documentation

◆ bHeteroAtomMayHaveXchgIsoH()

int bHeteroAtomMayHaveXchgIsoH ( inp_ATOM atom,
int  iat 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detect_unusual_el_valence()

int detect_unusual_el_valence ( int  nPeriodicNum,
int  charge,
int  radical,
int  bonds_valence,
int  num_H,
int  num_bonds 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dotify_non_printable_chars()

int dotify_non_printable_chars ( char *  line)
+ Here is the caller graph for this function:

◆ extract_all_backbone_bonds_from_inchi_string()

int extract_all_backbone_bonds_from_inchi_string ( char *  sinchi,
int *  n_all_bkb_orig,
int *  orig,
int *  all_bkb_orig 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extract_auxinfo_substring()

void extract_auxinfo_substring ( char **  buf,
const char *  str,
size_t  slen 
)
+ Here is the caller graph for this function:

◆ extract_charges_and_radicals()

int extract_charges_and_radicals ( char *  elname,
int *  pnRadical,
int *  pnCharge 
)
+ Here is the caller graph for this function:

◆ extract_H_atoms()

int extract_H_atoms ( char *  elname,
S_CHAR  num_iso_H[] 
)
+ Here is the caller graph for this function:

◆ extract_inchi_substring()

void extract_inchi_substring ( char **  buf,
const char *  str,
size_t  slen 
)
+ Here is the caller graph for this function:

◆ extract_nonstereo_eq_classes_from_auxinfo_string()

int extract_nonstereo_eq_classes_from_auxinfo_string ( char *  saux,
int  nat,
int *  orig,
int *  have_eclass_info,
int *  eclass,
int *  eclass_by_origs 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extract_orig_nums_from_auxinfo_string()

int extract_orig_nums_from_auxinfo_string ( char *  saux,
int *  orig 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extract_stereo_info_from_inchi_string()

int extract_stereo_info_from_inchi_string ( char *  sinchi,
int  nat,
int *  orig,
int *  at_stereo_mark 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_atomic_mass()

int get_atomic_mass ( const char *  elname)

Get the atomic mass object.

Parameters
elnameElement name
Returns
Returns the atomic mass as integer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_atomic_mass_from_elnum()

int get_atomic_mass_from_elnum ( int  nAtNum)

Get the atomic mass from elnum object.

Parameters
nAtNumElement number
Returns
Returns the atomic mass as integer
+ Here is the caller graph for this function:

◆ get_el_type()

int get_el_type ( int  nPeriodicNum)
+ Here is the caller graph for this function:

◆ get_el_valence()

int get_el_valence ( int  nPeriodicNum,
int  charge,
int  val_num 
)
+ Here is the caller graph for this function:

◆ get_element_chemical_symbol()

int get_element_chemical_symbol ( int  nAtNum,
char *  szElement 
)
+ Here is the caller graph for this function:

◆ get_element_or_pseudoelement_symbol()

int get_element_or_pseudoelement_symbol ( int  nAtNum,
char *  szElement 
)
+ Here is the caller graph for this function:

◆ get_endpoint_valence()

int get_endpoint_valence ( U_CHAR  el_number)
+ Here is the caller graph for this function:

◆ get_endpoint_valence_KET()

int get_endpoint_valence_KET ( U_CHAR  el_number)
+ Here is the caller graph for this function:

◆ get_num_H()

int get_num_H ( const char *  elname,
int  inp_num_H,
S_CHAR  num_iso_H[],
int  charge,
int  radical,
int  chem_bonds_valence,
int  atom_input_valence,
int  bAliased,
int  bDoNotAddH,
int  bHasMetalNeighbor 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_periodic_table_number()

int get_periodic_table_number ( const char *  elname)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_unusual_el_valence()

int get_unusual_el_valence ( int  nPeriodicNum,
int  charge,
int  radical,
int  bonds_valence,
int  num_H,
int  num_bonds 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_other_ion_in_sphere_2()

int has_other_ion_in_sphere_2 ( inp_ATOM at,
int  iat,
int  iat_ion_neigh 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ has_other_ion_neigh()

int has_other_ion_neigh ( inp_ATOM at,
int  iat,
int  iat_ion_neigh 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ if_skip_add_H()

int if_skip_add_H ( int  nPeriodicNum)
+ Here is the caller graph for this function:

◆ inchi__strdup()

char * inchi__strdup ( const char *  string)
+ Here is the caller graph for this function:

◆ inchi__strnset()

char * inchi__strnset ( char *  s,
int  val,
size_t  length 
)

◆ inchi_memicmp()

int inchi_memicmp ( const void *  p1,
const void *  p2,
size_t  length 
)

Compare two memory blocks in a case-insensitive manner.

Parameters
p1Pointer to the first memory block.
p2Pointer to the second memory block.
lengthNumber of bytes to compare.
Returns
int < 0 if p1 < p2, 0 if p1 == p2, > 0 if p1 > p2
+ Here is the caller graph for this function:

◆ inchi_stricmp()

int inchi_stricmp ( const char *  s1,
const char *  s2 
)
+ Here is the caller graph for this function:

◆ inchi_strtod()

double inchi_strtod ( const char *  str,
const char **  p 
)
+ Here is the caller graph for this function:

◆ inchi_strtol()

long inchi_strtol ( const char *  str,
const char **  p,
int  base 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ion_el_group()

U_CHAR ion_el_group ( int  el)
+ Here is the caller graph for this function:

◆ is_el_a_metal()

int is_el_a_metal ( int  nPeriodicNum)
+ Here is the caller graph for this function:

◆ is_ilist_inside()

int is_ilist_inside ( int *  ilist,
int  nlist,
int *  ilist2,
int  nlist2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_in_the_ilist()

int * is_in_the_ilist ( int *  pathAtom,
int  nNextAtom,
int  nPathLen 
)
+ Here is the caller graph for this function:

◆ is_in_the_list()

AT_NUMB * is_in_the_list ( AT_NUMB pathAtom,
AT_NUMB  nNextAtom,
int  nPathLen 
)
+ Here is the caller graph for this function:

◆ is_matching_any_delim()

int is_matching_any_delim ( char  c,
char *  delims 
)

Check if a character is in the list of possible delimiters.

Note
same as isspace if delims is " \t\n\v\f\r" (0x20 and 0x09-0x0D)
Parameters
cCharacter to check
delimsString of delimiter characters
Returns
int 1 if c is a delimiter, 0 otherwise
+ Here is the caller graph for this function:

◆ lrtrim()

char * lrtrim ( char *  p,
int *  nLen 
)

Remove leading and trailing white spaces.

Parameters
pInput string
nLenOutput length of the trimmed string
Returns
char* Pointer to the trimmed string
+ Here is the caller graph for this function:

◆ MakeRemovedProtonsString()

int MakeRemovedProtonsString ( int  nNumRemovedProtons,
NUM_H nNumExchgIsotopicH,
NUM_H nNumRemovedProtonsIsotopic,
int  bIsotopic,
char *  szRemovedProtons,
int *  num_removed_iso_H 
)

◆ mystrncpy()

int mystrncpy ( char *  target,
const char *  source,
unsigned  maxlen 
)

Copies up to maxlen characters INCLUDING end null from source to target. Fills out the rest of the target with null bytes. Protected from non-zero-terminated source and overlapped target/source.

Note
If source is NULL or maxlen is 0, nothing is copied and 0 is returned.
Parameters
targetTarget string
sourceSource string
maxlenMaximum length to copy
Returns
1 on success, 0 if target is NULL or maxlen is 0 or source is NULL
+ Here is the caller graph for this function:

◆ mystrrev()

void mystrrev ( char *  p)
+ Here is the caller graph for this function:

◆ nBondsValenceInpAt()

int nBondsValenceInpAt ( const inp_ATOM at,
int *  nNumAltBonds,
int *  nNumWrongBonds 
)
+ Here is the caller graph for this function:

◆ nBondsValToMetal()

int nBondsValToMetal ( inp_ATOM at,
int  iat 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ needed_unusual_el_valence()

int needed_unusual_el_valence ( int  nPeriodicNum,
int  charge,
int  radical,
int  bonds_valence,
int  actual_bonds_val,
int  num_H,
int  num_bonds 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nNoMetalBondsValence()

int nNoMetalBondsValence ( inp_ATOM at,
int  at_no 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nNoMetalNeighIndex()

int nNoMetalNeighIndex ( inp_ATOM at,
int  at_no 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nNoMetalNumBonds()

int nNoMetalNumBonds ( inp_ATOM at,
int  at_no 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nNoMetalOtherNeighIndex()

int nNoMetalOtherNeighIndex ( inp_ATOM at,
int  at_no,
int  cur_neigh 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nNoMetalOtherNeighIndex2()

int nNoMetalOtherNeighIndex2 ( inp_ATOM at,
int  at_no,
int  cur_neigh,
int  cur_neigh2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalize_string()

int normalize_string ( char *  name)
+ Here is the caller graph for this function:

◆ num_of_H()

int num_of_H ( inp_ATOM at,
int  iat 
)
+ Here is the caller graph for this function:

◆ read_upto_delim()

int read_upto_delim ( char **  pstring,
char *  field,
int  maxlen,
char *  delims 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_one_lf()

void remove_one_lf ( char *  p)

Remove one line feed character from the end of the string.

Parameters
pInput string
+ Here is the caller graph for this function:

◆ remove_trailing_spaces()

void remove_trailing_spaces ( char *  p)

Remove trailing spaces from a string.

Parameters
pInput string
+ Here is the caller graph for this function:

◆ SetBitFree()

int SetBitFree ( struct tagCANON_GLOBALS pCG)
+ Here is the caller graph for this function:

◆ WriteCoord()

void WriteCoord ( char *  str,
double  x 
)
+ Here is the caller graph for this function:

Variable Documentation

◆ ERR_ELEM

const int ERR_ELEM
extern

◆ nElDataLen

const int nElDataLen
extern