# test_smiles.nim
import smiles_parser
var
sp = "c1ccccc1"
# spa = addr sp
s = constructString(sp)
p = constructSmilesParserParams()
m = smilesToMol(s, p)
# smiles_parser.nim
const
libPath = "/home/pahl/anaconda3/pkgs/rdkit-2017.03.3-np111py36_1/lib/"
libSmiles = "libRDKitSmilesParse.so"
srcPath = "/home/pahl/dev/github/rdkit/Code/GraphMol/SmilesParse/"
srcSmiles = "SmilesParse.h"
{.link: libPath & libSmiles.}
discard "forward decl of RWMol"
type
stdStringObj {.header: "<string.h>", importcpp: "std::string".} = object
stdString* = ptr stdStringObj
RWMolObj {.final, header: srcPath & srcSmiles, importcpp: "RDKit::RWMol".} = object
RWMol* = ptr RWMolObj
SmilesParserParams* {.header: srcPath & srcSmiles,
importcpp: "RDKit::SmilesParserParams", bycopy.} = object
sanitize* {.importc: "sanitize".}: bool
proc constructString*(s: cstring): stdStringObj {.header: "<string.h>",
importcpp: "std::string(@)", constructor.}
proc constructSmilesParserParams*(): SmilesParserParams {.constructor,
importcpp: "RDKit::SmilesParserParams(@)", header: srcPath & srcSmiles.}
proc smilesToMol*(smi: stdStringObj; params: SmilesParserParams): RWMol {.header: srcPath & srcSmiles, importcpp: "RDKit::SmilesToMol(@)".}
# test_smiles.nim.cfg
cincludes:"/home/pahl/dev/github/rdkit/Code/"
# l:"-lstdc++"
t:"-D_GLIBCXX_USE_CXX11_ABI=0"
/* test_smiles.cpp */
/* Generated by Nim Compiler v0.17.3 */
/* (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
g++ -c -w -w -fpermissive -D_GLIBCXX_USE_CXX11_ABI=0 -I/home/pahl/progs/nim/lib -I/home/pahl/dev/github/rdkit/Code/ -o /home/pahl/dev/nim/rdkit/nimcache/test_smiles.o /home/pahl/dev/nim/rdkit/nimcache/test_smiles.cpp */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#include "/home/pahl/dev/github/rdkit/Code/GraphMol/SmilesParse/SmilesParse.h"
#include "/home/pahl/dev/github/rdkit/Code/GraphMol/GraphMol.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef powerpc
#undef unix
struct NimStringDesc;
struct TGenericSeq;
struct TNimType;
struct TNimNode;
struct tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g;
struct tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w;
struct tyObject_GcHeap_1TRH1TZMaVZTnLNcIHuNFQ;
struct tyObject_GcStack_7fytPA5bBsob6See21YMRA;
struct tyObject_MemRegion_x81NhDv59b8ercDZ9bi85jyg;
struct tyObject_SmallChunk_tXn60W2f8h3jgAYdEmy5NQ;
struct tyObject_LLChunk_XsENErzHIZV9bhvyJx56wGw;
struct tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg;
struct tyObject_IntSet_EZObFrE3NC9bIb3YMkY9crZA;
struct tyObject_Trunk_W0r8S0Y3UGke6T9bIUWnnuw;
struct tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw;
struct tyObject_HeapLinks_PDV1HBZ8CQSQJC9aOBFNRSg;
struct tyTuple_ujsjpB2O9cjj3uDHsXbnSzg;
struct tyObject_GcStat_0RwLoVBHZPfUAcLczmfQAg;
struct tyObject_CellSet_jG87P0AI9aZtss9ccTYBIISQ;
struct tyObject_PageDesc_fublkgIY4LG3mT51LU2WHg;
struct tyObject_BaseChunk_Sdq7WpT6qAH858F5ZEdG3w;
struct tyObject_FreeCell_u6M5LHprqzkn9axr04yg9bGQ;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc : public TGenericSeq {
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind_jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag_v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc_ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc_WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind_jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag_v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc_ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc_WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind_unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind_unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc_T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack_7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk_tXn60W2f8h3jgAYdEmy5NQ* tyArray_SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef tyObject_Trunk_W0r8S0Y3UGke6T9bIUWnnuw* tyArray_lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet_EZObFrE3NC9bIb3YMkY9crZA {
tyArray_lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw* tyArray_0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw {
tyArray_0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple_ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple_ujsjpB2O9cjj3uDHsXbnSzg tyArray_LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks_PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray_LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks_PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion_x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray_SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
tyObject_LLChunk_XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI lastSize;
tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg* freeChunksList;
tyObject_IntSet_EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode_IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks_PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat_0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet_jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc_fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc_fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap_1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack_7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion_x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat_0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet_jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w additionalRoots;
};
struct tyObject_BaseChunk_Sdq7WpT6qAH858F5ZEdG3w {
NI prevSize;
NI size;
};
struct tyObject_SmallChunk_tXn60W2f8h3jgAYdEmy5NQ : public tyObject_BaseChunk_Sdq7WpT6qAH858F5ZEdG3w {
tyObject_SmallChunk_tXn60W2f8h3jgAYdEmy5NQ* next;
tyObject_SmallChunk_tXn60W2f8h3jgAYdEmy5NQ* prev;
tyObject_FreeCell_u6M5LHprqzkn9axr04yg9bGQ* freeList;
NI free;
NI acc;
NF data;
};
struct tyObject_LLChunk_XsENErzHIZV9bhvyJx56wGw {
NI size;
NI acc;
tyObject_LLChunk_XsENErzHIZV9bhvyJx56wGw* next;
};
struct tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg : public tyObject_BaseChunk_Sdq7WpT6qAH858F5ZEdG3w {
tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg* next;
tyObject_BigChunk_Rv9c70Uhp2TytkX7eH78qEg* prev;
NF data;
};
typedef NI tyArray_9a8QARi5WsUggNU9bom7kzTQ[8];
struct tyObject_Trunk_W0r8S0Y3UGke6T9bIUWnnuw {
tyObject_Trunk_W0r8S0Y3UGke6T9bIUWnnuw* next;
NI key;
tyArray_9a8QARi5WsUggNU9bom7kzTQ bits;
};
struct tyObject_PageDesc_fublkgIY4LG3mT51LU2WHg {
tyObject_PageDesc_fublkgIY4LG3mT51LU2WHg* next;
NI key;
tyArray_9a8QARi5WsUggNU9bom7kzTQ bits;
};
struct tyObject_FreeCell_u6M5LHprqzkn9axr04yg9bGQ {
tyObject_FreeCell_u6M5LHprqzkn9axr04yg9bGQ* next;
NI zeroField;
};
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM_Am5Z4BpJc7OwUgoAEME44g_2)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc_T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr);
static N_INLINE(void, nimFrame)(TFrame* s);
N_NOINLINE(void, stackOverflow_II46IjNZztN9bmbxUD8dt8g)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, rtlAddZCT_MV4BBk6J1qu70IbBxwEn4w_2system)(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* c);
N_NOINLINE(void, addZCT_fCDI7oO1NNVXXURtxSzsRw)(tyObject_CellSeq_Axo1XVm9aaQueTOldv8le5w& s, tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, setStackBottom)(void* theStackBottom);
NIM_EXTERNC N_NOINLINE(void, systemInit000)(void);
NIM_EXTERNC N_NOINLINE(void, systemDatInit000)(void);
NIM_EXTERNC N_NOINLINE(void, unknown_rdmolInit000)(void);
NIM_EXTERNC N_NOINLINE(void, unknown_rdmolDatInit000)(void);
NIM_EXTERNC N_NOINLINE(void, unknown_smiles_parserInit000)(void);
NIM_EXTERNC N_NOINLINE(void, unknown_smiles_parserDatInit000)(void);
NIM_EXTERNC N_NOINLINE(void, NimMainModule)(void);
NIM_EXTERNC N_NOINLINE(void, test_smilesDatInit000)(void);
NimStringDesc* sp_K5kyEubSVpZuAGSTh8im9cQ;
extern TNimType NTI_77mFvmsOLKik79ci2hXkHEg_;
extern TFrame* framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap_1TRH1TZMaVZTnLNcIHuNFQ gch_IcYaEuuWivYAS86vFMTS3Q;
std::string s_QAI3Ojvcqbr3MIZceDYakg;
RDKit::SmilesParserParams p_YnMGxqjt4oqe2M6ZTaHLVg;
RDKit::RWMol* m_g8Ov9a9ceGsqVAYZVR9cUmruw;
STRING_LITERAL(TM_Am5Z4BpJc7OwUgoAEME44g_3, "c1ccccc1", 8);
static N_NIMCALL(void, TM_Am5Z4BpJc7OwUgoAEME44g_2)(void) {
nimGCvisit((void*)sp_K5kyEubSVpZuAGSTh8im9cQ, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
NI T1_;
T1_ = (NI)0;
{
if (!(framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
{ T1_ = ((NI) 0);
} }
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA9_;
{ stackOverflow_II46IjNZztN9bmbxUD8dt8g();
} }
LA9_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
static N_INLINE(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr) {
tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* result;
nimfr_("usrToCell", "gc.nim");
result = (tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
nimln_(138, "gc.nim");
result = ((tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU64)(((NI) (usr))) - (NU64)(((NI)sizeof(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g))))));
popFrame();
return result;
}
static N_INLINE(void, rtlAddZCT_MV4BBk6J1qu70IbBxwEn4w_2system)(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* c) {
nimfr_("rtlAddZCT", "gc.nim");
nimln_(216, "gc.nim");
addZCT_fCDI7oO1NNVXXURtxSzsRw(gch_IcYaEuuWivYAS86vFMTS3Q.zct, c);
popFrame();
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
nimfr_("nimGCunrefNoCycle", "gc.nim");
nimln_(255, "gc.nim");
tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* c = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem(p);
nimln_(257, "gc.nim");
{
(*c).refcount -= ((NI) 8);
if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3_;
{ nimln_(258, "gc.nim");
rtlAddZCT_MV4BBk6J1qu70IbBxwEn4w_2system(c);
} }
LA3_: ;
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
setStackBottom(locals);
}
void PreMainInner(void) {
systemInit000();
unknown_rdmolDatInit000();
unknown_smiles_parserDatInit000();
test_smilesDatInit000();
unknown_rdmolInit000();
unknown_smiles_parserInit000();
}
void PreMain(void) {
void (*volatile inner)(void);
systemDatInit000();
inner = PreMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int cmdCount;
char** cmdLine;
char** gEnv;
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
NIM_EXTERNC N_NOINLINE(void, NimMainModule)(void) {
NimStringDesc* T1_;
nimfr_("test_smiles", "test_smiles.nim");
nimRegisterGlobalMarker(TM_Am5Z4BpJc7OwUgoAEME44g_2);
nimln_(4, "test_smiles.nim");
T1_ = (NimStringDesc*)0;
T1_ = sp_K5kyEubSVpZuAGSTh8im9cQ; sp_K5kyEubSVpZuAGSTh8im9cQ = copyStringRC1(((NimStringDesc*) &TM_Am5Z4BpJc7OwUgoAEME44g_3));
if (T1_) nimGCunrefNoCycle(T1_);
nimln_(7, "test_smiles.nim");
s_QAI3Ojvcqbr3MIZceDYakg = std::string(sp_K5kyEubSVpZuAGSTh8im9cQ->data);
nimln_(8, "test_smiles.nim");
p_YnMGxqjt4oqe2M6ZTaHLVg = RDKit::SmilesParserParams();
nimln_(9, "test_smiles.nim");
m_g8Ov9a9ceGsqVAYZVR9cUmruw = RDKit::SmilesToMol(s_QAI3Ojvcqbr3MIZceDYakg, p_YnMGxqjt4oqe2M6ZTaHLVg);
popFrame();
}
NIM_EXTERNC N_NOINLINE(void, test_smilesDatInit000)(void) {
}