rino 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/README +44 -0
  2. data/Rakefile +123 -0
  3. data/ext/extconf.rb +26 -0
  4. data/ext/ruby_inchi_main.so +0 -0
  5. data/ext/src/aux2atom.h +2786 -0
  6. data/ext/src/comdef.h +148 -0
  7. data/ext/src/e_0dstereo.c +3014 -0
  8. data/ext/src/e_0dstereo.h +31 -0
  9. data/ext/src/e_comdef.h +57 -0
  10. data/ext/src/e_ctl_data.h +147 -0
  11. data/ext/src/e_ichi_io.c +498 -0
  12. data/ext/src/e_ichi_io.h +40 -0
  13. data/ext/src/e_ichi_parms.c +37 -0
  14. data/ext/src/e_ichi_parms.h +41 -0
  15. data/ext/src/e_ichicomp.h +50 -0
  16. data/ext/src/e_ichierr.h +40 -0
  17. data/ext/src/e_ichimain.c +593 -0
  18. data/ext/src/e_ichisize.h +43 -0
  19. data/ext/src/e_inchi_atom.c +75 -0
  20. data/ext/src/e_inchi_atom.h +33 -0
  21. data/ext/src/e_inpdef.h +41 -0
  22. data/ext/src/e_mode.h +706 -0
  23. data/ext/src/e_mol2atom.c +649 -0
  24. data/ext/src/e_readinch.c +58 -0
  25. data/ext/src/e_readmol.c +54 -0
  26. data/ext/src/e_readmol.h +180 -0
  27. data/ext/src/e_readstru.c +251 -0
  28. data/ext/src/e_readstru.h +33 -0
  29. data/ext/src/e_util.c +284 -0
  30. data/ext/src/e_util.h +61 -0
  31. data/ext/src/extr_ct.h +251 -0
  32. data/ext/src/ichi.h +206 -0
  33. data/ext/src/ichi_bns.c +7999 -0
  34. data/ext/src/ichi_bns.h +231 -0
  35. data/ext/src/ichican2.c +5000 -0
  36. data/ext/src/ichicano.c +2195 -0
  37. data/ext/src/ichicano.h +49 -0
  38. data/ext/src/ichicans.c +1625 -0
  39. data/ext/src/ichicant.h +379 -0
  40. data/ext/src/ichicomn.h +260 -0
  41. data/ext/src/ichicomp.h +50 -0
  42. data/ext/src/ichidrp.h +119 -0
  43. data/ext/src/ichierr.h +124 -0
  44. data/ext/src/ichiisot.c +101 -0
  45. data/ext/src/ichilnct.c +286 -0
  46. data/ext/src/ichimain.h +132 -0
  47. data/ext/src/ichimak2.c +1189 -0
  48. data/ext/src/ichimake.c +3812 -0
  49. data/ext/src/ichimake.h +205 -0
  50. data/ext/src/ichimap1.c +851 -0
  51. data/ext/src/ichimap2.c +2856 -0
  52. data/ext/src/ichimap4.c +1609 -0
  53. data/ext/src/ichinorm.c +741 -0
  54. data/ext/src/ichinorm.h +67 -0
  55. data/ext/src/ichiparm.c +45 -0
  56. data/ext/src/ichiparm.h +1441 -0
  57. data/ext/src/ichiprt1.c +3612 -0
  58. data/ext/src/ichiprt2.c +1511 -0
  59. data/ext/src/ichiprt3.c +3011 -0
  60. data/ext/src/ichiqueu.c +1003 -0
  61. data/ext/src/ichiring.c +326 -0
  62. data/ext/src/ichiring.h +49 -0
  63. data/ext/src/ichisize.h +35 -0
  64. data/ext/src/ichisort.c +539 -0
  65. data/ext/src/ichister.c +3538 -0
  66. data/ext/src/ichister.h +35 -0
  67. data/ext/src/ichitaut.c +3843 -0
  68. data/ext/src/ichitaut.h +387 -0
  69. data/ext/src/ichitime.h +74 -0
  70. data/ext/src/inchi_api.h +670 -0
  71. data/ext/src/inchi_dll.c +1480 -0
  72. data/ext/src/inchi_dll.h +34 -0
  73. data/ext/src/inchi_dll_main.c +23 -0
  74. data/ext/src/inchi_dll_main.h +31 -0
  75. data/ext/src/inpdef.h +328 -0
  76. data/ext/src/lreadmol.h +1246 -0
  77. data/ext/src/mode.h +706 -0
  78. data/ext/src/ruby_inchi_main.c +558 -0
  79. data/ext/src/runichi.c +4179 -0
  80. data/ext/src/strutil.c +3861 -0
  81. data/ext/src/strutil.h +182 -0
  82. data/ext/src/util.c +1130 -0
  83. data/ext/src/util.h +85 -0
  84. data/lib/clean_tempfile.rb +220 -0
  85. data/lib/rino.rb +111 -0
  86. data/test/test.rb +386 -0
  87. metadata +130 -0
@@ -0,0 +1,205 @@
1
+ /*
2
+ * International Union of Pure and Applied Chemistry (IUPAC)
3
+ * International Chemical Identifier (InChI)
4
+ * Version 1
5
+ * Software version 1.00
6
+ * April 13, 2005
7
+ * Developed at NIST
8
+ */
9
+
10
+ #ifndef __INCHIMAKE_H__
11
+ #define __INCHIMAKE_H__
12
+
13
+ /***********************************************************************/
14
+ /* replace all ' ' delimiters with ',' */
15
+ #define ITEM_DELIMETER ","
16
+ #define EXTRA_SPACE ""
17
+ #define COMMA_EXTRA_SPACE ","
18
+ #define LEN_EXTRA_SPACE 0
19
+
20
+ /**********************************************************************************************/
21
+ /* nCtMode for output INChI */
22
+
23
+ #define CT_MODE_NO_ORPHANS 1 /* no orphans, that CT should have only atoms with neighbors */
24
+ #define CT_MODE_ABC_NUMBERS 2
25
+ #define CT_MODE_ATOM_COUNTS 4
26
+ #define CT_MODE_PREDECESSORS 8
27
+ #define CT_MODE_EQL_H_TOGETHER 16
28
+ #define CT_MODE_ABC_NUM_CLOSURES 32 /* in CT_MODE_ABC_NUMBERS output AB1AC2AB instead of AB-AC-A-B */
29
+
30
+
31
+ /*************** Macros for retrieving requested INChI and INChI_Aux *****************************/
32
+ /* S->pINChI[TAUT_YES] has info: */
33
+ #define HAS_T(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
34
+ /* S->pINChI[TAUT_NON] has info: */
35
+ #define HAS_N(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
36
+
37
+ /* S->pINChI[TAUT_YES] has tautomeric info: */
38
+ #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
39
+ /* S->pINChI[TAUT_YES] has non-taitomeric info: */
40
+ #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
41
+ /* S->pINChI[TAUT_NON] has non-tautomeric info: */
42
+ #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
43
+ #define GET_II(M,S) ((M==OUT_N1)? (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
44
+ (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
45
+ (M==OUT_NN)? (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
46
+ (M==OUT_NT)? ((HAS_TT(S) && HAS_NN(S)) ? TAUT_NON : -1) : -1)
47
+
48
+ /*********************************/
49
+ /* Equivalence flags definitions */
50
+ /*********************************/
51
+
52
+ /* What is equal (ii = INChI_ITEM) */
53
+ #define iiSTEREO 0x0001 /* stereo (sp2 or sp3) */
54
+ #define iiSTEREO_INV 0x0002 /* inverted stereo (sp3) */
55
+ #define iiNUMB 0x0004 /* numbering or inverted stereo numbering */
56
+ #define iiEQU 0x0008 /* equivalence info */
57
+ /* derived:
58
+ (iiSTEREO_INV | iiNUMB) = numbering of inverted stereo
59
+ */
60
+
61
+ /* Additional info to what is equal (INCHI_ITEM_TYPE = iit) */
62
+ #define iitISO 0x0010 /* Isotopic */
63
+ #define iitNONTAUT 0x0020 /* Non-tautomeric */
64
+ /* derived:
65
+ (iitISO | iitNONTAUT) = isotopic non-tautomeric
66
+ */
67
+
68
+ /* Where is the equivalent item located (INChI_ITEM_EQUAL_TO = iiEq2) */
69
+ #define iiEq2NONTAUT 0x0040 /* non-tautomeric */
70
+ #define iiEq2ISO 0x0080 /* isotopic */
71
+ #define iiEq2INV 0x0100 /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
72
+
73
+ /*********************** Printing strings external declarations *******************************/
74
+
75
+ extern const char sCompDelim[];
76
+
77
+ #ifndef INCHI_ALL_CPP
78
+ #ifdef __cplusplus
79
+ extern "C" {
80
+ #endif
81
+ #endif
82
+
83
+ /**********************************************************************************************/
84
+ int FillOutINChI( INChI *pINChI, INChI_Aux *pINChI_Aux,
85
+ int num_atoms, int num_at_tg, int num_removed_H,
86
+ sp_ATOM *at, inp_ATOM *norm_at, CANON_STAT *pCS, int bTautomeric,
87
+ INCHI_MODE nUserMode, char *pStrErrStruct );
88
+
89
+ int MakeHillFormulaString( char *szHillFormula, char *szLinearCT, int nLen_szLinearCT, int *bOverflow);
90
+
91
+ int bHasOrigInfo( ORIG_INFO *OrigInfo, int num_atoms );
92
+ int EqlOrigInfo( INChI_Aux *a1, INChI_Aux *a2 );
93
+
94
+ int MakeAbcNumber( char *szString, int nStringLen, const char *szLeadingDelim, int nValue );
95
+ int MakeDecNumber( char *szString, int nStringLen, const char *szLeadingDelim, int nValue );
96
+ int MakeCtStringNew( AT_NUMB *LinearCT, int nLenCT, int bAddDelim,
97
+ S_CHAR *nNum_H, int num_atoms,
98
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
99
+ int MakeCtStringOld( AT_NUMB *LinearCT, int nLenCT, int bAddDelim,
100
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
101
+ int MakeCtString( AT_NUMB *LinearCT, int nLenCT, int bAddDelim,
102
+ S_CHAR *nNum_H, int num_atoms, /* both parameters are not used here */
103
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
104
+ int MakeTautString( AT_NUMB *LinearCT, int nLenCT, int bAddDelim,
105
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
106
+ int MakeEquString( AT_NUMB *LinearCT, int nLenCT, int bAddDelim,
107
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
108
+ int MakeIsoAtomString( INChI_IsotopicAtom *IsotopicAtom, int nNumberOfIsotopicAtoms,
109
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
110
+ int MakeIsoTautString( INChI_IsotopicTGroup *IsotopicTGroup, int nNumberOfIsotopicTGroups,
111
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
112
+ int MakeIsoHString( int num_iso_H[], char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
113
+ int MakeStereoString( AT_NUMB *at1, AT_NUMB *at2, S_CHAR *parity, int bAddDelim, int nLenCT,
114
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
115
+ int MakeCRVString( ORIG_INFO *OrigInfo, int nLenCT, int bAddDelim,
116
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
117
+ int MakeMult( int mult, const char *szTailingDelim, char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow);
118
+ int MakeDelim( const char *szTailingDelim, char *szLinearCT, int nLen_szLinearCT, int *bOverflow);
119
+ int MakeEqStr( const char *szTailingDelim, int mult, char *szLinearCT, int nLen_szLinearCT, int *bOverflow);
120
+ int MakeHString( int bAddDelim, S_CHAR *LinearCT, int nLenCT,
121
+ char *szLinearCT, int nLen_szLinearCT, int nCtMode, int *bOverflow );
122
+ AT_NUMB *GetDfsOrder4CT( AT_NUMB *LinearCT, int nLenCT, S_CHAR *nNum_H, int num_atoms, int nCtMode );
123
+
124
+ const char *EquString( int EquVal );
125
+
126
+
127
+ int str_HillFormula(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
128
+ int *bOverflow, int bOutType, int num_components, int bUseMulipliers);
129
+ int str_HillFormula2(INCHI_SORT *pINChISort /* non-taut */, INCHI_SORT *pINChISort2 /* taut */,
130
+ char *pStr, int nStrLen, int tot_len,
131
+ int *bOverflow, int bOutType, int num_components, int bUseMulipliers);
132
+ int str_Connections(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
133
+ int *bOverflow, int bOutType, int ATOM_MODE, int num_components, int bUseMulipliers);
134
+ int str_H_atoms(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
135
+ int *bOverflow, int bOutType, int ATOM_MODE, int TAUT_MODE,
136
+ int num_components, int bUseMulipliers);
137
+ int str_Charge2(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
138
+ int *bOverflow, int bOutType, int num_components,
139
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
140
+ int str_Sp2(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
141
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
142
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
143
+ int str_IsoSp2(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
144
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
145
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
146
+ int str_Sp3(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
147
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bRelRac,
148
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
149
+ int str_IsoSp3(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
150
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bRelRac,
151
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
152
+ int str_StereoAbsInv(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
153
+ int *bOverflow, int bOutType, int num_components);
154
+ int str_IsoStereoAbsInv(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
155
+ int *bOverflow, int bOutType, int num_components);
156
+ int str_IsoAtoms(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
157
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bAbcNumbers,
158
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
159
+ int str_FixedH_atoms(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
160
+ int *bOverflow, int bOutType, int ATOM_MODE, int num_components, int bUseMulipliers);
161
+
162
+ int str_AuxNumb(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
163
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
164
+ int bSecondNonTautPass, int bOmitRepetitions);
165
+ int str_AuxEqu(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
166
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
167
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
168
+ int str_AuxTgroupEqu(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
169
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bUseMulipliers);
170
+ int str_AuxIsoTgroupEqu(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
171
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bOmitRepetitions, int bUseMulipliers);
172
+ int str_AuxInvSp3(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
173
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
174
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
175
+ int str_AuxInvSp3Numb(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
176
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
177
+ int bSecondNonTautPass, int bOmitRepetitions);
178
+ int str_AuxIsoNumb(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
179
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
180
+ int bSecondNonTautPass, int bOmitRepetitions);
181
+ int str_AuxIsoEqu(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
182
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
183
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
184
+ int str_AuxInvIsoSp3(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
185
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
186
+ int bSecondNonTautPass, int bOmitRepetitions, int bUseMulipliers);
187
+ int str_AuxInvIsoSp3Numb(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2, char *pStr, int nStrLen, int tot_len,
188
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components,
189
+ int bSecondNonTautPass, int bOmitRepetitions);
190
+ int str_AuxChargeRadVal(INCHI_SORT *pINChISort, char *pStr, int nStrLen, int tot_len,
191
+ int *bOverflow, int bOutType, int TAUT_MODE, int num_components, int bUseMulipliers);
192
+ int bin_AuxTautTrans(INCHI_SORT *pINChISort, INCHI_SORT *pINChISort2,
193
+ AT_NUMB **pTrans_n, AT_NUMB **pTrans_s, int bOutType, int num_components);
194
+ int str_AuxTautTrans(AT_NUMB *nTrans_n, AT_NUMB *nTrans_s, char *pStr, int nStrLen, int tot_len,
195
+ int *bOverflow, int TAUT_MODE, int num_components);
196
+ int CompareTautNonIsoPartOfINChI( const INChI *i1, const INChI *i2 );
197
+
198
+ #ifndef INCHI_ALL_CPP
199
+ #ifdef __cplusplus
200
+ }
201
+ #endif
202
+ #endif
203
+
204
+
205
+ #endif /*__INCHIMAKE_H__*/