Skip to content

Commit d1e0f27

Browse files
committed
fix link error
PrintFileName and SplitTime are compiled in the library only when TARGET_API_LIB is not defined, which is always defined in the cmake build. Apprently, those two symbols and DetectInputINChIFileType are only used in the inchi-1 executable, so they were moved in ichimain.c
1 parent 8afe6e7 commit d1e0f27

File tree

6 files changed

+274
-304
lines changed

6 files changed

+274
-304
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ void EditINCHI_HidePolymerZz( INCHI_IOSTREAM *out, int n_pzz, int n_zy );
587587
/* MISCELLANEOUS */
588588

589589

590-
void SplitTime( unsigned long ulTotalTime, int *hours, int *minutes, int *seconds, int *mseconds );
591590
void set_line_separators( int bINChIOutputOptions, char **pLF, char **pTAB );
592591
void save_command_line( int argc, char *argv[], INCHI_IOSTREAM *plog );
593592
void emit_empty_inchi( INPUT_PARMS *ip, long num_inp,

INCHI-1-SRC/INCHI_BASE/src/ichiparm.c

Lines changed: 0 additions & 257 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383
REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
8484

8585

86-
int DetectInputINChIFileType(FILE** inp_file, INPUT_PARMS* ip, const char* fmode);
87-
8886
int set_common_options_by_parg(const char* pArg,
8987
int developer_options,
9088
INPUT_PARMS* ip,
@@ -2872,258 +2870,3 @@ void HelpCommandLineParms(INCHI_IOSTREAM* f)
28722870

28732871
#endif
28742872
}
2875-
2876-
#define fprintf2 inchi_fprintf
2877-
2878-
#ifndef TARGET_API_LIB
2879-
/****************************************************************************/
2880-
int OpenFiles(FILE** inp_file,
2881-
FILE** out_file,
2882-
FILE** log_file,
2883-
FILE** prb_file,
2884-
INPUT_PARMS* ip)
2885-
{
2886-
/*
2887-
-- Files --
2888-
ip->path[0] => Input
2889-
ip->path[1] => Output (INChI)
2890-
ip->path[2] => Log
2891-
ip->path[3] => Problem structures
2892-
ip->path[4] => Errors file (ACD Labs)
2893-
2894-
*/
2895-
2896-
/* Logfile (open as early as possible) */
2897-
if (!ip->path[2] || !ip->path[2][0])
2898-
{
2899-
fprintf2(stderr, "%s %-s\n%-s Build (%-s%-s) of %s %s %-s\n\n",
2900-
APP_DESCRIPTION, INCHI_SRC_REV,
2901-
INCHI_BUILD_PLATFORM, INCHI_BUILD_COMPILER, INCHI_BUILD_DEBUG, __DATE__, __TIME__,
2902-
RELEASE_IS_FINAL ? "" : " *** pre-release, for evaluation only ***");
2903-
fprintf2(stderr, "Log file not specified. Using standard error output.\n");
2904-
*log_file = stderr;
2905-
}
2906-
else if (!(*log_file = fopen(ip->path[2], "w")))
2907-
{
2908-
fprintf2(stderr, "%s %-s\n%-s Build (%-s%-s) of %s %s%-s\n\n",
2909-
APP_DESCRIPTION, INCHI_SRC_REV,
2910-
INCHI_BUILD_PLATFORM, INCHI_BUILD_COMPILER, INCHI_BUILD_DEBUG, __DATE__, __TIME__,
2911-
RELEASE_IS_FINAL ? "" : " *** pre-release, for evaluation only ***");
2912-
fprintf2(stderr, "Cannot open log file '%s'. Using standard error output.\n", ip->path[2]);
2913-
*log_file = stderr;
2914-
}
2915-
else
2916-
{
2917-
fprintf2(*log_file, "%s %-s\n%-s Build (%-s%-s) of %s %s%-s\n\n",
2918-
APP_DESCRIPTION, INCHI_SRC_REV,
2919-
INCHI_BUILD_PLATFORM, INCHI_BUILD_COMPILER, INCHI_BUILD_DEBUG, __DATE__, __TIME__,
2920-
RELEASE_IS_FINAL ? "" : " *** pre-release, for evaluation only ***");
2921-
fprintf2(*log_file, "Opened log file '%s'\n", ip->path[2]);
2922-
}
2923-
2924-
/* Input file */
2925-
if ((ip->nInputType == INPUT_MOLFILE || ip->nInputType == INPUT_SDFILE ||
2926-
ip->nInputType == INPUT_INCHI || ip->nInputType == INPUT_INCHI_PLAIN)
2927-
&&
2928-
ip->num_paths > 0)
2929-
{
2930-
const char* fmode = NULL;
2931-
2932-
#if ( defined(_MSC_VER)&&defined(_WIN32) || defined(__BORLANDC__)&&defined(__WIN32__) || defined(__GNUC__)&&defined(__MINGW32__)&&defined(_WIN32) )
2933-
/* compilers that definitely allow fopen "rb" (binary read) mode */
2934-
fmode = "rb";
2935-
if (!ip->path[0] || !ip->path[0][0] || !(*inp_file = fopen(ip->path[0], "rb")))
2936-
{
2937-
fprintf2(*log_file, "Cannot open input file '%s'. Terminating.\n", ip->path[0] ? ip->path[0] : "<No name>");
2938-
goto exit_function;
2939-
}
2940-
else
2941-
{
2942-
fprintf2(*log_file, "Opened input file '%s'\n", ip->path[0]);
2943-
}
2944-
2945-
#else
2946-
2947-
if (!ip->path[0] || !ip->path[0][0] || !(*inp_file = fopen(ip->path[0], "r")))
2948-
{
2949-
fprintf2(*log_file, "Cannot open input file '%s'. Terminating.\n", ip->path[0] ? ip->path[0] : "<No Name>");
2950-
goto exit_function;
2951-
}
2952-
else
2953-
{
2954-
fprintf2(*log_file, "Opened input file '%s'\n", ip->path[0]);
2955-
}
2956-
fmode = "r";
2957-
#endif /* ( defined(_MSC_VER)&&defined(_WIN32) || defined(__BORLANDC__)&&defined(__WIN32__) || defined(__GNUC__)&&defined(__MINGW32__)&&defined(_WIN32) ) */
2958-
2959-
DetectInputINChIFileType(inp_file, ip, fmode);
2960-
}
2961-
2962-
else if ((ip->nInputType != INPUT_MOLFILE &&
2963-
ip->nInputType != INPUT_SDFILE &&
2964-
ip->nInputType != INPUT_INCHI &&
2965-
/* post-1.02b */
2966-
ip->nInputType != INPUT_INCHI_PLAIN))
2967-
{
2968-
fprintf2(*log_file, "Input file type not specified. Terminating.\n");
2969-
goto exit_function;
2970-
}
2971-
else
2972-
{
2973-
fprintf2(*log_file, "Input file not specified. Using standard input.\n");
2974-
*inp_file = stdin;
2975-
}
2976-
2977-
/* Output file */
2978-
if (!ip->path[1] || !ip->path[1][0])
2979-
{
2980-
fprintf2(*log_file, "Output file not specified. Using standard output.\n");
2981-
*out_file = stdout;
2982-
}
2983-
else
2984-
{
2985-
if (!(*out_file = fopen(ip->path[1], "w")))
2986-
{
2987-
fprintf2(*log_file, "Cannot open output file '%s'. Terminating.\n", ip->path[1]);
2988-
goto exit_function;
2989-
}
2990-
else
2991-
{
2992-
fprintf2(*log_file, "Opened output file '%s'\n", ip->path[1]);
2993-
if ((ip->bINChIOutputOptions & (INCHI_OUT_PLAIN_TEXT)) &&
2994-
*inp_file != stdin &&
2995-
!(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY) &&
2996-
!ip->bNoStructLabels &&
2997-
!(ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT))
2998-
{
2999-
PrintFileName("* Input_File: \"%s\"\n", *out_file, ip->path[0]);
3000-
}
3001-
}
3002-
}
3003-
3004-
/* Problem file */
3005-
if (ip->path[3] && ip->path[3][0])
3006-
{
3007-
const char* fmode = "w";
3008-
3009-
#if ( defined(_MSC_VER)&&defined(_WIN32) || defined(__BORLANDC__)&&defined(__WIN32__) || defined(__GNUC__)&&defined(__MINGW32__)&&defined(_WIN32) )
3010-
fmode = "wb";
3011-
#endif
3012-
3013-
if (!(*prb_file = fopen(ip->path[3], fmode)))
3014-
{
3015-
fprintf2(*log_file, "Cannot open problem file '%s'. Terminating.\n", ip->path[3]);
3016-
goto exit_function;
3017-
}
3018-
else
3019-
{
3020-
fprintf2(*log_file, "Opened problem file '%s'\n", ip->path[3]);
3021-
}
3022-
}
3023-
3024-
/* Success */
3025-
return 1;
3026-
3027-
exit_function:
3028-
3029-
/* Failed */
3030-
return 0;
3031-
}
3032-
3033-
3034-
#define NUM_VERSIONS 7
3035-
#define LEN_VERSIONS 64
3036-
3037-
3038-
static int bMatchOnePrefix(int len, char* str, int lenPrefix[],
3039-
char strPrefix[][LEN_VERSIONS], int numPrefix);
3040-
3041-
3042-
/****************************************************************************/
3043-
static int bMatchOnePrefix(int len, char* str,
3044-
int lenPrefix[],
3045-
char strPrefix[][LEN_VERSIONS],
3046-
int numPrefix)
3047-
{
3048-
int i;
3049-
for (i = 0; i < numPrefix; i++)
3050-
{
3051-
if (len >= lenPrefix[i] &&
3052-
!memcmp(str, strPrefix[i], lenPrefix[i]))
3053-
{
3054-
return 1;
3055-
}
3056-
}
3057-
3058-
return 0;
3059-
}
3060-
3061-
/****************************************************************************/
3062-
int DetectInputINChIFileType(FILE** inp_file,
3063-
INPUT_PARMS* ip,
3064-
const char* fmode)
3065-
{
3066-
char szLine[256], ret = 0;
3067-
static char szPlnVersion[NUM_VERSIONS][LEN_VERSIONS]; /* = "INChI:1.1Beta/";*/
3068-
static int lenPlnVersion[NUM_VERSIONS];
3069-
static char szPlnAuxVer[NUM_VERSIONS][LEN_VERSIONS]; /* = "AuxInfo:1.1Beta/";*/
3070-
static int lenPlnAuxVer[NUM_VERSIONS];
3071-
static int bInitialized = 0;
3072-
int bINChI_plain = 0, len, i;
3073-
3074-
3075-
if (ip->nInputType == INPUT_INCHI_PLAIN || ip->nInputType == INPUT_INCHI)
3076-
{
3077-
return 1;
3078-
}
3079-
3080-
if (!bInitialized)
3081-
{
3082-
lenPlnVersion[0] = sprintf(szPlnVersion[0], "%s=%s/", INCHI_NAME, INCHI_VERSION);
3083-
lenPlnVersion[1] = sprintf(szPlnVersion[1], "INChI=1.12Beta/");
3084-
lenPlnVersion[2] = sprintf(szPlnVersion[2], "INChI=1.0RC/");
3085-
lenPlnVersion[3] = sprintf(szPlnVersion[3], "InChI=1.0RC/");
3086-
lenPlnVersion[4] = sprintf(szPlnVersion[4], "InChI=1/");
3087-
lenPlnVersion[5] = sprintf(szPlnVersion[5], "MoChI=1a/");
3088-
lenPlnVersion[6] = sprintf(szPlnVersion[6], "InChI=1S/");
3089-
lenPlnAuxVer[0] = sprintf(szPlnAuxVer[0], "AuxInfo=%s/", INCHI_VERSION);
3090-
lenPlnAuxVer[1] = sprintf(szPlnAuxVer[1], "AuxInfo=1.12Beta/");
3091-
lenPlnAuxVer[2] = sprintf(szPlnAuxVer[2], "AuxInfo=1.0RC/");
3092-
lenPlnAuxVer[3] = sprintf(szPlnAuxVer[3], "AuxInfo=1.0RC/");
3093-
lenPlnAuxVer[4] = sprintf(szPlnAuxVer[4], "AuxInfo=1/");
3094-
lenPlnAuxVer[5] = sprintf(szPlnAuxVer[5], "AuxInfo=1a/");
3095-
lenPlnAuxVer[6] = sprintf(szPlnAuxVer[6], "AuxInfo=1/");
3096-
#if ( FIX_DALKE_BUGS == 1 )
3097-
bInitialized = 1;
3098-
#endif
3099-
}
3100-
3101-
for (i = 0; i < 4; i++)
3102-
{
3103-
len = inchi_fgetsLfTab(szLine, sizeof(szLine) - 1, *inp_file);
3104-
if (len < 0)
3105-
{
3106-
break;
3107-
}
3108-
if (bMatchOnePrefix(len, szLine, lenPlnVersion, szPlnVersion, NUM_VERSIONS) ||
3109-
bMatchOnePrefix(len, szLine, lenPlnAuxVer, szPlnAuxVer, NUM_VERSIONS))
3110-
{
3111-
bINChI_plain++;
3112-
}
3113-
}
3114-
3115-
if (bINChI_plain >= 2)
3116-
{
3117-
ip->nInputType = INPUT_INCHI_PLAIN;
3118-
ret = 1;
3119-
}
3120-
3121-
fclose(*inp_file);
3122-
*inp_file = fopen(ip->path[0], fmode);
3123-
3124-
return ret;
3125-
}
3126-
#undef NUM_VERSIONS
3127-
#undef LEN_VERSIONS
3128-
3129-
#endif /* TARGET_API_LIB */

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,11 +803,6 @@ int DisplayInputStructure( char *szOutputString,
803803
DRAW_PARMS *dp );
804804
#endif
805805

806-
807-
void PrintFileName( const char *fmt,
808-
FILE *out_file,
809-
const char *szFname );
810-
811806
void MySleep( unsigned long ms );
812807

813808
int ReconcileAllCmlBondParities( inp_ATOM *at,

INCHI-1-SRC/INCHI_BASE/src/runichi4.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,26 +1245,6 @@ int DisplayStructure( struct tagCANON_GLOBALS *pCG,
12451245
#endif /* }COMPILE_ANSI_ONLY */
12461246

12471247

1248-
#ifndef TARGET_API_LIB
1249-
1250-
1251-
/****************************************************************************/
1252-
void SplitTime( unsigned long ulTotalTime,
1253-
int *hours, int *minutes,
1254-
int *seconds, int *mseconds )
1255-
{
1256-
1257-
*mseconds = (int) ( ulTotalTime % 1000 );
1258-
ulTotalTime /= 1000;
1259-
*seconds = (int) ( ulTotalTime % 60 );
1260-
ulTotalTime /= 60;
1261-
*minutes = (int) ( ulTotalTime % 60 );
1262-
ulTotalTime /= 60;
1263-
*hours = (int) ( ulTotalTime );
1264-
}
1265-
#endif
1266-
1267-
12681248
/****************************************************************************
12691249
Check if structure is chiral
12701250
****************************************************************************/

INCHI-1-SRC/INCHI_BASE/src/strutil.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5595,23 +5595,3 @@ int FixAdjacentRadicals( int num_inp_atoms, inp_ATOM *at )
55955595
}
55965596

55975597
#endif
5598-
5599-
#ifdef COMPILE_ANSI_ONLY
5600-
5601-
#ifndef TARGET_API_LIB
5602-
/*
5603-
#include <stdio.h>
5604-
#include "inpdef.h"
5605-
*/
5606-
5607-
/****************************************************************************/
5608-
void PrintFileName( const char *fmt,
5609-
FILE *out_file,
5610-
/* INCHI_IOSTREAM *out_file, */
5611-
const char *szFname )
5612-
{
5613-
inchi_print_nodisplay( out_file, fmt, szFname );
5614-
}
5615-
#endif
5616-
5617-
#endif

0 commit comments

Comments
 (0)