diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile index 8708a4dc..c403e027 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile @@ -154,9 +154,11 @@ $(P_BASE)/runichi4.c \ $(P_BASE)/sha2.c \ $(P_BASE)/strutil.c \ $(P_BASE)/util.c \ +$(P_BASE)/permutation_util.c \ $(P_MAIN)/dispstru.c \ $(P_BASE)/mol2atom.c \ $(P_MAIN)/ichimain.c \ +$(P_MAIN)/inchi_main_cli.c \ $(P_BASE)/bcf_s.c # INCHI_OBJS = ichi_bns.o \ @@ -205,7 +207,9 @@ sha2.o \ strutil.o \ util.o \ dispstru.o \ +permutation_util.o \ ichimain.o \ +inchi_main_cli.o \ bcf_s.o $(INCHI_EXECUTABLE_PATHNAME) : $(INCHI_OBJS) $(LINKER) $(LINKER_OPTIONS) -o $(INCHI_EXECUTABLE_PATHNAME) $(INCHI_OBJS) -lm diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 index 53d13fb7..70ea893f 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 @@ -148,9 +148,11 @@ $(P_BASE)/runichi4.c \ $(P_BASE)/sha2.c \ $(P_BASE)/strutil.c \ $(P_BASE)/util.c \ +$(P_BASE)/permutation_util.c \ $(P_MAIN)/dispstru.c \ $(P_BASE)/mol2atom.c \ $(P_MAIN)/ichimain.c \ +$(P_MAIN)/inchi_main_cli.c \ $(P_BASE)/bcf_s.c # INCHI_OBJS = ichi_bns.o \ @@ -199,8 +201,10 @@ sha2.o \ strutil.o \ util.o \ dispstru.o \ -ichimain.o \ -bcf_s.o +permutation_util.o \ +ichimain.o \ +inchi_main_cli.o \ +bcf_s.o $(INCHI_EXECUTABLE_PATHNAME) : $(INCHI_OBJS) $(LINKER) $(LINKER_OPTIONS) -o $(INCHI_EXECUTABLE_PATHNAME) $(INCHI_OBJS) -lm %.o: $(P_BASE)/%.c diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt index 8b83d19d..4bd91e3c 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt @@ -25,10 +25,10 @@ include_directories(${P_BASE} ${P_CURRENT}) add_executable(inchi-1) target_sources(inchi-1 PRIVATE - main.c - ${P_BASE}/ichimain.c - ${P_BASE}/dispstru.c - ${P_BASE}/dispstru.h + inchi_main_cli.c + ichimain.c + dispstru.c + dispstru.h ${P_BASE}/bcf_s.h ${P_BASE}/bcf_s.c ${P_BASE}/extr_ct.h diff --git a/INCHI-1-SRC/INCHI_BASE/src/dispstru.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/dispstru.c similarity index 99% rename from INCHI-1-SRC/INCHI_BASE/src/dispstru.c rename to INCHI-1-SRC/INCHI_EXE/inchi-1/src/dispstru.c index f5bff79f..8537bda5 100644 --- a/INCHI-1-SRC/INCHI_BASE/src/dispstru.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/dispstru.c @@ -40,7 +40,7 @@ /* Draw input atom -- Win32 specific */ -#include "mode.h" +#include "../../../INCHI_BASE/src/mode.h" #ifndef COMPILE_ANSI_ONLY diff --git a/INCHI-1-SRC/INCHI_BASE/src/dispstru.h b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/dispstru.h similarity index 100% rename from INCHI-1-SRC/INCHI_BASE/src/dispstru.h rename to INCHI-1-SRC/INCHI_EXE/inchi-1/src/dispstru.h diff --git a/INCHI-1-SRC/INCHI_BASE/src/ichimain.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c similarity index 92% rename from INCHI-1-SRC/INCHI_BASE/src/ichimain.c rename to INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c index 326dfb7b..160f62ab 100644 --- a/INCHI-1-SRC/INCHI_BASE/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -48,14 +48,13 @@ #include #include -#ifndef COMPILE_ANSI_ONLY -// #include +#if !defined(COMPILE_ANSI_ONLY) && defined(_WIN32) +#include "conio.h" #ifndef TARGET_LIB_FOR_WINCHI -// #include +#include #endif #endif - -#include "mode.h" +#include "../../../INCHI_BASE/src/mode.h" #if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 ) #include @@ -66,29 +65,124 @@ #ifdef _WIN32 #include #endif -#include "ichitime.h" -#include "incomdef.h" -#include "ichidrp.h" -#include "inpdef.h" -#include "ichi.h" -#include "strutil.h" -#include "util.h" -#include "ichierr.h" -#include "ichimain.h" -#include "ichicomp.h" -#include "ichi_io.h" +#include "../../../INCHI_BASE/src/ichitime.h" +#include "../../../INCHI_BASE/src/incomdef.h" +#include "../../../INCHI_BASE/src/ichidrp.h" +#include "../../../INCHI_BASE/src/inpdef.h" +#include "../../../INCHI_BASE/src/ichi.h" +#include "../../../INCHI_BASE/src/strutil.h" +#include "../../../INCHI_BASE/src/util.h" +#include "../../../INCHI_BASE/src/ichierr.h" +#include "../../../INCHI_BASE/src/ichimain.h" +#include "../../../INCHI_BASE/src/ichicomp.h" +#include "../../../INCHI_BASE/src/ichi_io.h" #ifdef TARGET_EXE_STANDALONE -#include "inchi_api.h" +#include "../../../INCHI_BASE/src/inchi_api.h" #endif -#include "bcf_s.h" -#include "permutation_util.h" +#include "../../../INCHI_BASE/src/bcf_s.h" +#include "../../../INCHI_BASE/src/permutation_util.h" /* Console-specific */ +#ifndef TARGET_LIB_FOR_WINCHI +/* COVERS THE CODE FROM HERE TO THE END OF FILE */ + +/* Enable/disable internal tests */ + +/* Uncomment for INCHI_LIB testing only */ +/*#define TEST_FPTRS*/ + +/* Windows-console-mode specific */ + +// int bInterrupted = 0; + + /* Console-specific */ + +#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY) + +/* Use Windows additional features */ + + +/****************************************************************************/ +int user_quit(struct tagINCHI_CLOCK* ic, + const char* msg, + unsigned long ulMaxTime) +{ +#if defined(TARGET_LIB_FOR_WINCHI) + return 0; +#endif + +#if ( !defined(TARGET_LIB_FOR_WINCHI) && defined(_WIN32) ) + + int quit, enter, ret; + printf("%s", msg); /* djb-rwth: format string added for security */ + if (ulMaxTime) + { + inchiTime ulEndTime; + InchiTimeGet(&ulEndTime); + InchiTimeAddMsec(ic, &ulEndTime, ulMaxTime); + while (!_kbhit()) + { + if (bInchiTimeIsOver(ic, &ulEndTime)) + { + printf("\n"); + return 0; + } + MySleep(100); + } + } + while (1) + { + quit = ('q' == (ret = _getch()) || 'Q' == ret || /*Esc*/ 27 == ret); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + enter = ('\r' == ret); + if (ret == 0xE0) + { + ret = _getch(); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + } + else + { + _putch(ret); /* echo */ + } + if (quit || enter) + { + break; + } + printf("\r"); + printf("%s", msg); /* djb-rwth: format string added for security */ + } + _putch('\n'); + return quit; +#else + return 0; + +#endif /* #if ( defined(_WIN32) && !defined(TARGET_LIB_FOR_WINCHI) ) */ +} + + +/****************************************************************************/ +void eat_keyboard_input(void) +{ + int ret_val; /* djb-rwth: adding return value */ /* djb-rwth: ignoring LLVM warning */ #ifndef TARGET_LIB_FOR_WINCHI + + while (_kbhit()) + { + if (0xE0 == _getch()) + { + ret_val = _getch(); /* djb-rwth: return value variable added */ + } + } + +#endif +} + +#endif /* end of !COMPILE_ANSI_ONLY */ + + +// #ifndef TARGET_LIB_FOR_WINCHI /* COVERS THE CODE FROM HERE TO THE END OF FILE */ @@ -99,7 +193,43 @@ /* Windows-console-mode specific */ -// int bInterrupted = 0; +int bInterrupted = 0; + +#if ( defined( _WIN32 ) && defined( _CONSOLE ) ) +#ifndef COMPILE_ANSI_ONLY + + +/****************************************************************************/ +BOOL WINAPI MyHandlerRoutine(DWORD dwCtrlType /* control signal type */) +{ + if (dwCtrlType == CTRL_C_EVENT || + dwCtrlType == CTRL_BREAK_EVENT || + dwCtrlType == CTRL_CLOSE_EVENT || + dwCtrlType == CTRL_LOGOFF_EVENT) + { + bInterrupted = 1; + return TRUE; + } + return FALSE; +} + + +/****************************************************************************/ +int WasInterrupted(void) +{ +#ifdef _DEBUG + if (bInterrupted) + { + int stop = 1; /* for debug only */ + } +#endif + return bInterrupted; +} +#if ( BUILD_WITH_AMI == 1 ) +#define CTRL_STOP_EVENT 101 +#endif +#endif /* ifndef COMPILE_ANSI_ONLY */ +#endif /* if( defined( _WIN32 ) && defined( _CONSOLE ) ) */ /****************************************************************************/ diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/main.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c similarity index 54% rename from INCHI-1-SRC/INCHI_EXE/inchi-1/src/main.c rename to INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c index 5e1f3f46..17134d42 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/main.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c @@ -49,13 +49,6 @@ #include #include -#ifndef COMPILE_ANSI_ONLY -#include -#ifndef TARGET_LIB_FOR_WINCHI -#include -#endif -#endif - #include "../../../INCHI_BASE/src/mode.h" #if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 ) @@ -85,141 +78,6 @@ #include "../../../INCHI_BASE/src/bcf_s.h" #include "../../../INCHI_BASE/src/permutation_util.h" - /* Console-specific */ - -#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY) - -/* Use Windows additional features */ - - -/****************************************************************************/ -int user_quit(struct tagINCHI_CLOCK* ic, - const char* msg, - unsigned long ulMaxTime) -{ -#if defined(TARGET_LIB_FOR_WINCHI) - return 0; -#endif - -#if ( !defined(TARGET_LIB_FOR_WINCHI) && defined(_WIN32) ) - - int quit, enter, ret; - printf("%s", msg); /* djb-rwth: format string added for security */ - if (ulMaxTime) - { - inchiTime ulEndTime; - InchiTimeGet(&ulEndTime); - InchiTimeAddMsec(ic, &ulEndTime, ulMaxTime); - while (!_kbhit()) - { - if (bInchiTimeIsOver(ic, &ulEndTime)) - { - printf("\n"); - return 0; - } - MySleep(100); - } - } - while (1) - { - quit = ('q' == (ret = _getch()) || 'Q' == ret || /*Esc*/ 27 == ret); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - enter = ('\r' == ret); - if (ret == 0xE0) - { - ret = _getch(); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - } - else - { - _putch(ret); /* echo */ - } - if (quit || enter) - { - break; - } - printf("\r"); - printf("%s", msg); /* djb-rwth: format string added for security */ - } - _putch('\n'); - - return quit; -#else - return 0; - -#endif /* #if ( defined(_WIN32) && !defined(TARGET_LIB_FOR_WINCHI) ) */ -} - - -/****************************************************************************/ -void eat_keyboard_input(void) -{ - int ret_val; /* djb-rwth: adding return value */ /* djb-rwth: ignoring LLVM warning */ -#ifndef TARGET_LIB_FOR_WINCHI - - while (_kbhit()) - { - if (0xE0 == _getch()) - { - ret_val = _getch(); /* djb-rwth: return value variable added */ - } - } - -#endif -} - -#endif /* end of !COMPILE_ANSI_ONLY */ - - -// #ifndef TARGET_LIB_FOR_WINCHI -/* COVERS THE CODE FROM HERE TO THE END OF FILE */ - - -/* Enable/disable internal tests */ - -/* Uncomment for INCHI_LIB testing only */ -/*#define TEST_FPTRS*/ - -/* Windows-console-mode specific */ - -int bInterrupted = 0; - -#if ( defined( _WIN32 ) && defined( _CONSOLE ) ) -#ifndef COMPILE_ANSI_ONLY - - -/****************************************************************************/ -BOOL WINAPI MyHandlerRoutine(DWORD dwCtrlType /* control signal type */) -{ - if (dwCtrlType == CTRL_C_EVENT || - dwCtrlType == CTRL_BREAK_EVENT || - dwCtrlType == CTRL_CLOSE_EVENT || - dwCtrlType == CTRL_LOGOFF_EVENT) - { - bInterrupted = 1; - return TRUE; - } - return FALSE; -} - - -/****************************************************************************/ -int WasInterrupted(void) -{ -#ifdef _DEBUG - if (bInterrupted) - { - int stop = 1; /* for debug only */ - } -#endif - return bInterrupted; -} -#if ( BUILD_WITH_AMI == 1 ) -#define CTRL_STOP_EVENT 101 -#endif -#endif /* ifndef COMPILE_ANSI_ONLY */ -#endif /* if( defined( _WIN32 ) && defined( _CONSOLE ) ) */ - - - /****************************************************************************/ int main(int argc, char* argv[]) { diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/djb-rwth.ruleset b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/djb-rwth.ruleset index ae46164d..a56d9ae2 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/djb-rwth.ruleset +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/djb-rwth.ruleset @@ -1,4 +1,4 @@ - + diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.rc b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.rc index 1e457688..f1815009 100644 Binary files a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.rc and b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.rc differ diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.sln b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.sln index 460b7376..a0ea0d5d 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.sln +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj index c5765930..5389090d 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj @@ -1,4 +1,4 @@ - + @@ -18,6 +18,101 @@ x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {61B178D7-60C1-4DB9-8FF5-D9BCB0C6E66B} inchi1 @@ -27,19 +122,19 @@ Application - v143 + v145 NotSet true Application - v143 + v145 NotSet true Application - v143 + v145 NotSet true false @@ -47,7 +142,7 @@ Application - v143 + v145 NotSet true false @@ -211,94 +306,6 @@ MachineX64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj.user b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj.user index a3aacbba..6934617a 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj.user +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj.user @@ -1,13 +1,25 @@ - + WindowsLocalDebugger + D:\Posao\code\dev_bcf\INCHI_EXE\bin2\Windows\x64\Release\MgCl2.mol|D:\Posao\code\dev_bcf\INCHI_EXE\bin2\Windows\x64\Release\MgH2.mol|D:\Posao\code\dev_bcf\INCHI_EXE\bin2\Windows\x64\Release\MgNitrate.mol|D:\Posao\code\dev_bcf\INCHI_EXE\bin2\Windows\x64\Release\MgSingleNitrate.mol| WindowsLocalDebugger + D:\Posao\code\dev_bcf\INCHI_EXE\bin2\Windows\x64\Release\MgCl2.mol| + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger \ No newline at end of file diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1_ansi.rc b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1_ansi.rc new file mode 100644 index 00000000..1e457688 --- /dev/null +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1_ansi.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,7,0 + PRODUCTVERSION 1,0,7,4 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "InChI CLI" + VALUE "FileVersion", "1.0.7.4" + VALUE "InternalName", "inchi-1.exe" + VALUE "OriginalFilename", "inchi-1.exe" + VALUE "ProductName", "IUPAC International Chemical Identifier (InChI) version 1, Software version 1.07, October 2023. InChI CLI" + VALUE "ProductVersion", "1.0.7.4" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/INCHI-1-TEST/tests/test_unit/CMakeLists.txt b/INCHI-1-TEST/tests/test_unit/CMakeLists.txt index 0419209c..0176b96e 100644 --- a/INCHI-1-TEST/tests/test_unit/CMakeLists.txt +++ b/INCHI-1-TEST/tests/test_unit/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) set(P_BASE "${CMAKE_SOURCE_DIR}/INCHI-1-SRC/INCHI_BASE/src") +set(P_CLI "${CMAKE_SOURCE_DIR}/INCHI-1-SRC/INCHI_EXE/inchi-1/src") file(GLOB BASE_SOURCES CONFIGURE_DEPENDS "${P_BASE}/*.c" "${P_BASE}/*.h" + "${P_CLI}/*.c" + "${P_CLI}/*.h" ) add_library(test_dependencies STATIC ${BASE_SOURCES}) target_compile_definitions(test_dependencies PUBLIC TARGET_EXE_STANDALONE)