Ticket #49449: pymol_no_cxx11.patch
File pymol_no_cxx11.patch, 8.5 KB (added by howarth.at.macports@…, 9 years ago) |
---|
-
layer2/AtomInfo.cpp
1163 1163 for (int i = 0; ok && i < 6; ++i) 1164 1164 ok = CPythonVal_PConvPyFloatToFloat_From_List(G, list, 41 + i, u + i); 1165 1165 if(ok && (u[0] || u[1] || u[2] || u[3] || u[4] || u[5])) 1166 std::copy_n(u, 6, I->get_anisou());1166 memcpy(I->get_anisou(), u, 6 * sizeof(float)); 1167 1167 } 1168 1168 if(ok && (ll > 47)) { 1169 1169 OrthoLineType temp; … … 1196 1196 #endif 1197 1197 if (src->anisou) { 1198 1198 dst->anisou = NULL; 1199 std::copy_n(src->anisou, 6, dst->get_anisou());1199 memcpy(dst->get_anisou(), src->anisou, 6 * sizeof(float)); 1200 1200 } 1201 1201 } 1202 1202 -
layer2/CifBondDict.h
25 25 // Working with this limitation is currently reasonable in PyMOL, 26 26 // since cResnLen=5 and cAtomNameLen=4 (see AtomInfo.h). 27 27 28 #include <cstdint> 28 #ifdef _PYMOL_NO_CXX11 29 #define unordered_map map 30 #else 29 31 #include <unordered_map> 32 #endif 33 34 #include <stdint.h> 30 35 #include <string.h> 31 36 32 37 // mapped type of bond_dict_t 33 class res_bond_dict_t : std::unordered_map< std::int_fast64_t, signed char> {38 class res_bond_dict_t : std::unordered_map<int64_t, signed char> { 34 39 static key_type make_key(const char * name1, const char * name2) { 35 union { char s[4]; std::int32_t i; } u1, u2;40 union { char s[4]; int32_t i; } u1, u2; 36 41 37 42 strncpy(u1.s, name1, 4); 38 43 strncpy(u2.s, name2, 4); … … 57 62 }; 58 63 59 64 // type for mapping: resn -> ((name1, name2) -> bond order) 60 class bond_dict_t : public std::map< std::int_fast64_t, res_bond_dict_t> {65 class bond_dict_t : public std::map<int64_t, res_bond_dict_t> { 61 66 static key_type make_key(const char * s_) { 62 67 union { key_type i; char s[sizeof(key_type)]; }; 63 68 strncpy(s, s_, sizeof(s)); -
layer2/CifMoleculeReader.cpp
195 195 I->Bond = bond; 196 196 } else { 197 197 VLASize(I->Bond, BondType, I->NBond + nbond); 198 std::copy(bond, bond + nbond, I->Bond + I->NBond);198 memcpy(I->Bond + I->NBond, bond, nbond * sizeof(*bond)); 199 199 VLAFreeP(bond); 200 200 } 201 201 … … 2106 2106 } 2107 2107 2108 2108 const char * filename = NULL; 2109 #ifndef _PYMOL_NO_CXX11 2109 2110 auto cif = std::make_shared<cif_file>(filename, st); 2111 #else 2112 cif_file _cif_stack(filename, st); 2113 auto cif = &_cif_stack; 2114 #endif 2110 2115 2111 2116 for (auto it = cif->datablocks.begin(); it != cif->datablocks.end(); ++it) { 2112 2117 ObjectMolecule * obj = ObjectMoleculeReadCifData(G, it->second, discrete); … … 2117 2122 continue; 2118 2123 } 2119 2124 2120 #if ndef _PYMOL_NOPY2125 #if !defined(_PYMOL_NOPY) && !defined(_PYMOL_NO_CXX11) 2121 2126 // we only provide access from the Python API so far 2122 2127 if (SettingGetGlobal_b(G, cSetting_cif_keepinmemory)) { 2123 2128 obj->m_cifdata = it->second; -
layer2/CoordSet.cpp
978 978 char *atomline = (*charVLA) + (*c); 979 979 char *anisoline = atomline + linelen; 980 980 float anisou[6]; 981 std::copy_n(ai->anisou, 6, anisou);981 memcpy(anisou, ai->anisou, 6 * sizeof(float)); 982 982 983 983 if(matrix && !RotateU(matrix, anisou)) { 984 984 PRINTFB(G, FB_CoordSet, FB_Errors) "RotateU failed\n" ENDFB(G); … … 1059 1059 float tmp_array[6] = { 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }; 1060 1060 1061 1061 if (ai->anisou) { 1062 std::copy_n(ai->anisou, 6, tmp_array);1062 memcpy(tmp_array, ai->anisou, 6 * sizeof(float)); 1063 1063 if (matrix) 1064 1064 RotateU(matrix, tmp_array); 1065 1065 } -
layer2/ObjectMolecule.cpp
22 22 #include <algorithm> 23 23 #include <set> 24 24 25 #ifdef _PYMOL_NO_CXX11 26 #define STD_MOVE(x) (x) 27 #else 28 #define STD_MOVE(x) std::move(x) 29 #endif 30 25 31 #include"Base.h" 26 32 #include"Debug.h" 27 33 #include"Parse.h" … … 7730 7736 if(PConvPyListToFloatArrayInPlace(tmp, u, 6)) { 7731 7737 // only allocate if not all zero 7732 7738 if(u[0] || u[1] || u[2] || u[3] || u[4] || u[5]) 7733 std::copy_n(u, 6, ai->get_anisou());7739 memcpy(ai->get_anisou(), u, 6 * sizeof(float)); 7734 7740 } 7735 7741 Py_DECREF(tmp); 7736 7742 } … … 9600 9606 CHECKOK(ok, ai2); 9601 9607 if (ok){ 9602 9608 for(a = 0; a < cs->NIndex; a++) 9603 ai2[a] = std::move(ai[index[a]]); /* creates a sorted list of atom info records */9609 ai2[a] = STD_MOVE(ai[index[a]]); /* creates a sorted list of atom info records */ 9604 9610 } 9605 9611 VLAFreeP(ai); 9606 9612 ai = ai2; … … 9722 9728 if(a2 < oldNAtom) 9723 9729 AtomInfoCombine(G, I->AtomInfo + a2, ai + a1, aic_mask); 9724 9730 else 9725 *(I->AtomInfo + a2) = std::move(*(ai + a1));9731 *(I->AtomInfo + a2) = STD_MOVE(*(ai + a1)); 9726 9732 } 9727 9733 } 9728 9734 … … 9861 9867 dest = I->AtomInfo + I->NAtom; 9862 9868 src = atInfo; 9863 9869 for(a = 0; a < cs->NIndex; a++) 9864 *(dest++) = std::move(*(src++));9870 *(dest++) = STD_MOVE(*(src++)); 9865 9871 I->NAtom = nAtom; 9866 9872 VLAFreeP(atInfo); 9867 9873 } else { … … 12561 12567 VLAFreeP(I->DiscreteAtmToIdx); 12562 12568 VLAFreeP(I->DiscreteCSet); 12563 12569 VLAFreeP(I->CSet); 12570 #ifndef _PYMOL_NO_CXX11 12564 12571 I->m_ciffile.reset(); // free data 12572 #endif 12565 12573 12566 12574 { 12567 12575 int nAtom = I->NAtom; -
layer2/ObjectMolecule.h
86 86 int RepVisCache; /* for transient storage during updates */ 87 87 88 88 // for reporting available assembly ids after mmCIF loading - SUBJECT TO CHANGE 89 #ifndef _PYMOL_NO_CXX11 89 90 std::shared_ptr<cif_file> m_ciffile; 91 #endif 90 92 const cif_data * m_cifdata; 91 93 92 94 // methods -
layer2/ObjectMolecule2.cpp
48 48 #include <iostream> 49 49 #include <map> 50 50 51 #ifdef _PYMOL_NO_CXX11 52 #define STD_MOVE(x) (x) 53 #else 54 #define STD_MOVE(x) std::move(x) 55 #endif 56 51 57 #define ntrim ParseNTrim 52 58 #define nextline ParseNextLine 53 59 #define ncopy ParseNCopy … … 4481 4487 if (ok){ 4482 4488 /* autozero here is important */ 4483 4489 for(a = 0; a < i_NAtom; a++) 4484 atInfo[a] = std::move(I->AtomInfo[index[a]]);4490 atInfo[a] = STD_MOVE(I->AtomInfo[index[a]]); 4485 4491 } 4486 4492 VLAFreeP(I->AtomInfo); 4487 4493 I->AtomInfo = atInfo; -
monkeypatch_distutils.py
13 13 # threaded parallel map (optional) 14 14 pmap = map 15 15 16 if sys.platform == 'darwin':16 try: 17 17 import _osx_support 18 18 _osx_support._UNIVERSAL_CONFIG_VARS += ('CXXFLAGS', 'LDCXXSHARED',) 19 19 _osx_support._COMPILER_CONFIG_VARS += ('LDCXXSHARED',) 20 except ImportError: 21 _osx_support = None 20 22 21 23 distutils.unixccompiler.UnixCCompiler.executables.update({ 22 24 'compiler_cxx' : ["c++"], … … 86 88 compiler_so = self.compiler_so 87 89 compiler_so_cxx = self.compiler_so_cxx 88 90 89 if sys.platform == 'darwin' :91 if sys.platform == 'darwin' and _osx_support is not None: 90 92 compiler_so = _osx_support.compiler_fixup(compiler_so, cc_args + extra_postargs) 91 93 compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, cc_args + extra_postargs) 92 94 -
setup.py
149 149 pyogl_libs = [] 150 150 lib_dirs = [] 151 151 ext_comp_args = [ 152 "-Wno-narrowing",153 152 # warnings as errors 154 153 "-Werror=implicit-function-declaration", 155 154 "-Werror=declaration-after-statement", … … 213 212 ("NO_MMLIBS",None), 214 213 ] 215 214 215 if sys.platform == 'darwin': 216 import platform 217 if int(platform.mac_ver()[0].split('.')[1]) < 9: 218 # OS X <= 10.8, will still use some C++11 features 219 # like the "auto" keyword, but excludes features which 220 # depend on the C++11 std library. 221 def_macros += [ 222 ('_PYMOL_NO_CXX11', None), 223 ] 224 216 225 try: 217 226 import numpy 218 227 inc_dirs += [