Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. Template comment:
  2. /*
  3. LFunction @ {
  4. "addBondsDeleteAtoms",
  5. {{Integer, 2}, {Integer, 1}},
  6. "Void",
  7. {bonds, atoms}
  8. }
  9. */
  10.  
  11. auto-generated C-code:
  12.  
  13. extern "C" DLLEXPORT int RDMol_addBondsDeleteAtoms(WolframLibraryData libData, mint Argc, MArgument * Args, MArgument Res) {
  14. mma::detail::MOutFlushGuard flushguard;
  15. const mint id = MArgument_getInteger(Args[0]);
  16.  
  17. if(RDMol_collection.find(id) == RDMol_collection.end()) {
  18. libData->Message("noinst");
  19. return LIBRARY_FUNCTION_ERROR;
  20. }
  21.  
  22. try {
  23. mma::IntTensorRef bonds = mma::detail::getTensor<mint>(Args[1]);
  24. mma::IntTensorRef atoms = mma::detail::getTensor<mint>(Args[2]);
  25.  
  26. (RDMol_collection[id])->addBondsDeleteAtoms(bonds, atoms);
  27. } catch(const mma::LibraryError & libErr) {
  28. libErr.report();
  29. return libErr.error_code();
  30. } catch(const Invar::Invariant & exc) {
  31. mma::detail::handleUnknownException(exc.getMessage(), "RDMol::addBondsDeleteAtoms()");
  32. return LIBRARY_FUNCTION_ERROR;
  33. } catch(const std::exception & exc) {
  34. mma::detail::handleUnknownException(exc.what(), "RDMol::addBondsDeleteAtoms()");
  35. return LIBRARY_FUNCTION_ERROR;
  36. } catch(...) {
  37. mma::detail::handleUnknownException(NULL, "RDMol::addBondsDeleteAtoms()");
  38. return LIBRARY_FUNCTION_ERROR;
  39. }
  40.  
  41. return LIBRARY_NO_ERROR;
  42. }
  43.  
  44. auto-generated WL code:
  45.  
  46. With[
  47. {
  48. fun = LibraryFunctionLoad[
  49. $RDKitLink, "RDMol_addBondsDeleteAtoms", {Integer, {Integer, 2}, {Integer, 1}},
  50. "Void"
  51. ]
  52. },
  53. RDMol[libraryID_]["addBondsDeleteAtoms", bonds_, atoms_] := fun[libraryID, bonds, atoms];
  54. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement