Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions INCHI-1-SRC/INCHI_EXE/inchi-1/gcc/makefile32
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions INCHI-1-SRC/INCHI_EXE/inchi-1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

/* Draw input atom -- Win32 specific */

#include "mode.h"
#include "../../../INCHI_BASE/src/mode.h"

#ifndef COMPILE_ANSI_ONLY

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@
#include <ctype.h>
#include <locale.h>

#ifndef COMPILE_ANSI_ONLY
// #include <conio.h>
#if !defined(COMPILE_ANSI_ONLY) && defined(_WIN32)
#include "conio.h"
#ifndef TARGET_LIB_FOR_WINCHI
// #include <windows.h>
#include <windows.h>
#endif
#endif

#include "mode.h"
#include "../../../INCHI_BASE/src/mode.h"

#if( BUILD_WITH_AMI == 1 && defined( _MSC_VER ) && MSC_AMI == 1 )
#include <malloc.h>
Expand All @@ -66,29 +65,124 @@
#ifdef _WIN32
#include <crtdbg.h>
#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 */


Expand All @@ -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 <BRKPT> */
}
#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 ) ) */


/****************************************************************************/
Expand Down
Loading