From eca9dbbe9eb3e40d4d9cf164373bc36498802106 Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Sun, 26 Apr 2026 21:48:53 +0200 Subject: [PATCH 1/7] Revision of refactor_main branch --- INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile | 4 + INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 | 8 +- .../INCHI_EXE/inchi-1/src/CMakeLists.txt | 8 +- .../inchi-1}/src/dispstru.c | 2 +- .../inchi-1}/src/dispstru.h | 0 .../inchi-1}/src/ichimain.c | 168 +++++++++++++-- .../inchi-1/src/{main.c => inchi_main_cli.c} | 142 ------------- .../INCHI_EXE/inchi-1/vc14/djb-rwth.ruleset | 2 +- INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1.rc | Bin 2171 -> 4538 bytes .../INCHI_EXE/inchi-1/vc14/inchi-1.sln | 2 +- .../INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj | 193 +++++++++--------- .../inchi-1/vc14/inchi-1.vcxproj.user | 14 +- .../INCHI_EXE/inchi-1/vc14/inchi-1_ansi.rc | 97 +++++++++ 13 files changed, 376 insertions(+), 264 deletions(-) rename INCHI-1-SRC/{INCHI_BASE => INCHI_EXE/inchi-1}/src/dispstru.c (99%) rename INCHI-1-SRC/{INCHI_BASE => INCHI_EXE/inchi-1}/src/dispstru.h (100%) rename INCHI-1-SRC/{INCHI_BASE => INCHI_EXE/inchi-1}/src/ichimain.c (92%) rename INCHI-1-SRC/INCHI_EXE/inchi-1/src/{main.c => inchi_main_cli.c} (54%) create mode 100644 INCHI-1-SRC/INCHI_EXE/inchi-1/vc14/inchi-1_ansi.rc diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile index 8708a4dc..cdca580f 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,6 +207,8 @@ sha2.o \ strutil.o \ util.o \ dispstru.o \ +inchi_main_cli.o \ +permutation_util.o \ ichimain.o \ bcf_s.o $(INCHI_EXECUTABLE_PATHNAME) : $(INCHI_OBJS) diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 index 53d13fb7..8d626d11 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 +inchi_main_cli.o \ +permutation_util.o \ +ichimain.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..62163f57 100644 --- a/INCHI-1-SRC/INCHI_BASE/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -49,13 +49,12 @@ #include #ifndef COMPILE_ANSI_ONLY -// #include +#include #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 1e4576883f7263825c5589609bfb865a80a75193..f1815009d35c42bf64fcc45f2f83f46b811141d3 100644 GIT binary patch literal 4538 zcmdUzTTdE66vxkVlYWOSzG!Myyu|cT0Vyeh5hQJ5LcEtmq2W?}=x1;H`_C}$E-W-s zA80ni%$_;t%(>55e*fCEO^fW)C*DYeQfyU;`W3h28U3u=hNX-Pw(G8GYbG z=4)VmX3>pUU9paM6St0i2WP|H+8a*Ubn^<(F1z<&Upw5~6n!3=ZNh{xCr=C5a z{}AiQ4o$TF!fyqw3+O3(lz?wDCVldEFFZQ?db+gzm(OBBA|D+iY^7MbMeoI8BUnE0 zU9LGu7vbG58F-JU2E;&QtN6UjTgb!)E1#DGTg!-oK_aI*&R*|QxpfW413MzBd`>mU zpEI(nz{zc*tI8w3KY5~=ludY?62on%YS6E_Q>#F0K+l-VE=~i)5)^lh2%5{O@W(c9w^j(5#WiX4#mL+doA2va1xrj>gZd z+IwzW*y@y%%zi#;f8u#!=fCo)lZJ)8{PK>zePvKW2-wQ-unrk*i;C|$)M;YmksUi)sKZ5&{ z?cl+xxSxEiJEgpo}}fBIe8BGXZjmz@c=u`$KOie>!#AFX^J}XdEUFosAqRf z6I-iEM{|ONX&K^uUoq2I;pFV>SADHxS6L>91Vj9-?(7Z^bftg%C5Sz`^@UEYy3X&9yt3R`5RvNKvrz9^W=7Y)C5`6bJ{v} z=gT|iPn{4vs`Fm=q!Ui+5!EBQ`r(u&75sIA-wN12t@RMuR9V9Jg?ictU{_;E#og$# zlk%m*ZXX`236H81`QhN9O8JVQ?!kY>Ji<#IZ5EzFbTn5CFI?QC2sjB)cmo@X)P8BQ} ztFg54O8c{K)z|5ClQ-OQt)+c(_`7J{cg%EGv0NG@rIBWO5A(l%(W=Xv|3w>YnUrF= W){<~`ymzTT`qyRp`*qsy;`9fIj2s96 literal 2171 zcmcIlO>d(x5WV|X%+gDvvc&n2svZeAtW^q89HLgLglOU(Dk3ZGK;^e~7+rkyW1OepO(1iM%lDu0D? z#bH7oCp7ZH#3#_*rSK{CHz9TSRp1v4%Fwfsnus$jT$~0Va=8}83a%3=jB2dZ;uWo3 z>V+0ZEZ|2i(EQpRK5B7ToQyq^`eE3Dj}JIpoVep4B~j8sp&JE>8xSxPZ3;rle%Zj1 z!J#2dSarlv;xwAZ_r$+=x<>T_iS;i+okI(t0SRb?K##*3ea03dk&jUKOZ2|BtzCgw z&+1uP^=`W@dS7mF3Vp@pTnnIwj(vAOwgjR7LeZ3~LgccdXUftk88aG3DUF6PG(TpJ zU`RvK7@%Wg`_{$?M&sB|yveb>UxSCC8?XnL-2;B_EkaXUM)=exgCsbB=;e-HwXi@erp4>FuL zK-|Z7xc{Pyz!=Rqh8fG$4HE*E+0Ey5&(j=QHds`8D+*pn_wJt@8o~{@<6!63>7RsB zS#l+_b(FnwgVo)1C4P1s{?1S0Vn0^}GGR5~c2jAKd&&vEodvtNP=jff!anl5IjvjL> z4V&9&)b(`81VuXG5opbrm;TR+s+h4*t7iUiMKyReL;s7`E5{ avL}7(RqXAahU!(kbOSn~TIS`6miHGb`xO=d 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 + From 2f0eda8f51e8fafc62f39634cbcdfd312454141c Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Sun, 26 Apr 2026 22:59:46 +0200 Subject: [PATCH 2/7] Attempt at resolving unit test build issues. --- INCHI-1-TEST/tests/test_unit/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) 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) From 502016069bdfc576a102d7bb5ad8dea550df149c Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Sun, 26 Apr 2026 23:08:05 +0200 Subject: [PATCH 3/7] Adding conio.h. --- INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h | 504 ++++++++++++++++++++++ 1 file changed, 504 insertions(+) create mode 100644 INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h new file mode 100644 index 00000000..a0f5e9c1 --- /dev/null +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h @@ -0,0 +1,504 @@ +// +// conio.h +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This file declares the direct console I/O functions. +// +#pragma once +#ifndef _INC_CONIO // include guard for 3rd party interop +#define _INC_CONIO + +#include +#include + +#pragma warning(push) +#pragma warning(disable: _UCRT_DISABLED_WARNINGS) +_UCRT_DISABLE_CLANG_WARNINGS + +_CRT_BEGIN_C_HEADER + + _Check_return_wat_ + _Success_(_BufferCount > 0) + _DCRTIMP errno_t __cdecl _cgets_s( + _Out_writes_z_(_BufferCount) char* _Buffer, + _In_ size_t _BufferCount, + _Out_ size_t* _SizeRead + ); + + __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( + _Success_(return == 0) + errno_t, _cgets_s, + _Out_writes_z_(*_Buffer) char, _Buffer, + _Out_ size_t*, _SizeRead + ) + + _Check_return_opt_ + _DCRTIMP int __cdecl _cputs( + _In_z_ char const* _Buffer + ); + + //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // + // Narrow Character Formatted Output Functions (Console) + // + //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + _Check_return_opt_ + _DCRTIMP int __cdecl __conio_common_vcprintf( + _In_ unsigned __int64 _Options, + _In_z_ _Printf_format_string_params_(2) char const* _Format, + _In_opt_ _locale_t _Locale, + va_list _ArgList + ); + + _Check_return_opt_ + _DCRTIMP int __cdecl __conio_common_vcprintf_s( + _In_ unsigned __int64 _Options, + _In_z_ _Printf_format_string_params_(2) char const* _Format, + _In_opt_ _locale_t _Locale, + va_list _ArgList + ); + + _Check_return_opt_ + _DCRTIMP int __cdecl __conio_common_vcprintf_p( + _In_ unsigned __int64 _Options, + _In_z_ _Printf_format_string_params_(2) char const* _Format, + _In_opt_ _locale_t _Locale, + va_list _ArgList + ); + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf_l( + _In_z_ _Printf_format_string_params_(2) char const* const _Format, + _In_opt_ _locale_t const _Locale, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return __conio_common_vcprintf( + _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, + _Format, _Locale, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf( + _In_z_ _Printf_format_string_ char const* const _Format, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return _vcprintf_l(_Format, NULL, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s_l( + _In_z_ _Printf_format_string_params_(2) char const* const _Format, + _In_opt_ _locale_t const _Locale, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return __conio_common_vcprintf_s( + _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, + _Format, _Locale, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s( + _In_z_ _Printf_format_string_ char const* const _Format, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return _vcprintf_s_l(_Format, NULL, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p_l( + _In_z_ _Printf_format_string_params_(2) char const* const _Format, + _In_opt_ _locale_t const _Locale, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return __conio_common_vcprintf_p( + _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, + _Format, _Locale, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p( + _In_z_ char const* const _Format, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return _vcprintf_p_l(_Format, NULL, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf_l( + _In_z_ _Printf_format_string_params_(0) char const* const _Format, + _In_opt_ _locale_t const _Locale, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Locale); + _Result = _vcprintf_l(_Format, _Locale, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf( + _In_z_ _Printf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + _Result = _vcprintf_l(_Format, NULL, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf_s_l( + _In_z_ _Printf_format_string_params_(0) char const* const _Format, + _In_opt_ _locale_t const _Locale, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Locale); + _Result = _vcprintf_s_l(_Format, _Locale, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf_s( + _In_z_ _Printf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + _Result = _vcprintf_s_l(_Format, NULL, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf_p_l( + _In_z_ _Printf_format_string_params_(0) char const* const _Format, + _In_opt_ _locale_t const _Locale, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Locale); + _Result = _vcprintf_p_l(_Format, _Locale, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cprintf_p( + _In_z_ _Printf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + _Result = _vcprintf_p_l(_Format, NULL, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + + //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // + // Narrow Character Formatted Input Functions (Console) + // + //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + _Check_return_opt_ + _DCRTIMP int __cdecl __conio_common_vcscanf( + _In_ unsigned __int64 _Options, + _In_z_ _Scanf_format_string_params_(2) char const* _Format, + _In_opt_ _locale_t _Locale, + va_list _ArgList + ); + + _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s_l) + _CRT_STDIO_INLINE int __CRTDECL _vcscanf_l( + _In_z_ _Scanf_format_string_params_(2) char const* const _Format, + _In_opt_ _locale_t const _Locale, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return __conio_common_vcscanf( + _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, + _Format, _Locale, _ArgList); + } +#endif + + _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s) + _CRT_STDIO_INLINE int __CRTDECL _vcscanf( + _In_z_ _Scanf_format_string_params_(1) char const* const _Format, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return _vcscanf_l(_Format, NULL, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s_l( + _In_z_ _Scanf_format_string_params_(2) char const* const _Format, + _In_opt_ _locale_t const _Locale, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return __conio_common_vcscanf( + _CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, + _Format, _Locale, _ArgList); + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s( + _In_z_ _Scanf_format_string_params_(1) char const* const _Format, + va_list _ArgList + ) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + return _vcscanf_s_l(_Format, NULL, _ArgList); + } +#endif + + _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s_l) + _CRT_STDIO_INLINE int __CRTDECL _cscanf_l( + _In_z_ _Scanf_format_string_params_(0) char const* const _Format, + _In_opt_ _locale_t const _Locale, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Locale); + + _Result = _vcscanf_l(_Format, _Locale, _ArgList); + + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s) + _CRT_STDIO_INLINE int __CRTDECL _cscanf( + _In_z_ _Scanf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + + _Result = _vcscanf_l(_Format, NULL, _ArgList); + + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cscanf_s_l( + _In_z_ _Scanf_format_string_params_(0) char const* const _Format, + _In_opt_ _locale_t const _Locale, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Locale); + _Result = _vcscanf_s_l(_Format, _Locale, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ + _CRT_STDIO_INLINE int __CRTDECL _cscanf_s( + _In_z_ _Scanf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + _Result = _vcscanf_s_l(_Format, NULL, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + + _DCRTIMP int __cdecl _kbhit(void); + + _Check_return_ _DCRTIMP int __cdecl _getch(void); + _Check_return_ _DCRTIMP int __cdecl _getche(void); + _Check_return_opt_ _DCRTIMP int __cdecl _putch (_In_ int _Ch); + _Check_return_opt_ _DCRTIMP int __cdecl _ungetch(_In_ int _Ch); + + _Check_return_ _DCRTIMP int __cdecl _getch_nolock (void); + _Check_return_ _DCRTIMP int __cdecl _getche_nolock (void); + _Check_return_opt_ _DCRTIMP int __cdecl _putch_nolock (_In_ int _Ch); + _Check_return_opt_ _DCRTIMP int __cdecl _ungetch_nolock(_In_ int _Ch); + + #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES + + // Suppress double-deprecation warnings: + #pragma warning(push) + #pragma warning(disable: 4141) + + _Success_(return != 0) + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cgets) _CRT_INSECURE_DEPRECATE(_cgets_s) + _DCRTIMP char* __cdecl cgets( + _At_(&_Buffer[0], _In_reads_(1)) + _At_(&_Buffer[1], _Out_writes_(1)) + _At_(&_Buffer[2], _Post_z_ _Out_writes_to_(_Buffer[0], _Buffer[1])) + char* _Buffer + ); + + #pragma warning(pop) + + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cputs) + _DCRTIMP int __cdecl cputs( + _In_z_ char const* _String + ); + + _Check_return_ _CRT_NONSTDC_DEPRECATE(_getch) + _DCRTIMP int __cdecl getch(void); + + _Check_return_ _CRT_NONSTDC_DEPRECATE(_getche) + _DCRTIMP int __cdecl getche(void); + + _Check_return_ _CRT_NONSTDC_DEPRECATE(_kbhit) + _DCRTIMP int __cdecl kbhit(void); + + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_putch) + _DCRTIMP int __cdecl putch( + _In_ int _Ch + ); + + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_ungetch) + _DCRTIMP int __cdecl ungetch( + _In_ int _Ch + ); + + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cprintf) + _CRT_STDIO_INLINE int __CRTDECL cprintf( + _In_z_ _Printf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + _Result = _vcprintf_l(_Format, NULL, _ArgList); + __crt_va_end(_ArgList); + return _Result; + } +#endif + + _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cscanf) + _CRT_STDIO_INLINE int __CRTDECL cscanf( + _In_z_ _Scanf_format_string_ char const* const _Format, + ...) +#if defined _NO_CRT_STDIO_INLINE +; +#else + { + int _Result; + va_list _ArgList; + __crt_va_start(_ArgList, _Format); + + _Result = _vcscanf_l(_Format, NULL, _ArgList); + + __crt_va_end(_ArgList); + return _Result; + } +#endif + + #endif // _CRT_INTERNAL_NONSTDC_NAMES + +_CRT_END_C_HEADER + +_UCRT_RESTORE_CLANG_WARNINGS +#pragma warning(pop) // _UCRT_DISABLED_WARNINGS +#endif // _INC_CONIO From 291762524a6af275abfa58290b1741102b3678f9 Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Sun, 26 Apr 2026 23:13:07 +0200 Subject: [PATCH 4/7] Adding reference to local conio.h. --- INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c index 62163f57..f26b08ea 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -49,7 +49,7 @@ #include #ifndef COMPILE_ANSI_ONLY -#include +#include "conio.h" #ifndef TARGET_LIB_FOR_WINCHI #include #endif From 67eb823c2ddd24d4db713bd4f0a668a21dc8c111 Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Sun, 26 Apr 2026 23:32:53 +0200 Subject: [PATCH 5/7] Resolving _getch() platform. --- INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h | 504 ------------------- INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c | 4 +- 2 files changed, 2 insertions(+), 506 deletions(-) delete mode 100644 INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h deleted file mode 100644 index a0f5e9c1..00000000 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/conio.h +++ /dev/null @@ -1,504 +0,0 @@ -// -// conio.h -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// This file declares the direct console I/O functions. -// -#pragma once -#ifndef _INC_CONIO // include guard for 3rd party interop -#define _INC_CONIO - -#include -#include - -#pragma warning(push) -#pragma warning(disable: _UCRT_DISABLED_WARNINGS) -_UCRT_DISABLE_CLANG_WARNINGS - -_CRT_BEGIN_C_HEADER - - _Check_return_wat_ - _Success_(_BufferCount > 0) - _DCRTIMP errno_t __cdecl _cgets_s( - _Out_writes_z_(_BufferCount) char* _Buffer, - _In_ size_t _BufferCount, - _Out_ size_t* _SizeRead - ); - - __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( - _Success_(return == 0) - errno_t, _cgets_s, - _Out_writes_z_(*_Buffer) char, _Buffer, - _Out_ size_t*, _SizeRead - ) - - _Check_return_opt_ - _DCRTIMP int __cdecl _cputs( - _In_z_ char const* _Buffer - ); - - //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // - // Narrow Character Formatted Output Functions (Console) - // - //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - _Check_return_opt_ - _DCRTIMP int __cdecl __conio_common_vcprintf( - _In_ unsigned __int64 _Options, - _In_z_ _Printf_format_string_params_(2) char const* _Format, - _In_opt_ _locale_t _Locale, - va_list _ArgList - ); - - _Check_return_opt_ - _DCRTIMP int __cdecl __conio_common_vcprintf_s( - _In_ unsigned __int64 _Options, - _In_z_ _Printf_format_string_params_(2) char const* _Format, - _In_opt_ _locale_t _Locale, - va_list _ArgList - ); - - _Check_return_opt_ - _DCRTIMP int __cdecl __conio_common_vcprintf_p( - _In_ unsigned __int64 _Options, - _In_z_ _Printf_format_string_params_(2) char const* _Format, - _In_opt_ _locale_t _Locale, - va_list _ArgList - ); - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf_l( - _In_z_ _Printf_format_string_params_(2) char const* const _Format, - _In_opt_ _locale_t const _Locale, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return __conio_common_vcprintf( - _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, - _Format, _Locale, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf( - _In_z_ _Printf_format_string_ char const* const _Format, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return _vcprintf_l(_Format, NULL, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s_l( - _In_z_ _Printf_format_string_params_(2) char const* const _Format, - _In_opt_ _locale_t const _Locale, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return __conio_common_vcprintf_s( - _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, - _Format, _Locale, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s( - _In_z_ _Printf_format_string_ char const* const _Format, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return _vcprintf_s_l(_Format, NULL, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p_l( - _In_z_ _Printf_format_string_params_(2) char const* const _Format, - _In_opt_ _locale_t const _Locale, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return __conio_common_vcprintf_p( - _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, - _Format, _Locale, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p( - _In_z_ char const* const _Format, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return _vcprintf_p_l(_Format, NULL, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf_l( - _In_z_ _Printf_format_string_params_(0) char const* const _Format, - _In_opt_ _locale_t const _Locale, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Locale); - _Result = _vcprintf_l(_Format, _Locale, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf( - _In_z_ _Printf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - _Result = _vcprintf_l(_Format, NULL, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf_s_l( - _In_z_ _Printf_format_string_params_(0) char const* const _Format, - _In_opt_ _locale_t const _Locale, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Locale); - _Result = _vcprintf_s_l(_Format, _Locale, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf_s( - _In_z_ _Printf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - _Result = _vcprintf_s_l(_Format, NULL, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf_p_l( - _In_z_ _Printf_format_string_params_(0) char const* const _Format, - _In_opt_ _locale_t const _Locale, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Locale); - _Result = _vcprintf_p_l(_Format, _Locale, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cprintf_p( - _In_z_ _Printf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - _Result = _vcprintf_p_l(_Format, NULL, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - - //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // - // Narrow Character Formatted Input Functions (Console) - // - //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - _Check_return_opt_ - _DCRTIMP int __cdecl __conio_common_vcscanf( - _In_ unsigned __int64 _Options, - _In_z_ _Scanf_format_string_params_(2) char const* _Format, - _In_opt_ _locale_t _Locale, - va_list _ArgList - ); - - _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s_l) - _CRT_STDIO_INLINE int __CRTDECL _vcscanf_l( - _In_z_ _Scanf_format_string_params_(2) char const* const _Format, - _In_opt_ _locale_t const _Locale, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return __conio_common_vcscanf( - _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, - _Format, _Locale, _ArgList); - } -#endif - - _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s) - _CRT_STDIO_INLINE int __CRTDECL _vcscanf( - _In_z_ _Scanf_format_string_params_(1) char const* const _Format, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return _vcscanf_l(_Format, NULL, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s_l( - _In_z_ _Scanf_format_string_params_(2) char const* const _Format, - _In_opt_ _locale_t const _Locale, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return __conio_common_vcscanf( - _CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, - _Format, _Locale, _ArgList); - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s( - _In_z_ _Scanf_format_string_params_(1) char const* const _Format, - va_list _ArgList - ) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - return _vcscanf_s_l(_Format, NULL, _ArgList); - } -#endif - - _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s_l) - _CRT_STDIO_INLINE int __CRTDECL _cscanf_l( - _In_z_ _Scanf_format_string_params_(0) char const* const _Format, - _In_opt_ _locale_t const _Locale, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Locale); - - _Result = _vcscanf_l(_Format, _Locale, _ArgList); - - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s) - _CRT_STDIO_INLINE int __CRTDECL _cscanf( - _In_z_ _Scanf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - - _Result = _vcscanf_l(_Format, NULL, _ArgList); - - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cscanf_s_l( - _In_z_ _Scanf_format_string_params_(0) char const* const _Format, - _In_opt_ _locale_t const _Locale, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Locale); - _Result = _vcscanf_s_l(_Format, _Locale, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ - _CRT_STDIO_INLINE int __CRTDECL _cscanf_s( - _In_z_ _Scanf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - _Result = _vcscanf_s_l(_Format, NULL, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - - _DCRTIMP int __cdecl _kbhit(void); - - _Check_return_ _DCRTIMP int __cdecl _getch(void); - _Check_return_ _DCRTIMP int __cdecl _getche(void); - _Check_return_opt_ _DCRTIMP int __cdecl _putch (_In_ int _Ch); - _Check_return_opt_ _DCRTIMP int __cdecl _ungetch(_In_ int _Ch); - - _Check_return_ _DCRTIMP int __cdecl _getch_nolock (void); - _Check_return_ _DCRTIMP int __cdecl _getche_nolock (void); - _Check_return_opt_ _DCRTIMP int __cdecl _putch_nolock (_In_ int _Ch); - _Check_return_opt_ _DCRTIMP int __cdecl _ungetch_nolock(_In_ int _Ch); - - #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES - - // Suppress double-deprecation warnings: - #pragma warning(push) - #pragma warning(disable: 4141) - - _Success_(return != 0) - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cgets) _CRT_INSECURE_DEPRECATE(_cgets_s) - _DCRTIMP char* __cdecl cgets( - _At_(&_Buffer[0], _In_reads_(1)) - _At_(&_Buffer[1], _Out_writes_(1)) - _At_(&_Buffer[2], _Post_z_ _Out_writes_to_(_Buffer[0], _Buffer[1])) - char* _Buffer - ); - - #pragma warning(pop) - - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cputs) - _DCRTIMP int __cdecl cputs( - _In_z_ char const* _String - ); - - _Check_return_ _CRT_NONSTDC_DEPRECATE(_getch) - _DCRTIMP int __cdecl getch(void); - - _Check_return_ _CRT_NONSTDC_DEPRECATE(_getche) - _DCRTIMP int __cdecl getche(void); - - _Check_return_ _CRT_NONSTDC_DEPRECATE(_kbhit) - _DCRTIMP int __cdecl kbhit(void); - - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_putch) - _DCRTIMP int __cdecl putch( - _In_ int _Ch - ); - - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_ungetch) - _DCRTIMP int __cdecl ungetch( - _In_ int _Ch - ); - - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cprintf) - _CRT_STDIO_INLINE int __CRTDECL cprintf( - _In_z_ _Printf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - _Result = _vcprintf_l(_Format, NULL, _ArgList); - __crt_va_end(_ArgList); - return _Result; - } -#endif - - _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cscanf) - _CRT_STDIO_INLINE int __CRTDECL cscanf( - _In_z_ _Scanf_format_string_ char const* const _Format, - ...) -#if defined _NO_CRT_STDIO_INLINE -; -#else - { - int _Result; - va_list _ArgList; - __crt_va_start(_ArgList, _Format); - - _Result = _vcscanf_l(_Format, NULL, _ArgList); - - __crt_va_end(_ArgList); - return _Result; - } -#endif - - #endif // _CRT_INTERNAL_NONSTDC_NAMES - -_CRT_END_C_HEADER - -_UCRT_RESTORE_CLANG_WARNINGS -#pragma warning(pop) // _UCRT_DISABLED_WARNINGS -#endif // _INC_CONIO diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c index f26b08ea..4ac75d19 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -48,8 +48,8 @@ #include #include -#ifndef COMPILE_ANSI_ONLY -#include "conio.h" +#if !defined(COMPILE_ANSI_ONLY) && defined(_WIN32) +#include #ifndef TARGET_LIB_FOR_WINCHI #include #endif From e1cabf48a2c2e2f5febf5987f01480897941dfe2 Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Mon, 27 Apr 2026 03:06:13 +0200 Subject: [PATCH 6/7] Restoring the original file system. --- INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile | 2 - INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 | 2 - .../INCHI_EXE/inchi-1/src/CMakeLists.txt | 1 - INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c | 71 +++++++--- .../INCHI_EXE/inchi-1/src/inchi_main_cli.c | 124 ------------------ .../INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj | 1 - 6 files changed, 50 insertions(+), 151 deletions(-) delete mode 100644 INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile index cdca580f..5234aa9e 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile @@ -158,7 +158,6 @@ $(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 \ @@ -207,7 +206,6 @@ sha2.o \ strutil.o \ util.o \ dispstru.o \ -inchi_main_cli.o \ permutation_util.o \ ichimain.o \ bcf_s.o diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 index 8d626d11..d5b4d29e 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 @@ -152,7 +152,6 @@ $(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 \ @@ -201,7 +200,6 @@ sha2.o \ strutil.o \ util.o \ dispstru.o \ -inchi_main_cli.o \ permutation_util.o \ ichimain.o \ bcf_s.o 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 4bd91e3c..01c209e8 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt @@ -25,7 +25,6 @@ include_directories(${P_BASE} ${P_CURRENT}) add_executable(inchi-1) target_sources(inchi-1 PRIVATE - inchi_main_cli.c ichimain.c dispstru.c dispstru.h diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c index 4ac75d19..2310bcab 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -2,6 +2,7 @@ * International Chemical Identifier (InChI) * Version 1 * Software version 1.07 + * April 30, 2024 * * MIT License * @@ -54,6 +55,7 @@ #include #endif #endif + #include "../../../INCHI_BASE/src/mode.h" #if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 ) @@ -85,21 +87,6 @@ /* 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 */ @@ -182,7 +169,7 @@ void eat_keyboard_input(void) #endif /* end of !COMPILE_ANSI_ONLY */ -// #ifndef TARGET_LIB_FOR_WINCHI +#ifndef TARGET_LIB_FOR_WINCHI /* COVERS THE CODE FROM HERE TO THE END OF FILE */ @@ -232,6 +219,49 @@ int WasInterrupted(void) #endif /* if( defined( _WIN32 ) && defined( _CONSOLE ) ) */ + +/****************************************************************************/ +int main(int argc, char* argv[]) +{ +#ifdef GHI100_FIX +#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2)) + setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */ +#endif +#endif + + /*************************/ +#if ( BUILD_WITH_AMI == 1 ) +/*************************/ + +/**** IF IN AMI MODE, main() STARTS HERE ****/ + int i, ret = 0, ami = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + + /* Check if multiple inputs expected */ + for (i = 1; i < argc; i++) + { + if (argv[i][0] == INCHI_OPTION_PREFX) + { + if (!inchi_stricmp(argv[i] + 1, "AMI")) + { + ami = 1; + break; + } + } + } + + if (ami) + { + ret = ProcessMultipleInputFiles(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + } + else + { + ret = ProcessSingleInputFile(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + } + + return 0; +} + + /****************************************************************************/ int ProcessMultipleInputFiles(int argc, char* argv[]) { @@ -492,8 +522,7 @@ int ProcessMultipleInputFiles(int argc, char* argv[]) /****************************************************************************/ int ProcessSingleInputFile(int argc, char* argv[]) { - -/**************************************/ + /**************************************/ #endif /* #if ( BUILD_WITH_AMI == 1 ) */ /**************************************/ @@ -594,7 +623,7 @@ int ProcessSingleInputFile(int argc, char* argv[]) #endif sd->bUserQuit = 0; - /* djb-rwth: fixing coverity CID #499552 */ + /* djb-rwth: fixing coverity ID #499552 */ sd->num_components[0] = 0; sd->num_components[1] = 0; #if ( defined( _WIN32 ) && defined( _CONSOLE ) && !defined( COMPILE_ANSI_ONLY ) ) @@ -787,7 +816,7 @@ int ProcessSingleInputFile(int argc, char* argv[]) /*************************************************************/ - while (!sd->bUserQuit ) //&& !bInterrupted + while (!sd->bUserQuit && !bInterrupted) { int do_renumbering = 0; int next_action; @@ -1049,7 +1078,7 @@ void emit_empty_inchi(INPUT_PARMS* ip, } inchi_ios_flush(pout); } - +#endif /* ifndef TARGET_LIB_FOR_WINCHI */ /*****************************************************************************/ diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c deleted file mode 100644 index 17134d42..00000000 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * International Chemical Identifier (InChI) - * Version 1 - * Software version 1.07 - * April 30, 2024 - * - * MIT License - * - * Copyright (c) 2024 IUPAC and InChI Trust - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. -* -* The InChI library and programs are free software developed under the - * auspices of the International Union of Pure and Applied Chemistry (IUPAC). - * Originally developed at NIST. - * Modifications and additions by IUPAC and the InChI Trust. - * Some portions of code were developed/changed by external contributors - * (either contractor or volunteer) which are listed in the file - * 'External-contributors' included in this distribution. - * - * info@inchi-trust.org - * -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../../INCHI_BASE/src/mode.h" - -#if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 ) -#include -#include -#endif - - -#ifdef _WIN32 -#include -#endif -#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_BASE/src/inchi_api.h" -#endif - -#include "../../../INCHI_BASE/src/bcf_s.h" -#include "../../../INCHI_BASE/src/permutation_util.h" - -/****************************************************************************/ -int main(int argc, char* argv[]) -{ -#ifdef GHI100_FIX -#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2)) - setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */ -#endif -#endif - -/*************************/ -// #if ( BUILD_WITH_AMI == 1 ) -/*************************/ - -/**** IF IN AMI MODE, main() STARTS HERE ****/ - int i, ret = 0, ami = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - - /* Check if multiple inputs expected */ - for (i = 1; i < argc; i++) - { - if (argv[i][0] == INCHI_OPTION_PREFX) - { - if (!inchi_stricmp(argv[i] + 1, "AMI")) - { - ami = 1; - break; - } - } - } - - if (ami) - { - ret = ProcessMultipleInputFiles(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - } - else - { - ret = ProcessSingleInputFile(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - } - - return 0; -} - - -// #endif /* ifndef TARGET_LIB_FOR_WINCHI */ - 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 5389090d..dfa3e6cd 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 @@ -69,7 +69,6 @@ - From 2c0d6dbb3fc61b7c384aad312947552f4b4b92bf Mon Sep 17 00:00:00 2001 From: Djordje Baljozovic Date: Mon, 27 Apr 2026 03:16:30 +0200 Subject: [PATCH 7/7] Returning inchi_main_cli.c. --- INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile | 2 + INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 | 4 +- .../INCHI_EXE/inchi-1/src/CMakeLists.txt | 1 + INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c | 73 ++++------- .../INCHI_EXE/inchi-1/src/inchi_main_cli.c | 124 ++++++++++++++++++ .../INCHI_EXE/inchi-1/vc14/inchi-1.vcxproj | 1 + 6 files changed, 153 insertions(+), 52 deletions(-) create mode 100644 INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile index 5234aa9e..c403e027 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile @@ -158,6 +158,7 @@ $(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 \ @@ -208,6 +209,7 @@ 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 d5b4d29e..70ea893f 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32 @@ -152,6 +152,7 @@ $(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 \ @@ -202,7 +203,8 @@ util.o \ dispstru.o \ permutation_util.o \ ichimain.o \ -bcf_s.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 01c209e8..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,6 +25,7 @@ include_directories(${P_BASE} ${P_CURRENT}) add_executable(inchi-1) target_sources(inchi-1 PRIVATE + inchi_main_cli.c ichimain.c dispstru.c dispstru.h diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c index 2310bcab..160f62ab 100644 --- a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/ichimain.c @@ -2,7 +2,6 @@ * International Chemical Identifier (InChI) * Version 1 * Software version 1.07 - * April 30, 2024 * * MIT License * @@ -50,12 +49,11 @@ #include #if !defined(COMPILE_ANSI_ONLY) && defined(_WIN32) -#include +#include "conio.h" #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 ) @@ -87,6 +85,21 @@ /* 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 */ @@ -169,7 +182,7 @@ void eat_keyboard_input(void) #endif /* end of !COMPILE_ANSI_ONLY */ -#ifndef TARGET_LIB_FOR_WINCHI +// #ifndef TARGET_LIB_FOR_WINCHI /* COVERS THE CODE FROM HERE TO THE END OF FILE */ @@ -219,49 +232,6 @@ int WasInterrupted(void) #endif /* if( defined( _WIN32 ) && defined( _CONSOLE ) ) */ - -/****************************************************************************/ -int main(int argc, char* argv[]) -{ -#ifdef GHI100_FIX -#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2)) - setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */ -#endif -#endif - - /*************************/ -#if ( BUILD_WITH_AMI == 1 ) -/*************************/ - -/**** IF IN AMI MODE, main() STARTS HERE ****/ - int i, ret = 0, ami = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - - /* Check if multiple inputs expected */ - for (i = 1; i < argc; i++) - { - if (argv[i][0] == INCHI_OPTION_PREFX) - { - if (!inchi_stricmp(argv[i] + 1, "AMI")) - { - ami = 1; - break; - } - } - } - - if (ami) - { - ret = ProcessMultipleInputFiles(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - } - else - { - ret = ProcessSingleInputFile(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ - } - - return 0; -} - - /****************************************************************************/ int ProcessMultipleInputFiles(int argc, char* argv[]) { @@ -522,7 +492,8 @@ int ProcessMultipleInputFiles(int argc, char* argv[]) /****************************************************************************/ int ProcessSingleInputFile(int argc, char* argv[]) { - /**************************************/ + +/**************************************/ #endif /* #if ( BUILD_WITH_AMI == 1 ) */ /**************************************/ @@ -623,7 +594,7 @@ int ProcessSingleInputFile(int argc, char* argv[]) #endif sd->bUserQuit = 0; - /* djb-rwth: fixing coverity ID #499552 */ + /* djb-rwth: fixing coverity CID #499552 */ sd->num_components[0] = 0; sd->num_components[1] = 0; #if ( defined( _WIN32 ) && defined( _CONSOLE ) && !defined( COMPILE_ANSI_ONLY ) ) @@ -816,7 +787,7 @@ int ProcessSingleInputFile(int argc, char* argv[]) /*************************************************************/ - while (!sd->bUserQuit && !bInterrupted) + while (!sd->bUserQuit ) //&& !bInterrupted { int do_renumbering = 0; int next_action; @@ -1078,7 +1049,7 @@ void emit_empty_inchi(INPUT_PARMS* ip, } inchi_ios_flush(pout); } -#endif /* ifndef TARGET_LIB_FOR_WINCHI */ + /*****************************************************************************/ diff --git a/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c new file mode 100644 index 00000000..17134d42 --- /dev/null +++ b/INCHI-1-SRC/INCHI_EXE/inchi-1/src/inchi_main_cli.c @@ -0,0 +1,124 @@ +/* + * International Chemical Identifier (InChI) + * Version 1 + * Software version 1.07 + * April 30, 2024 + * + * MIT License + * + * Copyright (c) 2024 IUPAC and InChI Trust + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +* +* The InChI library and programs are free software developed under the + * auspices of the International Union of Pure and Applied Chemistry (IUPAC). + * Originally developed at NIST. + * Modifications and additions by IUPAC and the InChI Trust. + * Some portions of code were developed/changed by external contributors + * (either contractor or volunteer) which are listed in the file + * 'External-contributors' included in this distribution. + * + * info@inchi-trust.org + * +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../../INCHI_BASE/src/mode.h" + +#if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 ) +#include +#include +#endif + + +#ifdef _WIN32 +#include +#endif +#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_BASE/src/inchi_api.h" +#endif + +#include "../../../INCHI_BASE/src/bcf_s.h" +#include "../../../INCHI_BASE/src/permutation_util.h" + +/****************************************************************************/ +int main(int argc, char* argv[]) +{ +#ifdef GHI100_FIX +#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2)) + setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */ +#endif +#endif + +/*************************/ +// #if ( BUILD_WITH_AMI == 1 ) +/*************************/ + +/**** IF IN AMI MODE, main() STARTS HERE ****/ + int i, ret = 0, ami = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + + /* Check if multiple inputs expected */ + for (i = 1; i < argc; i++) + { + if (argv[i][0] == INCHI_OPTION_PREFX) + { + if (!inchi_stricmp(argv[i] + 1, "AMI")) + { + ami = 1; + break; + } + } + } + + if (ami) + { + ret = ProcessMultipleInputFiles(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + } + else + { + ret = ProcessSingleInputFile(argc, argv); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */ + } + + return 0; +} + + +// #endif /* ifndef TARGET_LIB_FOR_WINCHI */ + 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 dfa3e6cd..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 @@ -69,6 +69,7 @@ +