A collection of small improvements from Roger S (#7566)

* get builds working on cygwin

contribution from Roger Sayle

* rearrange memory layout of bond object

This reduces the memory used by 7 bytes/bond,
but due to the padding there's no visible difference.

Contribution from Roger Sayle

* Simplify the smiles lexer so that io.h is no longer needed.


Contribution from Roger Sayle

* make an analogous change to the SMARTS parser
This commit is contained in:
Greg Landrum
2024-06-26 08:29:57 +02:00
committed by GitHub
parent df0224fb7d
commit a3b2e50ad3
6 changed files with 228 additions and 250 deletions

View File

@@ -85,7 +85,7 @@ if(NOT MSVC)
endif()
endif()
if(NOT UNIX OR APPLE)
if(NOT UNIX OR APPLE OR CYGWIN)
if(RDK_USE_BOOST_STACKTRACE)
MESSAGE("Disabling boost::stacktrace on non-linux platform")
set(RDK_USE_BOOST_STACKTRACE OFF)

View File

@@ -373,15 +373,15 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps {
/// void setOwningMol(ROMol *other);
//! sets our owning molecule
/// void setOwningMol(ROMol &other) { setOwningMol(&other); }
ROMol *dp_mol;
INT_VECT *dp_stereoAtoms;
atomindex_t d_index;
atomindex_t d_beginAtomIdx, d_endAtomIdx;
bool df_isAromatic;
bool df_isConjugated;
std::uint8_t d_bondType;
std::uint8_t d_dirTag;
std::uint8_t d_stereo;
atomindex_t d_index;
atomindex_t d_beginAtomIdx, d_endAtomIdx;
ROMol *dp_mol;
INT_VECT *dp_stereoAtoms;
void initBond();
};

View File

@@ -1,6 +1,6 @@
#line 2 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 1 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 4 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 3 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#define YY_INT_ALIGNED short int
@@ -795,7 +795,7 @@ static const flex_int16_t yy_chk[363] =
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
#line 1 "smarts.ll"
#line 6 "smarts.ll"
#line 9 "smarts.ll"
//
// Copyright (C) 2003-2018 Greg Landrum and Rational Discovery LLC
@@ -809,9 +809,6 @@ extern "C" int fileno(FILE*);
#endif
#include <cstdio>
#ifdef WIN32
#include <io.h>
#endif
#include <RDGeneral/Exceptions.h>
#include <GraphMol/RDKitBase.h>
@@ -876,9 +873,9 @@ size_t setup_smarts_string(const std::string &text,yyscan_t yyscanner){
}
#line 880 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 876 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 882 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 878 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#define INITIAL 0
#define IN_ATOM_STATE 1
@@ -1174,7 +1171,7 @@ YY_DECL
}
#line 1178 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 1174 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1207,16 +1204,12 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 278 );
while ( yy_current_state != 220 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
@@ -1942,9 +1935,9 @@ return yytext[0];
case 183:
YY_RULE_SETUP
#line 458 "smarts.ll"
ECHO;
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
#line 1948 "/scratch/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
#line 1940 "/localhome/glandrum/RDKit_git/Code/GraphMol/SmilesParse/lex.yysmarts.cpp"
case YY_END_OF_BUFFER:
{
@@ -2009,7 +2002,8 @@ ECHO;
else
{
yy_cp = yyg->yy_c_buf_p;
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
goto yy_find_action;
}
}
@@ -2535,7 +2529,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
b->yy_bs_column = 0;
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
b->yy_is_interactive = 0;
errno = oerrno;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,9 @@
%option reentrant
%option bison-bridge
%option noyywrap
%option never-interactive
%option nodefault
%option nostdinit
%{
@@ -16,9 +19,6 @@ extern "C" int fileno(FILE*);
#endif
#include <cstdio>
#ifdef WIN32
#include <io.h>
#endif
#include <RDGeneral/Exceptions.h>
#include <GraphMol/RDKitBase.h>

View File

@@ -1,6 +1,9 @@
%option reentrant
%option bison-bridge
%option noyywrap
%option never-interactive
%option nodefault
%option nostdinit
%{
@@ -11,15 +14,7 @@
// @@ All Rights Reserved @@
//
#if defined(__CYGWIN__) && !defined(fileno)
// -std=c++11 turns off recent posix features
extern "C" int fileno(FILE*);
#endif
#include <cstdio>
#ifdef WIN32
#include <io.h>
#endif
#include <RDGeneral/Exceptions.h>
#include <RDGeneral/types.h>
@@ -359,7 +354,7 @@ s { yylval->atom = new Atom( 16 );
\% { return PERCENT_TOKEN; }
[0] { yylval->ival = 0; return ZERO_TOKEN; }
[1-9] { yylval->ival = atoi( yytext ); return NONZERO_DIGIT_TOKEN; }
[1-9] { yylval->ival = yytext[0] - '0'; return NONZERO_DIGIT_TOKEN; }