Skip to content

Commit 2bf6418

Browse files
committed
Added doxygen comments to mol_fmt.h
1 parent a3e9cdd commit 2bf6418

2 files changed

Lines changed: 133 additions & 54 deletions

File tree

INCHI-1-SRC/INCHI_BASE/src/mol_fmt.h

Lines changed: 119 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,38 @@
7676
#define MOL_FMT_ABSENT 0
7777

7878
/* configuration */
79-
#define MOL_FMT_QUERY MOL_FMT_ABSENT
80-
#define MOL_FMT_CPSS MOL_FMT_ABSENT
81-
#define MOL_FMT_REACT MOL_FMT_ABSENT
79+
#define MOL_FMT_QUERY MOL_FMT_ABSENT
80+
#define MOL_FMT_CPSS MOL_FMT_ABSENT
81+
#define MOL_FMT_REACT MOL_FMT_ABSENT
8282

83-
#define MOL_FMT_STRING_DATA 'S'
84-
#define MOL_FMT_CHAR_INT_DATA 'C'
83+
#define MOL_FMT_STRING_DATA 'S'
84+
#define MOL_FMT_CHAR_INT_DATA 'C'
8585
#define MOL_FMT_SHORT_INT_DATA 'N'
86-
#define MOL_FMT_LONG_INT_DATA 'L'
87-
#define MOL_FMT_DOUBLE_DATA 'D'
88-
#define MOL_FMT_FLOAT_DATA 'F'
89-
#define MOL_FMT_JUMP_TO_RIGHT 'J'
90-
#define MOL_FMT_INT_DATA 'I'
91-
92-
#define MOL_FMT_MAX_VALUE_LEN 32 /* max length of string containing a numerical value */
93-
94-
#define MOL_FMT_M_STY_NON 0 /**< None */
95-
#define MOL_FMT_M_STY_SRU 1 /**< Structure repeating unit */
96-
#define MOL_FMT_M_STY_MON 2 /**< Monomer */
97-
#define MOL_FMT_M_STY_COP 3 /**< Copolymer */
98-
#define MOL_FMT_M_STY_MOD 4 /**< Modification */
99-
#define MOL_FMT_M_STY_CRO 5 /**< Crosslink */
100-
#define MOL_FMT_M_STY_MER 6 /**< Mer type */
101-
102-
#define MOL_FMT_M_SST_NON 0 /**< None */
103-
#define MOL_FMT_M_SST_ALT 1 /**< Alternating */
104-
#define MOL_FMT_M_SST_RAN 2 /**< Random */
105-
#define MOL_FMT_M_SST_BLK 3 /**< Block */
106-
107-
#define MOL_FMT_M_CONN_NON 0
108-
#define MOL_FMT_M_CONN_HT 1
109-
#define MOL_FMT_M_CONN_HH 2
110-
#define MOL_FMT_M_CONN_EU 3
86+
#define MOL_FMT_LONG_INT_DATA 'L'
87+
#define MOL_FMT_DOUBLE_DATA 'D'
88+
#define MOL_FMT_FLOAT_DATA 'F'
89+
#define MOL_FMT_JUMP_TO_RIGHT 'J'
90+
#define MOL_FMT_INT_DATA 'I'
91+
92+
#define MOL_FMT_MAX_VALUE_LEN 32 /* max length of string containing a numerical value */
93+
94+
#define MOL_FMT_M_STY_NON 0 /**< None */
95+
#define MOL_FMT_M_STY_SRU 1 /**< Structure repeating unit */
96+
#define MOL_FMT_M_STY_MON 2 /**< Monomer */
97+
#define MOL_FMT_M_STY_COP 3 /**< Copolymer */
98+
#define MOL_FMT_M_STY_MOD 4 /**< Modification */
99+
#define MOL_FMT_M_STY_CRO 5 /**< Crosslink */
100+
#define MOL_FMT_M_STY_MER 6 /**< Mer type */
101+
102+
#define MOL_FMT_M_SST_NON 0 /**< None */
103+
#define MOL_FMT_M_SST_ALT 1 /**< Alternating */
104+
#define MOL_FMT_M_SST_RAN 2 /**< Random */
105+
#define MOL_FMT_M_SST_BLK 3 /**< Block */
106+
107+
#define MOL_FMT_M_CONN_NON 0
108+
#define MOL_FMT_M_CONN_HT 1
109+
#define MOL_FMT_M_CONN_HH 2
110+
#define MOL_FMT_M_CONN_EU 3
111111

112112
/* V3000 specific constants */
113113
#define MOL_FMT_V3000_STENON -1
@@ -151,9 +151,10 @@ typedef unsigned char U_CHAR;
151151

152152
/**
153153
* @brief NUM_LISTS - Dynamically growing array of numeric lists
154-
*
155-
* TODO: Provide a brief description of the purpose of this structure.
156-
*
154+
* @param lists Pointer to the array of integer lists.
155+
* @param allocated Amount of memory allocated.
156+
* @param used Amount of memory used.
157+
* @param increment Amount to increment when expanding.
157158
*/
158159
typedef struct A_NUM_LISTS
159160
{
@@ -167,22 +168,25 @@ typedef struct A_NUM_LISTS
167168
* @brief Allocates memory for a specified number of numeric lists.
168169
* @param num_lists Pointer to the NUM_LISTS structure.
169170
* @param nlists Number of lists to allocate.
170-
* @return 0 on success, -1 on failure.
171+
* @return 0 on success,
172+
* -1 on failure.
171173
*/
172174
int NumLists_Alloc(NUM_LISTS *num_lists, int nlists);
173175

174176
/**
175177
* @brief Reallocates memory for the numeric lists.
176178
* @param num_lists Pointer to the NUM_LISTS structure.
177-
* @return 0 on success, -1 on failure.
179+
* @return 0 on success,
180+
* -1 on failure.
178181
*/
179182
int NumLists_ReAlloc(NUM_LISTS *num_lists);
180183

181184
/**
182185
* @brief Push new item to the end of array.
183186
* @param num_lists Pointer to the NUM_LISTS structure.
184187
* @param list Pointer to the list of integers to append.
185-
* @return 0 on success, -1 on failure.
188+
* @return 0 on success,
189+
* -1 on failure.
186190
*/
187191
int NumLists_Append(NUM_LISTS *num_lists, int *list);
188192

@@ -212,15 +216,17 @@ typedef struct tagINT_ARRAY
212216
*
213217
* @param items Pointer to the INT_ARRAY structure to initialize.
214218
* @param nitems Initial number of items to allocate.
215-
* @return int 0 on success, -1 on failure.
219+
* @return 0 on success,
220+
* -1 on failure.
216221
*/
217222
int IntArray_Alloc(INT_ARRAY *items, int nitems);
218223

219224
/**
220225
* @brief Reallocates memory for the INT_ARRAY structure.
221226
*
222227
* @param items Pointer to the INT_ARRAY structure to reallocate.
223-
* @return int 0 on success, -1 on failure.
228+
* @return 0 on success,
229+
* -1 on failure.
224230
*/
225231
int IntArray_ReAlloc(INT_ARRAY *items);
226232

@@ -229,7 +235,8 @@ int IntArray_ReAlloc(INT_ARRAY *items);
229235
*
230236
* @param items Pointer to the INT_ARRAY structure to modify.
231237
* @param new_item The new item to append.
232-
* @return int 0 on success, -1 on failure.
238+
* @return 0 on success,
239+
* -1 on failure.
233240
*/
234241
int IntArray_Append(INT_ARRAY *items, int new_item);
235242

@@ -238,7 +245,8 @@ int IntArray_Append(INT_ARRAY *items, int new_item);
238245
*
239246
* @param items Pointer to the INT_ARRAY structure to modify.
240247
* @param new_item The new item to append.
241-
* @return int 0 on success, -1 on failure.
248+
* @return 0 on success,
249+
* -1 on failure.
242250
*/
243251
int IntArray_AppendIfAbsent(INT_ARRAY *items, int new_item);
244252

@@ -264,7 +272,7 @@ void IntArray_Free(INT_ARRAY *items);
264272
void IntArray_DebugPrint(INT_ARRAY *items);
265273

266274
/**
267-
* @brief
275+
* @brief Data structure for Sgroup data (substance group data).
268276
*
269277
* @param id it is what is called 'Sgroup number' in CTFile
270278
* @param type Sgroup type: SUP = superatom, MUL = multiple group, SRU = SRU type, MON = monomer, MER = Mer type, COP = copolymer, CRO = crosslink, MOD = modification, GRA = graft, COM = component, MIX = mixture, FOR = formulation, DAT = data Sgroup, ANY = any polymer, GEN = generic
@@ -293,6 +301,7 @@ typedef struct A_MOL_FMT_SGROUP
293301

294302
/**
295303
* @brief Allocate new array Sgroup.
304+
*
296305
* @param sgroup Pointer to the Sgroup structure to allocate.
297306
* @param id Sgroup ID.
298307
* @param type Sgroup type.
@@ -304,12 +313,14 @@ int MolFmtSgroup_Create(MOL_FMT_SGROUP **sgroup,
304313

305314
/**
306315
* @brief Frees the memory allocated for the Sgroup.
316+
*
307317
* @param sgroup Pointer to the Sgroup structure to free.
308318
*/
309319
void MolFmtSgroup_Free(MOL_FMT_SGROUP *sgroup);
310320

311321
/**
312-
* @brief MOL_FMT_SGROUPS is a dynamically growing array of pointers to MOL_FMT_SGROUP objects
322+
* @brief MOL_FMT_SGROUPS is a dynamically growing array of pointers to MOL_FMT_SGROUP objects.
323+
*
313324
* @param group Pointer to the growable array of pointers to MOL_FMT_SGROUPs
314325
* @param allocated Number of allocated objects
315326
* @param used Number of used objects
@@ -325,6 +336,7 @@ typedef struct A_MOL_FMT_SGROUPS
325336

326337
/**
327338
* @brief Allocates memory for a specified number of Sgroup objects.
339+
*
328340
* @param items Pointer to the MOL_FMT_SGROUPS structure.
329341
* @param nitems Number of Sgroup objects to allocate.
330342
* @return 0 on success, -1 on failure.
@@ -333,13 +345,15 @@ int MolFmtSgroups_Alloc(MOL_FMT_SGROUPS *items, int nitems);
333345

334346
/**
335347
* @brief Expand array of Sgroups.
348+
*
336349
* @param items Pointer to the MOL_FMT_SGROUPS structure.
337350
* @return 0 on success, -1 on failure.
338351
*/
339352
int MolFmtSgroups_ReAlloc(MOL_FMT_SGROUPS *items);
340353

341354
/**
342355
* @brief Appends a new Sgroup to the array.
356+
*
343357
* @param items Pointer to the MOL_FMT_SGROUPS structure.
344358
* @param id Sgroup ID.
345359
* @param type Sgroup type.
@@ -349,20 +363,23 @@ int MolFmtSgroups_Append(MOL_FMT_SGROUPS *items, int id, int type);
349363

350364
/**
351365
* @brief Frees the memory allocated for the MOL_FMT_SGROUPS list.
366+
*
352367
* @param items Pointer to the MOL_FMT_SGROUPS structure.
353368
*/
354369
void MolFmtSgroups_Free(MOL_FMT_SGROUPS *items);
355370

356371
/**
357372
* @brief Gets the index of a Sgroup by its ID.
373+
*
358374
* @param id Sgroup ID.
359375
* @param items Pointer to the MOL_FMT_SGROUPS structure.
360376
* @return Index of the Sgroup on success, -1 on failure.
361377
*/
362378
int MolFmtSgroups_GetIndexBySgroupId(int id, MOL_FMT_SGROUPS *items);
363379

364380
/**
365-
* @brief Data structure for MOL file header block (3 lines)
381+
* @brief Data structure for MOL file header block (3 lines).
382+
*
366383
* @param molname Name of molecule (up to 80 characters)
367384
* @param line2 Second line of the header (the whole line2, up to 80 chars)
368385
* @param user_initls User initials (2 bytes; char)
@@ -399,7 +416,8 @@ typedef struct A_MOL_FMT_HEADER_BLOCK
399416
} MOL_FMT_HEADER_BLOCK;
400417

401418
/**
402-
* @brief Atom representation in the MOL format.
419+
* @brief Data structure for atom representation in the MOL format.
420+
*
403421
* @param fx x coordinate: F10.5; Generic
404422
* @param fy y coordinate: F10.5; Generic
405423
* @param fz z coordinate: F10.5; Generic
@@ -475,8 +493,14 @@ typedef struct A_MOL_FMT_ATOM
475493
} MOL_FMT_ATOM;
476494

477495
/**
478-
* @brief Bond representation in the MOL format.
496+
* @brief Data structure for bond representation in the MOL format.
479497
*
498+
* @param atnum1 First atom number.
499+
* @param atnum2 Second atom number.
500+
* @param bond_type Type of bond (single, double, triple, etc.).
501+
* @param bond_stereo Stereo information for the bond.
502+
* @param bond_topology Topology information for the bond.
503+
* @param react_center_status Reaction center status information.
480504
*/
481505
typedef struct A_MOL_FMT_BOND
482506
{
@@ -521,6 +545,27 @@ typedef struct A_MOL_FMT_BOND
521545
#endif
522546
} MOL_FMT_BOND;
523547

548+
549+
/**
550+
* @brief Data structure for V3000 representation in the MOL format.
551+
*
552+
* @param n_non_star_atoms Number of non-star atoms.
553+
* @param n_star_atoms Number of star atoms.
554+
* @param atom_index_orig Original atom indices as supplied.
555+
* @param atom_index_fin Final atom indices, with -1 for star atoms.
556+
* @param n_sgroups Number of S-groups.
557+
* @param n_3d_constraints Number of 3D constraints.
558+
* @param n_collections Number of collections.
559+
* @param n_non_haptic_bonds Number of non-haptic bonds.
560+
* @param n_haptic_bonds Number of haptic bonds.
561+
* @param haptic_bonds Pointer to the list of haptic bonds.
562+
* @param n_steabs Number of absolute stereo groups.
563+
* @param steabs Pointer to the list of absolute stereo groups (e.g. R and S).
564+
* @param n_sterel Number of relative stereo groups.
565+
* @param sterel Pointer to the list of relative stereo groups (OR - describes the orientation of groups relative to each other, such as in cis- and trans-isomers).
566+
* @param n_sterac Number of racemic stereo groups.
567+
* @param sterac Pointer to the list of racemic stereo groups (AND - equal 50:50 mixture of two enantiomers of a chiral molecule).
568+
*/
524569
typedef struct A_MOL_FMT_v3000
525570
{
526571
int n_non_star_atoms;
@@ -551,8 +596,25 @@ typedef struct A_MOL_FMT_v3000
551596
} MOL_FMT_v3000;
552597

553598
/**
554-
* @brief Connection table data structure
555-
*
599+
* @brief Connection table data structure.
600+
*
601+
* @param n_atoms Number of atoms in the molecule.
602+
* @param n_bonds Number of bonds in the molecule.
603+
* @param n_atom_lists Number of atom lists.
604+
* @param chiral_flag Chiral flag indicating the presence of chiral centers.
605+
* @param n_stext_entries Number of stereo text entries.
606+
* @param n_reaction_components_plus_1 Number of reaction components.
607+
* @param n_reactants Number of reactants.
608+
* @param n_products Number of products.
609+
* @param n_intermediates Number of intermediates.
610+
* @param n_property_lines Number of property lines.
611+
* @param follow_inchi_1_treating_iso_mass Flag indicating whether to follow InChI-1 treating isotopic mass.
612+
* @param version_string Version string indicating the format version.
613+
* @param atoms Pointer to the array of atom block data structure.
614+
* @param bonds Pointer to the array of bond block data structure.
615+
* @param coords Pointer to the array of coordinate data structure.
616+
* @param sgroups Growable array of pointers to Sgroup objects.
617+
* @param v3000 Pointer to the V3000 specific data structure.
556618
*/
557619
typedef struct A_MOL_FMT_CTAB
558620
{
@@ -581,6 +643,12 @@ typedef struct A_MOL_FMT_CTAB
581643
MOL_FMT_v3000 *v3000;
582644
} MOL_FMT_CTAB;
583645

646+
/**
647+
* @brief Data structure for a MOL file
648+
*
649+
* @param hdr Header block data structure.
650+
* @param ctab Connection table data structure.
651+
*/
584652
typedef struct A_MOL_FMT_DATA
585653
{
586654
MOL_FMT_HEADER_BLOCK hdr;
@@ -592,8 +660,8 @@ typedef struct A_MOL_FMT_DATA
592660
*/
593661

594662
/**
595-
* @brief
596-
*
663+
* @brief Read MOL file data in to data structures.
664+
*
597665
* @param inp_file Pointer to the input file stream.
598666
* @param OnlyHeaderBlock Pointer to the header block to read.
599667
* @param OnlyCTab Pointer to the connection table to read.
@@ -640,7 +708,7 @@ int MolfileStrnread(char *dest,
640708
char **first_space);
641709

642710
/**
643-
* @brief Extract the 'data' in the mol file field at given text position 'line_ptr'.
711+
* @brief Extract the 'data' in the MOL file field at given text position 'line_ptr'.
644712
*
645713
* @param data Pointer to the destination buffer.
646714
* @param field_len Length of the field to read. For MOL_FMT_STRING_DATA does not include
@@ -660,7 +728,7 @@ int MolfileReadField(void *data,
660728
int data_type,
661729
char **line_ptr);
662730
/**
663-
* @brief Extract molfile number from the header name line like "Structure #22"
731+
* @brief Extract the MOL file number from the header name line like "Structure #22"
664732
*
665733
* @param pHdr Pointer to the header block.
666734
* @return The structure number.

0 commit comments

Comments
 (0)