Skip to content

Commit b140af1

Browse files
committed
Completed doxygen for mol_fmt.h
1 parent f2cd429 commit b140af1

File tree

1 file changed

+150
-2
lines changed

1 file changed

+150
-2
lines changed

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

Lines changed: 150 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,50 +853,179 @@ int MolfileV3000ReadBondsBlock(MOL_FMT_CTAB *ctab,
853853
INCHI_IOSTREAM *inp_file,
854854
int err,
855855
char *pStrErr);
856+
857+
/**
858+
* @brief Read V3000 tail (haptic bonds, stereo collections, Sgroups, 3D constraints, collections, end line) in to the MOL file data structure from input file stream.
859+
*
860+
* @param ctab Pointer to the connection table data structure.
861+
* @param inp_file Pointer to the input file stream.
862+
* @param err Error code.
863+
* @param pStrErr Pointer to the error string buffer.
864+
* @return 0: Success (no error encountered, tail of CTAB read correctly)
865+
* 1: Error (e.g., missing "END CTAB" marker, or other parsing errors)
866+
* 7: Error in reading or interpreting V3000 collection lines
867+
* 71, 77, etc.: Error codes from sub-blocks (e.g., SGroup, 3DBlock, Collection) plus 70, indicating which sub-block failed
868+
* Other positive values: Error codes from called functions (e.g., MolfileV3000ReadSGroup, MolfileV3000Read3DBlock, MolfileV3000ReadCollections) plus 70
869+
* Negative values: If an end-of-data marker ($$$$) is encountered during an error, the error code may be returned as a negative value (e.g., -1, -7, -71, etc.)
870+
*/
856871
int MolfileV3000ReadTailOfCTAB(MOL_FMT_CTAB *ctab,
857872
INCHI_IOSTREAM *inp_file,
858873
int err,
859874
char *pStrErr);
875+
876+
/**
877+
* @brief Read V3000 haptic bond information from the input line.
878+
*
879+
* @param ctab Pointer to the connection table data structure.
880+
* @param line_ptr Pointer to the line buffer.
881+
* @param num_list Pointer to the list of numbers.
882+
* @param pStrErr Pointer to the error string buffer.
883+
* @return Positive integer (nread > 0): Success; number of bytes/fields read from the haptic bond block.
884+
* 0: No data read (rare, usually means nothing was parsed).
885+
* -1: Error; parsing failed at any step (missing '(', invalid count, allocation failure, field read error, missing "ATTACH=ALL", etc.).
886+
*/
860887
int MolfileV3000ReadHapticBond(MOL_FMT_CTAB *ctab,
861888
char **line_ptr,
862889
int **num_list,
863890
char *pStrErr);
891+
892+
/**
893+
* @brief Read V3000 stereo collection information from the input line.
894+
*
895+
* @param ctab Pointer to the connection table data structure.
896+
* @param line_ptr Pointer to the line buffer.
897+
* @param num_list Pointer to the list of numbers.
898+
* @param pStrErr Pointer to the error string buffer.
899+
* @return Positive integer (nread > 0): Success; number of bytes/fields read from the stereo collection block.
900+
* 0: No data read (rare, usually means nothing was parsed).
901+
* -1: Error; parsing failed at any step (missing '(', invalid count, allocation failure, field read error, missing "ATTACH=ALL", etc.).
902+
*/
864903
int MolfileV3000ReadStereoCollection(MOL_FMT_CTAB *ctab,
865904
char **line_ptr,
866905
int **num_list,
867906
char *pStrErr);
907+
908+
/**
909+
* @brief Read V3000 Sgroup information from the input file stream into the MOL file data structure.
910+
*
911+
* @param ctab Pointer to the connection table data structure.
912+
* @param inp_file Pointer to the input file stream.
913+
* @param err Error code.
914+
* @param pStrErr Pointer to the error string buffer.
915+
* @return 0: Success (no error encountered, SGroup read correctly)
916+
* 1: Error (e.g., missing "END SGROUP" marker, or other parsing errors)
917+
*/
868918
int MolfileV3000ReadSGroup(MOL_FMT_CTAB *ctab,
869919
INCHI_IOSTREAM *inp_file,
870920
int err,
871921
char *pStrErr);
922+
923+
/**
924+
* @brief Read V3000 3D constraints block in MOL file data structure from input file stream.
925+
*
926+
* @param ctab Pointer to the connection table data structure.
927+
* @param inp_file Pointer to the input file stream.
928+
* @param err Error code.
929+
* @param pStrErr Pointer to the error string buffer.
930+
* @return 0: Success (no error encountered, 3D block read correctly)
931+
* 1: Error (e.g., missing "END 3D" marker, or other parsing errors)
932+
*/
872933
int MolfileV3000Read3DBlock(MOL_FMT_CTAB *ctab,
873934
INCHI_IOSTREAM *inp_file,
874935
int err,
875936
char *pStrErr);
937+
938+
/**
939+
* @brief Read V3000 collections block in MOL file data structure from input file stream.
940+
*
941+
* @param ctab Pointer to the connection table data structure.
942+
* @param inp_file Pointer to the input file stream.
943+
* @param err Error code.
944+
* @param pStrErr Pointer to the error string buffer.
945+
* @return 0: Success (collections block read and parsed correctly)
946+
* 7: Error in reading or interpreting V3000 collection lines (parsing failure, unexpected format, missing required fields, etc.)
947+
*/
876948
int MolfileV3000ReadCollections(MOL_FMT_CTAB *ctab,
877949
INCHI_IOSTREAM *inp_file,
878950
int err,
879951
char *pStrErr);
880952
/* Clean V3000 stuff */
953+
954+
/**
955+
* @brief Free memory allocated for V3000 specific data in the MOL file data structure.
956+
*
957+
* @param v3000 Pointer to the V3000 specific data structure to free.
958+
* @return 0.
959+
*/
881960
int DeleteMolfileV3000Info(MOL_FMT_v3000 *v3000);
882961

962+
/**
963+
* @brief Read a line from the input file stream, handling V3000 line continuations: Extended version of inchi_fgetsLf which is able of reading
964+
* concatenated lines (ending with '-') of V3000 Molfile. Also removes "M V30 " prefix" and normalizes the rest of string.
965+
*
966+
* @param line Pointer to the buffer to store the read line.
967+
* @param inp_stream Pointer to the input file stream.
968+
* @return Pointer to the read line, or NULL on end of file or error.
969+
*/
883970
char *inchi_fgetsLf_V3000(char *line,
884971
INCHI_IOSTREAM *inp_stream);
972+
973+
/**
974+
* @brief Get a V3000 input line and store it in a string buffer.
975+
*
976+
* @param buf Pointer to the string buffer to store the line.
977+
* @param inp_stream Pointer to the input file stream.
978+
* @return Length of buffer stored on success, -1 on failure.
979+
*/
885980
int get_V3000_input_line_to_strbuf(INCHI_IOS_STRING *buf,
886981
INCHI_IOSTREAM *inp_stream);
887982

888-
/* Extract the 'data' in specified mol file field at given text position 'line_ptr' */
983+
/**
984+
* @brief Extract the 'data' in specified mol file field at given text position 'line_ptr'
985+
*
986+
* @param data Pointer to the destination buffer.
987+
* @param data_type Type of the data to read. E.g. MOL_FMT_STRING_DATA, MOL_FMT_CHAR_INT_DATA, etc.
988+
* @param line_ptr Pointer to the line buffer.
989+
* @return for MOL_FMT_STRING_DATA: number of bytes excluding trailing zero
990+
* for all others: 1=success; 0 = empty
991+
*/
889992
int MolfileV3000ReadField(void *data,
890993
int data_type,
891994
char **line_ptr);
892-
/* Read keyword */
995+
/**
996+
* @brief Read keyword from the specified line.
997+
*
998+
* @param key Pointer to the buffer to store the keyword.
999+
* @param line_ptr Pointer to the line buffer.
1000+
* @return Length of the keyword on success, -1 on failure.
1001+
*/
8931002
int MolfileV3000ReadKeyword(char *key,
8941003
char **line_ptr);
8951004

8961005
/*
8971006
SDF
8981007
*/
8991008

1009+
/**
1010+
* @brief Skip extra data in SDF file after the MOL file data.
1011+
*
1012+
* @param inp_file Pointer to the input file stream.
1013+
* @param CAS_num Pointer to the variable to store the CAS number.
1014+
* @param comment Pointer to the buffer to store the comment.
1015+
* @param lcomment Length of the comment buffer.
1016+
* @param name Pointer to the buffer to store the name.
1017+
* @param lname Length of the name buffer.
1018+
* @param prev_err Previous error code.
1019+
* @param pSdfLabel Pointer to the SDF label buffer.
1020+
* @param pSdfValue Pointer to the SDF value buffer.
1021+
* @param pStrErr Pointer to the error string buffer.
1022+
* @param bNoWarnings Flag indicating whether to suppress warnings.
1023+
* @return 0: Success; extra SDF data was skipped without errors.
1024+
* 3: Unexpected SData header line (unexpected contents or format).
1025+
* 5: Only blank lines encountered (all lines empty).
1026+
* 9: Error occurred, but successfully bypassed to the next structure ($$$$ marker found); non-fatal, warning issued.
1027+
* Other values: The function may propagate the value of prev_err if set before entering the loop.
1028+
*/
9001029
int SDFileSkipExtraData(INCHI_IOSTREAM *inp_file,
9011030
unsigned long *CAS_num,
9021031
char *comment,
@@ -908,7 +1037,26 @@ int SDFileSkipExtraData(INCHI_IOSTREAM *inp_file,
9081037
char *pSdfValue,
9091038
char *pStrErr,
9101039
int bNoWarnings);
1040+
1041+
/**
1042+
* @brief Identify if the given line matches the specified SDF label.
1043+
*
1044+
* @param inp_line Pointer to the input line.
1045+
* @param pSdfLabel Pointer to the SDF label to match.
1046+
* @return SDF_DATA_HEADER_USER: The label matches the user-specified label (pSdfLabel).
1047+
* SDF_DATA_HEADER_NAME: The label is "NAME".
1048+
* SDF_DATA_HEADER_COMMENT: The label is "COMMENT".
1049+
* SDF_DATA_HEADER_CAS: The label is "CAS".
1050+
* SDF_DATA_HEADER: The label does not match any of the above (default case).
1051+
*/
9111052
int SDFileIdentifyLabel(char *inp_line, const char *pSdfLabel);
1053+
1054+
/**
1055+
* @brief Extract CAS number from the given line.
1056+
*
1057+
* @param line Pointer to the line containing the CAS number.
1058+
* @return The extracted CAS number, or 0 if not found or invalid.
1059+
*/
9121060
unsigned long SDFileExtractCASNo(char *line);
9131061

9141062
#endif /* _MOL_FMT_H_ */

0 commit comments

Comments
 (0)